aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c5
-rw-r--r--net/ipv6/addrlabel.c34
-rw-r--r--net/ipv6/ah6.c4
-rw-r--r--net/ipv6/anycast.c6
-rw-r--r--net/ipv6/esp6.c4
-rw-r--r--net/ipv6/exthdrs.c2
-rw-r--r--net/ipv6/icmp.c7
-rw-r--r--net/ipv6/ip6_flowlabel.c4
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6mr.c5
-rw-r--r--net/ipv6/ipcomp6.c4
-rw-r--r--net/ipv6/mcast.c10
-rw-r--r--net/ipv6/ndisc.c7
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c5
-rw-r--r--net/ipv6/route.c9
-rw-r--r--net/ipv6/tcp_ipv6.c8
-rw-r--r--net/ipv6/udp.c137
-rw-r--r--net/ipv6/udp_impl.h4
-rw-r--r--net/ipv6/udplite.c9
20 files changed, 137 insertions, 131 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index eea9542728ca..ff7ae05f72e1 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2986,9 +2986,8 @@ static void if6_seq_stop(struct seq_file *seq, void *v)
2986static int if6_seq_show(struct seq_file *seq, void *v) 2986static int if6_seq_show(struct seq_file *seq, void *v)
2987{ 2987{
2988 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; 2988 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
2989 seq_printf(seq, 2989 seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
2990 NIP6_SEQFMT " %02x %02x %02x %02x %8s\n", 2990 &ifp->addr,
2991 NIP6(ifp->addr),
2992 ifp->idev->dev->ifindex, 2991 ifp->idev->dev->ifindex,
2993 ifp->prefix_len, 2992 ifp->prefix_len,
2994 ifp->scope, 2993 ifp->scope,
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index 08909039d87b..6ff73c4c126a 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -186,10 +186,8 @@ u32 ipv6_addr_label(struct net *net,
186 label = p ? p->label : IPV6_ADDR_LABEL_DEFAULT; 186 label = p ? p->label : IPV6_ADDR_LABEL_DEFAULT;
187 rcu_read_unlock(); 187 rcu_read_unlock();
188 188
189 ADDRLABEL(KERN_DEBUG "%s(addr=" NIP6_FMT ", type=%d, ifindex=%d) => %08x\n", 189 ADDRLABEL(KERN_DEBUG "%s(addr=%pI6, type=%d, ifindex=%d) => %08x\n",
190 __func__, 190 __func__, addr, type, ifindex, label);
191 NIP6(*addr), type, ifindex,
192 label);
193 191
194 return label; 192 return label;
195} 193}
@@ -203,11 +201,8 @@ static struct ip6addrlbl_entry *ip6addrlbl_alloc(struct net *net,
203 struct ip6addrlbl_entry *newp; 201 struct ip6addrlbl_entry *newp;
204 int addrtype; 202 int addrtype;
205 203
206 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d, label=%u)\n", 204 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u)\n",
207 __func__, 205 __func__, prefix, prefixlen, ifindex, (unsigned int)label);
208 NIP6(*prefix), prefixlen,
209 ifindex,
210 (unsigned int)label);
211 206
212 addrtype = ipv6_addr_type(prefix) & (IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK); 207 addrtype = ipv6_addr_type(prefix) & (IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK);
213 208
@@ -294,12 +289,9 @@ static int ip6addrlbl_add(struct net *net,
294 struct ip6addrlbl_entry *newp; 289 struct ip6addrlbl_entry *newp;
295 int ret = 0; 290 int ret = 0;
296 291
297 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n", 292 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n",
298 __func__, 293 __func__, prefix, prefixlen, ifindex, (unsigned int)label,
299 NIP6(*prefix), prefixlen, 294 replace);
300 ifindex,
301 (unsigned int)label,
302 replace);
303 295
304 newp = ip6addrlbl_alloc(net, prefix, prefixlen, ifindex, label); 296 newp = ip6addrlbl_alloc(net, prefix, prefixlen, ifindex, label);
305 if (IS_ERR(newp)) 297 if (IS_ERR(newp))
@@ -321,10 +313,8 @@ static int __ip6addrlbl_del(struct net *net,
321 struct hlist_node *pos, *n; 313 struct hlist_node *pos, *n;
322 int ret = -ESRCH; 314 int ret = -ESRCH;
323 315
324 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d)\n", 316 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n",
325 __func__, 317 __func__, prefix, prefixlen, ifindex);
326 NIP6(*prefix), prefixlen,
327 ifindex);
328 318
329 hlist_for_each_entry_safe(p, pos, n, &ip6addrlbl_table.head, list) { 319 hlist_for_each_entry_safe(p, pos, n, &ip6addrlbl_table.head, list) {
330 if (p->prefixlen == prefixlen && 320 if (p->prefixlen == prefixlen &&
@@ -347,10 +337,8 @@ static int ip6addrlbl_del(struct net *net,
347 struct in6_addr prefix_buf; 337 struct in6_addr prefix_buf;
348 int ret; 338 int ret;
349 339
350 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d)\n", 340 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n",
351 __func__, 341 __func__, prefix, prefixlen, ifindex);
352 NIP6(*prefix), prefixlen,
353 ifindex);
354 342
355 ipv6_addr_prefix(&prefix_buf, prefix, prefixlen); 343 ipv6_addr_prefix(&prefix_buf, prefix, prefixlen);
356 spin_lock(&ip6addrlbl_table.lock); 344 spin_lock(&ip6addrlbl_table.lock);
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 2ff0c8233e47..7a8a01369e5c 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -419,8 +419,8 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
419 if (!x) 419 if (!x)
420 return; 420 return;
421 421
422 NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/" NIP6_FMT "\n", 422 NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/%pI6\n",
423 ntohl(ah->spi), NIP6(iph->daddr)); 423 ntohl(ah->spi), &iph->daddr);
424 424
425 xfrm_state_put(x); 425 xfrm_state_put(x);
426} 426}
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 8336cd81cb4f..1ae58bec1de0 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -512,11 +512,9 @@ static int ac6_seq_show(struct seq_file *seq, void *v)
512 struct ifacaddr6 *im = (struct ifacaddr6 *)v; 512 struct ifacaddr6 *im = (struct ifacaddr6 *)v;
513 struct ac6_iter_state *state = ac6_seq_private(seq); 513 struct ac6_iter_state *state = ac6_seq_private(seq);
514 514
515 seq_printf(seq, 515 seq_printf(seq, "%-4d %-15s %pi6 %5d\n",
516 "%-4d %-15s " NIP6_SEQFMT " %5d\n",
517 state->dev->ifindex, state->dev->name, 516 state->dev->ifindex, state->dev->name,
518 NIP6(im->aca_addr), 517 &im->aca_addr, im->aca_users);
519 im->aca_users);
520 return 0; 518 return 0;
521} 519}
522 520
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index b181b08fb761..c02a6308defe 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -367,8 +367,8 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
367 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6); 367 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6);
368 if (!x) 368 if (!x)
369 return; 369 return;
370 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n", 370 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%pI6\n",
371 ntohl(esph->spi), NIP6(iph->daddr)); 371 ntohl(esph->spi), &iph->daddr);
372 xfrm_state_put(x); 372 xfrm_state_put(x);
373} 373}
374 374
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 6bfffec2371c..1c7f400a3cfe 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -219,7 +219,7 @@ static int ipv6_dest_hao(struct sk_buff *skb, int optoff)
219 219
220 if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) { 220 if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) {
221 LIMIT_NETDEBUG( 221 LIMIT_NETDEBUG(
222 KERN_DEBUG "hao is not an unicast addr: " NIP6_FMT "\n", NIP6(hao->addr)); 222 KERN_DEBUG "hao is not an unicast addr: %pI6\n", &hao->addr);
223 goto discard; 223 goto discard;
224 } 224 }
225 225
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9b7d19ae5ced..3c2821f9b529 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -646,9 +646,10 @@ static int icmpv6_rcv(struct sk_buff *skb)
646 int type; 646 int type;
647 647
648 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { 648 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
649 struct sec_path *sp = skb_sec_path(skb);
649 int nh; 650 int nh;
650 651
651 if (!(skb->sp && skb->sp->xvec[skb->sp->len - 1]->props.flags & 652 if (!(sp && sp->xvec[sp->len - 1]->props.flags &
652 XFRM_STATE_ICMP)) 653 XFRM_STATE_ICMP))
653 goto drop_no_count; 654 goto drop_no_count;
654 655
@@ -680,8 +681,8 @@ static int icmpv6_rcv(struct sk_buff *skb)
680 skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len, 681 skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len,
681 IPPROTO_ICMPV6, 0)); 682 IPPROTO_ICMPV6, 0));
682 if (__skb_checksum_complete(skb)) { 683 if (__skb_checksum_complete(skb)) {
683 LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n", 684 LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [%pI6 > %pI6]\n",
684 NIP6(*saddr), NIP6(*daddr)); 685 saddr, daddr);
685 goto discard_it; 686 goto discard_it;
686 } 687 }
687 } 688 }
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 37a4e777e347..7927a8498d17 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -696,14 +696,14 @@ static int ip6fl_seq_show(struct seq_file *seq, void *v)
696 else { 696 else {
697 struct ip6_flowlabel *fl = v; 697 struct ip6_flowlabel *fl = v;
698 seq_printf(seq, 698 seq_printf(seq,
699 "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_SEQFMT " %-4d\n", 699 "%05X %-1d %-6d %-6d %-6ld %-8ld %pi6 %-4d\n",
700 (unsigned)ntohl(fl->label), 700 (unsigned)ntohl(fl->label),
701 fl->share, 701 fl->share,
702 (unsigned)fl->owner, 702 (unsigned)fl->owner,
703 atomic_read(&fl->users), 703 atomic_read(&fl->users),
704 fl->linger/HZ, 704 fl->linger/HZ,
705 (long)(fl->expires - jiffies)/HZ, 705 (long)(fl->expires - jiffies)/HZ,
706 NIP6(fl->dst), 706 &fl->dst,
707 fl->opt ? fl->opt->opt_nflen : 0); 707 fl->opt ? fl->opt->opt_nflen : 0);
708 } 708 }
709 return 0; 709 return 0;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index c77db0b95e26..7d92fd97cfb9 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -490,7 +490,7 @@ int ip6_forward(struct sk_buff *skb)
490 We don't send redirects to frames decapsulated from IPsec. 490 We don't send redirects to frames decapsulated from IPsec.
491 */ 491 */
492 if (skb->dev == dst->dev && dst->neighbour && opt->srcrt == 0 && 492 if (skb->dev == dst->dev && dst->neighbour && opt->srcrt == 0 &&
493 !skb->sp) { 493 !skb_sec_path(skb)) {
494 struct in6_addr *target = NULL; 494 struct in6_addr *target = NULL;
495 struct rt6_info *rt; 495 struct rt6_info *rt;
496 struct neighbour *n = dst->neighbour; 496 struct neighbour *n = dst->neighbour;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 182f8a177e7f..c491fb98a5e3 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -297,9 +297,8 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
297 const struct mfc6_cache *mfc = v; 297 const struct mfc6_cache *mfc = v;
298 const struct ipmr_mfc_iter *it = seq->private; 298 const struct ipmr_mfc_iter *it = seq->private;
299 299
300 seq_printf(seq, 300 seq_printf(seq, "%pI6 %pI6 %-3d %8ld %8ld %8ld",
301 NIP6_FMT " " NIP6_FMT " %-3d %8ld %8ld %8ld", 301 &mfc->mf6c_mcastgrp, &mfc->mf6c_origin,
302 NIP6(mfc->mf6c_mcastgrp), NIP6(mfc->mf6c_origin),
303 mfc->mf6c_parent, 302 mfc->mf6c_parent,
304 mfc->mfc_un.res.pkt, 303 mfc->mfc_un.res.pkt,
305 mfc->mfc_un.res.bytes, 304 mfc->mfc_un.res.bytes,
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 4545e4306862..d4576a9c154f 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -67,8 +67,8 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
67 if (!x) 67 if (!x)
68 return; 68 return;
69 69
70 printk(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/" NIP6_FMT "\n", 70 printk(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%pI6\n",
71 spi, NIP6(iph->daddr)); 71 spi, &iph->daddr);
72 xfrm_state_put(x); 72 xfrm_state_put(x);
73} 73}
74 74
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index d7b3c6d398ae..a76199ecad23 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2430,9 +2430,9 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
2430 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2430 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2431 2431
2432 seq_printf(seq, 2432 seq_printf(seq,
2433 "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", 2433 "%-4d %-15s %pi6 %5d %08X %ld\n",
2434 state->dev->ifindex, state->dev->name, 2434 state->dev->ifindex, state->dev->name,
2435 NIP6(im->mca_addr), 2435 &im->mca_addr,
2436 im->mca_users, im->mca_flags, 2436 im->mca_users, im->mca_flags,
2437 (im->mca_flags&MAF_TIMER_RUNNING) ? 2437 (im->mca_flags&MAF_TIMER_RUNNING) ?
2438 jiffies_to_clock_t(im->mca_timer.expires-jiffies) : 0); 2438 jiffies_to_clock_t(im->mca_timer.expires-jiffies) : 0);
@@ -2591,10 +2591,10 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
2591 "Source Address", "INC", "EXC"); 2591 "Source Address", "INC", "EXC");
2592 } else { 2592 } else {
2593 seq_printf(seq, 2593 seq_printf(seq,
2594 "%3d %6.6s " NIP6_SEQFMT " " NIP6_SEQFMT " %6lu %6lu\n", 2594 "%3d %6.6s %pi6 %pi6 %6lu %6lu\n",
2595 state->dev->ifindex, state->dev->name, 2595 state->dev->ifindex, state->dev->name,
2596 NIP6(state->im->mca_addr), 2596 &state->im->mca_addr,
2597 NIP6(psf->sf_addr), 2597 &psf->sf_addr,
2598 psf->sf_count[MCAST_INCLUDE], 2598 psf->sf_count[MCAST_INCLUDE],
2599 psf->sf_count[MCAST_EXCLUDE]); 2599 psf->sf_count[MCAST_EXCLUDE]);
2600 } 2600 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 172438320eec..2a6752dae09d 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -647,11 +647,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
647 647
648 if ((probes -= neigh->parms->ucast_probes) < 0) { 648 if ((probes -= neigh->parms->ucast_probes) < 0) {
649 if (!(neigh->nud_state & NUD_VALID)) { 649 if (!(neigh->nud_state & NUD_VALID)) {
650 ND_PRINTK1(KERN_DEBUG 650 ND_PRINTK1(KERN_DEBUG "%s(): trying to ucast probe in NUD_INVALID: %pI6\n",
651 "%s(): trying to ucast probe in NUD_INVALID: " 651 __func__, target);
652 NIP6_FMT "\n",
653 __func__,
654 NIP6(*target));
655 } 652 }
656 ndisc_send_ns(dev, neigh, target, target, saddr); 653 ndisc_send_ns(dev, neigh, target, target, saddr);
657 } else if ((probes -= neigh->parms->app_probes) < 0) { 654 } else if ((probes -= neigh->parms->app_probes) < 0) {
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index caa441d09567..02885e8bb69b 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -61,7 +61,7 @@ static void dump_packet(const struct nf_loginfo *info,
61 } 61 }
62 62
63 /* Max length: 88 "SRC=0000.0000.0000.0000.0000.0000.0000.0000 DST=0000.0000.0000.0000.0000.0000.0000.0000 " */ 63 /* Max length: 88 "SRC=0000.0000.0000.0000.0000.0000.0000.0000 DST=0000.0000.0000.0000.0000.0000.0000.0000 " */
64 printk("SRC=" NIP6_FMT " DST=" NIP6_FMT " ", NIP6(ih->saddr), NIP6(ih->daddr)); 64 printk("SRC=%pI6 DST=%pI6 ", &ih->saddr, &ih->daddr);
65 65
66 /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */ 66 /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */
67 printk("LEN=%Zu TC=%u HOPLIMIT=%u FLOWLBL=%u ", 67 printk("LEN=%Zu TC=%u HOPLIMIT=%u FLOWLBL=%u ",
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index e91db16611d9..727b9530448a 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -56,9 +56,8 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple,
56static int ipv6_print_tuple(struct seq_file *s, 56static int ipv6_print_tuple(struct seq_file *s,
57 const struct nf_conntrack_tuple *tuple) 57 const struct nf_conntrack_tuple *tuple)
58{ 58{
59 return seq_printf(s, "src=" NIP6_FMT " dst=" NIP6_FMT " ", 59 return seq_printf(s, "src=%pI6 dst=%pI6 ",
60 NIP6(*((struct in6_addr *)tuple->src.u3.ip6)), 60 tuple->src.u3.ip6, tuple->dst.u3.ip6);
61 NIP6(*((struct in6_addr *)tuple->dst.u3.ip6)));
62} 61}
63 62
64/* 63/*
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 89dc69924340..d69fa462d3f0 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2408,19 +2408,16 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
2408{ 2408{
2409 struct seq_file *m = p_arg; 2409 struct seq_file *m = p_arg;
2410 2410
2411 seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_dst.addr), 2411 seq_printf(m, "%pi6 %02x ", &rt->rt6i_dst.addr, rt->rt6i_dst.plen);
2412 rt->rt6i_dst.plen);
2413 2412
2414#ifdef CONFIG_IPV6_SUBTREES 2413#ifdef CONFIG_IPV6_SUBTREES
2415 seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_src.addr), 2414 seq_printf(m, "%pi6 %02x ", &rt->rt6i_src.addr, rt->rt6i_src.plen);
2416 rt->rt6i_src.plen);
2417#else 2415#else
2418 seq_puts(m, "00000000000000000000000000000000 00 "); 2416 seq_puts(m, "00000000000000000000000000000000 00 ");
2419#endif 2417#endif
2420 2418
2421 if (rt->rt6i_nexthop) { 2419 if (rt->rt6i_nexthop) {
2422 seq_printf(m, NIP6_SEQFMT, 2420 seq_printf(m, "%pi6", rt->rt6i_nexthop->primary_key);
2423 NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key)));
2424 } else { 2421 } else {
2425 seq_puts(m, "00000000000000000000000000000000"); 2422 seq_puts(m, "00000000000000000000000000000000");
2426 } 2423 }
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b6b356b7912a..984276463a8d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -872,12 +872,10 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
872 872
873 if (genhash || memcmp(hash_location, newhash, 16) != 0) { 873 if (genhash || memcmp(hash_location, newhash, 16) != 0) {
874 if (net_ratelimit()) { 874 if (net_ratelimit()) {
875 printk(KERN_INFO "MD5 Hash %s for " 875 printk(KERN_INFO "MD5 Hash %s for (%pI6, %u)->(%pI6, %u)\n",
876 "(" NIP6_FMT ", %u)->"
877 "(" NIP6_FMT ", %u)\n",
878 genhash ? "failed" : "mismatch", 876 genhash ? "failed" : "mismatch",
879 NIP6(ip6h->saddr), ntohs(th->source), 877 &ip6h->saddr, ntohs(th->source),
880 NIP6(ip6h->daddr), ntohs(th->dest)); 878 &ip6h->daddr, ntohs(th->dest));
881 } 879 }
882 return 1; 880 return 1;
883 } 881 }
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e51da8c092fa..32d914db6c4f 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -54,62 +54,89 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum)
54 return udp_lib_get_port(sk, snum, ipv6_rcv_saddr_equal); 54 return udp_lib_get_port(sk, snum, ipv6_rcv_saddr_equal);
55} 55}
56 56
57static inline int compute_score(struct sock *sk, struct net *net,
58 unsigned short hnum,
59 struct in6_addr *saddr, __be16 sport,
60 struct in6_addr *daddr, __be16 dport,
61 int dif)
62{
63 int score = -1;
64
65 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
66 sk->sk_family == PF_INET6) {
67 struct ipv6_pinfo *np = inet6_sk(sk);
68 struct inet_sock *inet = inet_sk(sk);
69
70 score = 0;
71 if (inet->dport) {
72 if (inet->dport != sport)
73 return -1;
74 score++;
75 }
76 if (!ipv6_addr_any(&np->rcv_saddr)) {
77 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
78 return -1;
79 score++;
80 }
81 if (!ipv6_addr_any(&np->daddr)) {
82 if (!ipv6_addr_equal(&np->daddr, saddr))
83 return -1;
84 score++;
85 }
86 if (sk->sk_bound_dev_if) {
87 if (sk->sk_bound_dev_if != dif)
88 return -1;
89 score++;
90 }
91 }
92 return score;
93}
94
57static struct sock *__udp6_lib_lookup(struct net *net, 95static struct sock *__udp6_lib_lookup(struct net *net,
58 struct in6_addr *saddr, __be16 sport, 96 struct in6_addr *saddr, __be16 sport,
59 struct in6_addr *daddr, __be16 dport, 97 struct in6_addr *daddr, __be16 dport,
60 int dif, struct hlist_head udptable[]) 98 int dif, struct udp_table *udptable)
61{ 99{
62 struct sock *sk, *result = NULL; 100 struct sock *sk, *result;
63 struct hlist_node *node; 101 struct hlist_node *node, *next;
64 unsigned short hnum = ntohs(dport); 102 unsigned short hnum = ntohs(dport);
65 int badness = -1; 103 unsigned int hash = udp_hashfn(net, hnum);
66 104 struct udp_hslot *hslot = &udptable->hash[hash];
67 read_lock(&udp_hash_lock); 105 int score, badness;
68 sk_for_each(sk, node, &udptable[udp_hashfn(net, hnum)]) { 106
69 struct inet_sock *inet = inet_sk(sk); 107 rcu_read_lock();
70 108begin:
71 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && 109 result = NULL;
72 sk->sk_family == PF_INET6) { 110 badness = -1;
73 struct ipv6_pinfo *np = inet6_sk(sk); 111 sk_for_each_rcu_safenext(sk, node, &hslot->head, next) {
74 int score = 0; 112 /*
75 if (inet->dport) { 113 * lockless reader, and SLAB_DESTROY_BY_RCU items:
76 if (inet->dport != sport) 114 * We must check this item was not moved to another chain
77 continue; 115 */
78 score++; 116 if (udp_hashfn(net, sk->sk_hash) != hash)
79 } 117 goto begin;
80 if (!ipv6_addr_any(&np->rcv_saddr)) { 118 score = compute_score(sk, net, hnum, saddr, sport, daddr, dport, dif);
81 if (!ipv6_addr_equal(&np->rcv_saddr, daddr)) 119 if (score > badness) {
82 continue; 120 result = sk;
83 score++; 121 badness = score;
84 } 122 }
85 if (!ipv6_addr_any(&np->daddr)) { 123 }
86 if (!ipv6_addr_equal(&np->daddr, saddr)) 124 if (result) {
87 continue; 125 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
88 score++; 126 result = NULL;
89 } 127 else if (unlikely(compute_score(result, net, hnum, saddr, sport,
90 if (sk->sk_bound_dev_if) { 128 daddr, dport, dif) < badness)) {
91 if (sk->sk_bound_dev_if != dif) 129 sock_put(result);
92 continue; 130 goto begin;
93 score++;
94 }
95 if (score == 4) {
96 result = sk;
97 break;
98 } else if (score > badness) {
99 result = sk;
100 badness = score;
101 }
102 } 131 }
103 } 132 }
104 if (result) 133 rcu_read_unlock();
105 sock_hold(result);
106 read_unlock(&udp_hash_lock);
107 return result; 134 return result;
108} 135}
109 136
110static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb, 137static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,
111 __be16 sport, __be16 dport, 138 __be16 sport, __be16 dport,
112 struct hlist_head udptable[]) 139 struct udp_table *udptable)
113{ 140{
114 struct sock *sk; 141 struct sock *sk;
115 struct ipv6hdr *iph = ipv6_hdr(skb); 142 struct ipv6hdr *iph = ipv6_hdr(skb);
@@ -239,7 +266,7 @@ csum_copy_err:
239 266
240void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 267void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
241 int type, int code, int offset, __be32 info, 268 int type, int code, int offset, __be32 info,
242 struct hlist_head udptable[] ) 269 struct udp_table *udptable)
243{ 270{
244 struct ipv6_pinfo *np; 271 struct ipv6_pinfo *np;
245 struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; 272 struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data;
@@ -275,7 +302,7 @@ static __inline__ void udpv6_err(struct sk_buff *skb,
275 struct inet6_skb_parm *opt, int type, 302 struct inet6_skb_parm *opt, int type,
276 int code, int offset, __be32 info ) 303 int code, int offset, __be32 info )
277{ 304{
278 __udp6_lib_err(skb, opt, type, code, offset, info, udp_hash); 305 __udp6_lib_err(skb, opt, type, code, offset, info, &udp_table);
279} 306}
280 307
281int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) 308int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
@@ -374,14 +401,15 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
374 */ 401 */
375static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, 402static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
376 struct in6_addr *saddr, struct in6_addr *daddr, 403 struct in6_addr *saddr, struct in6_addr *daddr,
377 struct hlist_head udptable[]) 404 struct udp_table *udptable)
378{ 405{
379 struct sock *sk, *sk2; 406 struct sock *sk, *sk2;
380 const struct udphdr *uh = udp_hdr(skb); 407 const struct udphdr *uh = udp_hdr(skb);
408 struct udp_hslot *hslot = &udptable->hash[udp_hashfn(net, ntohs(uh->dest))];
381 int dif; 409 int dif;
382 410
383 read_lock(&udp_hash_lock); 411 spin_lock(&hslot->lock);
384 sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); 412 sk = sk_head(&hslot->head);
385 dif = inet6_iif(skb); 413 dif = inet6_iif(skb);
386 sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); 414 sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
387 if (!sk) { 415 if (!sk) {
@@ -409,7 +437,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
409 sk_add_backlog(sk, skb); 437 sk_add_backlog(sk, skb);
410 bh_unlock_sock(sk); 438 bh_unlock_sock(sk);
411out: 439out:
412 read_unlock(&udp_hash_lock); 440 spin_unlock(&hslot->lock);
413 return 0; 441 return 0;
414} 442}
415 443
@@ -447,7 +475,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
447 return 0; 475 return 0;
448} 476}
449 477
450int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], 478int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
451 int proto) 479 int proto)
452{ 480{
453 struct sock *sk; 481 struct sock *sk;
@@ -544,7 +572,7 @@ discard:
544 572
545static __inline__ int udpv6_rcv(struct sk_buff *skb) 573static __inline__ int udpv6_rcv(struct sk_buff *skb)
546{ 574{
547 return __udp6_lib_rcv(skb, udp_hash, IPPROTO_UDP); 575 return __udp6_lib_rcv(skb, &udp_table, IPPROTO_UDP);
548} 576}
549 577
550/* 578/*
@@ -1008,7 +1036,7 @@ int udp6_seq_show(struct seq_file *seq, void *v)
1008static struct udp_seq_afinfo udp6_seq_afinfo = { 1036static struct udp_seq_afinfo udp6_seq_afinfo = {
1009 .name = "udp6", 1037 .name = "udp6",
1010 .family = AF_INET6, 1038 .family = AF_INET6,
1011 .hashtable = udp_hash, 1039 .udp_table = &udp_table,
1012 .seq_fops = { 1040 .seq_fops = {
1013 .owner = THIS_MODULE, 1041 .owner = THIS_MODULE,
1014 }, 1042 },
@@ -1050,7 +1078,8 @@ struct proto udpv6_prot = {
1050 .sysctl_wmem = &sysctl_udp_wmem_min, 1078 .sysctl_wmem = &sysctl_udp_wmem_min,
1051 .sysctl_rmem = &sysctl_udp_rmem_min, 1079 .sysctl_rmem = &sysctl_udp_rmem_min,
1052 .obj_size = sizeof(struct udp6_sock), 1080 .obj_size = sizeof(struct udp6_sock),
1053 .h.udp_hash = udp_hash, 1081 .slab_flags = SLAB_DESTROY_BY_RCU,
1082 .h.udp_table = &udp_table,
1054#ifdef CONFIG_COMPAT 1083#ifdef CONFIG_COMPAT
1055 .compat_setsockopt = compat_udpv6_setsockopt, 1084 .compat_setsockopt = compat_udpv6_setsockopt,
1056 .compat_getsockopt = compat_udpv6_getsockopt, 1085 .compat_getsockopt = compat_udpv6_getsockopt,
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index 92dd7da766d8..23779208c334 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -7,9 +7,9 @@
7#include <net/inet_common.h> 7#include <net/inet_common.h>
8#include <net/transp_v6.h> 8#include <net/transp_v6.h>
9 9
10extern int __udp6_lib_rcv(struct sk_buff *, struct hlist_head [], int ); 10extern int __udp6_lib_rcv(struct sk_buff *, struct udp_table *, int );
11extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, 11extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *,
12 int , int , int , __be32 , struct hlist_head []); 12 int , int , int , __be32 , struct udp_table *);
13 13
14extern int udp_v6_get_port(struct sock *sk, unsigned short snum); 14extern int udp_v6_get_port(struct sock *sk, unsigned short snum);
15 15
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 3cd1a1ac3d6c..ba162a824585 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -15,14 +15,14 @@
15 15
16static int udplitev6_rcv(struct sk_buff *skb) 16static int udplitev6_rcv(struct sk_buff *skb)
17{ 17{
18 return __udp6_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); 18 return __udp6_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE);
19} 19}
20 20
21static void udplitev6_err(struct sk_buff *skb, 21static void udplitev6_err(struct sk_buff *skb,
22 struct inet6_skb_parm *opt, 22 struct inet6_skb_parm *opt,
23 int type, int code, int offset, __be32 info) 23 int type, int code, int offset, __be32 info)
24{ 24{
25 __udp6_lib_err(skb, opt, type, code, offset, info, udplite_hash); 25 __udp6_lib_err(skb, opt, type, code, offset, info, &udplite_table);
26} 26}
27 27
28static struct inet6_protocol udplitev6_protocol = { 28static struct inet6_protocol udplitev6_protocol = {
@@ -49,7 +49,8 @@ struct proto udplitev6_prot = {
49 .unhash = udp_lib_unhash, 49 .unhash = udp_lib_unhash,
50 .get_port = udp_v6_get_port, 50 .get_port = udp_v6_get_port,
51 .obj_size = sizeof(struct udp6_sock), 51 .obj_size = sizeof(struct udp6_sock),
52 .h.udp_hash = udplite_hash, 52 .slab_flags = SLAB_DESTROY_BY_RCU,
53 .h.udp_table = &udplite_table,
53#ifdef CONFIG_COMPAT 54#ifdef CONFIG_COMPAT
54 .compat_setsockopt = compat_udpv6_setsockopt, 55 .compat_setsockopt = compat_udpv6_setsockopt,
55 .compat_getsockopt = compat_udpv6_getsockopt, 56 .compat_getsockopt = compat_udpv6_getsockopt,
@@ -95,7 +96,7 @@ void udplitev6_exit(void)
95static struct udp_seq_afinfo udplite6_seq_afinfo = { 96static struct udp_seq_afinfo udplite6_seq_afinfo = {
96 .name = "udplite6", 97 .name = "udplite6",
97 .family = AF_INET6, 98 .family = AF_INET6,
98 .hashtable = udplite_hash, 99 .udp_table = &udplite_table,
99 .seq_fops = { 100 .seq_fops = {
100 .owner = THIS_MODULE, 101 .owner = THIS_MODULE,
101 }, 102 },