aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-07 14:14:49 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-07 14:14:49 -0500
commita18bc6959d9793c8352d2177b456d93868953874 (patch)
tree315376e105603a9c81d65c222b7f75e637024c1c /net/ipv6/ndisc.c
parent8a3edd800dcdf949953777c73abf54de261574e8 (diff)
[NETNS][IPV6] ndisc - make ndisc handle multiple network namespaces
Make ndisc handle multiple network namespaces: Remove references to init_net, add network namespace parameters and add pernet_operations for ndisc 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>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index e0d023360a88..a539b9ea53fd 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -541,7 +541,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
541 }; 541 };
542 542
543 /* for anycast or proxy, solicited_addr != src_addr */ 543 /* for anycast or proxy, solicited_addr != src_addr */
544 ifp = ipv6_get_ifaddr(&init_net, solicited_addr, dev, 1); 544 ifp = ipv6_get_ifaddr(dev->nd_net, solicited_addr, dev, 1);
545 if (ifp) { 545 if (ifp) {
546 src_addr = solicited_addr; 546 src_addr = solicited_addr;
547 if (ifp->flags & IFA_F_OPTIMISTIC) 547 if (ifp->flags & IFA_F_OPTIMISTIC)
@@ -601,7 +601,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
601 * suppress the inclusion of the sllao. 601 * suppress the inclusion of the sllao.
602 */ 602 */
603 if (send_sllao) { 603 if (send_sllao) {
604 struct inet6_ifaddr *ifp = ipv6_get_ifaddr(&init_net, saddr, 604 struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev->nd_net, saddr,
605 dev, 1); 605 dev, 1);
606 if (ifp) { 606 if (ifp) {
607 if (ifp->flags & IFA_F_OPTIMISTIC) { 607 if (ifp->flags & IFA_F_OPTIMISTIC) {
@@ -639,7 +639,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
639 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; 639 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
640 int probes = atomic_read(&neigh->probes); 640 int probes = atomic_read(&neigh->probes);
641 641
642 if (skb && ipv6_chk_addr(&init_net, &ipv6_hdr(skb)->saddr, dev, 1)) 642 if (skb && ipv6_chk_addr(dev->nd_net, &ipv6_hdr(skb)->saddr, dev, 1))
643 saddr = &ipv6_hdr(skb)->saddr; 643 saddr = &ipv6_hdr(skb)->saddr;
644 644
645 if ((probes -= neigh->parms->ucast_probes) < 0) { 645 if ((probes -= neigh->parms->ucast_probes) < 0) {
@@ -727,7 +727,8 @@ static void ndisc_recv_ns(struct sk_buff *skb)
727 727
728 inc = ipv6_addr_is_multicast(daddr); 728 inc = ipv6_addr_is_multicast(daddr);
729 729
730 if ((ifp = ipv6_get_ifaddr(&init_net, &msg->target, dev, 1)) != NULL) { 730 ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1);
731 if (ifp) {
731 732
732 if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { 733 if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) {
733 if (dad) { 734 if (dad) {
@@ -775,7 +776,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
775 if (ipv6_chk_acast_addr(dev, &msg->target) || 776 if (ipv6_chk_acast_addr(dev, &msg->target) ||
776 (idev->cnf.forwarding && 777 (idev->cnf.forwarding &&
777 (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && 778 (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) &&
778 (pneigh = pneigh_lookup(&nd_tbl, &init_net, 779 (pneigh = pneigh_lookup(&nd_tbl, dev->nd_net,
779 &msg->target, dev, 0)) != NULL)) { 780 &msg->target, dev, 0)) != NULL)) {
780 if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && 781 if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) &&
781 skb->pkt_type != PACKET_HOST && 782 skb->pkt_type != PACKET_HOST &&
@@ -885,7 +886,8 @@ static void ndisc_recv_na(struct sk_buff *skb)
885 return; 886 return;
886 } 887 }
887 } 888 }
888 if ((ifp = ipv6_get_ifaddr(&init_net, &msg->target, dev, 1))) { 889 ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1);
890 if (ifp) {
889 if (ifp->flags & IFA_F_TENTATIVE) { 891 if (ifp->flags & IFA_F_TENTATIVE) {
890 addrconf_dad_failure(ifp); 892 addrconf_dad_failure(ifp);
891 return; 893 return;
@@ -916,7 +918,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
916 */ 918 */
917 if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) && 919 if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) &&
918 ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && 920 ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp &&
919 pneigh_lookup(&nd_tbl, &init_net, &msg->target, dev, 0)) { 921 pneigh_lookup(&nd_tbl, dev->nd_net, &msg->target, dev, 0)) {
920 /* XXX: idev->cnf.prixy_ndp */ 922 /* XXX: idev->cnf.prixy_ndp */
921 goto out; 923 goto out;
922 } 924 }
@@ -1006,6 +1008,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
1006 struct sk_buff *skb; 1008 struct sk_buff *skb;
1007 struct nlmsghdr *nlh; 1009 struct nlmsghdr *nlh;
1008 struct nduseroptmsg *ndmsg; 1010 struct nduseroptmsg *ndmsg;
1011 struct net *net = ra->dev->nd_net;
1009 int err; 1012 int err;
1010 int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg) 1013 int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg)
1011 + (opt->nd_opt_len << 3)); 1014 + (opt->nd_opt_len << 3));
@@ -1035,7 +1038,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
1035 &ipv6_hdr(ra)->saddr); 1038 &ipv6_hdr(ra)->saddr);
1036 nlmsg_end(skb, nlh); 1039 nlmsg_end(skb, nlh);
1037 1040
1038 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_ND_USEROPT, NULL, 1041 err = rtnl_notify(skb, net, 0, RTNLGRP_ND_USEROPT, NULL,
1039 GFP_ATOMIC); 1042 GFP_ATOMIC);
1040 if (err < 0) 1043 if (err < 0)
1041 goto errout; 1044 goto errout;
@@ -1046,7 +1049,7 @@ nla_put_failure:
1046 nlmsg_free(skb); 1049 nlmsg_free(skb);
1047 err = -EMSGSIZE; 1050 err = -EMSGSIZE;
1048errout: 1051errout:
1049 rtnl_set_sk_err(&init_net, RTNLGRP_ND_USEROPT, err); 1052 rtnl_set_sk_err(net, RTNLGRP_ND_USEROPT, err);
1050} 1053}
1051 1054
1052static void ndisc_router_discovery(struct sk_buff *skb) 1055static void ndisc_router_discovery(struct sk_buff *skb)
@@ -1600,9 +1603,6 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
1600 struct net_device *dev = ptr; 1603 struct net_device *dev = ptr;
1601 struct net *net = dev->nd_net; 1604 struct net *net = dev->nd_net;
1602 1605
1603 if (dev->nd_net != &init_net)
1604 return NOTIFY_DONE;
1605
1606 switch (event) { 1606 switch (event) {
1607 case NETDEV_CHANGEADDR: 1607 case NETDEV_CHANGEADDR:
1608 neigh_changeaddr(&nd_tbl, dev); 1608 neigh_changeaddr(&nd_tbl, dev);