diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-03-05 13:48:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-05 13:48:10 -0500 |
commit | 4591db4f37618f37a9f1f25d291c3c7a43a15a21 (patch) | |
tree | 10694d610a78d8cc607fcb2998e4dc97856138f6 | |
parent | 6fda73500581be531fd9bc232173332ec64f6435 (diff) |
[NETNS][IPV6] route6 - add netns parameter to ip6_route_output
Add an netns parameter to ip6_route_output. That will allow to access
to the right routing table for outgoing traffic.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ip6_route.h | 3 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter.c | 4 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_REJECT.c | 2 | ||||
-rw-r--r-- | net/ipv6/route.c | 7 | ||||
-rw-r--r-- | net/ipv6/sit.c | 2 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 2 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 2 |
11 files changed, 17 insertions, 15 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index e0caed25bfba..0e2895c8b270 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -43,7 +43,8 @@ extern struct rt6_info *ip6_blk_hole_entry; | |||
43 | 43 | ||
44 | extern void ip6_route_input(struct sk_buff *skb); | 44 | extern void ip6_route_input(struct sk_buff *skb); |
45 | 45 | ||
46 | extern struct dst_entry * ip6_route_output(struct sock *sk, | 46 | extern struct dst_entry * ip6_route_output(struct net *net, |
47 | struct sock *sk, | ||
47 | struct flowi *fl); | 48 | struct flowi *fl); |
48 | 49 | ||
49 | extern int ip6_route_init(void); | 50 | extern int ip6_route_init(void); |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index cff74127ea32..d4c4b50420d8 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -178,7 +178,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, | |||
178 | * XXX: perhaps the expire for routing entries cloned by | 178 | * XXX: perhaps the expire for routing entries cloned by |
179 | * this lookup should be more aggressive (not longer than timeout). | 179 | * this lookup should be more aggressive (not longer than timeout). |
180 | */ | 180 | */ |
181 | dst = ip6_route_output(sk, fl); | 181 | dst = ip6_route_output(&init_net, sk, fl); |
182 | if (dst->error) { | 182 | if (dst->error) { |
183 | IP6_INC_STATS(ip6_dst_idev(dst), | 183 | IP6_INC_STATS(ip6_dst_idev(dst), |
184 | IPSTATS_MIB_OUTNOROUTES); | 184 | IPSTATS_MIB_OUTNOROUTES); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index ff3971173e1e..161afd1142d0 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -913,7 +913,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
913 | int err; | 913 | int err; |
914 | 914 | ||
915 | if (*dst == NULL) | 915 | if (*dst == NULL) |
916 | *dst = ip6_route_output(sk, fl); | 916 | *dst = ip6_route_output(&init_net, sk, fl); |
917 | 917 | ||
918 | if ((err = (*dst)->error)) | 918 | if ((err = (*dst)->error)) |
919 | goto out_err_release; | 919 | goto out_err_release; |
@@ -954,7 +954,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
954 | dst_release(*dst); | 954 | dst_release(*dst); |
955 | memcpy(&fl_gw, fl, sizeof(struct flowi)); | 955 | memcpy(&fl_gw, fl, sizeof(struct flowi)); |
956 | memset(&fl_gw.fl6_dst, 0, sizeof(struct in6_addr)); | 956 | memset(&fl_gw.fl6_dst, 0, sizeof(struct in6_addr)); |
957 | *dst = ip6_route_output(sk, &fl_gw); | 957 | *dst = ip6_route_output(&init_net, sk, &fl_gw); |
958 | if ((err = (*dst)->error)) | 958 | if ((err = (*dst)->error)) |
959 | goto out_err_release; | 959 | goto out_err_release; |
960 | } | 960 | } |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 4e1981660b3c..1e1ad1ed87e6 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -847,7 +847,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
847 | if ((dst = ip6_tnl_dst_check(t)) != NULL) | 847 | if ((dst = ip6_tnl_dst_check(t)) != NULL) |
848 | dst_hold(dst); | 848 | dst_hold(dst); |
849 | else { | 849 | else { |
850 | dst = ip6_route_output(NULL, fl); | 850 | dst = ip6_route_output(&init_net, NULL, fl); |
851 | 851 | ||
852 | if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0) | 852 | if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0) |
853 | goto tx_err_link_failure; | 853 | goto tx_err_link_failure; |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index f1c95125100d..b5b4fd173e98 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1427,7 +1427,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1427 | icmpv6_flow_init(ndisc_socket->sk, &fl, NDISC_REDIRECT, | 1427 | icmpv6_flow_init(ndisc_socket->sk, &fl, NDISC_REDIRECT, |
1428 | &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex); | 1428 | &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex); |
1429 | 1429 | ||
1430 | dst = ip6_route_output(NULL, &fl); | 1430 | dst = ip6_route_output(&init_net, NULL, &fl); |
1431 | if (dst == NULL) | 1431 | if (dst == NULL) |
1432 | return; | 1432 | return; |
1433 | 1433 | ||
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index 2e06724dc348..aed51bcc66b4 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c | |||
@@ -23,7 +23,7 @@ int ip6_route_me_harder(struct sk_buff *skb) | |||
23 | .saddr = iph->saddr, } }, | 23 | .saddr = iph->saddr, } }, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | dst = ip6_route_output(skb->sk, &fl); | 26 | dst = ip6_route_output(&init_net, skb->sk, &fl); |
27 | 27 | ||
28 | #ifdef CONFIG_XFRM | 28 | #ifdef CONFIG_XFRM |
29 | if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && | 29 | if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && |
@@ -86,7 +86,7 @@ static int nf_ip6_reroute(struct sk_buff *skb, | |||
86 | 86 | ||
87 | static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl) | 87 | static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl) |
88 | { | 88 | { |
89 | *dst = ip6_route_output(NULL, fl); | 89 | *dst = ip6_route_output(&init_net, NULL, fl); |
90 | return (*dst)->error; | 90 | return (*dst)->error; |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index b23baa635fe0..831708aeab37 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c | |||
@@ -93,7 +93,7 @@ static void send_reset(struct sk_buff *oldskb) | |||
93 | fl.fl_ip_sport = otcph.dest; | 93 | fl.fl_ip_sport = otcph.dest; |
94 | fl.fl_ip_dport = otcph.source; | 94 | fl.fl_ip_dport = otcph.source; |
95 | security_skb_classify_flow(oldskb, &fl); | 95 | security_skb_classify_flow(oldskb, &fl); |
96 | dst = ip6_route_output(NULL, &fl); | 96 | dst = ip6_route_output(&init_net, NULL, &fl); |
97 | if (dst == NULL) | 97 | if (dst == NULL) |
98 | return; | 98 | return; |
99 | if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0)) | 99 | if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0)) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ec1fedb339cc..f31d7dc11e72 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -772,7 +772,8 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table | |||
772 | return ip6_pol_route(net, table, fl->oif, fl, flags); | 772 | return ip6_pol_route(net, table, fl->oif, fl, flags); |
773 | } | 773 | } |
774 | 774 | ||
775 | struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl) | 775 | struct dst_entry * ip6_route_output(struct net *net, struct sock *sk, |
776 | struct flowi *fl) | ||
776 | { | 777 | { |
777 | int flags = 0; | 778 | int flags = 0; |
778 | 779 | ||
@@ -782,7 +783,7 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl) | |||
782 | if (!ipv6_addr_any(&fl->fl6_src)) | 783 | if (!ipv6_addr_any(&fl->fl6_src)) |
783 | flags |= RT6_LOOKUP_F_HAS_SADDR; | 784 | flags |= RT6_LOOKUP_F_HAS_SADDR; |
784 | 785 | ||
785 | return fib6_rule_lookup(&init_net, fl, flags, ip6_pol_route_output); | 786 | return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output); |
786 | } | 787 | } |
787 | 788 | ||
788 | EXPORT_SYMBOL(ip6_route_output); | 789 | EXPORT_SYMBOL(ip6_route_output); |
@@ -2260,7 +2261,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2260 | skb_reset_mac_header(skb); | 2261 | skb_reset_mac_header(skb); |
2261 | skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); | 2262 | skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); |
2262 | 2263 | ||
2263 | rt = (struct rt6_info*) ip6_route_output(NULL, &fl); | 2264 | rt = (struct rt6_info*) ip6_route_output(&init_net, NULL, &fl); |
2264 | skb->dst = &rt->u.dst; | 2265 | skb->dst = &rt->u.dst; |
2265 | 2266 | ||
2266 | err = rt6_fill_node(skb, rt, &fl.fl6_dst, &fl.fl6_src, iif, | 2267 | err = rt6_fill_node(skb, rt, &fl.fl6_dst, &fl.fl6_src, iif, |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 68720aa63f96..1b8196c8d145 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -393,7 +393,7 @@ isatap_srcok(struct sk_buff *skb, struct iphdr *iph, struct net_device *dev) | |||
393 | fl.oif = dev->ifindex; | 393 | fl.oif = dev->ifindex; |
394 | security_skb_classify_flow(skb, &fl); | 394 | security_skb_classify_flow(skb, &fl); |
395 | 395 | ||
396 | dst = ip6_route_output(NULL, &fl); | 396 | dst = ip6_route_output(&init_net, NULL, &fl); |
397 | if (!dst->error && (dst->dev == dev) && (neigh = dst->neighbour)) { | 397 | if (!dst->error && (dst->dev == dev) && (neigh = dst->neighbour)) { |
398 | 398 | ||
399 | addr6 = (struct in6_addr*)&neigh->primary_key; | 399 | addr6 = (struct in6_addr*)&neigh->primary_key; |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 6ef56303e69e..e96dafdc7032 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -38,7 +38,7 @@ static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr, | |||
38 | if (saddr) | 38 | if (saddr) |
39 | memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src)); | 39 | memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src)); |
40 | 40 | ||
41 | dst = ip6_route_output(NULL, &fl); | 41 | dst = ip6_route_output(&init_net, NULL, &fl); |
42 | 42 | ||
43 | err = dst->error; | 43 | err = dst->error; |
44 | if (dst->error) { | 44 | if (dst->error) { |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 3e4878800b36..4862835b0c39 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -257,7 +257,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, | |||
257 | NIP6(fl.fl6_src)); | 257 | NIP6(fl.fl6_src)); |
258 | } | 258 | } |
259 | 259 | ||
260 | dst = ip6_route_output(NULL, &fl); | 260 | dst = ip6_route_output(&init_net, NULL, &fl); |
261 | if (!dst->error) { | 261 | if (!dst->error) { |
262 | struct rt6_info *rt; | 262 | struct rt6_info *rt; |
263 | rt = (struct rt6_info *)dst; | 263 | rt = (struct rt6_info *)dst; |