Skip to content

Commit 63137bc

Browse files
Timothée COCAULTummakynes
authored andcommitted
netfilter: ebtables: Fixes dropping of small packets in bridge nat
Fixes an error causing small packets to get dropped. skb_ensure_writable expects the second parameter to be a length in the ethernet payload.=20 If we want to write the ethernet header (src, dst), we should pass 0. Otherwise, packets with small payloads (< ETH_ALEN) will get dropped. Fixes: c1a8311 ("netfilter: bridge: convert skb_make_writable to skb_ensure_writable") Signed-off-by: Timothée COCAULT <timothee.cocault@orange.com> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 68f9f9c commit 63137bc

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

net/bridge/netfilter/ebt_dnat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
2121
{
2222
const struct ebt_nat_info *info = par->targinfo;
2323

24-
if (skb_ensure_writable(skb, ETH_ALEN))
24+
if (skb_ensure_writable(skb, 0))
2525
return EBT_DROP;
2626

2727
ether_addr_copy(eth_hdr(skb)->h_dest, info->mac);

net/bridge/netfilter/ebt_redirect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
2121
{
2222
const struct ebt_redirect_info *info = par->targinfo;
2323

24-
if (skb_ensure_writable(skb, ETH_ALEN))
24+
if (skb_ensure_writable(skb, 0))
2525
return EBT_DROP;
2626

2727
if (xt_hooknum(par) != NF_BR_BROUTING)

net/bridge/netfilter/ebt_snat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
2222
{
2323
const struct ebt_nat_info *info = par->targinfo;
2424

25-
if (skb_ensure_writable(skb, ETH_ALEN * 2))
25+
if (skb_ensure_writable(skb, 0))
2626
return EBT_DROP;
2727

2828
ether_addr_copy(eth_hdr(skb)->h_source, info->mac);

0 commit comments

Comments
 (0)