提交 b8172a6b 编写于 作者: J Jason A. Donenfeld 提交者: Cheng Jian

sunvnet: use icmp_ndo_send helper

stable inclusion
from linux-4.19.178
commit 5351e67767ecde80ecba894d88f191c2c378c17c

--------------------------------

commit 67c9a7e1 upstream.

Because sunvnet is calling icmp from network device context, it should use
the ndo helper so that the rate limiting applies correctly. While we're
at it, doing the additional route lookup before calling icmp_ndo_send is
superfluous, since this is the job of the icmp code in the first place.
Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
Cc: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 e1690dcb
...@@ -1353,27 +1353,12 @@ sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev, ...@@ -1353,27 +1353,12 @@ sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
if (vio_version_after_eq(&port->vio, 1, 3)) if (vio_version_after_eq(&port->vio, 1, 3))
localmtu -= VLAN_HLEN; localmtu -= VLAN_HLEN;
if (skb->protocol == htons(ETH_P_IP)) { if (skb->protocol == htons(ETH_P_IP))
struct flowi4 fl4; icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
struct rtable *rt = NULL; htonl(localmtu));
memset(&fl4, 0, sizeof(fl4));
fl4.flowi4_oif = dev->ifindex;
fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos);
fl4.daddr = ip_hdr(skb)->daddr;
fl4.saddr = ip_hdr(skb)->saddr;
rt = ip_route_output_key(dev_net(dev), &fl4);
if (!IS_ERR(rt)) {
skb_dst_set(skb, &rt->dst);
icmp_send(skb, ICMP_DEST_UNREACH,
ICMP_FRAG_NEEDED,
htonl(localmtu));
}
}
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
else if (skb->protocol == htons(ETH_P_IPV6)) else if (skb->protocol == htons(ETH_P_IPV6))
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu); icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
#endif #endif
goto out_dropped; goto out_dropped;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册