diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-03-04 16:46:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-04 16:46:48 -0500 |
commit | efa2cea0d97a91dbbc067463de702738f7e50748 (patch) | |
tree | 0e50044072ed8d0e924979b5997fc0e098dce932 | |
parent | 69ddb80562a460d6d9edafe33a5bee06ca18b1a1 (diff) |
[NETNS][IPV6] route6 - Pass network namespace to rt6_add_route_info and rt6_get_route_info
Add a network namespace parameter to rt6_add_route_info() and
rt6_get_route_info to enable them to handle multiple network
namespaces.
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-- | net/ipv6/route.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ebd9033fece3..4278cec522c5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -88,10 +88,12 @@ static void ip6_link_failure(struct sk_buff *skb); | |||
88 | static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu); | 88 | static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu); |
89 | 89 | ||
90 | #ifdef CONFIG_IPV6_ROUTE_INFO | 90 | #ifdef CONFIG_IPV6_ROUTE_INFO |
91 | static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixlen, | 91 | static struct rt6_info *rt6_add_route_info(struct net *net, |
92 | struct in6_addr *prefix, int prefixlen, | ||
92 | struct in6_addr *gwaddr, int ifindex, | 93 | struct in6_addr *gwaddr, int ifindex, |
93 | unsigned pref); | 94 | unsigned pref); |
94 | static struct rt6_info *rt6_get_route_info(struct in6_addr *prefix, int prefixlen, | 95 | static struct rt6_info *rt6_get_route_info(struct net *net, |
96 | struct in6_addr *prefix, int prefixlen, | ||
95 | struct in6_addr *gwaddr, int ifindex); | 97 | struct in6_addr *gwaddr, int ifindex); |
96 | #endif | 98 | #endif |
97 | 99 | ||
@@ -442,6 +444,7 @@ static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict) | |||
442 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | 444 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, |
443 | struct in6_addr *gwaddr) | 445 | struct in6_addr *gwaddr) |
444 | { | 446 | { |
447 | struct net *net = dev->nd_net; | ||
445 | struct route_info *rinfo = (struct route_info *) opt; | 448 | struct route_info *rinfo = (struct route_info *) opt; |
446 | struct in6_addr prefix_buf, *prefix; | 449 | struct in6_addr prefix_buf, *prefix; |
447 | unsigned int pref; | 450 | unsigned int pref; |
@@ -489,7 +492,8 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
489 | prefix = &prefix_buf; | 492 | prefix = &prefix_buf; |
490 | } | 493 | } |
491 | 494 | ||
492 | rt = rt6_get_route_info(prefix, rinfo->prefix_len, gwaddr, dev->ifindex); | 495 | rt = rt6_get_route_info(net, prefix, rinfo->prefix_len, gwaddr, |
496 | dev->ifindex); | ||
493 | 497 | ||
494 | if (rt && !lifetime) { | 498 | if (rt && !lifetime) { |
495 | ip6_del_rt(rt); | 499 | ip6_del_rt(rt); |
@@ -497,7 +501,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
497 | } | 501 | } |
498 | 502 | ||
499 | if (!rt && lifetime) | 503 | if (!rt && lifetime) |
500 | rt = rt6_add_route_info(prefix, rinfo->prefix_len, gwaddr, dev->ifindex, | 504 | rt = rt6_add_route_info(net, prefix, rinfo->prefix_len, gwaddr, dev->ifindex, |
501 | pref); | 505 | pref); |
502 | else if (rt) | 506 | else if (rt) |
503 | rt->rt6i_flags = RTF_ROUTEINFO | | 507 | rt->rt6i_flags = RTF_ROUTEINFO | |
@@ -1588,14 +1592,15 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) | |||
1588 | } | 1592 | } |
1589 | 1593 | ||
1590 | #ifdef CONFIG_IPV6_ROUTE_INFO | 1594 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1591 | static struct rt6_info *rt6_get_route_info(struct in6_addr *prefix, int prefixlen, | 1595 | static struct rt6_info *rt6_get_route_info(struct net *net, |
1596 | struct in6_addr *prefix, int prefixlen, | ||
1592 | struct in6_addr *gwaddr, int ifindex) | 1597 | struct in6_addr *gwaddr, int ifindex) |
1593 | { | 1598 | { |
1594 | struct fib6_node *fn; | 1599 | struct fib6_node *fn; |
1595 | struct rt6_info *rt = NULL; | 1600 | struct rt6_info *rt = NULL; |
1596 | struct fib6_table *table; | 1601 | struct fib6_table *table; |
1597 | 1602 | ||
1598 | table = fib6_get_table(&init_net, RT6_TABLE_INFO); | 1603 | table = fib6_get_table(net, RT6_TABLE_INFO); |
1599 | if (table == NULL) | 1604 | if (table == NULL) |
1600 | return NULL; | 1605 | return NULL; |
1601 | 1606 | ||
@@ -1619,7 +1624,8 @@ out: | |||
1619 | return rt; | 1624 | return rt; |
1620 | } | 1625 | } |
1621 | 1626 | ||
1622 | static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixlen, | 1627 | static struct rt6_info *rt6_add_route_info(struct net *net, |
1628 | struct in6_addr *prefix, int prefixlen, | ||
1623 | struct in6_addr *gwaddr, int ifindex, | 1629 | struct in6_addr *gwaddr, int ifindex, |
1624 | unsigned pref) | 1630 | unsigned pref) |
1625 | { | 1631 | { |
@@ -1630,6 +1636,9 @@ static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixle | |||
1630 | .fc_dst_len = prefixlen, | 1636 | .fc_dst_len = prefixlen, |
1631 | .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO | | 1637 | .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO | |
1632 | RTF_UP | RTF_PREF(pref), | 1638 | RTF_UP | RTF_PREF(pref), |
1639 | .fc_nlinfo.pid = 0, | ||
1640 | .fc_nlinfo.nlh = NULL, | ||
1641 | .fc_nlinfo.nl_net = net, | ||
1633 | }; | 1642 | }; |
1634 | 1643 | ||
1635 | ipv6_addr_copy(&cfg.fc_dst, prefix); | 1644 | ipv6_addr_copy(&cfg.fc_dst, prefix); |
@@ -1641,7 +1650,7 @@ static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixle | |||
1641 | 1650 | ||
1642 | ip6_route_add(&cfg); | 1651 | ip6_route_add(&cfg); |
1643 | 1652 | ||
1644 | return rt6_get_route_info(prefix, prefixlen, gwaddr, ifindex); | 1653 | return rt6_get_route_info(net, prefix, prefixlen, gwaddr, ifindex); |
1645 | } | 1654 | } |
1646 | #endif | 1655 | #endif |
1647 | 1656 | ||