Skip to content

Commit 67c9a7e

Browse files
zx2c4davem330
authored andcommitted
sunvnet: use icmp_ndo_send helper
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>
1 parent e0fce6f commit 67c9a7e

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
@@ -1350,27 +1350,12 @@ sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
13501350
if (vio_version_after_eq(&port->vio, 1, 3))
13511351
localmtu -= VLAN_HLEN;
13521352

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

0 commit comments

Comments
 (0)