-
- Downloads
netfilter: Pass struct net into the netfilter hooks
Pass a network namespace parameter into the netfilter hooks. At the call site of the netfilter hooks the path a packet is taking through the network stack is well known which allows the network namespace to be easily and reliabily. This allows the replacement of magic code like "dev_net(state->in?:state->out)" that appears at the start of most netfilter hooks with "state->net". In almost all cases the network namespace passed in is derived from the first network device passed in, guaranteeing those paths will not see any changes in practice. The exceptions are: xfrm/xfrm_output.c:xfrm_output_resume() xs_net(skb_dst(skb)->xfrm) ipvs/ip_vs_xmit.c:ip_vs_nat_send_or_cont() ip_vs_conn_net(cp) ipvs/ip_vs_xmit.c:ip_vs_send_or_cont() ip_vs_conn_net(cp) ipv4/raw.c:raw_send_hdrinc() sock_net(sk) ipv6/ip6_output.c:ip6_xmit() sock_net(sk) ipv6/ndisc.c:ndisc_send_skb() dev_net(skb->dev) not dev_net(dst->dev) ipv6/raw.c:raw6_send_hdrinc() sock_net(sk) br_netfilter_hooks.c:br_nf_pre_routing_finish() dev_net(skb->dev) before skb->dev is set to nf_bridge->physindev In all cases these exceptions seem to be a better expression for the network namespace the packet is being processed in then the historic "dev_net(in?in:out)". I am documenting them in case something odd pops up and someone starts trying to track down what happened. Signed-off-by:"Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by:
David S. Miller <davem@davemloft.net>
Showing
- drivers/net/vrf.c 4 additions, 3 deletionsdrivers/net/vrf.c
- include/linux/netfilter.h 12 additions, 15 deletionsinclude/linux/netfilter.h
- net/bridge/br_forward.c 7 additions, 6 deletionsnet/bridge/br_forward.c
- net/bridge/br_input.c 7 additions, 6 deletionsnet/bridge/br_input.c
- net/bridge/br_multicast.c 2 additions, 2 deletionsnet/bridge/br_multicast.c
- net/bridge/br_netfilter_hooks.c 8 additions, 7 deletionsnet/bridge/br_netfilter_hooks.c
- net/bridge/br_netfilter_ipv6.c 4 additions, 3 deletionsnet/bridge/br_netfilter_ipv6.c
- net/bridge/br_stp_bpdu.c 2 additions, 2 deletionsnet/bridge/br_stp_bpdu.c
- net/decnet/dn_neigh.c 9 additions, 6 deletionsnet/decnet/dn_neigh.c
- net/decnet/dn_nsp_in.c 2 additions, 2 deletionsnet/decnet/dn_nsp_in.c
- net/decnet/dn_route.c 12 additions, 12 deletionsnet/decnet/dn_route.c
- net/ipv4/arp.c 6 additions, 4 deletionsnet/ipv4/arp.c
- net/ipv4/ip_forward.c 3 additions, 2 deletionsnet/ipv4/ip_forward.c
- net/ipv4/ip_input.c 4 additions, 4 deletionsnet/ipv4/ip_input.c
- net/ipv4/ip_output.c 13 additions, 9 deletionsnet/ipv4/ip_output.c
- net/ipv4/ipmr.c 2 additions, 2 deletionsnet/ipv4/ipmr.c
- net/ipv4/raw.c 3 additions, 2 deletionsnet/ipv4/raw.c
- net/ipv4/xfrm4_input.c 2 additions, 2 deletionsnet/ipv4/xfrm4_input.c
- net/ipv4/xfrm4_output.c 4 additions, 2 deletionsnet/ipv4/xfrm4_output.c
- net/ipv6/ip6_input.c 4 additions, 4 deletionsnet/ipv6/ip6_input.c
Loading