]> err.no Git - linux-2.6/commitdiff
[NETNS][IPV6] route6 - add netns parameter to ip6_route_output
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 5 Mar 2008 18:48:10 +0000 (10:48 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Mar 2008 18:48:10 +0000 (10:48 -0800)
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>
include/net/ip6_route.h
net/ipv6/icmp.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/ipv6/ndisc.c
net/ipv6/netfilter.c
net/ipv6/netfilter/ip6t_REJECT.c
net/ipv6/route.c
net/ipv6/sit.c
net/ipv6/xfrm6_policy.c
net/sctp/ipv6.c

index e0caed25bfbad51db58375185e8c2fe16d4869c1..0e2895c8b27019775bc2cf76ce23a5749d54dd86 100644 (file)
@@ -43,7 +43,8 @@ extern struct rt6_info        *ip6_blk_hole_entry;
 
 extern void                    ip6_route_input(struct sk_buff *skb);
 
-extern struct dst_entry *      ip6_route_output(struct sock *sk,
+extern struct dst_entry *      ip6_route_output(struct net *net,
+                                                struct sock *sk,
                                                 struct flowi *fl);
 
 extern int                     ip6_route_init(void);
index cff74127ea3208eddfd6953f357515dc98fd883d..d4c4b50420d84d72ee052ddbd610cbb02d22b49f 100644 (file)
@@ -178,7 +178,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
         * XXX: perhaps the expire for routing entries cloned by
         * this lookup should be more aggressive (not longer than timeout).
         */
-       dst = ip6_route_output(sk, fl);
+       dst = ip6_route_output(&init_net, sk, fl);
        if (dst->error) {
                IP6_INC_STATS(ip6_dst_idev(dst),
                              IPSTATS_MIB_OUTNOROUTES);
index ff3971173e1e208b995f6d3c75b91361eac61ab6..161afd1142d08a3413f550fc5f05d3ddea02e00c 100644 (file)
@@ -913,7 +913,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
        int err;
 
        if (*dst == NULL)
-               *dst = ip6_route_output(sk, fl);
+               *dst = ip6_route_output(&init_net, sk, fl);
 
        if ((err = (*dst)->error))
                goto out_err_release;
@@ -954,7 +954,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
                                dst_release(*dst);
                                memcpy(&fl_gw, fl, sizeof(struct flowi));
                                memset(&fl_gw.fl6_dst, 0, sizeof(struct in6_addr));
-                               *dst = ip6_route_output(sk, &fl_gw);
+                               *dst = ip6_route_output(&init_net, sk, &fl_gw);
                                if ((err = (*dst)->error))
                                        goto out_err_release;
                        }
index 4e1981660b3c228b816974eeffb85ce4e8a665c2..1e1ad1ed87e603fce2bb6ccaf10813a2ff684607 100644 (file)
@@ -847,7 +847,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
        if ((dst = ip6_tnl_dst_check(t)) != NULL)
                dst_hold(dst);
        else {
-               dst = ip6_route_output(NULL, fl);
+               dst = ip6_route_output(&init_net, NULL, fl);
 
                if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0)
                        goto tx_err_link_failure;
index f1c95125100d31d97ae2e98bec79c1c98ad59428..b5b4fd173e98cfd11505a68ed106e112eda5d5d3 100644 (file)
@@ -1427,7 +1427,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        icmpv6_flow_init(ndisc_socket->sk, &fl, NDISC_REDIRECT,
                         &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
 
-       dst = ip6_route_output(NULL, &fl);
+       dst = ip6_route_output(&init_net, NULL, &fl);
        if (dst == NULL)
                return;
 
index 2e06724dc34877c7b6f085aba43e294d4ae974d1..aed51bcc66b44d5df82bd05775d674333a9e09c0 100644 (file)
@@ -23,7 +23,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
                    .saddr = iph->saddr, } },
        };
 
-       dst = ip6_route_output(skb->sk, &fl);
+       dst = ip6_route_output(&init_net, skb->sk, &fl);
 
 #ifdef CONFIG_XFRM
        if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
@@ -86,7 +86,7 @@ static int nf_ip6_reroute(struct sk_buff *skb,
 
 static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl)
 {
-       *dst = ip6_route_output(NULL, fl);
+       *dst = ip6_route_output(&init_net, NULL, fl);
        return (*dst)->error;
 }
 
index b23baa635fe0f591f8584123e9283244dbbec280..831708aeab371099a460ca689c43d27da22a5a97 100644 (file)
@@ -93,7 +93,7 @@ static void send_reset(struct sk_buff *oldskb)
        fl.fl_ip_sport = otcph.dest;
        fl.fl_ip_dport = otcph.source;
        security_skb_classify_flow(oldskb, &fl);
-       dst = ip6_route_output(NULL, &fl);
+       dst = ip6_route_output(&init_net, NULL, &fl);
        if (dst == NULL)
                return;
        if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0))
index ec1fedb339cc468a5afec8d8a7d9a5eb4ca8512b..f31d7dc11e723ba492a9d3aa38511ebb51ae164d 100644 (file)
@@ -772,7 +772,8 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table
        return ip6_pol_route(net, table, fl->oif, fl, flags);
 }
 
-struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
+struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
+                                   struct flowi *fl)
 {
        int flags = 0;
 
@@ -782,7 +783,7 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
        if (!ipv6_addr_any(&fl->fl6_src))
                flags |= RT6_LOOKUP_F_HAS_SADDR;
 
-       return fib6_rule_lookup(&init_net, fl, flags, ip6_pol_route_output);
+       return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output);
 }
 
 EXPORT_SYMBOL(ip6_route_output);
@@ -2260,7 +2261,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
        skb_reset_mac_header(skb);
        skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
 
-       rt = (struct rt6_info*) ip6_route_output(NULL, &fl);
+       rt = (struct rt6_info*) ip6_route_output(&init_net, NULL, &fl);
        skb->dst = &rt->u.dst;
 
        err = rt6_fill_node(skb, rt, &fl.fl6_dst, &fl.fl6_src, iif,
index 68720aa63f962f5899865d37453e12f7e60a11b8..1b8196c8d1456d4c2a88967e4b249ddec85ba472 100644 (file)
@@ -393,7 +393,7 @@ isatap_srcok(struct sk_buff *skb, struct iphdr *iph, struct net_device *dev)
        fl.oif = dev->ifindex;
        security_skb_classify_flow(skb, &fl);
 
-       dst = ip6_route_output(NULL, &fl);
+       dst = ip6_route_output(&init_net, NULL, &fl);
        if (!dst->error && (dst->dev == dev) && (neigh = dst->neighbour)) {
 
                addr6 = (struct in6_addr*)&neigh->primary_key;
index 6ef56303e69ef735f0ee0785368901a6a56a3fe2..e96dafdc7032e91bcea6738357c34c0b4b735986 100644 (file)
@@ -38,7 +38,7 @@ static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr,
        if (saddr)
                memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src));
 
-       dst = ip6_route_output(NULL, &fl);
+       dst = ip6_route_output(&init_net, NULL, &fl);
 
        err = dst->error;
        if (dst->error) {
index 3e4878800b361f6d0567e1cff458895a3d691542..4862835b0c39b3d58cea27a85cc6d11020f6e21b 100644 (file)
@@ -257,7 +257,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
                        NIP6(fl.fl6_src));
        }
 
-       dst = ip6_route_output(NULL, &fl);
+       dst = ip6_route_output(&init_net, NULL, &fl);
        if (!dst->error) {
                struct rt6_info *rt;
                rt = (struct rt6_info *)dst;