netfilter: af_info: add network namespace parameter to route hook

This is required to eventually replace the rt6_lookup call in
xt_addrtype.c with nf_afinfo->route().

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Patrick McHardy <kaber@trash.net>

authored by Florian Westphal and committed by Patrick McHardy 31ad3dd6 a09d1977

+13 -10
+2 -1
include/linux/netfilter.h
··· 270 270 unsigned int dataoff, 271 271 unsigned int len, 272 272 u_int8_t protocol); 273 - int (*route)(struct dst_entry **dst, struct flowi *fl); 273 + int (*route)(struct net *net, struct dst_entry **dst, 274 + struct flowi *fl); 274 275 void (*saveroute)(const struct sk_buff *skb, 275 276 struct nf_queue_entry *entry); 276 277 int (*reroute)(struct sk_buff *skb,
+3 -2
net/ipv4/netfilter.c
··· 221 221 return csum; 222 222 } 223 223 224 - static int nf_ip_route(struct dst_entry **dst, struct flowi *fl) 224 + static int nf_ip_route(struct net *net, struct dst_entry **dst, 225 + struct flowi *fl) 225 226 { 226 - struct rtable *rt = ip_route_output_key(&init_net, &fl->u.ip4); 227 + struct rtable *rt = ip_route_output_key(net, &fl->u.ip4); 227 228 if (IS_ERR(rt)) 228 229 return PTR_ERR(rt); 229 230 *dst = &rt->dst;
+3 -2
net/ipv6/netfilter.c
··· 90 90 return 0; 91 91 } 92 92 93 - static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl) 93 + static int nf_ip6_route(struct net *net, struct dst_entry **dst, 94 + struct flowi *fl) 94 95 { 95 - *dst = ip6_route_output(&init_net, NULL, &fl->u.ip6); 96 + *dst = ip6_route_output(net, NULL, &fl->u.ip6); 96 97 return (*dst)->error; 97 98 } 98 99
+4 -4
net/netfilter/nf_conntrack_h323_main.c
··· 731 731 732 732 memset(&fl2, 0, sizeof(fl2)); 733 733 fl2.daddr = dst->ip; 734 - if (!afinfo->route((struct dst_entry **)&rt1, 734 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt1, 735 735 flowi4_to_flowi(&fl1))) { 736 - if (!afinfo->route((struct dst_entry **)&rt2, 736 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, 737 737 flowi4_to_flowi(&fl2))) { 738 738 if (rt1->rt_gateway == rt2->rt_gateway && 739 739 rt1->dst.dev == rt2->dst.dev) ··· 755 755 756 756 memset(&fl2, 0, sizeof(fl2)); 757 757 ipv6_addr_copy(&fl2.daddr, &dst->in6); 758 - if (!afinfo->route((struct dst_entry **)&rt1, 758 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt1, 759 759 flowi6_to_flowi(&fl1))) { 760 - if (!afinfo->route((struct dst_entry **)&rt2, 760 + if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, 761 761 flowi6_to_flowi(&fl2))) { 762 762 if (!memcmp(&rt1->rt6i_gateway, &rt2->rt6i_gateway, 763 763 sizeof(rt1->rt6i_gateway)) &&
+1 -1
net/netfilter/xt_TCPMSS.c
··· 166 166 rcu_read_lock(); 167 167 ai = nf_get_afinfo(family); 168 168 if (ai != NULL) 169 - ai->route((struct dst_entry **)&rt, &fl); 169 + ai->route(&init_net, (struct dst_entry **)&rt, &fl); 170 170 rcu_read_unlock(); 171 171 172 172 if (rt != NULL) {