netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH net 4/5] wireguard: use icmp_ndo_send helper
Date: Sun,  9 Feb 2020 15:31:42 +0100	[thread overview]
Message-ID: <20200209143143.151632-4-Jason@zx2c4.com> (raw)
In-Reply-To: <20200209143143.151632-1-Jason@zx2c4.com>

Because wireguard is calling icmp from network device context, it should use
the ndo helper so that the rate limiting applies correctly.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/wireguard/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index 16b19824b9ad..43db442b1373 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -203,9 +203,9 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev)
 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;
 }
-- 
2.25.0


  parent reply	other threads:[~2020-02-09 14:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-09 14:31 [PATCH net 1/5] icmp: introduce helper for NAT'd source address in ndo context Jason A. Donenfeld
2020-02-09 14:31 ` [PATCH net 2/5] gtp: use icmp_ndo_send helper Jason A. Donenfeld
2020-02-09 14:31 ` [PATCH net 3/5] sunvnet: " Jason A. Donenfeld
2020-02-10 11:36   ` David Miller
2020-02-10 13:34     ` Jason A. Donenfeld
2020-02-09 14:31 ` Jason A. Donenfeld [this message]
2020-02-09 14:31 ` [PATCH net 5/5] xfrm: interface: " Jason A. Donenfeld
2020-02-10 11:50 ` [PATCH net 1/5] icmp: introduce helper for NAT'd source address in ndo context Florian Westphal
2020-02-10 13:33   ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200209143143.151632-4-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).