diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 08:47:49 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 15:39:53 -0400 |
commit | c346dca10840a874240c78efe3f39acf4312a1f2 (patch) | |
tree | c04cff20124eba5cc337cc5ec260ad2513eeb065 /net/ipv6/ndisc.c | |
parent | 7cbca67c073263c179f605bdbbdc565ab29d801d (diff) |
[NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS.
Introduce per-net_device inlines: dev_net(), dev_net_set().
Without CONFIG_NET_NS, no namespace other than &init_net exists.
Let's explicitly define them to help compiler optimizations.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r-- | net/ipv6/ndisc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3f68a6eae7b2..79af57f586e8 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -447,7 +447,7 @@ static void __ndisc_send(struct net_device *dev, | |||
447 | { | 447 | { |
448 | struct flowi fl; | 448 | struct flowi fl; |
449 | struct dst_entry *dst; | 449 | struct dst_entry *dst; |
450 | struct net *net = dev->nd_net; | 450 | struct net *net = dev_net(dev); |
451 | struct sock *sk = net->ipv6.ndisc_sk; | 451 | struct sock *sk = net->ipv6.ndisc_sk; |
452 | struct sk_buff *skb; | 452 | struct sk_buff *skb; |
453 | struct icmp6hdr *hdr; | 453 | struct icmp6hdr *hdr; |
@@ -539,7 +539,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
539 | }; | 539 | }; |
540 | 540 | ||
541 | /* for anycast or proxy, solicited_addr != src_addr */ | 541 | /* for anycast or proxy, solicited_addr != src_addr */ |
542 | ifp = ipv6_get_ifaddr(dev->nd_net, solicited_addr, dev, 1); | 542 | ifp = ipv6_get_ifaddr(dev_net(dev), solicited_addr, dev, 1); |
543 | if (ifp) { | 543 | if (ifp) { |
544 | src_addr = solicited_addr; | 544 | src_addr = solicited_addr; |
545 | if (ifp->flags & IFA_F_OPTIMISTIC) | 545 | if (ifp->flags & IFA_F_OPTIMISTIC) |
@@ -547,7 +547,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
547 | in6_ifa_put(ifp); | 547 | in6_ifa_put(ifp); |
548 | } else { | 548 | } else { |
549 | if (ipv6_dev_get_saddr(dev, daddr, | 549 | if (ipv6_dev_get_saddr(dev, daddr, |
550 | inet6_sk(dev->nd_net->ipv6.ndisc_sk)->srcprefs, | 550 | inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs, |
551 | &tmpaddr)) | 551 | &tmpaddr)) |
552 | return; | 552 | return; |
553 | src_addr = &tmpaddr; | 553 | src_addr = &tmpaddr; |
@@ -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(dev->nd_net, saddr, | 604 | struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), 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(dev->nd_net, &ipv6_hdr(skb)->saddr, dev, 1)) | 642 | if (skb && ipv6_chk_addr(dev_net(dev), &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,7 @@ 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 | ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1); | 730 | ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1); |
731 | if (ifp) { | 731 | if (ifp) { |
732 | 732 | ||
733 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { | 733 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { |
@@ -776,7 +776,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
776 | if (ipv6_chk_acast_addr(dev, &msg->target) || | 776 | if (ipv6_chk_acast_addr(dev, &msg->target) || |
777 | (idev->cnf.forwarding && | 777 | (idev->cnf.forwarding && |
778 | (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && | 778 | (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && |
779 | (pneigh = pneigh_lookup(&nd_tbl, dev->nd_net, | 779 | (pneigh = pneigh_lookup(&nd_tbl, dev_net(dev), |
780 | &msg->target, dev, 0)) != NULL)) { | 780 | &msg->target, dev, 0)) != NULL)) { |
781 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && | 781 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && |
782 | skb->pkt_type != PACKET_HOST && | 782 | skb->pkt_type != PACKET_HOST && |
@@ -886,7 +886,7 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
886 | return; | 886 | return; |
887 | } | 887 | } |
888 | } | 888 | } |
889 | ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1); | 889 | ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1); |
890 | if (ifp) { | 890 | if (ifp) { |
891 | if (ifp->flags & IFA_F_TENTATIVE) { | 891 | if (ifp->flags & IFA_F_TENTATIVE) { |
892 | addrconf_dad_failure(ifp); | 892 | addrconf_dad_failure(ifp); |
@@ -918,7 +918,7 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
918 | */ | 918 | */ |
919 | if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) && | 919 | if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) && |
920 | ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && | 920 | ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && |
921 | pneigh_lookup(&nd_tbl, dev->nd_net, &msg->target, dev, 0)) { | 921 | pneigh_lookup(&nd_tbl, dev_net(dev), &msg->target, dev, 0)) { |
922 | /* XXX: idev->cnf.prixy_ndp */ | 922 | /* XXX: idev->cnf.prixy_ndp */ |
923 | goto out; | 923 | goto out; |
924 | } | 924 | } |
@@ -1008,7 +1008,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt) | |||
1008 | struct sk_buff *skb; | 1008 | struct sk_buff *skb; |
1009 | struct nlmsghdr *nlh; | 1009 | struct nlmsghdr *nlh; |
1010 | struct nduseroptmsg *ndmsg; | 1010 | struct nduseroptmsg *ndmsg; |
1011 | struct net *net = ra->dev->nd_net; | 1011 | struct net *net = dev_net(ra->dev); |
1012 | int err; | 1012 | int err; |
1013 | int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg) | 1013 | int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg) |
1014 | + (opt->nd_opt_len << 3)); | 1014 | + (opt->nd_opt_len << 3)); |
@@ -1395,7 +1395,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1395 | struct in6_addr *target) | 1395 | struct in6_addr *target) |
1396 | { | 1396 | { |
1397 | struct net_device *dev = skb->dev; | 1397 | struct net_device *dev = skb->dev; |
1398 | struct net *net = dev->nd_net; | 1398 | struct net *net = dev_net(dev); |
1399 | struct sock *sk = net->ipv6.ndisc_sk; | 1399 | struct sock *sk = net->ipv6.ndisc_sk; |
1400 | int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | 1400 | int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); |
1401 | struct sk_buff *buff; | 1401 | struct sk_buff *buff; |
@@ -1597,7 +1597,7 @@ int ndisc_rcv(struct sk_buff *skb) | |||
1597 | static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1597 | static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
1598 | { | 1598 | { |
1599 | struct net_device *dev = ptr; | 1599 | struct net_device *dev = ptr; |
1600 | struct net *net = dev->nd_net; | 1600 | struct net *net = dev_net(dev); |
1601 | 1601 | ||
1602 | switch (event) { | 1602 | switch (event) { |
1603 | case NETDEV_CHANGEADDR: | 1603 | case NETDEV_CHANGEADDR: |