summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-02-11 20:47:08 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2022-07-07 13:26:41 +0200
commitaa4e44aeabe4036eb66b31ee5c996f2e6db8e952 (patch)
treee49c03fe9a8356d0188cd84b81b5e869b5d4dae2
parent391844a720190ada8d9646f0393ce6f2f59ed265 (diff)
downloadwireguard-linux-trimmed-aa4e44aeabe4036eb66b31ee5c996f2e6db8e952.tar.gz
wireguard-linux-trimmed-aa4e44aeabe4036eb66b31ee5c996f2e6db8e952.zip
wireguard: device: use icmp_ndo_send helper
commit 4b8c8cb8cb4b48a351e3349a1d305a555b9c93f8 upstream. Because wireguard is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. This commit adds a small test to the wireguard test suite to ensure that the new functions continue doing the right thing in the context of wireguard. It does this by setting up a condition that will definately evoke an icmp error message from the driver, but along a nat'd path. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--drivers/net/wireguard/device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index 16b1982..43db442 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -203,9 +203,9 @@ err_peer:
err:
++dev->stats.tx_errors;
if (skb->protocol == htons(ETH_P_IP))
- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
+ icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
else if (skb->protocol == htons(ETH_P_IPV6))
- icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0);
+ icmpv6_ndo_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0);
kfree_skb(skb);
return ret;
}