netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fixes dropping of small packets in bridge nat
@ 2020-10-14 12:36 timothee.cocault
  2020-10-14 12:47 ` Florian Westphal
  2020-10-20 15:18 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: timothee.cocault @ 2020-10-14 12:36 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Pablo Neira Ayuso, netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]

Fixes an error causing small packets to get dropped. skb_ensure_writable
expects the second parameter to be a length in the ethernet payload. 
If we want to write the ethernet header (src, dst), we should pass 0.
Otherwise, packets with small payloads (< ETH_ALEN) will get dropped.

Signed-off-by: Timothée COCAULT <timothee.cocault@orange.com>
---
 net/bridge/netfilter/ebt_dnat.c     | 2 +-
 net/bridge/netfilter/ebt_redirect.c | 2 +-
 net/bridge/netfilter/ebt_snat.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bridge/netfilter/ebt_dnat.c
b/net/bridge/netfilter/ebt_dnat.c
index 12a4f4d93681..3fda71a8579d 100644
--- a/net/bridge/netfilter/ebt_dnat.c
+++ b/net/bridge/netfilter/ebt_dnat.c
@@ -21,7 +21,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct
xt_action_param *par)
 {
 	const struct ebt_nat_info *info = par->targinfo;
 
-	if (skb_ensure_writable(skb, ETH_ALEN))
+	if (skb_ensure_writable(skb, 0))
 		return EBT_DROP;
 
 	ether_addr_copy(eth_hdr(skb)->h_dest, info->mac);
diff --git a/net/bridge/netfilter/ebt_redirect.c
b/net/bridge/netfilter/ebt_redirect.c
index 0cad62a4052b..307790562b49 100644
--- a/net/bridge/netfilter/ebt_redirect.c
+++ b/net/bridge/netfilter/ebt_redirect.c
@@ -21,7 +21,7 @@ ebt_redirect_tg(struct sk_buff *skb, const struct
xt_action_param *par)
 {
 	const struct ebt_redirect_info *info = par->targinfo;
 
-	if (skb_ensure_writable(skb, ETH_ALEN))
+	if (skb_ensure_writable(skb, 0))
 		return EBT_DROP;
 
 	if (xt_hooknum(par) != NF_BR_BROUTING)
diff --git a/net/bridge/netfilter/ebt_snat.c
b/net/bridge/netfilter/ebt_snat.c
index 27443bf229a3..7dfbcdfc30e5 100644
--- a/net/bridge/netfilter/ebt_snat.c
+++ b/net/bridge/netfilter/ebt_snat.c
@@ -22,7 +22,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct
xt_action_param *par)
 {
 	const struct ebt_nat_info *info = par->targinfo;
 
-	if (skb_ensure_writable(skb, ETH_ALEN * 2))
+	if (skb_ensure_writable(skb, 0))
 		return EBT_DROP;
 
 	ether_addr_copy(eth_hdr(skb)->h_source, info->mac);
-- 
2.25.1


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6929 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fixes dropping of small packets in bridge nat
  2020-10-14 12:36 [PATCH] Fixes dropping of small packets in bridge nat timothee.cocault
@ 2020-10-14 12:47 ` Florian Westphal
  2020-10-20 15:18 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2020-10-14 12:47 UTC (permalink / raw)
  To: timothee.cocault; +Cc: Florian Westphal, Pablo Neira Ayuso, netfilter-devel

timothee.cocault@orange.com <timothee.cocault@orange.com> wrote:
> Fixes an error causing small packets to get dropped. skb_ensure_writable
> expects the second parameter to be a length in the ethernet payload. 
> If we want to write the ethernet header (src, dst), we should pass 0.
> Otherwise, packets with small payloads (< ETH_ALEN) will get dropped.

Reviewed-by: Florian Westphal <fw@strlen.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fixes dropping of small packets in bridge nat
  2020-10-14 12:36 [PATCH] Fixes dropping of small packets in bridge nat timothee.cocault
  2020-10-14 12:47 ` Florian Westphal
@ 2020-10-20 15:18 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2020-10-20 15:18 UTC (permalink / raw)
  To: timothee.cocault; +Cc: Florian Westphal, netfilter-devel

On Wed, Oct 14, 2020 at 12:36:15PM +0000, timothee.cocault@orange.com wrote:
> Fixes an error causing small packets to get dropped. skb_ensure_writable
> expects the second parameter to be a length in the ethernet payload. 
> If we want to write the ethernet header (src, dst), we should pass 0.
> Otherwise, packets with small payloads (< ETH_ALEN) will get dropped.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-20 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 12:36 [PATCH] Fixes dropping of small packets in bridge nat timothee.cocault
2020-10-14 12:47 ` Florian Westphal
2020-10-20 15:18 ` Pablo Neira Ayuso

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).