Skip to content

Commit e6b367e

Browse files
zx2c4ksacilotto
authored andcommitted
sunvnet: use icmp_ndo_send helper
BugLink: https://bugs.launchpad.net/bugs/1918974 commit 67c9a7e 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: Jason A. Donenfeld <Jason@zx2c4.com> Cc: Shannon Nelson <shannon.nelson@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
1 parent f719f2f commit e6b367e

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

drivers/net/ethernet/sun/sunvnet_common.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,27 +1353,12 @@ sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
13531353
if (vio_version_after_eq(&port->vio, 1, 3))
13541354
localmtu -= VLAN_HLEN;
13551355

1356-
if (skb->protocol == htons(ETH_P_IP)) {
1357-
struct flowi4 fl4;
1358-
struct rtable *rt = NULL;
1359-
1360-
memset(&fl4, 0, sizeof(fl4));
1361-
fl4.flowi4_oif = dev->ifindex;
1362-
fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos);
1363-
fl4.daddr = ip_hdr(skb)->daddr;
1364-
fl4.saddr = ip_hdr(skb)->saddr;
1365-
1366-
rt = ip_route_output_key(dev_net(dev), &fl4);
1367-
if (!IS_ERR(rt)) {
1368-
skb_dst_set(skb, &rt->dst);
1369-
icmp_send(skb, ICMP_DEST_UNREACH,
1370-
ICMP_FRAG_NEEDED,
1371-
htonl(localmtu));
1372-
}
1373-
}
1356+
if (skb->protocol == htons(ETH_P_IP))
1357+
icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
1358+
htonl(localmtu));
13741359
#if IS_ENABLED(CONFIG_IPV6)
13751360
else if (skb->protocol == htons(ETH_P_IPV6))
1376-
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
1361+
icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
13771362
#endif
13781363
goto out_dropped;
13791364
}

0 commit comments

Comments
 (0)