Re: [PATCH net-next] netfilter: bridge: reset skb->pkt_type after NF_INET_POST_ROUTING traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 23 Nov 2020 19:32:53 +0100 Florian Westphal wrote:
> Antoine Tenart <atenart@xxxxxxxxxx> wrote:
> > Netfilter changes PACKET_OTHERHOST to PACKET_HOST before invoking the
> > hooks as, while it's an expected value for a bridge, routing expects
> > PACKET_HOST. The change is undone later on after hook traversal. This
> > can be seen with pairs of functions updating skb>pkt_type and then
> > reverting it to its original value:
> > 
> > For hook NF_INET_PRE_ROUTING:
> >   setup_pre_routing / br_nf_pre_routing_finish
> > 
> > For hook NF_INET_FORWARD:
> >   br_nf_forward_ip / br_nf_forward_finish
> > 
> > But the third case where netfilter does this, for hook
> > NF_INET_POST_ROUTING, the packet type is changed in br_nf_post_routing
> > but never reverted. A comment says:
> > 
> >   /* We assume any code from br_dev_queue_push_xmit onwards doesn't care
> >    * about the value of skb->pkt_type. */  
> 
> [..]
> > But when having a tunnel (say vxlan) attached to a bridge we have the
> > following call trace:  
> 
> > In this specific case, this creates issues such as when an ICMPv6 PTB
> > should be sent back. When CONFIG_BRIDGE_NETFILTER is enabled, the PTB
> > isn't sent (as skb_tunnel_check_pmtu checks if pkt_type is PACKET_HOST
> > and returns early).
> > 
> > If the comment is right and no one cares about the value of
> > skb->pkt_type after br_dev_queue_push_xmit (which isn't true), resetting
> > it to its original value should be safe.  
> 
> That comment is 18 years old, safe bet noone thought of
> ipv6-in-tunnel-interface-added-as-bridge-port back then.
> 
> Reviewed-by: Florian Westphal <fw@xxxxxxxxx>

Sounds like a fix. Probably hard to pin point which commit to blame,
but this should go to net, not net-next, right?



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux