aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/802/tr.c22
-rw-r--r--net/8021q/vlan.c8
-rw-r--r--net/8021q/vlan.h6
-rw-r--r--net/8021q/vlan_dev.c22
-rw-r--r--net/Kconfig2
-rw-r--r--net/appletalk/aarp.c3
-rw-r--r--net/atm/br2684.c5
-rw-r--r--net/atm/lec.c26
-rw-r--r--net/bridge/netfilter/ebt_log.c6
-rw-r--r--net/core/dev.c25
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/net-sysfs.c7
-rw-r--r--net/core/net_namespace.c2
-rw-r--r--net/core/netpoll.c5
-rw-r--r--net/core/pktgen.c9
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/core/sock.c3
-rw-r--r--net/ieee80211/ieee80211_crypt_ccmp.c13
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c29
-rw-r--r--net/ieee80211/ieee80211_rx.c71
-rw-r--r--net/ieee80211/ieee80211_wx.c5
-rw-r--r--net/ipv4/cipso_ipv4.c1
-rw-r--r--net/ipv4/devinet.c9
-rw-r--r--net/ipv4/icmp.c3
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/route.c135
-rw-r--r--net/ipv4/sysctl_net_ipv4.c12
-rw-r--r--net/ipv4/tcp_input.c4
-rw-r--r--net/ipv4/tcp_timer.c4
-rw-r--r--net/ipv4/udp.c241
-rw-r--r--net/ipv4/udp_impl.h4
-rw-r--r--net/ipv4/udplite.c14
-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
-rw-r--r--net/irda/irlan/irlan_client.c4
-rw-r--r--net/llc/llc_proc.c3
-rw-r--r--net/mac80211/debugfs_key.c4
-rw-r--r--net/mac80211/debugfs_netdev.c3
-rw-r--r--net/mac80211/debugfs_sta.c5
-rw-r--r--net/mac80211/event.c5
-rw-r--r--net/mac80211/ht.c42
-rw-r--r--net/mac80211/key.c10
-rw-r--r--net/mac80211/mesh_plink.c49
-rw-r--r--net/mac80211/mlme.c121
-rw-r--r--net/mac80211/rx.c38
-rw-r--r--net/mac80211/sta_info.c33
-rw-r--r--net/mac80211/tkip.c10
-rw-r--r--net/mac80211/tx.c24
-rw-r--r--net/mac80211/wme.c8
-rw-r--r--net/mac80211/wpa.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_conn.c20
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c8
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c8
-rw-r--r--net/netfilter/ipvs/ip_vs_proto.c19
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_ah_esp.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c17
-rw-r--r--net/netfilter/nf_conntrack_ftp.c8
-rw-r--r--net/netfilter/nf_conntrack_h323_main.c12
-rw-r--r--net/netfilter/xt_hashlimit.c7
-rw-r--r--net/netfilter/xt_recent.c5
-rw-r--r--net/netlabel/netlabel_addrlist.c2
-rw-r--r--net/netlink/attr.c2
-rw-r--r--net/sctp/ipv6.c35
-rw-r--r--net/sctp/sm_statefuns.c5
-rw-r--r--net/sunrpc/clnt.c4
-rw-r--r--net/sunrpc/rpcb_clnt.c6
-rw-r--r--net/sunrpc/svcauth_unix.c7
-rw-r--r--net/sunrpc/xprtsock.c26
-rw-r--r--net/tipc/eth_media.c3
-rw-r--r--net/xfrm/xfrm_policy.c6
-rw-r--r--net/xfrm/xfrm_state.c12
-rw-r--r--net/xfrm/xfrm_user.c52
90 files changed, 850 insertions, 751 deletions
diff --git a/net/802/tr.c b/net/802/tr.c
index 18c66475d8c3..38f1f290c635 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -285,10 +285,7 @@ void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,
285 if(entry) 285 if(entry)
286 { 286 {
287#if TR_SR_DEBUG 287#if TR_SR_DEBUG
288{ 288printk("source routing for %pM\n", trh->daddr);
289DECLARE_MAC_BUF(mac);
290printk("source routing for %s\n",print_mac(mac, trh->daddr));
291}
292#endif 289#endif
293 if(!entry->local_ring && (ntohs(entry->rcf) & TR_RCF_LEN_MASK) >> 8) 290 if(!entry->local_ring && (ntohs(entry->rcf) & TR_RCF_LEN_MASK) >> 8)
294 { 291 {
@@ -370,9 +367,8 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
370 if(entry==NULL) 367 if(entry==NULL)
371 { 368 {
372#if TR_SR_DEBUG 369#if TR_SR_DEBUG
373 DECLARE_MAC_BUF(mac); 370 printk("adding rif_entry: addr:%pM rcf:%04X\n",
374 printk("adding rif_entry: addr:%s rcf:%04X\n", 371 trh->saddr, ntohs(trh->rcf));
375 print_mac(mac, trh->saddr), ntohs(trh->rcf));
376#endif 372#endif
377 /* 373 /*
378 * Allocate our new entry. A failure to allocate loses 374 * Allocate our new entry. A failure to allocate loses
@@ -417,11 +413,8 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
417 !(trh->rcf & htons(TR_RCF_BROADCAST_MASK))) 413 !(trh->rcf & htons(TR_RCF_BROADCAST_MASK)))
418 { 414 {
419#if TR_SR_DEBUG 415#if TR_SR_DEBUG
420{ 416printk("updating rif_entry: addr:%pM rcf:%04X\n",
421DECLARE_MAC_BUF(mac); 417 trh->saddr, ntohs(trh->rcf));
422printk("updating rif_entry: addr:%s rcf:%04X\n",
423 print_mac(mac, trh->saddr), ntohs(trh->rcf));
424}
425#endif 418#endif
426 entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK); 419 entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK);
427 memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); 420 memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short));
@@ -532,7 +525,6 @@ static int rif_seq_show(struct seq_file *seq, void *v)
532{ 525{
533 int j, rcf_len, segment, brdgnmb; 526 int j, rcf_len, segment, brdgnmb;
534 struct rif_cache *entry = v; 527 struct rif_cache *entry = v;
535 DECLARE_MAC_BUF(mac);
536 528
537 if (v == SEQ_START_TOKEN) 529 if (v == SEQ_START_TOKEN)
538 seq_puts(seq, 530 seq_puts(seq,
@@ -542,9 +534,9 @@ static int rif_seq_show(struct seq_file *seq, void *v)
542 long ttl = (long) (entry->last_used + sysctl_tr_rif_timeout) 534 long ttl = (long) (entry->last_used + sysctl_tr_rif_timeout)
543 - (long) jiffies; 535 - (long) jiffies;
544 536
545 seq_printf(seq, "%s %s %7li ", 537 seq_printf(seq, "%s %pM %7li ",
546 dev?dev->name:"?", 538 dev?dev->name:"?",
547 print_mac(mac, entry->addr), 539 entry->addr,
548 ttl/HZ); 540 ttl/HZ);
549 541
550 if (entry->local_ring) 542 if (entry->local_ring)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index f0e335aa20df..72326b9c759c 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -46,10 +46,10 @@ int vlan_net_id;
46/* Our listing of VLAN group(s) */ 46/* Our listing of VLAN group(s) */
47static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; 47static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE];
48 48
49static char vlan_fullname[] = "802.1Q VLAN Support"; 49const char vlan_fullname[] = "802.1Q VLAN Support";
50static char vlan_version[] = DRV_VERSION; 50const char vlan_version[] = DRV_VERSION;
51static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; 51static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
52static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; 52static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
53 53
54static struct packet_type vlan_packet_type = { 54static struct packet_type vlan_packet_type = {
55 .type = __constant_htons(ETH_P_8021Q), 55 .type = __constant_htons(ETH_P_8021Q),
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index a6603a4d917f..82570bc2a180 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -108,8 +108,10 @@ static inline int vlan_gvrp_init(void) { return 0; }
108static inline void vlan_gvrp_uninit(void) {} 108static inline void vlan_gvrp_uninit(void) {}
109#endif 109#endif
110 110
111int vlan_netlink_init(void); 111extern const char vlan_fullname[];
112void vlan_netlink_fini(void); 112extern const char vlan_version[];
113extern int vlan_netlink_init(void);
114extern void vlan_netlink_fini(void);
113 115
114extern struct rtnl_link_ops vlan_link_ops; 116extern struct rtnl_link_ops vlan_link_ops;
115 117
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8883e9c8a223..c269fcbd13d5 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -648,6 +648,26 @@ static void vlan_dev_uninit(struct net_device *dev)
648 } 648 }
649} 649}
650 650
651static int vlan_ethtool_get_settings(struct net_device *dev,
652 struct ethtool_cmd *cmd)
653{
654 const struct vlan_dev_info *vlan = vlan_dev_info(dev);
655 struct net_device *real_dev = vlan->real_dev;
656
657 if (!real_dev->ethtool_ops->get_settings)
658 return -EOPNOTSUPP;
659
660 return real_dev->ethtool_ops->get_settings(real_dev, cmd);
661}
662
663static void vlan_ethtool_get_drvinfo(struct net_device *dev,
664 struct ethtool_drvinfo *info)
665{
666 strcpy(info->driver, vlan_fullname);
667 strcpy(info->version, vlan_version);
668 strcpy(info->fw_version, "N/A");
669}
670
651static u32 vlan_ethtool_get_rx_csum(struct net_device *dev) 671static u32 vlan_ethtool_get_rx_csum(struct net_device *dev)
652{ 672{
653 const struct vlan_dev_info *vlan = vlan_dev_info(dev); 673 const struct vlan_dev_info *vlan = vlan_dev_info(dev);
@@ -672,6 +692,8 @@ static u32 vlan_ethtool_get_flags(struct net_device *dev)
672} 692}
673 693
674static const struct ethtool_ops vlan_ethtool_ops = { 694static const struct ethtool_ops vlan_ethtool_ops = {
695 .get_settings = vlan_ethtool_get_settings,
696 .get_drvinfo = vlan_ethtool_get_drvinfo,
675 .get_link = ethtool_op_get_link, 697 .get_link = ethtool_op_get_link,
676 .get_rx_csum = vlan_ethtool_get_rx_csum, 698 .get_rx_csum = vlan_ethtool_get_rx_csum,
677 .get_flags = vlan_ethtool_get_flags, 699 .get_flags = vlan_ethtool_get_flags,
diff --git a/net/Kconfig b/net/Kconfig
index d789d79551ae..8c3d97ca0d96 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -27,7 +27,7 @@ menu "Networking options"
27config NET_NS 27config NET_NS
28 bool "Network namespace support" 28 bool "Network namespace support"
29 default n 29 default n
30 depends on EXPERIMENTAL && !SYSFS && NAMESPACES 30 depends on EXPERIMENTAL && NAMESPACES
31 help 31 help
32 Allow user space to create what appear to be multiple instances 32 Allow user space to create what appear to be multiple instances
33 of the network stack. 33 of the network stack.
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index b25c1e909d14..b03ff58e9308 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -995,7 +995,6 @@ static int aarp_seq_show(struct seq_file *seq, void *v)
995 struct aarp_iter_state *iter = seq->private; 995 struct aarp_iter_state *iter = seq->private;
996 struct aarp_entry *entry = v; 996 struct aarp_entry *entry = v;
997 unsigned long now = jiffies; 997 unsigned long now = jiffies;
998 DECLARE_MAC_BUF(mac);
999 998
1000 if (v == SEQ_START_TOKEN) 999 if (v == SEQ_START_TOKEN)
1001 seq_puts(seq, 1000 seq_puts(seq,
@@ -1006,7 +1005,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v)
1006 ntohs(entry->target_addr.s_net), 1005 ntohs(entry->target_addr.s_net),
1007 (unsigned int) entry->target_addr.s_node, 1006 (unsigned int) entry->target_addr.s_node,
1008 entry->dev ? entry->dev->name : "????"); 1007 entry->dev ? entry->dev->name : "????");
1009 seq_printf(seq, "%s", print_mac(mac, entry->hwaddr)); 1008 seq_printf(seq, "%pM", entry->hwaddr);
1010 seq_printf(seq, " %8s", 1009 seq_printf(seq, " %8s",
1011 dt2str((long)entry->expires_at - (long)now)); 1010 dt2str((long)entry->expires_at - (long)now));
1012 if (iter->table == unresolved) 1011 if (iter->table == unresolved)
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 280de481edc7..29ef8dc6921b 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -698,12 +698,11 @@ static int br2684_seq_show(struct seq_file *seq, void *v)
698 br2684_devs); 698 br2684_devs);
699 const struct net_device *net_dev = brdev->net_dev; 699 const struct net_device *net_dev = brdev->net_dev;
700 const struct br2684_vcc *brvcc; 700 const struct br2684_vcc *brvcc;
701 DECLARE_MAC_BUF(mac);
702 701
703 seq_printf(seq, "dev %.16s: num=%d, mac=%s (%s)\n", 702 seq_printf(seq, "dev %.16s: num=%d, mac=%pM (%s)\n",
704 net_dev->name, 703 net_dev->name,
705 brdev->number, 704 brdev->number,
706 print_mac(mac, net_dev->dev_addr), 705 net_dev->dev_addr,
707 brdev->mac_was_set ? "set" : "auto"); 706 brdev->mac_was_set ? "set" : "auto");
708 707
709 list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { 708 list_for_each_entry(brvcc, &brdev->brvccs, brvccs) {
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 8f701cde5945..1def62d17739 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -373,19 +373,13 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
373 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { 373 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
374 pr_debug("%s:lec_start_xmit: queuing packet, ", 374 pr_debug("%s:lec_start_xmit: queuing packet, ",
375 dev->name); 375 dev->name);
376 pr_debug("MAC address " MAC_FMT "\n", 376 pr_debug("MAC address %pM\n", lec_h->h_dest);
377 lec_h->h_dest[0], lec_h->h_dest[1],
378 lec_h->h_dest[2], lec_h->h_dest[3],
379 lec_h->h_dest[4], lec_h->h_dest[5]);
380 skb_queue_tail(&entry->tx_wait, skb); 377 skb_queue_tail(&entry->tx_wait, skb);
381 } else { 378 } else {
382 pr_debug 379 pr_debug
383 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", 380 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
384 dev->name); 381 dev->name);
385 pr_debug("MAC address " MAC_FMT "\n", 382 pr_debug("MAC address %pM\n", lec_h->h_dest);
386 lec_h->h_dest[0], lec_h->h_dest[1],
387 lec_h->h_dest[2], lec_h->h_dest[3],
388 lec_h->h_dest[4], lec_h->h_dest[5]);
389 priv->stats.tx_dropped++; 383 priv->stats.tx_dropped++;
390 dev_kfree_skb(skb); 384 dev_kfree_skb(skb);
391 } 385 }
@@ -397,10 +391,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
397 391
398 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { 392 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
399 pr_debug("lec.c: emptying tx queue, "); 393 pr_debug("lec.c: emptying tx queue, ");
400 pr_debug("MAC address " MAC_FMT "\n", 394 pr_debug("MAC address %pM\n", lec_h->h_dest);
401 lec_h->h_dest[0], lec_h->h_dest[1],
402 lec_h->h_dest[2], lec_h->h_dest[3],
403 lec_h->h_dest[4], lec_h->h_dest[5]);
404 lec_send(vcc, skb2, priv); 395 lec_send(vcc, skb2, priv);
405 } 396 }
406 397
@@ -539,15 +530,8 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
539 { 530 {
540 struct net_bridge_fdb_entry *f; 531 struct net_bridge_fdb_entry *f;
541 532
542 pr_debug 533 pr_debug("%s: bridge zeppelin asks about %pM\n",
543 ("%s: bridge zeppelin asks about " MAC_FMT "\n", 534 dev->name, mesg->content.proxy.mac_addr);
544 dev->name,
545 mesg->content.proxy.mac_addr[0],
546 mesg->content.proxy.mac_addr[1],
547 mesg->content.proxy.mac_addr[2],
548 mesg->content.proxy.mac_addr[3],
549 mesg->content.proxy.mac_addr[4],
550 mesg->content.proxy.mac_addr[5]);
551 535
552 if (br_fdb_get_hook == NULL || dev->br_port == NULL) 536 if (br_fdb_get_hook == NULL || dev->br_port == NULL)
553 break; 537 break;
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
index 3d33c608906a..5e7cff3542f2 100644
--- a/net/bridge/netfilter/ebt_log.c
+++ b/net/bridge/netfilter/ebt_log.c
@@ -133,10 +133,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
133 printk(" INCOMPLETE IPv6 header"); 133 printk(" INCOMPLETE IPv6 header");
134 goto out; 134 goto out;
135 } 135 }
136 printk(" IPv6 SRC=%x:%x:%x:%x:%x:%x:%x:%x " 136 printk(" IPv6 SRC=%pI6 IPv6 DST=%pI6, IPv6 priority=0x%01X, Next Header=%d",
137 "IPv6 DST=%x:%x:%x:%x:%x:%x:%x:%x, IPv6 " 137 &ih->saddr, &ih->daddr, ih->priority, ih->nexthdr);
138 "priority=0x%01X, Next Header=%d", NIP6(ih->saddr),
139 NIP6(ih->daddr), ih->priority, ih->nexthdr);
140 nexthdr = ih->nexthdr; 138 nexthdr = ih->nexthdr;
141 offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr); 139 offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr);
142 if (offset_ph == -1) 140 if (offset_ph == -1)
diff --git a/net/core/dev.c b/net/core/dev.c
index d9038e328cc1..3a2b8be9e67b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -924,10 +924,15 @@ int dev_change_name(struct net_device *dev, const char *newname)
924 strlcpy(dev->name, newname, IFNAMSIZ); 924 strlcpy(dev->name, newname, IFNAMSIZ);
925 925
926rollback: 926rollback:
927 ret = device_rename(&dev->dev, dev->name); 927 /* For now only devices in the initial network namespace
928 if (ret) { 928 * are in sysfs.
929 memcpy(dev->name, oldname, IFNAMSIZ); 929 */
930 return ret; 930 if (net == &init_net) {
931 ret = device_rename(&dev->dev, dev->name);
932 if (ret) {
933 memcpy(dev->name, oldname, IFNAMSIZ);
934 return ret;
935 }
931 } 936 }
932 937
933 write_lock_bh(&dev_base_lock); 938 write_lock_bh(&dev_base_lock);
@@ -4460,6 +4465,15 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
4460 if (dev->features & NETIF_F_NETNS_LOCAL) 4465 if (dev->features & NETIF_F_NETNS_LOCAL)
4461 goto out; 4466 goto out;
4462 4467
4468#ifdef CONFIG_SYSFS
4469 /* Don't allow real devices to be moved when sysfs
4470 * is enabled.
4471 */
4472 err = -EINVAL;
4473 if (dev->dev.parent)
4474 goto out;
4475#endif
4476
4463 /* Ensure the device has been registrered */ 4477 /* Ensure the device has been registrered */
4464 err = -EINVAL; 4478 err = -EINVAL;
4465 if (dev->reg_state != NETREG_REGISTERED) 4479 if (dev->reg_state != NETREG_REGISTERED)
@@ -4517,6 +4531,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
4517 */ 4531 */
4518 dev_addr_discard(dev); 4532 dev_addr_discard(dev);
4519 4533
4534 netdev_unregister_kobject(dev);
4535
4520 /* Actually switch the network namespace */ 4536 /* Actually switch the network namespace */
4521 dev_net_set(dev, net); 4537 dev_net_set(dev, net);
4522 4538
@@ -4533,7 +4549,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
4533 } 4549 }
4534 4550
4535 /* Fixup kobjects */ 4551 /* Fixup kobjects */
4536 netdev_unregister_kobject(dev);
4537 err = netdev_register_kobject(dev); 4552 err = netdev_register_kobject(dev);
4538 WARN_ON(err); 4553 WARN_ON(err);
4539 4554
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 1dc728b38589..b337a937ea52 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1340,7 +1340,6 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
1340 if (p) { 1340 if (p) {
1341 p->tbl = tbl; 1341 p->tbl = tbl;
1342 atomic_set(&p->refcnt, 1); 1342 atomic_set(&p->refcnt, 1);
1343 INIT_RCU_HEAD(&p->rcu_head);
1344 p->reachable_time = 1343 p->reachable_time =
1345 neigh_rand_reach_time(p->base_reachable_time); 1344 neigh_rand_reach_time(p->base_reachable_time);
1346 1345
@@ -1412,7 +1411,6 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
1412 tbl->parms.net = &init_net; 1411 tbl->parms.net = &init_net;
1413#endif 1412#endif
1414 atomic_set(&tbl->parms.refcnt, 1); 1413 atomic_set(&tbl->parms.refcnt, 1);
1415 INIT_RCU_HEAD(&tbl->parms.rcu_head);
1416 tbl->parms.reachable_time = 1414 tbl->parms.reachable_time =
1417 neigh_rand_reach_time(tbl->parms.base_reachable_time); 1415 neigh_rand_reach_time(tbl->parms.base_reachable_time);
1418 1416
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 92d6b9467314..85cb8bdcfb8f 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -476,6 +476,10 @@ void netdev_unregister_kobject(struct net_device * net)
476 struct device *dev = &(net->dev); 476 struct device *dev = &(net->dev);
477 477
478 kobject_get(&dev->kobj); 478 kobject_get(&dev->kobj);
479
480 if (dev_net(net) != &init_net)
481 return;
482
479 device_del(dev); 483 device_del(dev);
480} 484}
481 485
@@ -501,6 +505,9 @@ int netdev_register_kobject(struct net_device *net)
501#endif 505#endif
502#endif /* CONFIG_SYSFS */ 506#endif /* CONFIG_SYSFS */
503 507
508 if (dev_net(net) != &init_net)
509 return 0;
510
504 return device_add(dev); 511 return device_add(dev);
505} 512}
506 513
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1895a4ca9c4f..55cffad2f328 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -47,7 +47,6 @@ static __net_init int setup_net(struct net *net)
47 goto out; 47 goto out;
48 48
49 ng->len = INITIAL_NET_GEN_PTRS; 49 ng->len = INITIAL_NET_GEN_PTRS;
50 INIT_RCU_HEAD(&ng->rcu);
51 rcu_assign_pointer(net->gen, ng); 50 rcu_assign_pointer(net->gen, ng);
52 51
53 error = 0; 52 error = 0;
@@ -478,7 +477,6 @@ int net_assign_generic(struct net *net, int id, void *data)
478 */ 477 */
479 478
480 ng->len = id; 479 ng->len = id;
481 INIT_RCU_HEAD(&ng->rcu);
482 memcpy(&ng->ptr, &old_ng->ptr, old_ng->len); 480 memcpy(&ng->ptr, &old_ng->ptr, old_ng->len);
483 481
484 rcu_assign_pointer(net->gen, ng); 482 rcu_assign_pointer(net->gen, ng);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 6c7af390be0a..34f5d072f168 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -553,7 +553,6 @@ out:
553 553
554void netpoll_print_options(struct netpoll *np) 554void netpoll_print_options(struct netpoll *np)
555{ 555{
556 DECLARE_MAC_BUF(mac);
557 printk(KERN_INFO "%s: local port %d\n", 556 printk(KERN_INFO "%s: local port %d\n",
558 np->name, np->local_port); 557 np->name, np->local_port);
559 printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n", 558 printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n",
@@ -564,8 +563,8 @@ void netpoll_print_options(struct netpoll *np)
564 np->name, np->remote_port); 563 np->name, np->remote_port);
565 printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n", 564 printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n",
566 np->name, HIPQUAD(np->remote_ip)); 565 np->name, HIPQUAD(np->remote_ip));
567 printk(KERN_INFO "%s: remote ethernet address %s\n", 566 printk(KERN_INFO "%s: remote ethernet address %pM\n",
568 np->name, print_mac(mac, np->remote_mac)); 567 np->name, np->remote_mac);
569} 568}
570 569
571int netpoll_parse_options(struct netpoll *np, char *opt) 570int netpoll_parse_options(struct netpoll *np, char *opt)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index a47f5bad110d..fa4973bf73e9 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -509,7 +509,6 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
509 __u64 sa; 509 __u64 sa;
510 __u64 stopped; 510 __u64 stopped;
511 __u64 now = getCurUs(); 511 __u64 now = getCurUs();
512 DECLARE_MAC_BUF(mac);
513 512
514 seq_printf(seq, 513 seq_printf(seq,
515 "Params: count %llu min_pkt_size: %u max_pkt_size: %u\n", 514 "Params: count %llu min_pkt_size: %u max_pkt_size: %u\n",
@@ -554,12 +553,12 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
554 553
555 seq_puts(seq, " src_mac: "); 554 seq_puts(seq, " src_mac: ");
556 555
557 seq_printf(seq, "%s ", 556 seq_printf(seq, "%pM ",
558 print_mac(mac, is_zero_ether_addr(pkt_dev->src_mac) ? 557 is_zero_ether_addr(pkt_dev->src_mac) ?
559 pkt_dev->odev->dev_addr : pkt_dev->src_mac)); 558 pkt_dev->odev->dev_addr : pkt_dev->src_mac);
560 559
561 seq_printf(seq, "dst_mac: "); 560 seq_printf(seq, "dst_mac: ");
562 seq_printf(seq, "%s\n", print_mac(mac, pkt_dev->dst_mac)); 561 seq_printf(seq, "%pM\n", pkt_dev->dst_mac);
563 562
564 seq_printf(seq, 563 seq_printf(seq,
565 " udp_src_min: %d udp_src_max: %d udp_dst_min: %d udp_dst_max: %d\n", 564 " udp_src_min: %d udp_src_max: %d udp_dst_min: %d udp_dst_max: %d\n",
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4e22e3a35359..cdfe473181af 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -489,7 +489,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
489 new->network_header = old->network_header; 489 new->network_header = old->network_header;
490 new->mac_header = old->mac_header; 490 new->mac_header = old->mac_header;
491 new->dst = dst_clone(old->dst); 491 new->dst = dst_clone(old->dst);
492#ifdef CONFIG_INET 492#ifdef CONFIG_XFRM
493 new->sp = secpath_get(old->sp); 493 new->sp = secpath_get(old->sp);
494#endif 494#endif
495 memcpy(new->cb, old->cb, sizeof(old->cb)); 495 memcpy(new->cb, old->cb, sizeof(old->cb));
diff --git a/net/core/sock.c b/net/core/sock.c
index 5e2a3132a8c9..ded1eb5d2fd4 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2042,7 +2042,8 @@ int proto_register(struct proto *prot, int alloc_slab)
2042 2042
2043 if (alloc_slab) { 2043 if (alloc_slab) {
2044 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, 2044 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
2045 SLAB_HWCACHE_ALIGN, NULL); 2045 SLAB_HWCACHE_ALIGN | prot->slab_flags,
2046 NULL);
2046 2047
2047 if (prot->slab == NULL) { 2048 if (prot->slab == NULL) {
2048 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", 2049 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c
index 208bf35b5546..bea04af0b482 100644
--- a/net/ieee80211/ieee80211_crypt_ccmp.c
+++ b/net/ieee80211/ieee80211_crypt_ccmp.c
@@ -296,7 +296,6 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
296 int i, blocks, last, len; 296 int i, blocks, last, len;
297 size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; 297 size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN;
298 u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; 298 u8 *mic = skb->data + skb->len - CCMP_MIC_LEN;
299 DECLARE_MAC_BUF(mac);
300 299
301 if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { 300 if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) {
302 key->dot11RSNAStatsCCMPFormatErrors++; 301 key->dot11RSNAStatsCCMPFormatErrors++;
@@ -309,7 +308,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
309 if (!(keyidx & (1 << 5))) { 308 if (!(keyidx & (1 << 5))) {
310 if (net_ratelimit()) { 309 if (net_ratelimit()) {
311 printk(KERN_DEBUG "CCMP: received packet without ExtIV" 310 printk(KERN_DEBUG "CCMP: received packet without ExtIV"
312 " flag from %s\n", print_mac(mac, hdr->addr2)); 311 " flag from %pM\n", hdr->addr2);
313 } 312 }
314 key->dot11RSNAStatsCCMPFormatErrors++; 313 key->dot11RSNAStatsCCMPFormatErrors++;
315 return -2; 314 return -2;
@@ -322,9 +321,9 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
322 } 321 }
323 if (!key->key_set) { 322 if (!key->key_set) {
324 if (net_ratelimit()) { 323 if (net_ratelimit()) {
325 printk(KERN_DEBUG "CCMP: received packet from %s" 324 printk(KERN_DEBUG "CCMP: received packet from %pM"
326 " with keyid=%d that does not have a configured" 325 " with keyid=%d that does not have a configured"
327 " key\n", print_mac(mac, hdr->addr2), keyidx); 326 " key\n", hdr->addr2, keyidx);
328 } 327 }
329 return -3; 328 return -3;
330 } 329 }
@@ -339,10 +338,10 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
339 338
340 if (ccmp_replay_check(pn, key->rx_pn)) { 339 if (ccmp_replay_check(pn, key->rx_pn)) {
341 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) { 340 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
342 IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s " 341 IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%pM "
343 "previous PN %02x%02x%02x%02x%02x%02x " 342 "previous PN %02x%02x%02x%02x%02x%02x "
344 "received PN %02x%02x%02x%02x%02x%02x\n", 343 "received PN %02x%02x%02x%02x%02x%02x\n",
345 print_mac(mac, hdr->addr2), 344 hdr->addr2,
346 key->rx_pn[0], key->rx_pn[1], key->rx_pn[2], 345 key->rx_pn[0], key->rx_pn[1], key->rx_pn[2],
347 key->rx_pn[3], key->rx_pn[4], key->rx_pn[5], 346 key->rx_pn[3], key->rx_pn[4], key->rx_pn[5],
348 pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]); 347 pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]);
@@ -373,7 +372,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
373 if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { 372 if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
374 if (net_ratelimit()) { 373 if (net_ratelimit()) {
375 printk(KERN_DEBUG "CCMP: decrypt failed: STA=" 374 printk(KERN_DEBUG "CCMP: decrypt failed: STA="
376 "%s\n", print_mac(mac, hdr->addr2)); 375 "%pM\n", hdr->addr2);
377 } 376 }
378 key->dot11RSNAStatsCCMPDecryptErrors++; 377 key->dot11RSNAStatsCCMPDecryptErrors++;
379 return -5; 378 return -5;
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index bba0152e2d71..d12da1da6328 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -359,15 +359,13 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
359 u8 rc4key[16], *pos, *icv; 359 u8 rc4key[16], *pos, *icv;
360 u32 crc; 360 u32 crc;
361 struct scatterlist sg; 361 struct scatterlist sg;
362 DECLARE_MAC_BUF(mac);
363 362
364 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { 363 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
365 if (net_ratelimit()) { 364 if (net_ratelimit()) {
366 struct ieee80211_hdr_4addr *hdr = 365 struct ieee80211_hdr_4addr *hdr =
367 (struct ieee80211_hdr_4addr *)skb->data; 366 (struct ieee80211_hdr_4addr *)skb->data;
368 printk(KERN_DEBUG ": TKIP countermeasures: dropped " 367 printk(KERN_DEBUG ": TKIP countermeasures: dropped "
369 "TX packet to %s\n", 368 "TX packet to %pM\n", hdr->addr1);
370 print_mac(mac, hdr->addr1));
371 } 369 }
372 return -1; 370 return -1;
373 } 371 }
@@ -420,15 +418,13 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
420 u32 crc; 418 u32 crc;
421 struct scatterlist sg; 419 struct scatterlist sg;
422 int plen; 420 int plen;
423 DECLARE_MAC_BUF(mac);
424 421
425 hdr = (struct ieee80211_hdr_4addr *)skb->data; 422 hdr = (struct ieee80211_hdr_4addr *)skb->data;
426 423
427 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { 424 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
428 if (net_ratelimit()) { 425 if (net_ratelimit()) {
429 printk(KERN_DEBUG ": TKIP countermeasures: dropped " 426 printk(KERN_DEBUG ": TKIP countermeasures: dropped "
430 "received packet from %s\n", 427 "received packet from %pM\n", hdr->addr2);
431 print_mac(mac, hdr->addr2));
432 } 428 }
433 return -1; 429 return -1;
434 } 430 }
@@ -441,7 +437,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
441 if (!(keyidx & (1 << 5))) { 437 if (!(keyidx & (1 << 5))) {
442 if (net_ratelimit()) { 438 if (net_ratelimit()) {
443 printk(KERN_DEBUG "TKIP: received packet without ExtIV" 439 printk(KERN_DEBUG "TKIP: received packet without ExtIV"
444 " flag from %s\n", print_mac(mac, hdr->addr2)); 440 " flag from %pM\n", hdr->addr2);
445 } 441 }
446 return -2; 442 return -2;
447 } 443 }
@@ -453,9 +449,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
453 } 449 }
454 if (!tkey->key_set) { 450 if (!tkey->key_set) {
455 if (net_ratelimit()) { 451 if (net_ratelimit()) {
456 printk(KERN_DEBUG "TKIP: received packet from %s" 452 printk(KERN_DEBUG "TKIP: received packet from %pM"
457 " with keyid=%d that does not have a configured" 453 " with keyid=%d that does not have a configured"
458 " key\n", print_mac(mac, hdr->addr2), keyidx); 454 " key\n", hdr->addr2, keyidx);
459 } 455 }
460 return -3; 456 return -3;
461 } 457 }
@@ -465,9 +461,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
465 461
466 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { 462 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) {
467 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) { 463 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
468 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s" 464 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%pM"
469 " previous TSC %08x%04x received TSC " 465 " previous TSC %08x%04x received TSC "
470 "%08x%04x\n", print_mac(mac, hdr->addr2), 466 "%08x%04x\n", hdr->addr2,
471 tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); 467 tkey->rx_iv32, tkey->rx_iv16, iv32, iv16);
472 } 468 }
473 tkey->dot11RSNAStatsTKIPReplays++; 469 tkey->dot11RSNAStatsTKIPReplays++;
@@ -487,8 +483,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
487 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { 483 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
488 if (net_ratelimit()) { 484 if (net_ratelimit()) {
489 printk(KERN_DEBUG ": TKIP: failed to decrypt " 485 printk(KERN_DEBUG ": TKIP: failed to decrypt "
490 "received packet from %s\n", 486 "received packet from %pM\n",
491 print_mac(mac, hdr->addr2)); 487 hdr->addr2);
492 } 488 }
493 return -7; 489 return -7;
494 } 490 }
@@ -506,7 +502,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
506 } 502 }
507 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) { 503 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
508 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA=" 504 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA="
509 "%s\n", print_mac(mac, hdr->addr2)); 505 "%pM\n", hdr->addr2);
510 } 506 }
511 tkey->dot11RSNAStatsTKIPICVErrors++; 507 tkey->dot11RSNAStatsTKIPICVErrors++;
512 return -5; 508 return -5;
@@ -633,7 +629,6 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
633{ 629{
634 struct ieee80211_tkip_data *tkey = priv; 630 struct ieee80211_tkip_data *tkey = priv;
635 u8 mic[8]; 631 u8 mic[8];
636 DECLARE_MAC_BUF(mac);
637 632
638 if (!tkey->key_set) 633 if (!tkey->key_set)
639 return -1; 634 return -1;
@@ -646,8 +641,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
646 struct ieee80211_hdr_4addr *hdr; 641 struct ieee80211_hdr_4addr *hdr;
647 hdr = (struct ieee80211_hdr_4addr *)skb->data; 642 hdr = (struct ieee80211_hdr_4addr *)skb->data;
648 printk(KERN_DEBUG "%s: Michael MIC verification failed for " 643 printk(KERN_DEBUG "%s: Michael MIC verification failed for "
649 "MSDU from %s keyidx=%d\n", 644 "MSDU from %pM keyidx=%d\n",
650 skb->dev ? skb->dev->name : "N/A", print_mac(mac, hdr->addr2), 645 skb->dev ? skb->dev->name : "N/A", hdr->addr2,
651 keyidx); 646 keyidx);
652 if (skb->dev) 647 if (skb->dev)
653 ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); 648 ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 69dbc342a464..281223e41c58 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -282,12 +282,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
282 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 282 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
283 atomic_dec(&crypt->refcnt); 283 atomic_dec(&crypt->refcnt);
284 if (res < 0) { 284 if (res < 0) {
285 IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT 285 IEEE80211_DEBUG_DROP("decryption failed (SA=%pM) res=%d\n",
286 ") res=%d\n", 286 hdr->addr2, res);
287 hdr->addr2[0], hdr->addr2[1],
288 hdr->addr2[2], hdr->addr2[3],
289 hdr->addr2[4], hdr->addr2[5],
290 res);
291 if (res == -2) 287 if (res == -2)
292 IEEE80211_DEBUG_DROP("Decryption failed ICV " 288 IEEE80211_DEBUG_DROP("Decryption failed ICV "
293 "mismatch (key %d)\n", 289 "mismatch (key %d)\n",
@@ -319,11 +315,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
319 atomic_dec(&crypt->refcnt); 315 atomic_dec(&crypt->refcnt);
320 if (res < 0) { 316 if (res < 0) {
321 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" 317 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
322 " (SA=" MAC_FMT " keyidx=%d)\n", 318 " (SA=%pM keyidx=%d)\n", ieee->dev->name, hdr->addr2,
323 ieee->dev->name,
324 hdr->addr2[0], hdr->addr2[1],
325 hdr->addr2[2], hdr->addr2[3],
326 hdr->addr2[4], hdr->addr2[5],
327 keyidx); 319 keyidx);
328 return -1; 320 return -1;
329 } 321 }
@@ -358,7 +350,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
358 struct ieee80211_crypt_data *crypt = NULL; 350 struct ieee80211_crypt_data *crypt = NULL;
359 int keyidx = 0; 351 int keyidx = 0;
360 int can_be_decrypted = 0; 352 int can_be_decrypted = 0;
361 DECLARE_MAC_BUF(mac);
362 353
363 hdr = (struct ieee80211_hdr_4addr *)skb->data; 354 hdr = (struct ieee80211_hdr_4addr *)skb->data;
364 stats = &ieee->stats; 355 stats = &ieee->stats;
@@ -468,10 +459,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
468 * frames silently instead of filling system log with 459 * frames silently instead of filling system log with
469 * these reports. */ 460 * these reports. */
470 IEEE80211_DEBUG_DROP("Decryption failed (not set)" 461 IEEE80211_DEBUG_DROP("Decryption failed (not set)"
471 " (SA=" MAC_FMT ")\n", 462 " (SA=%pM)\n", hdr->addr2);
472 hdr->addr2[0], hdr->addr2[1],
473 hdr->addr2[2], hdr->addr2[3],
474 hdr->addr2[4], hdr->addr2[5]);
475 ieee->ieee_stats.rx_discards_undecryptable++; 463 ieee->ieee_stats.rx_discards_undecryptable++;
476 goto rx_dropped; 464 goto rx_dropped;
477 } 465 }
@@ -482,10 +470,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
482 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && 470 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt &&
483 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { 471 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) {
484 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 472 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
485 "from " MAC_FMT "\n", dev->name, 473 "from %pM\n", dev->name, hdr->addr2);
486 hdr->addr2[0], hdr->addr2[1],
487 hdr->addr2[2], hdr->addr2[3],
488 hdr->addr2[4], hdr->addr2[5]);
489 /* TODO: could inform hostapd about this so that it 474 /* TODO: could inform hostapd about this so that it
490 * could send auth failure report */ 475 * could send auth failure report */
491 goto rx_dropped; 476 goto rx_dropped;
@@ -663,11 +648,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
663 * configured */ 648 * configured */
664 } else { 649 } else {
665 IEEE80211_DEBUG_DROP("encryption configured, but RX " 650 IEEE80211_DEBUG_DROP("encryption configured, but RX "
666 "frame not encrypted (SA=" 651 "frame not encrypted (SA=%pM)\n",
667 MAC_FMT ")\n", 652 hdr->addr2);
668 hdr->addr2[0], hdr->addr2[1],
669 hdr->addr2[2], hdr->addr2[3],
670 hdr->addr2[4], hdr->addr2[5]);
671 goto rx_dropped; 653 goto rx_dropped;
672 } 654 }
673 } 655 }
@@ -675,11 +657,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
675 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && 657 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep &&
676 !ieee80211_is_eapol_frame(ieee, skb)) { 658 !ieee80211_is_eapol_frame(ieee, skb)) {
677 IEEE80211_DEBUG_DROP("dropped unencrypted RX data " 659 IEEE80211_DEBUG_DROP("dropped unencrypted RX data "
678 "frame from " MAC_FMT 660 "frame from %pM (drop_unencrypted=1)\n",
679 " (drop_unencrypted=1)\n", 661 hdr->addr2);
680 hdr->addr2[0], hdr->addr2[1],
681 hdr->addr2[2], hdr->addr2[3],
682 hdr->addr2[4], hdr->addr2[5]);
683 goto rx_dropped; 662 goto rx_dropped;
684 } 663 }
685 664
@@ -1429,8 +1408,6 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021
1429 struct ieee80211_network *network, 1408 struct ieee80211_network *network,
1430 struct ieee80211_rx_stats *stats) 1409 struct ieee80211_rx_stats *stats)
1431{ 1410{
1432 DECLARE_MAC_BUF(mac);
1433
1434 network->qos_data.active = 0; 1411 network->qos_data.active = 0;
1435 network->qos_data.supported = 0; 1412 network->qos_data.supported = 0;
1436 network->qos_data.param_count = 0; 1413 network->qos_data.param_count = 0;
@@ -1477,11 +1454,11 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021
1477 } 1454 }
1478 1455
1479 if (network->mode == 0) { 1456 if (network->mode == 0) {
1480 IEEE80211_DEBUG_SCAN("Filtered out '%s (%s)' " 1457 IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' "
1481 "network.\n", 1458 "network.\n",
1482 escape_essid(network->ssid, 1459 escape_essid(network->ssid,
1483 network->ssid_len), 1460 network->ssid_len),
1484 print_mac(mac, network->bssid)); 1461 network->bssid);
1485 return 1; 1462 return 1;
1486 } 1463 }
1487 1464
@@ -1510,7 +1487,6 @@ static void update_network(struct ieee80211_network *dst,
1510{ 1487{
1511 int qos_active; 1488 int qos_active;
1512 u8 old_param; 1489 u8 old_param;
1513 DECLARE_MAC_BUF(mac);
1514 1490
1515 ieee80211_network_reset(dst); 1491 ieee80211_network_reset(dst);
1516 dst->ibss_dfs = src->ibss_dfs; 1492 dst->ibss_dfs = src->ibss_dfs;
@@ -1524,8 +1500,8 @@ static void update_network(struct ieee80211_network *dst,
1524 memcpy(&dst->stats, &src->stats, 1500 memcpy(&dst->stats, &src->stats,
1525 sizeof(struct ieee80211_rx_stats)); 1501 sizeof(struct ieee80211_rx_stats));
1526 else 1502 else
1527 IEEE80211_DEBUG_SCAN("Network %s info received " 1503 IEEE80211_DEBUG_SCAN("Network %pM info received "
1528 "off channel (%d vs. %d)\n", print_mac(mac, src->bssid), 1504 "off channel (%d vs. %d)\n", src->bssid,
1529 dst->channel, src->stats.received_channel); 1505 dst->channel, src->stats.received_channel);
1530 1506
1531 dst->capability = src->capability; 1507 dst->capability = src->capability;
@@ -1597,12 +1573,11 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1597 struct ieee80211_info_element *info_element = beacon->info_element; 1573 struct ieee80211_info_element *info_element = beacon->info_element;
1598#endif 1574#endif
1599 unsigned long flags; 1575 unsigned long flags;
1600 DECLARE_MAC_BUF(mac);
1601 1576
1602 IEEE80211_DEBUG_SCAN("'%s' (%s" 1577 IEEE80211_DEBUG_SCAN("'%s' (%pM"
1603 "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", 1578 "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
1604 escape_essid(info_element->data, info_element->len), 1579 escape_essid(info_element->data, info_element->len),
1605 print_mac(mac, beacon->header.addr3), 1580 beacon->header.addr3,
1606 (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', 1581 (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0',
1607 (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0', 1582 (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0',
1608 (beacon->capability & cpu_to_le16(1 << 0xd)) ? '1' : '0', 1583 (beacon->capability & cpu_to_le16(1 << 0xd)) ? '1' : '0',
@@ -1621,10 +1596,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1621 (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0'); 1596 (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0');
1622 1597
1623 if (ieee80211_network_init(ieee, beacon, &network, stats)) { 1598 if (ieee80211_network_init(ieee, beacon, &network, stats)) {
1624 IEEE80211_DEBUG_SCAN("Dropped '%s' (%s) via %s.\n", 1599 IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n",
1625 escape_essid(info_element->data, 1600 escape_essid(info_element->data,
1626 info_element->len), 1601 info_element->len),
1627 print_mac(mac, beacon->header.addr3), 1602 beacon->header.addr3,
1628 is_beacon(beacon->header.frame_ctl) ? 1603 is_beacon(beacon->header.frame_ctl) ?
1629 "BEACON" : "PROBE RESPONSE"); 1604 "BEACON" : "PROBE RESPONSE");
1630 return; 1605 return;
@@ -1658,11 +1633,11 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1658 /* If there are no more slots, expire the oldest */ 1633 /* If there are no more slots, expire the oldest */
1659 list_del(&oldest->list); 1634 list_del(&oldest->list);
1660 target = oldest; 1635 target = oldest;
1661 IEEE80211_DEBUG_SCAN("Expired '%s' (%s) from " 1636 IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from "
1662 "network list.\n", 1637 "network list.\n",
1663 escape_essid(target->ssid, 1638 escape_essid(target->ssid,
1664 target->ssid_len), 1639 target->ssid_len),
1665 print_mac(mac, target->bssid)); 1640 target->bssid);
1666 ieee80211_network_reset(target); 1641 ieee80211_network_reset(target);
1667 } else { 1642 } else {
1668 /* Otherwise just pull from the free list */ 1643 /* Otherwise just pull from the free list */
@@ -1672,10 +1647,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1672 } 1647 }
1673 1648
1674#ifdef CONFIG_IEEE80211_DEBUG 1649#ifdef CONFIG_IEEE80211_DEBUG
1675 IEEE80211_DEBUG_SCAN("Adding '%s' (%s) via %s.\n", 1650 IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n",
1676 escape_essid(network.ssid, 1651 escape_essid(network.ssid,
1677 network.ssid_len), 1652 network.ssid_len),
1678 print_mac(mac, network.bssid), 1653 network.bssid,
1679 is_beacon(beacon->header.frame_ctl) ? 1654 is_beacon(beacon->header.frame_ctl) ?
1680 "BEACON" : "PROBE RESPONSE"); 1655 "BEACON" : "PROBE RESPONSE");
1681#endif 1656#endif
@@ -1683,10 +1658,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1683 network.ibss_dfs = NULL; 1658 network.ibss_dfs = NULL;
1684 list_add_tail(&target->list, &ieee->network_list); 1659 list_add_tail(&target->list, &ieee->network_list);
1685 } else { 1660 } else {
1686 IEEE80211_DEBUG_SCAN("Updating '%s' (%s) via %s.\n", 1661 IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n",
1687 escape_essid(target->ssid, 1662 escape_essid(target->ssid,
1688 target->ssid_len), 1663 target->ssid_len),
1689 print_mac(mac, target->bssid), 1664 target->bssid,
1690 is_beacon(beacon->header.frame_ctl) ? 1665 is_beacon(beacon->header.frame_ctl) ?
1691 "BEACON" : "PROBE RESPONSE"); 1666 "BEACON" : "PROBE RESPONSE");
1692 update_network(target, &network); 1667 update_network(target, &network);
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 973832dd7faf..89a81062ab4b 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -264,7 +264,6 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
264 char *ev = extra; 264 char *ev = extra;
265 char *stop = ev + wrqu->data.length; 265 char *stop = ev + wrqu->data.length;
266 int i = 0; 266 int i = 0;
267 DECLARE_MAC_BUF(mac);
268 267
269 IEEE80211_DEBUG_WX("Getting scan\n"); 268 IEEE80211_DEBUG_WX("Getting scan\n");
270 269
@@ -283,10 +282,10 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
283 info); 282 info);
284 else 283 else
285 IEEE80211_DEBUG_SCAN("Not showing network '%s (" 284 IEEE80211_DEBUG_SCAN("Not showing network '%s ("
286 "%s)' due to age (%dms).\n", 285 "%pM)' due to age (%dms).\n",
287 escape_essid(network->ssid, 286 escape_essid(network->ssid,
288 network->ssid_len), 287 network->ssid_len),
289 print_mac(mac, network->bssid), 288 network->bssid,
290 jiffies_to_msecs(jiffies - 289 jiffies_to_msecs(jiffies -
291 network-> 290 network->
292 last_scanned)); 291 last_scanned));
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 2e78f6bd9775..e52799047a5f 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -490,7 +490,6 @@ int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
490 } 490 }
491 491
492 atomic_set(&doi_def->refcount, 1); 492 atomic_set(&doi_def->refcount, 1);
493 INIT_RCU_HEAD(&doi_def->rcu);
494 493
495 spin_lock(&cipso_v4_doi_list_lock); 494 spin_lock(&cipso_v4_doi_list_lock);
496 if (cipso_v4_doi_search(doi_def->doi) != NULL) 495 if (cipso_v4_doi_search(doi_def->doi) != NULL)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 56fce3ab6c55..0bff576d2918 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -112,13 +112,7 @@ static inline void devinet_sysctl_unregister(struct in_device *idev)
112 112
113static struct in_ifaddr *inet_alloc_ifa(void) 113static struct in_ifaddr *inet_alloc_ifa(void)
114{ 114{
115 struct in_ifaddr *ifa = kzalloc(sizeof(*ifa), GFP_KERNEL); 115 return kzalloc(sizeof(struct in_ifaddr), GFP_KERNEL);
116
117 if (ifa) {
118 INIT_RCU_HEAD(&ifa->rcu_head);
119 }
120
121 return ifa;
122} 116}
123 117
124static void inet_rcu_free_ifa(struct rcu_head *head) 118static void inet_rcu_free_ifa(struct rcu_head *head)
@@ -161,7 +155,6 @@ static struct in_device *inetdev_init(struct net_device *dev)
161 in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL); 155 in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL);
162 if (!in_dev) 156 if (!in_dev)
163 goto out; 157 goto out;
164 INIT_RCU_HEAD(&in_dev->rcu_head);
165 memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt, 158 memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt,
166 sizeof(in_dev->cnf)); 159 sizeof(in_dev->cnf));
167 in_dev->cnf.sysctl = NULL; 160 in_dev->cnf.sysctl = NULL;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 72b2de76f1cd..e9d6ea0b49ca 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -976,9 +976,10 @@ int icmp_rcv(struct sk_buff *skb)
976 struct net *net = dev_net(rt->u.dst.dev); 976 struct net *net = dev_net(rt->u.dst.dev);
977 977
978 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { 978 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
979 struct sec_path *sp = skb_sec_path(skb);
979 int nh; 980 int nh;
980 981
981 if (!(skb->sp && skb->sp->xvec[skb->sp->len - 1]->props.flags & 982 if (!(sp && sp->xvec[sp->len - 1]->props.flags &
982 XFRM_STATE_ICMP)) 983 XFRM_STATE_ICMP))
983 goto drop; 984 goto drop;
984 985
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 450016b89a18..df3fe50bbf0d 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -106,7 +106,7 @@ int ip_forward(struct sk_buff *skb)
106 * We now generate an ICMP HOST REDIRECT giving the route 106 * We now generate an ICMP HOST REDIRECT giving the route
107 * we calculated. 107 * we calculated.
108 */ 108 */
109 if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb->sp) 109 if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb))
110 ip_rt_send_redirect(skb); 110 ip_rt_send_redirect(skb);
111 111
112 skb->priority = rt_tos2priority(iph->tos); 112 skb->priority = rt_tos2priority(iph->tos);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 2ea6dcc3e2cc..e59b4dcf6778 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -129,6 +129,7 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ;
129static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; 129static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
130static int ip_rt_min_advmss __read_mostly = 256; 130static int ip_rt_min_advmss __read_mostly = 256;
131static int ip_rt_secret_interval __read_mostly = 10 * 60 * HZ; 131static int ip_rt_secret_interval __read_mostly = 10 * 60 * HZ;
132static int rt_chain_length_max __read_mostly = 20;
132 133
133static void rt_worker_func(struct work_struct *work); 134static void rt_worker_func(struct work_struct *work);
134static DECLARE_DELAYED_WORK(expires_work, rt_worker_func); 135static DECLARE_DELAYED_WORK(expires_work, rt_worker_func);
@@ -145,6 +146,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
145static void ipv4_link_failure(struct sk_buff *skb); 146static void ipv4_link_failure(struct sk_buff *skb);
146static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu); 147static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu);
147static int rt_garbage_collect(struct dst_ops *ops); 148static int rt_garbage_collect(struct dst_ops *ops);
149static void rt_emergency_hash_rebuild(struct net *net);
148 150
149 151
150static struct dst_ops ipv4_dst_ops = { 152static struct dst_ops ipv4_dst_ops = {
@@ -201,6 +203,7 @@ const __u8 ip_tos2prio[16] = {
201struct rt_hash_bucket { 203struct rt_hash_bucket {
202 struct rtable *chain; 204 struct rtable *chain;
203}; 205};
206
204#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) || \ 207#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) || \
205 defined(CONFIG_PROVE_LOCKING) 208 defined(CONFIG_PROVE_LOCKING)
206/* 209/*
@@ -674,6 +677,20 @@ static inline u32 rt_score(struct rtable *rt)
674 return score; 677 return score;
675} 678}
676 679
680static inline bool rt_caching(const struct net *net)
681{
682 return net->ipv4.current_rt_cache_rebuild_count <=
683 net->ipv4.sysctl_rt_cache_rebuild_count;
684}
685
686static inline bool compare_hash_inputs(const struct flowi *fl1,
687 const struct flowi *fl2)
688{
689 return (__force u32)(((fl1->nl_u.ip4_u.daddr ^ fl2->nl_u.ip4_u.daddr) |
690 (fl1->nl_u.ip4_u.saddr ^ fl2->nl_u.ip4_u.saddr) |
691 (fl1->iif ^ fl2->iif)) == 0);
692}
693
677static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) 694static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
678{ 695{
679 return ((__force u32)((fl1->nl_u.ip4_u.daddr ^ fl2->nl_u.ip4_u.daddr) | 696 return ((__force u32)((fl1->nl_u.ip4_u.daddr ^ fl2->nl_u.ip4_u.daddr) |
@@ -753,11 +770,24 @@ static void rt_do_flush(int process_context)
753 } 770 }
754} 771}
755 772
773/*
774 * While freeing expired entries, we compute average chain length
775 * and standard deviation, using fixed-point arithmetic.
776 * This to have an estimation of rt_chain_length_max
777 * rt_chain_length_max = max(elasticity, AVG + 4*SD)
778 * We use 3 bits for frational part, and 29 (or 61) for magnitude.
779 */
780
781#define FRACT_BITS 3
782#define ONE (1UL << FRACT_BITS)
783
756static void rt_check_expire(void) 784static void rt_check_expire(void)
757{ 785{
758 static unsigned int rover; 786 static unsigned int rover;
759 unsigned int i = rover, goal; 787 unsigned int i = rover, goal;
760 struct rtable *rth, **rthp; 788 struct rtable *rth, **rthp;
789 unsigned long length = 0, samples = 0;
790 unsigned long sum = 0, sum2 = 0;
761 u64 mult; 791 u64 mult;
762 792
763 mult = ((u64)ip_rt_gc_interval) << rt_hash_log; 793 mult = ((u64)ip_rt_gc_interval) << rt_hash_log;
@@ -766,6 +796,7 @@ static void rt_check_expire(void)
766 goal = (unsigned int)mult; 796 goal = (unsigned int)mult;
767 if (goal > rt_hash_mask) 797 if (goal > rt_hash_mask)
768 goal = rt_hash_mask + 1; 798 goal = rt_hash_mask + 1;
799 length = 0;
769 for (; goal > 0; goal--) { 800 for (; goal > 0; goal--) {
770 unsigned long tmo = ip_rt_gc_timeout; 801 unsigned long tmo = ip_rt_gc_timeout;
771 802
@@ -775,6 +806,8 @@ static void rt_check_expire(void)
775 if (need_resched()) 806 if (need_resched())
776 cond_resched(); 807 cond_resched();
777 808
809 samples++;
810
778 if (*rthp == NULL) 811 if (*rthp == NULL)
779 continue; 812 continue;
780 spin_lock_bh(rt_hash_lock_addr(i)); 813 spin_lock_bh(rt_hash_lock_addr(i));
@@ -789,11 +822,29 @@ static void rt_check_expire(void)
789 if (time_before_eq(jiffies, rth->u.dst.expires)) { 822 if (time_before_eq(jiffies, rth->u.dst.expires)) {
790 tmo >>= 1; 823 tmo >>= 1;
791 rthp = &rth->u.dst.rt_next; 824 rthp = &rth->u.dst.rt_next;
825 /*
826 * Only bump our length if the hash
827 * inputs on entries n and n+1 are not
828 * the same, we only count entries on
829 * a chain with equal hash inputs once
830 * so that entries for different QOS
831 * levels, and other non-hash input
832 * attributes don't unfairly skew
833 * the length computation
834 */
835 if ((*rthp == NULL) ||
836 !compare_hash_inputs(&(*rthp)->fl,
837 &rth->fl))
838 length += ONE;
792 continue; 839 continue;
793 } 840 }
794 } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) { 841 } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) {
795 tmo >>= 1; 842 tmo >>= 1;
796 rthp = &rth->u.dst.rt_next; 843 rthp = &rth->u.dst.rt_next;
844 if ((*rthp == NULL) ||
845 !compare_hash_inputs(&(*rthp)->fl,
846 &rth->fl))
847 length += ONE;
797 continue; 848 continue;
798 } 849 }
799 850
@@ -802,6 +853,15 @@ static void rt_check_expire(void)
802 rt_free(rth); 853 rt_free(rth);
803 } 854 }
804 spin_unlock_bh(rt_hash_lock_addr(i)); 855 spin_unlock_bh(rt_hash_lock_addr(i));
856 sum += length;
857 sum2 += length*length;
858 }
859 if (samples) {
860 unsigned long avg = sum / samples;
861 unsigned long sd = int_sqrt(sum2 / samples - avg*avg);
862 rt_chain_length_max = max_t(unsigned long,
863 ip_rt_gc_elasticity,
864 (avg + 4*sd) >> FRACT_BITS);
805 } 865 }
806 rover = i; 866 rover = i;
807} 867}
@@ -851,6 +911,26 @@ static void rt_secret_rebuild(unsigned long __net)
851 mod_timer(&net->ipv4.rt_secret_timer, jiffies + ip_rt_secret_interval); 911 mod_timer(&net->ipv4.rt_secret_timer, jiffies + ip_rt_secret_interval);
852} 912}
853 913
914static void rt_secret_rebuild_oneshot(struct net *net)
915{
916 del_timer_sync(&net->ipv4.rt_secret_timer);
917 rt_cache_invalidate(net);
918 if (ip_rt_secret_interval) {
919 net->ipv4.rt_secret_timer.expires += ip_rt_secret_interval;
920 add_timer(&net->ipv4.rt_secret_timer);
921 }
922}
923
924static void rt_emergency_hash_rebuild(struct net *net)
925{
926 if (net_ratelimit()) {
927 printk(KERN_WARNING "Route hash chain too long!\n");
928 printk(KERN_WARNING "Adjust your secret_interval!\n");
929 }
930
931 rt_secret_rebuild_oneshot(net);
932}
933
854/* 934/*
855 Short description of GC goals. 935 Short description of GC goals.
856 936
@@ -989,6 +1069,7 @@ out: return 0;
989static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp) 1069static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
990{ 1070{
991 struct rtable *rth, **rthp; 1071 struct rtable *rth, **rthp;
1072 struct rtable *rthi;
992 unsigned long now; 1073 unsigned long now;
993 struct rtable *cand, **candp; 1074 struct rtable *cand, **candp;
994 u32 min_score; 1075 u32 min_score;
@@ -1002,7 +1083,13 @@ restart:
1002 candp = NULL; 1083 candp = NULL;
1003 now = jiffies; 1084 now = jiffies;
1004 1085
1086 if (!rt_caching(dev_net(rt->u.dst.dev))) {
1087 rt_drop(rt);
1088 return 0;
1089 }
1090
1005 rthp = &rt_hash_table[hash].chain; 1091 rthp = &rt_hash_table[hash].chain;
1092 rthi = NULL;
1006 1093
1007 spin_lock_bh(rt_hash_lock_addr(hash)); 1094 spin_lock_bh(rt_hash_lock_addr(hash));
1008 while ((rth = *rthp) != NULL) { 1095 while ((rth = *rthp) != NULL) {
@@ -1048,6 +1135,17 @@ restart:
1048 chain_length++; 1135 chain_length++;
1049 1136
1050 rthp = &rth->u.dst.rt_next; 1137 rthp = &rth->u.dst.rt_next;
1138
1139 /*
1140 * check to see if the next entry in the chain
1141 * contains the same hash input values as rt. If it does
1142 * This is where we will insert into the list, instead of
1143 * at the head. This groups entries that differ by aspects not
1144 * relvant to the hash function together, which we use to adjust
1145 * our chain length
1146 */
1147 if (*rthp && compare_hash_inputs(&(*rthp)->fl, &rt->fl))
1148 rthi = rth;
1051 } 1149 }
1052 1150
1053 if (cand) { 1151 if (cand) {
@@ -1061,6 +1159,16 @@ restart:
1061 *candp = cand->u.dst.rt_next; 1159 *candp = cand->u.dst.rt_next;
1062 rt_free(cand); 1160 rt_free(cand);
1063 } 1161 }
1162 } else {
1163 if (chain_length > rt_chain_length_max) {
1164 struct net *net = dev_net(rt->u.dst.dev);
1165 int num = ++net->ipv4.current_rt_cache_rebuild_count;
1166 if (!rt_caching(dev_net(rt->u.dst.dev))) {
1167 printk(KERN_WARNING "%s: %d rebuilds is over limit, route caching disabled\n",
1168 rt->u.dst.dev->name, num);
1169 }
1170 rt_emergency_hash_rebuild(dev_net(rt->u.dst.dev));
1171 }
1064 } 1172 }
1065 1173
1066 /* Try to bind route to arp only if it is output 1174 /* Try to bind route to arp only if it is output
@@ -1098,7 +1206,11 @@ restart:
1098 } 1206 }
1099 } 1207 }
1100 1208
1101 rt->u.dst.rt_next = rt_hash_table[hash].chain; 1209 if (rthi)
1210 rt->u.dst.rt_next = rthi->u.dst.rt_next;
1211 else
1212 rt->u.dst.rt_next = rt_hash_table[hash].chain;
1213
1102#if RT_CACHE_DEBUG >= 2 1214#if RT_CACHE_DEBUG >= 2
1103 if (rt->u.dst.rt_next) { 1215 if (rt->u.dst.rt_next) {
1104 struct rtable *trt; 1216 struct rtable *trt;
@@ -1114,7 +1226,11 @@ restart:
1114 * previous writes to rt are comitted to memory 1226 * previous writes to rt are comitted to memory
1115 * before making rt visible to other CPUS. 1227 * before making rt visible to other CPUS.
1116 */ 1228 */
1117 rcu_assign_pointer(rt_hash_table[hash].chain, rt); 1229 if (rthi)
1230 rcu_assign_pointer(rthi->u.dst.rt_next, rt);
1231 else
1232 rcu_assign_pointer(rt_hash_table[hash].chain, rt);
1233
1118 spin_unlock_bh(rt_hash_lock_addr(hash)); 1234 spin_unlock_bh(rt_hash_lock_addr(hash));
1119 *rp = rt; 1235 *rp = rt;
1120 return 0; 1236 return 0;
@@ -1217,6 +1333,9 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1217 || ipv4_is_zeronet(new_gw)) 1333 || ipv4_is_zeronet(new_gw))
1218 goto reject_redirect; 1334 goto reject_redirect;
1219 1335
1336 if (!rt_caching(net))
1337 goto reject_redirect;
1338
1220 if (!IN_DEV_SHARED_MEDIA(in_dev)) { 1339 if (!IN_DEV_SHARED_MEDIA(in_dev)) {
1221 if (!inet_addr_onlink(in_dev, new_gw, old_gw)) 1340 if (!inet_addr_onlink(in_dev, new_gw, old_gw))
1222 goto reject_redirect; 1341 goto reject_redirect;
@@ -1267,7 +1386,6 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1267 1386
1268 /* Copy all the information. */ 1387 /* Copy all the information. */
1269 *rt = *rth; 1388 *rt = *rth;
1270 INIT_RCU_HEAD(&rt->u.dst.rcu_head);
1271 rt->u.dst.__use = 1; 1389 rt->u.dst.__use = 1;
1272 atomic_set(&rt->u.dst.__refcnt, 1); 1390 atomic_set(&rt->u.dst.__refcnt, 1);
1273 rt->u.dst.child = NULL; 1391 rt->u.dst.child = NULL;
@@ -1280,7 +1398,9 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1280 rt->u.dst.path = &rt->u.dst; 1398 rt->u.dst.path = &rt->u.dst;
1281 rt->u.dst.neighbour = NULL; 1399 rt->u.dst.neighbour = NULL;
1282 rt->u.dst.hh = NULL; 1400 rt->u.dst.hh = NULL;
1401#ifdef CONFIG_XFRM
1283 rt->u.dst.xfrm = NULL; 1402 rt->u.dst.xfrm = NULL;
1403#endif
1284 rt->rt_genid = rt_genid(net); 1404 rt->rt_genid = rt_genid(net);
1285 rt->rt_flags |= RTCF_REDIRECTED; 1405 rt->rt_flags |= RTCF_REDIRECTED;
1286 1406
@@ -2130,6 +2250,10 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2130 struct net *net; 2250 struct net *net;
2131 2251
2132 net = dev_net(dev); 2252 net = dev_net(dev);
2253
2254 if (!rt_caching(net))
2255 goto skip_cache;
2256
2133 tos &= IPTOS_RT_MASK; 2257 tos &= IPTOS_RT_MASK;
2134 hash = rt_hash(daddr, saddr, iif, rt_genid(net)); 2258 hash = rt_hash(daddr, saddr, iif, rt_genid(net));
2135 2259
@@ -2154,6 +2278,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2154 } 2278 }
2155 rcu_read_unlock(); 2279 rcu_read_unlock();
2156 2280
2281skip_cache:
2157 /* Multicast recognition logic is moved from route cache to here. 2282 /* Multicast recognition logic is moved from route cache to here.
2158 The problem was that too many Ethernet cards have broken/missing 2283 The problem was that too many Ethernet cards have broken/missing
2159 hardware multicast filters :-( As result the host on multicasting 2284 hardware multicast filters :-( As result the host on multicasting
@@ -2539,6 +2664,9 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
2539 unsigned hash; 2664 unsigned hash;
2540 struct rtable *rth; 2665 struct rtable *rth;
2541 2666
2667 if (!rt_caching(net))
2668 goto slow_output;
2669
2542 hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net)); 2670 hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net));
2543 2671
2544 rcu_read_lock_bh(); 2672 rcu_read_lock_bh();
@@ -2563,6 +2691,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
2563 } 2691 }
2564 rcu_read_unlock_bh(); 2692 rcu_read_unlock_bh();
2565 2693
2694slow_output:
2566 return ip_route_output_slow(net, rp, flp); 2695 return ip_route_output_slow(net, rp, flp);
2567} 2696}
2568 2697
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 1bb10df8ce7d..0cc8d31f9ac0 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -795,6 +795,14 @@ static struct ctl_table ipv4_net_table[] = {
795 .mode = 0644, 795 .mode = 0644,
796 .proc_handler = &proc_dointvec 796 .proc_handler = &proc_dointvec
797 }, 797 },
798 {
799 .ctl_name = CTL_UNNUMBERED,
800 .procname = "rt_cache_rebuild_count",
801 .data = &init_net.ipv4.sysctl_rt_cache_rebuild_count,
802 .maxlen = sizeof(int),
803 .mode = 0644,
804 .proc_handler = &proc_dointvec
805 },
798 { } 806 { }
799}; 807};
800 808
@@ -827,8 +835,12 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
827 &net->ipv4.sysctl_icmp_ratelimit; 835 &net->ipv4.sysctl_icmp_ratelimit;
828 table[5].data = 836 table[5].data =
829 &net->ipv4.sysctl_icmp_ratemask; 837 &net->ipv4.sysctl_icmp_ratemask;
838 table[6].data =
839 &net->ipv4.sysctl_rt_cache_rebuild_count;
830 } 840 }
831 841
842 net->ipv4.sysctl_rt_cache_rebuild_count = 4;
843
832 net->ipv4.ipv4_hdr = register_net_sysctl_table(net, 844 net->ipv4.ipv4_hdr = register_net_sysctl_table(net,
833 net_ipv4_ctl_path, table); 845 net_ipv4_ctl_path, table);
834 if (net->ipv4.ipv4_hdr == NULL) 846 if (net->ipv4.ipv4_hdr == NULL)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index d77c0d29e239..04909e4b3c4c 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2346,9 +2346,9 @@ static void DBGUNDO(struct sock *sk, const char *msg)
2346#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 2346#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
2347 else if (sk->sk_family == AF_INET6) { 2347 else if (sk->sk_family == AF_INET6) {
2348 struct ipv6_pinfo *np = inet6_sk(sk); 2348 struct ipv6_pinfo *np = inet6_sk(sk);
2349 printk(KERN_DEBUG "Undo %s " NIP6_FMT "/%u c%u l%u ss%u/%u p%u\n", 2349 printk(KERN_DEBUG "Undo %s %pI6/%u c%u l%u ss%u/%u p%u\n",
2350 msg, 2350 msg,
2351 NIP6(np->daddr), ntohs(inet->dport), 2351 &np->daddr, ntohs(inet->dport),
2352 tp->snd_cwnd, tcp_left_out(tp), 2352 tp->snd_cwnd, tcp_left_out(tp),
2353 tp->snd_ssthresh, tp->prior_ssthresh, 2353 tp->snd_ssthresh, tp->prior_ssthresh,
2354 tp->packets_out); 2354 tp->packets_out);
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 6b6dff1164b9..979c9d604eb0 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -306,8 +306,8 @@ static void tcp_retransmit_timer(struct sock *sk)
306#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 306#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
307 else if (sk->sk_family == AF_INET6) { 307 else if (sk->sk_family == AF_INET6) {
308 struct ipv6_pinfo *np = inet6_sk(sk); 308 struct ipv6_pinfo *np = inet6_sk(sk);
309 LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer " NIP6_FMT ":%u/%u shrinks window %u:%u. Repaired.\n", 309 LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer %pI6:%u/%u shrinks window %u:%u. Repaired.\n",
310 NIP6(np->daddr), ntohs(inet->dport), 310 &np->daddr, ntohs(inet->dport),
311 inet->num, tp->snd_una, tp->snd_nxt); 311 inet->num, tp->snd_una, tp->snd_nxt);
312 } 312 }
313#endif 313#endif
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2095abc3caba..f760b86e7530 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -81,6 +81,8 @@
81#include <asm/uaccess.h> 81#include <asm/uaccess.h>
82#include <asm/ioctls.h> 82#include <asm/ioctls.h>
83#include <linux/bootmem.h> 83#include <linux/bootmem.h>
84#include <linux/highmem.h>
85#include <linux/swap.h>
84#include <linux/types.h> 86#include <linux/types.h>
85#include <linux/fcntl.h> 87#include <linux/fcntl.h>
86#include <linux/module.h> 88#include <linux/module.h>
@@ -104,12 +106,8 @@
104#include <net/xfrm.h> 106#include <net/xfrm.h>
105#include "udp_impl.h" 107#include "udp_impl.h"
106 108
107/* 109struct udp_table udp_table;
108 * Snmp MIB for the UDP layer 110EXPORT_SYMBOL(udp_table);
109 */
110
111struct hlist_head udp_hash[UDP_HTABLE_SIZE];
112DEFINE_RWLOCK(udp_hash_lock);
113 111
114int sysctl_udp_mem[3] __read_mostly; 112int sysctl_udp_mem[3] __read_mostly;
115int sysctl_udp_rmem_min __read_mostly; 113int sysctl_udp_rmem_min __read_mostly;
@@ -123,7 +121,7 @@ atomic_t udp_memory_allocated;
123EXPORT_SYMBOL(udp_memory_allocated); 121EXPORT_SYMBOL(udp_memory_allocated);
124 122
125static int udp_lib_lport_inuse(struct net *net, __u16 num, 123static int udp_lib_lport_inuse(struct net *net, __u16 num,
126 const struct hlist_head udptable[], 124 const struct udp_hslot *hslot,
127 struct sock *sk, 125 struct sock *sk,
128 int (*saddr_comp)(const struct sock *sk1, 126 int (*saddr_comp)(const struct sock *sk1,
129 const struct sock *sk2)) 127 const struct sock *sk2))
@@ -131,7 +129,7 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
131 struct sock *sk2; 129 struct sock *sk2;
132 struct hlist_node *node; 130 struct hlist_node *node;
133 131
134 sk_for_each(sk2, node, &udptable[udp_hashfn(net, num)]) 132 sk_for_each(sk2, node, &hslot->head)
135 if (net_eq(sock_net(sk2), net) && 133 if (net_eq(sock_net(sk2), net) &&
136 sk2 != sk && 134 sk2 != sk &&
137 sk2->sk_hash == num && 135 sk2->sk_hash == num &&
@@ -154,12 +152,11 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
154 int (*saddr_comp)(const struct sock *sk1, 152 int (*saddr_comp)(const struct sock *sk1,
155 const struct sock *sk2 ) ) 153 const struct sock *sk2 ) )
156{ 154{
157 struct hlist_head *udptable = sk->sk_prot->h.udp_hash; 155 struct udp_hslot *hslot;
156 struct udp_table *udptable = sk->sk_prot->h.udp_table;
158 int error = 1; 157 int error = 1;
159 struct net *net = sock_net(sk); 158 struct net *net = sock_net(sk);
160 159
161 write_lock_bh(&udp_hash_lock);
162
163 if (!snum) { 160 if (!snum) {
164 int low, high, remaining; 161 int low, high, remaining;
165 unsigned rand; 162 unsigned rand;
@@ -171,26 +168,34 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
171 rand = net_random(); 168 rand = net_random();
172 snum = first = rand % remaining + low; 169 snum = first = rand % remaining + low;
173 rand |= 1; 170 rand |= 1;
174 while (udp_lib_lport_inuse(net, snum, udptable, sk, 171 for (;;) {
175 saddr_comp)) { 172 hslot = &udptable->hash[udp_hashfn(net, snum)];
173 spin_lock_bh(&hslot->lock);
174 if (!udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
175 break;
176 spin_unlock_bh(&hslot->lock);
176 do { 177 do {
177 snum = snum + rand; 178 snum = snum + rand;
178 } while (snum < low || snum > high); 179 } while (snum < low || snum > high);
179 if (snum == first) 180 if (snum == first)
180 goto fail; 181 goto fail;
181 } 182 }
182 } else if (udp_lib_lport_inuse(net, snum, udptable, sk, saddr_comp)) 183 } else {
183 goto fail; 184 hslot = &udptable->hash[udp_hashfn(net, snum)];
184 185 spin_lock_bh(&hslot->lock);
186 if (udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
187 goto fail_unlock;
188 }
185 inet_sk(sk)->num = snum; 189 inet_sk(sk)->num = snum;
186 sk->sk_hash = snum; 190 sk->sk_hash = snum;
187 if (sk_unhashed(sk)) { 191 if (sk_unhashed(sk)) {
188 sk_add_node(sk, &udptable[udp_hashfn(net, snum)]); 192 sk_add_node_rcu(sk, &hslot->head);
189 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); 193 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
190 } 194 }
191 error = 0; 195 error = 0;
196fail_unlock:
197 spin_unlock_bh(&hslot->lock);
192fail: 198fail:
193 write_unlock_bh(&udp_hash_lock);
194 return error; 199 return error;
195} 200}
196 201
@@ -208,63 +213,89 @@ int udp_v4_get_port(struct sock *sk, unsigned short snum)
208 return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal); 213 return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal);
209} 214}
210 215
216static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr,
217 unsigned short hnum,
218 __be16 sport, __be32 daddr, __be16 dport, int dif)
219{
220 int score = -1;
221
222 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
223 !ipv6_only_sock(sk)) {
224 struct inet_sock *inet = inet_sk(sk);
225
226 score = (sk->sk_family == PF_INET ? 1 : 0);
227 if (inet->rcv_saddr) {
228 if (inet->rcv_saddr != daddr)
229 return -1;
230 score += 2;
231 }
232 if (inet->daddr) {
233 if (inet->daddr != saddr)
234 return -1;
235 score += 2;
236 }
237 if (inet->dport) {
238 if (inet->dport != sport)
239 return -1;
240 score += 2;
241 }
242 if (sk->sk_bound_dev_if) {
243 if (sk->sk_bound_dev_if != dif)
244 return -1;
245 score += 2;
246 }
247 }
248 return score;
249}
250
211/* UDP is nearly always wildcards out the wazoo, it makes no sense to try 251/* UDP is nearly always wildcards out the wazoo, it makes no sense to try
212 * harder than this. -DaveM 252 * harder than this. -DaveM
213 */ 253 */
214static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, 254static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
215 __be16 sport, __be32 daddr, __be16 dport, 255 __be16 sport, __be32 daddr, __be16 dport,
216 int dif, struct hlist_head udptable[]) 256 int dif, struct udp_table *udptable)
217{ 257{
218 struct sock *sk, *result = NULL; 258 struct sock *sk, *result;
219 struct hlist_node *node; 259 struct hlist_node *node, *next;
220 unsigned short hnum = ntohs(dport); 260 unsigned short hnum = ntohs(dport);
221 int badness = -1; 261 unsigned int hash = udp_hashfn(net, hnum);
222 262 struct udp_hslot *hslot = &udptable->hash[hash];
223 read_lock(&udp_hash_lock); 263 int score, badness;
224 sk_for_each(sk, node, &udptable[udp_hashfn(net, hnum)]) { 264
225 struct inet_sock *inet = inet_sk(sk); 265 rcu_read_lock();
226 266begin:
227 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && 267 result = NULL;
228 !ipv6_only_sock(sk)) { 268 badness = -1;
229 int score = (sk->sk_family == PF_INET ? 1 : 0); 269 sk_for_each_rcu_safenext(sk, node, &hslot->head, next) {
230 if (inet->rcv_saddr) { 270 /*
231 if (inet->rcv_saddr != daddr) 271 * lockless reader, and SLAB_DESTROY_BY_RCU items:
232 continue; 272 * We must check this item was not moved to another chain
233 score+=2; 273 */
234 } 274 if (udp_hashfn(net, sk->sk_hash) != hash)
235 if (inet->daddr) { 275 goto begin;
236 if (inet->daddr != saddr) 276 score = compute_score(sk, net, saddr, hnum, sport,
237 continue; 277 daddr, dport, dif);
238 score+=2; 278 if (score > badness) {
239 } 279 result = sk;
240 if (inet->dport) { 280 badness = score;
241 if (inet->dport != sport)
242 continue;
243 score+=2;
244 }
245 if (sk->sk_bound_dev_if) {
246 if (sk->sk_bound_dev_if != dif)
247 continue;
248 score+=2;
249 }
250 if (score == 9) {
251 result = sk;
252 break;
253 } else if (score > badness) {
254 result = sk;
255 badness = score;
256 }
257 } 281 }
258 } 282 }
259 if (result) 283 if (result) {
260 sock_hold(result); 284 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
261 read_unlock(&udp_hash_lock); 285 result = NULL;
286 else if (unlikely(compute_score(result, net, saddr, hnum, sport,
287 daddr, dport, dif) < badness)) {
288 sock_put(result);
289 goto begin;
290 }
291 }
292 rcu_read_unlock();
262 return result; 293 return result;
263} 294}
264 295
265static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, 296static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
266 __be16 sport, __be16 dport, 297 __be16 sport, __be16 dport,
267 struct hlist_head udptable[]) 298 struct udp_table *udptable)
268{ 299{
269 struct sock *sk; 300 struct sock *sk;
270 const struct iphdr *iph = ip_hdr(skb); 301 const struct iphdr *iph = ip_hdr(skb);
@@ -280,7 +311,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
280struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 311struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
281 __be32 daddr, __be16 dport, int dif) 312 __be32 daddr, __be16 dport, int dif)
282{ 313{
283 return __udp4_lib_lookup(net, saddr, sport, daddr, dport, dif, udp_hash); 314 return __udp4_lib_lookup(net, saddr, sport, daddr, dport, dif, &udp_table);
284} 315}
285EXPORT_SYMBOL_GPL(udp4_lib_lookup); 316EXPORT_SYMBOL_GPL(udp4_lib_lookup);
286 317
@@ -323,7 +354,7 @@ found:
323 * to find the appropriate port. 354 * to find the appropriate port.
324 */ 355 */
325 356
326void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[]) 357void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable)
327{ 358{
328 struct inet_sock *inet; 359 struct inet_sock *inet;
329 struct iphdr *iph = (struct iphdr*)skb->data; 360 struct iphdr *iph = (struct iphdr*)skb->data;
@@ -392,7 +423,7 @@ out:
392 423
393void udp_err(struct sk_buff *skb, u32 info) 424void udp_err(struct sk_buff *skb, u32 info)
394{ 425{
395 __udp4_lib_err(skb, info, udp_hash); 426 __udp4_lib_err(skb, info, &udp_table);
396} 427}
397 428
398/* 429/*
@@ -933,6 +964,21 @@ int udp_disconnect(struct sock *sk, int flags)
933 return 0; 964 return 0;
934} 965}
935 966
967void udp_lib_unhash(struct sock *sk)
968{
969 struct udp_table *udptable = sk->sk_prot->h.udp_table;
970 unsigned int hash = udp_hashfn(sock_net(sk), sk->sk_hash);
971 struct udp_hslot *hslot = &udptable->hash[hash];
972
973 spin_lock_bh(&hslot->lock);
974 if (sk_del_node_init_rcu(sk)) {
975 inet_sk(sk)->num = 0;
976 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
977 }
978 spin_unlock_bh(&hslot->lock);
979}
980EXPORT_SYMBOL(udp_lib_unhash);
981
936static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) 982static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
937{ 983{
938 int is_udplite = IS_UDPLITE(sk); 984 int is_udplite = IS_UDPLITE(sk);
@@ -1071,13 +1117,14 @@ drop:
1071static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, 1117static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1072 struct udphdr *uh, 1118 struct udphdr *uh,
1073 __be32 saddr, __be32 daddr, 1119 __be32 saddr, __be32 daddr,
1074 struct hlist_head udptable[]) 1120 struct udp_table *udptable)
1075{ 1121{
1076 struct sock *sk; 1122 struct sock *sk;
1123 struct udp_hslot *hslot = &udptable->hash[udp_hashfn(net, ntohs(uh->dest))];
1077 int dif; 1124 int dif;
1078 1125
1079 read_lock(&udp_hash_lock); 1126 spin_lock(&hslot->lock);
1080 sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); 1127 sk = sk_head(&hslot->head);
1081 dif = skb->dev->ifindex; 1128 dif = skb->dev->ifindex;
1082 sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); 1129 sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
1083 if (sk) { 1130 if (sk) {
@@ -1102,7 +1149,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1102 } while (sknext); 1149 } while (sknext);
1103 } else 1150 } else
1104 kfree_skb(skb); 1151 kfree_skb(skb);
1105 read_unlock(&udp_hash_lock); 1152 spin_unlock(&hslot->lock);
1106 return 0; 1153 return 0;
1107} 1154}
1108 1155
@@ -1148,7 +1195,7 @@ static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh,
1148 * All we need to do is get the socket, and then do a checksum. 1195 * All we need to do is get the socket, and then do a checksum.
1149 */ 1196 */
1150 1197
1151int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], 1198int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1152 int proto) 1199 int proto)
1153{ 1200{
1154 struct sock *sk; 1201 struct sock *sk;
@@ -1246,7 +1293,7 @@ drop:
1246 1293
1247int udp_rcv(struct sk_buff *skb) 1294int udp_rcv(struct sk_buff *skb)
1248{ 1295{
1249 return __udp4_lib_rcv(skb, udp_hash, IPPROTO_UDP); 1296 return __udp4_lib_rcv(skb, &udp_table, IPPROTO_UDP);
1250} 1297}
1251 1298
1252void udp_destroy_sock(struct sock *sk) 1299void udp_destroy_sock(struct sock *sk)
@@ -1488,7 +1535,8 @@ struct proto udp_prot = {
1488 .sysctl_wmem = &sysctl_udp_wmem_min, 1535 .sysctl_wmem = &sysctl_udp_wmem_min,
1489 .sysctl_rmem = &sysctl_udp_rmem_min, 1536 .sysctl_rmem = &sysctl_udp_rmem_min,
1490 .obj_size = sizeof(struct udp_sock), 1537 .obj_size = sizeof(struct udp_sock),
1491 .h.udp_hash = udp_hash, 1538 .slab_flags = SLAB_DESTROY_BY_RCU,
1539 .h.udp_table = &udp_table,
1492#ifdef CONFIG_COMPAT 1540#ifdef CONFIG_COMPAT
1493 .compat_setsockopt = compat_udp_setsockopt, 1541 .compat_setsockopt = compat_udp_setsockopt,
1494 .compat_getsockopt = compat_udp_getsockopt, 1542 .compat_getsockopt = compat_udp_getsockopt,
@@ -1498,20 +1546,23 @@ struct proto udp_prot = {
1498/* ------------------------------------------------------------------------ */ 1546/* ------------------------------------------------------------------------ */
1499#ifdef CONFIG_PROC_FS 1547#ifdef CONFIG_PROC_FS
1500 1548
1501static struct sock *udp_get_first(struct seq_file *seq) 1549static struct sock *udp_get_first(struct seq_file *seq, int start)
1502{ 1550{
1503 struct sock *sk; 1551 struct sock *sk;
1504 struct udp_iter_state *state = seq->private; 1552 struct udp_iter_state *state = seq->private;
1505 struct net *net = seq_file_net(seq); 1553 struct net *net = seq_file_net(seq);
1506 1554
1507 for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { 1555 for (state->bucket = start; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
1508 struct hlist_node *node; 1556 struct hlist_node *node;
1509 sk_for_each(sk, node, state->hashtable + state->bucket) { 1557 struct udp_hslot *hslot = &state->udp_table->hash[state->bucket];
1558 spin_lock_bh(&hslot->lock);
1559 sk_for_each(sk, node, &hslot->head) {
1510 if (!net_eq(sock_net(sk), net)) 1560 if (!net_eq(sock_net(sk), net))
1511 continue; 1561 continue;
1512 if (sk->sk_family == state->family) 1562 if (sk->sk_family == state->family)
1513 goto found; 1563 goto found;
1514 } 1564 }
1565 spin_unlock_bh(&hslot->lock);
1515 } 1566 }
1516 sk = NULL; 1567 sk = NULL;
1517found: 1568found:
@@ -1525,20 +1576,18 @@ static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
1525 1576
1526 do { 1577 do {
1527 sk = sk_next(sk); 1578 sk = sk_next(sk);
1528try_again:
1529 ;
1530 } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family)); 1579 } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
1531 1580
1532 if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { 1581 if (!sk) {
1533 sk = sk_head(state->hashtable + state->bucket); 1582 spin_unlock_bh(&state->udp_table->hash[state->bucket].lock);
1534 goto try_again; 1583 return udp_get_first(seq, state->bucket + 1);
1535 } 1584 }
1536 return sk; 1585 return sk;
1537} 1586}
1538 1587
1539static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) 1588static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
1540{ 1589{
1541 struct sock *sk = udp_get_first(seq); 1590 struct sock *sk = udp_get_first(seq, 0);
1542 1591
1543 if (sk) 1592 if (sk)
1544 while (pos && (sk = udp_get_next(seq, sk)) != NULL) 1593 while (pos && (sk = udp_get_next(seq, sk)) != NULL)
@@ -1547,9 +1596,7 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
1547} 1596}
1548 1597
1549static void *udp_seq_start(struct seq_file *seq, loff_t *pos) 1598static void *udp_seq_start(struct seq_file *seq, loff_t *pos)
1550 __acquires(udp_hash_lock)
1551{ 1599{
1552 read_lock(&udp_hash_lock);
1553 return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN; 1600 return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN;
1554} 1601}
1555 1602
@@ -1567,9 +1614,11 @@ static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1567} 1614}
1568 1615
1569static void udp_seq_stop(struct seq_file *seq, void *v) 1616static void udp_seq_stop(struct seq_file *seq, void *v)
1570 __releases(udp_hash_lock)
1571{ 1617{
1572 read_unlock(&udp_hash_lock); 1618 struct udp_iter_state *state = seq->private;
1619
1620 if (state->bucket < UDP_HTABLE_SIZE)
1621 spin_unlock_bh(&state->udp_table->hash[state->bucket].lock);
1573} 1622}
1574 1623
1575static int udp_seq_open(struct inode *inode, struct file *file) 1624static int udp_seq_open(struct inode *inode, struct file *file)
@@ -1585,7 +1634,7 @@ static int udp_seq_open(struct inode *inode, struct file *file)
1585 1634
1586 s = ((struct seq_file *)file->private_data)->private; 1635 s = ((struct seq_file *)file->private_data)->private;
1587 s->family = afinfo->family; 1636 s->family = afinfo->family;
1588 s->hashtable = afinfo->hashtable; 1637 s->udp_table = afinfo->udp_table;
1589 return err; 1638 return err;
1590} 1639}
1591 1640
@@ -1657,7 +1706,7 @@ int udp4_seq_show(struct seq_file *seq, void *v)
1657static struct udp_seq_afinfo udp4_seq_afinfo = { 1706static struct udp_seq_afinfo udp4_seq_afinfo = {
1658 .name = "udp", 1707 .name = "udp",
1659 .family = AF_INET, 1708 .family = AF_INET,
1660 .hashtable = udp_hash, 1709 .udp_table = &udp_table,
1661 .seq_fops = { 1710 .seq_fops = {
1662 .owner = THIS_MODULE, 1711 .owner = THIS_MODULE,
1663 }, 1712 },
@@ -1692,16 +1741,28 @@ void udp4_proc_exit(void)
1692} 1741}
1693#endif /* CONFIG_PROC_FS */ 1742#endif /* CONFIG_PROC_FS */
1694 1743
1744void __init udp_table_init(struct udp_table *table)
1745{
1746 int i;
1747
1748 for (i = 0; i < UDP_HTABLE_SIZE; i++) {
1749 INIT_HLIST_HEAD(&table->hash[i].head);
1750 spin_lock_init(&table->hash[i].lock);
1751 }
1752}
1753
1695void __init udp_init(void) 1754void __init udp_init(void)
1696{ 1755{
1697 unsigned long limit; 1756 unsigned long nr_pages, limit;
1698 1757
1758 udp_table_init(&udp_table);
1699 /* Set the pressure threshold up by the same strategy of TCP. It is a 1759 /* Set the pressure threshold up by the same strategy of TCP. It is a
1700 * fraction of global memory that is up to 1/2 at 256 MB, decreasing 1760 * fraction of global memory that is up to 1/2 at 256 MB, decreasing
1701 * toward zero with the amount of memory, with a floor of 128 pages. 1761 * toward zero with the amount of memory, with a floor of 128 pages.
1702 */ 1762 */
1703 limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); 1763 nr_pages = totalram_pages - totalhigh_pages;
1704 limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); 1764 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
1765 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
1705 limit = max(limit, 128UL); 1766 limit = max(limit, 128UL);
1706 sysctl_udp_mem[0] = limit / 4 * 3; 1767 sysctl_udp_mem[0] = limit / 4 * 3;
1707 sysctl_udp_mem[1] = limit; 1768 sysctl_udp_mem[1] = limit;
@@ -1712,8 +1773,6 @@ void __init udp_init(void)
1712} 1773}
1713 1774
1714EXPORT_SYMBOL(udp_disconnect); 1775EXPORT_SYMBOL(udp_disconnect);
1715EXPORT_SYMBOL(udp_hash);
1716EXPORT_SYMBOL(udp_hash_lock);
1717EXPORT_SYMBOL(udp_ioctl); 1776EXPORT_SYMBOL(udp_ioctl);
1718EXPORT_SYMBOL(udp_prot); 1777EXPORT_SYMBOL(udp_prot);
1719EXPORT_SYMBOL(udp_sendmsg); 1778EXPORT_SYMBOL(udp_sendmsg);
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h
index 2e9bad2fa1bc..9f4a6165f722 100644
--- a/net/ipv4/udp_impl.h
+++ b/net/ipv4/udp_impl.h
@@ -5,8 +5,8 @@
5#include <net/protocol.h> 5#include <net/protocol.h>
6#include <net/inet_common.h> 6#include <net/inet_common.h>
7 7
8extern int __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int ); 8extern int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int );
9extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []); 9extern void __udp4_lib_err(struct sk_buff *, u32, struct udp_table *);
10 10
11extern int udp_v4_get_port(struct sock *sk, unsigned short snum); 11extern int udp_v4_get_port(struct sock *sk, unsigned short snum);
12 12
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 3c807964da96..c784891cb7e5 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -12,16 +12,17 @@
12 */ 12 */
13#include "udp_impl.h" 13#include "udp_impl.h"
14 14
15struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; 15struct udp_table udplite_table;
16EXPORT_SYMBOL(udplite_table);
16 17
17static int udplite_rcv(struct sk_buff *skb) 18static int udplite_rcv(struct sk_buff *skb)
18{ 19{
19 return __udp4_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); 20 return __udp4_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE);
20} 21}
21 22
22static void udplite_err(struct sk_buff *skb, u32 info) 23static void udplite_err(struct sk_buff *skb, u32 info)
23{ 24{
24 __udp4_lib_err(skb, info, udplite_hash); 25 __udp4_lib_err(skb, info, &udplite_table);
25} 26}
26 27
27static struct net_protocol udplite_protocol = { 28static struct net_protocol udplite_protocol = {
@@ -50,7 +51,8 @@ struct proto udplite_prot = {
50 .unhash = udp_lib_unhash, 51 .unhash = udp_lib_unhash,
51 .get_port = udp_v4_get_port, 52 .get_port = udp_v4_get_port,
52 .obj_size = sizeof(struct udp_sock), 53 .obj_size = sizeof(struct udp_sock),
53 .h.udp_hash = udplite_hash, 54 .slab_flags = SLAB_DESTROY_BY_RCU,
55 .h.udp_table = &udplite_table,
54#ifdef CONFIG_COMPAT 56#ifdef CONFIG_COMPAT
55 .compat_setsockopt = compat_udp_setsockopt, 57 .compat_setsockopt = compat_udp_setsockopt,
56 .compat_getsockopt = compat_udp_getsockopt, 58 .compat_getsockopt = compat_udp_getsockopt,
@@ -71,7 +73,7 @@ static struct inet_protosw udplite4_protosw = {
71static struct udp_seq_afinfo udplite4_seq_afinfo = { 73static struct udp_seq_afinfo udplite4_seq_afinfo = {
72 .name = "udplite", 74 .name = "udplite",
73 .family = AF_INET, 75 .family = AF_INET,
74 .hashtable = udplite_hash, 76 .udp_table = &udplite_table,
75 .seq_fops = { 77 .seq_fops = {
76 .owner = THIS_MODULE, 78 .owner = THIS_MODULE,
77 }, 79 },
@@ -108,6 +110,7 @@ static inline int udplite4_proc_init(void)
108 110
109void __init udplite4_register(void) 111void __init udplite4_register(void)
110{ 112{
113 udp_table_init(&udplite_table);
111 if (proto_register(&udplite_prot, 1)) 114 if (proto_register(&udplite_prot, 1))
112 goto out_register_err; 115 goto out_register_err;
113 116
@@ -126,5 +129,4 @@ out_register_err:
126 printk(KERN_CRIT "%s: Cannot add UDP-Lite protocol.\n", __func__); 129 printk(KERN_CRIT "%s: Cannot add UDP-Lite protocol.\n", __func__);
127} 130}
128 131
129EXPORT_SYMBOL(udplite_hash);
130EXPORT_SYMBOL(udplite_prot); 132EXPORT_SYMBOL(udplite_prot);
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 },
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c
index 6be1ec26b30c..42f7d960d055 100644
--- a/net/irda/irlan/irlan_client.c
+++ b/net/irda/irlan/irlan_client.c
@@ -436,7 +436,6 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
436 __u16 tmp_cpu; /* Temporary value in host order */ 436 __u16 tmp_cpu; /* Temporary value in host order */
437 __u8 *bytes; 437 __u8 *bytes;
438 int i; 438 int i;
439 DECLARE_MAC_BUF(mac);
440 439
441 IRDA_DEBUG(4, "%s(), parm=%s\n", __func__ , param); 440 IRDA_DEBUG(4, "%s(), parm=%s\n", __func__ , param);
442 441
@@ -521,8 +520,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
521 /* FILTER_ENTRY, have we got an ethernet address? */ 520 /* FILTER_ENTRY, have we got an ethernet address? */
522 if (strcmp(param, "FILTER_ENTRY") == 0) { 521 if (strcmp(param, "FILTER_ENTRY") == 0) {
523 bytes = value; 522 bytes = value;
524 IRDA_DEBUG(4, "Ethernet address = %s\n", 523 IRDA_DEBUG(4, "Ethernet address = %pM\n", bytes);
525 print_mac(mac, bytes));
526 for (i = 0; i < 6; i++) 524 for (i = 0; i < 6; i++)
527 self->dev->dev_addr[i] = bytes[i]; 525 self->dev->dev_addr[i] = bytes[i];
528 } 526 }
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 48212c0a961c..b58bd7c6cdf8 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -27,8 +27,7 @@
27 27
28static void llc_ui_format_mac(struct seq_file *seq, u8 *addr) 28static void llc_ui_format_mac(struct seq_file *seq, u8 *addr)
29{ 29{
30 DECLARE_MAC_BUF(mac); 30 seq_printf(seq, "%pM", addr);
31 seq_printf(seq, "%s", print_mac(mac, addr));
32} 31}
33 32
34static struct sock *llc_get_sk_idx(loff_t pos) 33static struct sock *llc_get_sk_idx(loff_t pos)
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index a3294d109322..6424ac565ae0 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -188,7 +188,6 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
188 { 188 {
189 static int keycount; 189 static int keycount;
190 char buf[50]; 190 char buf[50];
191 DECLARE_MAC_BUF(mac);
192 struct sta_info *sta; 191 struct sta_info *sta;
193 192
194 if (!key->local->debugfs.keys) 193 if (!key->local->debugfs.keys)
@@ -206,8 +205,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
206 rcu_read_lock(); 205 rcu_read_lock();
207 sta = rcu_dereference(key->sta); 206 sta = rcu_dereference(key->sta);
208 if (sta) 207 if (sta)
209 sprintf(buf, "../../stations/%s", 208 sprintf(buf, "../../stations/%pM", sta->sta.addr);
210 print_mac(mac, sta->sta.addr));
211 rcu_read_unlock(); 209 rcu_read_unlock();
212 210
213 /* using sta as a boolean is fine outside RCU lock */ 211 /* using sta as a boolean is fine outside RCU lock */
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 2ad504fc3414..69b2fbf35145 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -104,8 +104,7 @@ static ssize_t ieee80211_if_fmt_##name( \
104 const struct ieee80211_sub_if_data *sdata, char *buf, \ 104 const struct ieee80211_sub_if_data *sdata, char *buf, \
105 int buflen) \ 105 int buflen) \
106{ \ 106{ \
107 DECLARE_MAC_BUF(mac); \ 107 return scnprintf(buf, buflen, "%pM\n", sdata->field); \
108 return scnprintf(buf, buflen, "%s\n", print_mac(mac, sdata->field));\
109} 108}
110 109
111#define __IEEE80211_IF_FILE(name) \ 110#define __IEEE80211_IF_FILE(name) \
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 189d0bafa91a..21e8b1c4f64e 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -246,15 +246,14 @@ STA_OPS_WR(agg_status);
246void ieee80211_sta_debugfs_add(struct sta_info *sta) 246void ieee80211_sta_debugfs_add(struct sta_info *sta)
247{ 247{
248 struct dentry *stations_dir = sta->local->debugfs.stations; 248 struct dentry *stations_dir = sta->local->debugfs.stations;
249 DECLARE_MAC_BUF(mbuf); 249 u8 mac[3*ETH_ALEN];
250 u8 *mac;
251 250
252 sta->debugfs.add_has_run = true; 251 sta->debugfs.add_has_run = true;
253 252
254 if (!stations_dir) 253 if (!stations_dir)
255 return; 254 return;
256 255
257 mac = print_mac(mbuf, sta->sta.addr); 256 snprintf(mac, sizeof(mac), "%pM", sta->sta.addr);
258 257
259 /* 258 /*
260 * This might fail due to a race condition: 259 * This might fail due to a race condition:
diff --git a/net/mac80211/event.c b/net/mac80211/event.c
index 8de60de70bc9..0d95561c0ee0 100644
--- a/net/mac80211/event.c
+++ b/net/mac80211/event.c
@@ -21,14 +21,13 @@ void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int ke
21{ 21{
22 union iwreq_data wrqu; 22 union iwreq_data wrqu;
23 char *buf = kmalloc(128, GFP_ATOMIC); 23 char *buf = kmalloc(128, GFP_ATOMIC);
24 DECLARE_MAC_BUF(mac);
25 24
26 if (buf) { 25 if (buf) {
27 /* TODO: needed parameters: count, key type, TSC */ 26 /* TODO: needed parameters: count, key type, TSC */
28 sprintf(buf, "MLME-MICHAELMICFAILURE.indication(" 27 sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
29 "keyid=%d %scast addr=%s)", 28 "keyid=%d %scast addr=%pM)",
30 keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", 29 keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni",
31 print_mac(mac, hdr->addr2)); 30 hdr->addr2);
32 memset(&wrqu, 0, sizeof(wrqu)); 31 memset(&wrqu, 0, sizeof(wrqu));
33 wrqu.data.length = strlen(buf); 32 wrqu.data.length = strlen(buf);
34 wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf); 33 wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf);
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index dc7d9a3d70d5..b854483cf23f 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -241,7 +241,6 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
241 struct ieee80211_hw *hw = &local->hw; 241 struct ieee80211_hw *hw = &local->hw;
242 struct sta_info *sta; 242 struct sta_info *sta;
243 int ret, i; 243 int ret, i;
244 DECLARE_MAC_BUF(mac);
245 244
246 rcu_read_lock(); 245 rcu_read_lock();
247 246
@@ -269,8 +268,8 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
269 BUG_ON(!local->ops->ampdu_action); 268 BUG_ON(!local->ops->ampdu_action);
270 269
271#ifdef CONFIG_MAC80211_HT_DEBUG 270#ifdef CONFIG_MAC80211_HT_DEBUG
272 printk(KERN_DEBUG "Rx BA session stop requested for %s tid %u\n", 271 printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n",
273 print_mac(mac, ra), tid); 272 ra, tid);
274#endif /* CONFIG_MAC80211_HT_DEBUG */ 273#endif /* CONFIG_MAC80211_HT_DEBUG */
275 274
276 ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, 275 ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP,
@@ -383,14 +382,13 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
383 u16 start_seq_num; 382 u16 start_seq_num;
384 u8 *state; 383 u8 *state;
385 int ret; 384 int ret;
386 DECLARE_MAC_BUF(mac);
387 385
388 if (tid >= STA_TID_NUM) 386 if (tid >= STA_TID_NUM)
389 return -EINVAL; 387 return -EINVAL;
390 388
391#ifdef CONFIG_MAC80211_HT_DEBUG 389#ifdef CONFIG_MAC80211_HT_DEBUG
392 printk(KERN_DEBUG "Open BA session requested for %s tid %u\n", 390 printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n",
393 print_mac(mac, ra), tid); 391 ra, tid);
394#endif /* CONFIG_MAC80211_HT_DEBUG */ 392#endif /* CONFIG_MAC80211_HT_DEBUG */
395 393
396 rcu_read_lock(); 394 rcu_read_lock();
@@ -524,7 +522,6 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
524 struct sta_info *sta; 522 struct sta_info *sta;
525 u8 *state; 523 u8 *state;
526 int ret = 0; 524 int ret = 0;
527 DECLARE_MAC_BUF(mac);
528 525
529 if (tid >= STA_TID_NUM) 526 if (tid >= STA_TID_NUM)
530 return -EINVAL; 527 return -EINVAL;
@@ -546,8 +543,8 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
546 } 543 }
547 544
548#ifdef CONFIG_MAC80211_HT_DEBUG 545#ifdef CONFIG_MAC80211_HT_DEBUG
549 printk(KERN_DEBUG "Tx BA session stop requested for %s tid %u\n", 546 printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
550 print_mac(mac, ra), tid); 547 ra, tid);
551#endif /* CONFIG_MAC80211_HT_DEBUG */ 548#endif /* CONFIG_MAC80211_HT_DEBUG */
552 549
553 ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]); 550 ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]);
@@ -579,7 +576,6 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
579 struct ieee80211_local *local = hw_to_local(hw); 576 struct ieee80211_local *local = hw_to_local(hw);
580 struct sta_info *sta; 577 struct sta_info *sta;
581 u8 *state; 578 u8 *state;
582 DECLARE_MAC_BUF(mac);
583 579
584 if (tid >= STA_TID_NUM) { 580 if (tid >= STA_TID_NUM) {
585#ifdef CONFIG_MAC80211_HT_DEBUG 581#ifdef CONFIG_MAC80211_HT_DEBUG
@@ -594,8 +590,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
594 if (!sta) { 590 if (!sta) {
595 rcu_read_unlock(); 591 rcu_read_unlock();
596#ifdef CONFIG_MAC80211_HT_DEBUG 592#ifdef CONFIG_MAC80211_HT_DEBUG
597 printk(KERN_DEBUG "Could not find station: %s\n", 593 printk(KERN_DEBUG "Could not find station: %pM\n", ra);
598 print_mac(mac, ra));
599#endif 594#endif
600 return; 595 return;
601 } 596 }
@@ -634,7 +629,6 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
634 struct sta_info *sta; 629 struct sta_info *sta;
635 u8 *state; 630 u8 *state;
636 int agg_queue; 631 int agg_queue;
637 DECLARE_MAC_BUF(mac);
638 632
639 if (tid >= STA_TID_NUM) { 633 if (tid >= STA_TID_NUM) {
640#ifdef CONFIG_MAC80211_HT_DEBUG 634#ifdef CONFIG_MAC80211_HT_DEBUG
@@ -645,16 +639,15 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
645 } 639 }
646 640
647#ifdef CONFIG_MAC80211_HT_DEBUG 641#ifdef CONFIG_MAC80211_HT_DEBUG
648 printk(KERN_DEBUG "Stopping Tx BA session for %s tid %d\n", 642 printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n",
649 print_mac(mac, ra), tid); 643 ra, tid);
650#endif /* CONFIG_MAC80211_HT_DEBUG */ 644#endif /* CONFIG_MAC80211_HT_DEBUG */
651 645
652 rcu_read_lock(); 646 rcu_read_lock();
653 sta = sta_info_get(local, ra); 647 sta = sta_info_get(local, ra);
654 if (!sta) { 648 if (!sta) {
655#ifdef CONFIG_MAC80211_HT_DEBUG 649#ifdef CONFIG_MAC80211_HT_DEBUG
656 printk(KERN_DEBUG "Could not find station: %s\n", 650 printk(KERN_DEBUG "Could not find station: %pM\n", ra);
657 print_mac(mac, ra));
658#endif 651#endif
659 rcu_read_unlock(); 652 rcu_read_unlock();
660 return; 653 return;
@@ -783,7 +776,6 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
783 u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; 776 u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status;
784 u8 dialog_token; 777 u8 dialog_token;
785 int ret = -EOPNOTSUPP; 778 int ret = -EOPNOTSUPP;
786 DECLARE_MAC_BUF(mac);
787 779
788 /* extract session parameters from addba request frame */ 780 /* extract session parameters from addba request frame */
789 dialog_token = mgmt->u.action.u.addba_req.dialog_token; 781 dialog_token = mgmt->u.action.u.addba_req.dialog_token;
@@ -808,8 +800,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
808#ifdef CONFIG_MAC80211_HT_DEBUG 800#ifdef CONFIG_MAC80211_HT_DEBUG
809 if (net_ratelimit()) 801 if (net_ratelimit())
810 printk(KERN_DEBUG "AddBA Req with bad params from " 802 printk(KERN_DEBUG "AddBA Req with bad params from "
811 "%s on tid %u. policy %d, buffer size %d\n", 803 "%pM on tid %u. policy %d, buffer size %d\n",
812 print_mac(mac, mgmt->sa), tid, ba_policy, 804 mgmt->sa, tid, ba_policy,
813 buf_size); 805 buf_size);
814#endif /* CONFIG_MAC80211_HT_DEBUG */ 806#endif /* CONFIG_MAC80211_HT_DEBUG */
815 goto end_no_lock; 807 goto end_no_lock;
@@ -831,8 +823,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
831#ifdef CONFIG_MAC80211_HT_DEBUG 823#ifdef CONFIG_MAC80211_HT_DEBUG
832 if (net_ratelimit()) 824 if (net_ratelimit())
833 printk(KERN_DEBUG "unexpected AddBA Req from " 825 printk(KERN_DEBUG "unexpected AddBA Req from "
834 "%s on tid %u\n", 826 "%pM on tid %u\n",
835 print_mac(mac, mgmt->sa), tid); 827 mgmt->sa, tid);
836#endif /* CONFIG_MAC80211_HT_DEBUG */ 828#endif /* CONFIG_MAC80211_HT_DEBUG */
837 goto end; 829 goto end;
838 } 830 }
@@ -964,7 +956,6 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
964 struct ieee80211_local *local = sdata->local; 956 struct ieee80211_local *local = sdata->local;
965 u16 tid, params; 957 u16 tid, params;
966 u16 initiator; 958 u16 initiator;
967 DECLARE_MAC_BUF(mac);
968 959
969 params = le16_to_cpu(mgmt->u.action.u.delba.params); 960 params = le16_to_cpu(mgmt->u.action.u.delba.params);
970 tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; 961 tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12;
@@ -972,9 +963,8 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
972 963
973#ifdef CONFIG_MAC80211_HT_DEBUG 964#ifdef CONFIG_MAC80211_HT_DEBUG
974 if (net_ratelimit()) 965 if (net_ratelimit())
975 printk(KERN_DEBUG "delba from %s (%s) tid %d reason code %d\n", 966 printk(KERN_DEBUG "delba from %pM (%s) tid %d reason code %d\n",
976 print_mac(mac, mgmt->sa), 967 mgmt->sa, initiator ? "initiator" : "recipient", tid,
977 initiator ? "initiator" : "recipient", tid,
978 mgmt->u.action.u.delba.reason_code); 968 mgmt->u.action.u.delba.reason_code);
979#endif /* CONFIG_MAC80211_HT_DEBUG */ 969#endif /* CONFIG_MAC80211_HT_DEBUG */
980 970
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index a5b06fe71980..999f7aa42326 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -132,7 +132,6 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
132{ 132{
133 const u8 *addr; 133 const u8 *addr;
134 int ret; 134 int ret;
135 DECLARE_MAC_BUF(mac);
136 135
137 assert_key_lock(); 136 assert_key_lock();
138 might_sleep(); 137 might_sleep();
@@ -154,16 +153,15 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
154 153
155 if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) 154 if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP)
156 printk(KERN_ERR "mac80211-%s: failed to set key " 155 printk(KERN_ERR "mac80211-%s: failed to set key "
157 "(%d, %s) to hardware (%d)\n", 156 "(%d, %pM) to hardware (%d)\n",
158 wiphy_name(key->local->hw.wiphy), 157 wiphy_name(key->local->hw.wiphy),
159 key->conf.keyidx, print_mac(mac, addr), ret); 158 key->conf.keyidx, addr, ret);
160} 159}
161 160
162static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) 161static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
163{ 162{
164 const u8 *addr; 163 const u8 *addr;
165 int ret; 164 int ret;
166 DECLARE_MAC_BUF(mac);
167 165
168 assert_key_lock(); 166 assert_key_lock();
169 might_sleep(); 167 might_sleep();
@@ -186,9 +184,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
186 184
187 if (ret) 185 if (ret)
188 printk(KERN_ERR "mac80211-%s: failed to remove key " 186 printk(KERN_ERR "mac80211-%s: failed to remove key "
189 "(%d, %s) from hardware (%d)\n", 187 "(%d, %pM) from hardware (%d)\n",
190 wiphy_name(key->local->hw.wiphy), 188 wiphy_name(key->local->hw.wiphy),
191 key->conf.keyidx, print_mac(mac, addr), ret); 189 key->conf.keyidx, addr, ret);
192 190
193 spin_lock(&todo_lock); 191 spin_lock(&todo_lock);
194 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 192 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index faac101c0f85..929ba542fd72 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -257,9 +257,6 @@ static void mesh_plink_timer(unsigned long data)
257 struct sta_info *sta; 257 struct sta_info *sta;
258 __le16 llid, plid, reason; 258 __le16 llid, plid, reason;
259 struct ieee80211_sub_if_data *sdata; 259 struct ieee80211_sub_if_data *sdata;
260#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
261 DECLARE_MAC_BUF(mac);
262#endif
263 260
264 /* 261 /*
265 * This STA is valid because sta_info_destroy() will 262 * This STA is valid because sta_info_destroy() will
@@ -274,8 +271,8 @@ static void mesh_plink_timer(unsigned long data)
274 spin_unlock_bh(&sta->lock); 271 spin_unlock_bh(&sta->lock);
275 return; 272 return;
276 } 273 }
277 mpl_dbg("Mesh plink timer for %s fired on state %d\n", 274 mpl_dbg("Mesh plink timer for %pM fired on state %d\n",
278 print_mac(mac, sta->sta.addr), sta->plink_state); 275 sta->sta.addr, sta->plink_state);
279 reason = 0; 276 reason = 0;
280 llid = sta->llid; 277 llid = sta->llid;
281 plid = sta->plid; 278 plid = sta->plid;
@@ -287,9 +284,9 @@ static void mesh_plink_timer(unsigned long data)
287 /* retry timer */ 284 /* retry timer */
288 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { 285 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
289 u32 rand; 286 u32 rand;
290 mpl_dbg("Mesh plink for %s (retry, timeout): %d %d\n", 287 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n",
291 print_mac(mac, sta->sta.addr), 288 sta->sta.addr, sta->plink_retries,
292 sta->plink_retries, sta->plink_timeout); 289 sta->plink_timeout);
293 get_random_bytes(&rand, sizeof(u32)); 290 get_random_bytes(&rand, sizeof(u32));
294 sta->plink_timeout = sta->plink_timeout + 291 sta->plink_timeout = sta->plink_timeout +
295 rand % sta->plink_timeout; 292 rand % sta->plink_timeout;
@@ -337,9 +334,6 @@ int mesh_plink_open(struct sta_info *sta)
337{ 334{
338 __le16 llid; 335 __le16 llid;
339 struct ieee80211_sub_if_data *sdata = sta->sdata; 336 struct ieee80211_sub_if_data *sdata = sta->sdata;
340#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
341 DECLARE_MAC_BUF(mac);
342#endif
343 337
344 spin_lock_bh(&sta->lock); 338 spin_lock_bh(&sta->lock);
345 get_random_bytes(&llid, 2); 339 get_random_bytes(&llid, 2);
@@ -351,8 +345,8 @@ int mesh_plink_open(struct sta_info *sta)
351 sta->plink_state = PLINK_OPN_SNT; 345 sta->plink_state = PLINK_OPN_SNT;
352 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); 346 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
353 spin_unlock_bh(&sta->lock); 347 spin_unlock_bh(&sta->lock);
354 mpl_dbg("Mesh plink: starting establishment with %s\n", 348 mpl_dbg("Mesh plink: starting establishment with %pM\n",
355 print_mac(mac, sta->sta.addr)); 349 sta->sta.addr);
356 350
357 return mesh_plink_frame_tx(sdata, PLINK_OPEN, 351 return mesh_plink_frame_tx(sdata, PLINK_OPEN,
358 sta->sta.addr, llid, 0, 0); 352 sta->sta.addr, llid, 0, 0);
@@ -360,10 +354,6 @@ int mesh_plink_open(struct sta_info *sta)
360 354
361void mesh_plink_block(struct sta_info *sta) 355void mesh_plink_block(struct sta_info *sta)
362{ 356{
363#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
364 DECLARE_MAC_BUF(mac);
365#endif
366
367 spin_lock_bh(&sta->lock); 357 spin_lock_bh(&sta->lock);
368 __mesh_plink_deactivate(sta); 358 __mesh_plink_deactivate(sta);
369 sta->plink_state = PLINK_BLOCKED; 359 sta->plink_state = PLINK_BLOCKED;
@@ -374,12 +364,8 @@ int mesh_plink_close(struct sta_info *sta)
374{ 364{
375 struct ieee80211_sub_if_data *sdata = sta->sdata; 365 struct ieee80211_sub_if_data *sdata = sta->sdata;
376 __le16 llid, plid, reason; 366 __le16 llid, plid, reason;
377#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
378 DECLARE_MAC_BUF(mac);
379#endif
380 367
381 mpl_dbg("Mesh plink: closing link with %s\n", 368 mpl_dbg("Mesh plink: closing link with %pM\n", sta->sta.addr);
382 print_mac(mac, sta->sta.addr));
383 spin_lock_bh(&sta->lock); 369 spin_lock_bh(&sta->lock);
384 sta->reason = cpu_to_le16(MESH_LINK_CANCELLED); 370 sta->reason = cpu_to_le16(MESH_LINK_CANCELLED);
385 reason = sta->reason; 371 reason = sta->reason;
@@ -417,9 +403,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
417 u8 ie_len; 403 u8 ie_len;
418 u8 *baseaddr; 404 u8 *baseaddr;
419 __le16 plid, llid, reason; 405 __le16 plid, llid, reason;
420#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
421 DECLARE_MAC_BUF(mac);
422#endif
423 406
424 /* need action_code, aux */ 407 /* need action_code, aux */
425 if (len < IEEE80211_MIN_ACTION_SIZE + 3) 408 if (len < IEEE80211_MIN_ACTION_SIZE + 3)
@@ -557,10 +540,10 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
557 } 540 }
558 } 541 }
559 542
560 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %s %d %d %d %d\n", 543 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %d %d %d %d\n",
561 print_mac(mac, mgmt->sa), sta->plink_state, 544 mgmt->sa, sta->plink_state,
562 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid), 545 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
563 event); 546 event);
564 reason = 0; 547 reason = 0;
565 switch (sta->plink_state) { 548 switch (sta->plink_state) {
566 /* spin_unlock as soon as state is updated at each case */ 549 /* spin_unlock as soon as state is updated at each case */
@@ -660,8 +643,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
660 sta->plink_state = PLINK_ESTAB; 643 sta->plink_state = PLINK_ESTAB;
661 mesh_plink_inc_estab_count(sdata); 644 mesh_plink_inc_estab_count(sdata);
662 spin_unlock_bh(&sta->lock); 645 spin_unlock_bh(&sta->lock);
663 mpl_dbg("Mesh plink with %s ESTABLISHED\n", 646 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
664 print_mac(mac, sta->sta.addr)); 647 sta->sta.addr);
665 break; 648 break;
666 default: 649 default:
667 spin_unlock_bh(&sta->lock); 650 spin_unlock_bh(&sta->lock);
@@ -693,8 +676,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
693 sta->plink_state = PLINK_ESTAB; 676 sta->plink_state = PLINK_ESTAB;
694 mesh_plink_inc_estab_count(sdata); 677 mesh_plink_inc_estab_count(sdata);
695 spin_unlock_bh(&sta->lock); 678 spin_unlock_bh(&sta->lock);
696 mpl_dbg("Mesh plink with %s ESTABLISHED\n", 679 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
697 print_mac(mac, sta->sta.addr)); 680 sta->sta.addr);
698 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid, 681 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
699 plid, 0); 682 plid, 0);
700 break; 683 break;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 87665d7bb4f9..6ad2619db85f 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -575,18 +575,16 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
575 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; 575 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
576#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 576#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
577 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 577 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
578 DECLARE_MAC_BUF(mac);
579#endif 578#endif
580 u32 changed = 0; 579 u32 changed = 0;
581 580
582 if (use_protection != bss_conf->use_cts_prot) { 581 if (use_protection != bss_conf->use_cts_prot) {
583#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 582#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
584 if (net_ratelimit()) { 583 if (net_ratelimit()) {
585 printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" 584 printk(KERN_DEBUG "%s: CTS protection %s (BSSID=%pM)\n",
586 "%s)\n",
587 sdata->dev->name, 585 sdata->dev->name,
588 use_protection ? "enabled" : "disabled", 586 use_protection ? "enabled" : "disabled",
589 print_mac(mac, ifsta->bssid)); 587 ifsta->bssid);
590 } 588 }
591#endif 589#endif
592 bss_conf->use_cts_prot = use_protection; 590 bss_conf->use_cts_prot = use_protection;
@@ -597,10 +595,10 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
597#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 595#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
598 if (net_ratelimit()) { 596 if (net_ratelimit()) {
599 printk(KERN_DEBUG "%s: switched to %s barker preamble" 597 printk(KERN_DEBUG "%s: switched to %s barker preamble"
600 " (BSSID=%s)\n", 598 " (BSSID=%pM)\n",
601 sdata->dev->name, 599 sdata->dev->name,
602 use_short_preamble ? "short" : "long", 600 use_short_preamble ? "short" : "long",
603 print_mac(mac, ifsta->bssid)); 601 ifsta->bssid);
604 } 602 }
605#endif 603#endif
606 bss_conf->use_short_preamble = use_short_preamble; 604 bss_conf->use_short_preamble = use_short_preamble;
@@ -760,18 +758,16 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
760static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, 758static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
761 struct ieee80211_if_sta *ifsta) 759 struct ieee80211_if_sta *ifsta)
762{ 760{
763 DECLARE_MAC_BUF(mac);
764
765 ifsta->direct_probe_tries++; 761 ifsta->direct_probe_tries++;
766 if (ifsta->direct_probe_tries > IEEE80211_AUTH_MAX_TRIES) { 762 if (ifsta->direct_probe_tries > IEEE80211_AUTH_MAX_TRIES) {
767 printk(KERN_DEBUG "%s: direct probe to AP %s timed out\n", 763 printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n",
768 sdata->dev->name, print_mac(mac, ifsta->bssid)); 764 sdata->dev->name, ifsta->bssid);
769 ifsta->state = IEEE80211_STA_MLME_DISABLED; 765 ifsta->state = IEEE80211_STA_MLME_DISABLED;
770 return; 766 return;
771 } 767 }
772 768
773 printk(KERN_DEBUG "%s: direct probe to AP %s try %d\n", 769 printk(KERN_DEBUG "%s: direct probe to AP %pM try %d\n",
774 sdata->dev->name, print_mac(mac, ifsta->bssid), 770 sdata->dev->name, ifsta->bssid,
775 ifsta->direct_probe_tries); 771 ifsta->direct_probe_tries);
776 772
777 ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE; 773 ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE;
@@ -791,20 +787,18 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
791static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, 787static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
792 struct ieee80211_if_sta *ifsta) 788 struct ieee80211_if_sta *ifsta)
793{ 789{
794 DECLARE_MAC_BUF(mac);
795
796 ifsta->auth_tries++; 790 ifsta->auth_tries++;
797 if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { 791 if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) {
798 printk(KERN_DEBUG "%s: authentication with AP %s" 792 printk(KERN_DEBUG "%s: authentication with AP %pM"
799 " timed out\n", 793 " timed out\n",
800 sdata->dev->name, print_mac(mac, ifsta->bssid)); 794 sdata->dev->name, ifsta->bssid);
801 ifsta->state = IEEE80211_STA_MLME_DISABLED; 795 ifsta->state = IEEE80211_STA_MLME_DISABLED;
802 return; 796 return;
803 } 797 }
804 798
805 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; 799 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
806 printk(KERN_DEBUG "%s: authenticate with AP %s\n", 800 printk(KERN_DEBUG "%s: authenticate with AP %pM\n",
807 sdata->dev->name, print_mac(mac, ifsta->bssid)); 801 sdata->dev->name, ifsta->bssid);
808 802
809 ieee80211_send_auth(sdata, ifsta, 1, NULL, 0, 0); 803 ieee80211_send_auth(sdata, ifsta, 1, NULL, 0, 0);
810 804
@@ -914,20 +908,18 @@ static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata,
914static void ieee80211_associate(struct ieee80211_sub_if_data *sdata, 908static void ieee80211_associate(struct ieee80211_sub_if_data *sdata,
915 struct ieee80211_if_sta *ifsta) 909 struct ieee80211_if_sta *ifsta)
916{ 910{
917 DECLARE_MAC_BUF(mac);
918
919 ifsta->assoc_tries++; 911 ifsta->assoc_tries++;
920 if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { 912 if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) {
921 printk(KERN_DEBUG "%s: association with AP %s" 913 printk(KERN_DEBUG "%s: association with AP %pM"
922 " timed out\n", 914 " timed out\n",
923 sdata->dev->name, print_mac(mac, ifsta->bssid)); 915 sdata->dev->name, ifsta->bssid);
924 ifsta->state = IEEE80211_STA_MLME_DISABLED; 916 ifsta->state = IEEE80211_STA_MLME_DISABLED;
925 return; 917 return;
926 } 918 }
927 919
928 ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; 920 ifsta->state = IEEE80211_STA_MLME_ASSOCIATE;
929 printk(KERN_DEBUG "%s: associate with AP %s\n", 921 printk(KERN_DEBUG "%s: associate with AP %pM\n",
930 sdata->dev->name, print_mac(mac, ifsta->bssid)); 922 sdata->dev->name, ifsta->bssid);
931 if (ieee80211_privacy_mismatch(sdata, ifsta)) { 923 if (ieee80211_privacy_mismatch(sdata, ifsta)) {
932 printk(KERN_DEBUG "%s: mismatch in privacy configuration and " 924 printk(KERN_DEBUG "%s: mismatch in privacy configuration and "
933 "mixed-cell disabled - abort association\n", sdata->dev->name); 925 "mixed-cell disabled - abort association\n", sdata->dev->name);
@@ -947,7 +939,6 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
947 struct ieee80211_local *local = sdata->local; 939 struct ieee80211_local *local = sdata->local;
948 struct sta_info *sta; 940 struct sta_info *sta;
949 int disassoc; 941 int disassoc;
950 DECLARE_MAC_BUF(mac);
951 942
952 /* TODO: start monitoring current AP signal quality and number of 943 /* TODO: start monitoring current AP signal quality and number of
953 * missed beacons. Scan other channels every now and then and search 944 * missed beacons. Scan other channels every now and then and search
@@ -960,8 +951,8 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
960 951
961 sta = sta_info_get(local, ifsta->bssid); 952 sta = sta_info_get(local, ifsta->bssid);
962 if (!sta) { 953 if (!sta) {
963 printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", 954 printk(KERN_DEBUG "%s: No STA entry for own AP %pM\n",
964 sdata->dev->name, print_mac(mac, ifsta->bssid)); 955 sdata->dev->name, ifsta->bssid);
965 disassoc = 1; 956 disassoc = 1;
966 } else { 957 } else {
967 disassoc = 0; 958 disassoc = 0;
@@ -969,9 +960,9 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
969 sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { 960 sta->last_rx + IEEE80211_MONITORING_INTERVAL)) {
970 if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) { 961 if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) {
971 printk(KERN_DEBUG "%s: No ProbeResp from " 962 printk(KERN_DEBUG "%s: No ProbeResp from "
972 "current AP %s - assume out of " 963 "current AP %pM - assume out of "
973 "range\n", 964 "range\n",
974 sdata->dev->name, print_mac(mac, ifsta->bssid)); 965 sdata->dev->name, ifsta->bssid);
975 disassoc = 1; 966 disassoc = 1;
976 } else 967 } else
977 ieee80211_send_probe_req(sdata, ifsta->bssid, 968 ieee80211_send_probe_req(sdata, ifsta->bssid,
@@ -1032,7 +1023,6 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1032 size_t len) 1023 size_t len)
1033{ 1024{
1034 u16 auth_alg, auth_transaction, status_code; 1025 u16 auth_alg, auth_transaction, status_code;
1035 DECLARE_MAC_BUF(mac);
1036 1026
1037 if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && 1027 if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
1038 sdata->vif.type != NL80211_IFTYPE_ADHOC) 1028 sdata->vif.type != NL80211_IFTYPE_ADHOC)
@@ -1125,7 +1115,6 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1125 size_t len) 1115 size_t len)
1126{ 1116{
1127 u16 reason_code; 1117 u16 reason_code;
1128 DECLARE_MAC_BUF(mac);
1129 1118
1130 if (len < 24 + 2) 1119 if (len < 24 + 2)
1131 return; 1120 return;
@@ -1157,7 +1146,6 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1157 size_t len) 1146 size_t len)
1158{ 1147{
1159 u16 reason_code; 1148 u16 reason_code;
1160 DECLARE_MAC_BUF(mac);
1161 1149
1162 if (len < 24 + 2) 1150 if (len < 24 + 2)
1163 return; 1151 return;
@@ -1195,7 +1183,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1195 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; 1183 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
1196 u8 *pos; 1184 u8 *pos;
1197 int i, j; 1185 int i, j;
1198 DECLARE_MAC_BUF(mac);
1199 bool have_higher_than_11mbit = false; 1186 bool have_higher_than_11mbit = false;
1200 1187
1201 /* AssocResp and ReassocResp have identical structure, so process both 1188 /* AssocResp and ReassocResp have identical structure, so process both
@@ -1214,9 +1201,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1214 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 1201 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
1215 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); 1202 aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
1216 1203
1217 printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " 1204 printk(KERN_DEBUG "%s: RX %sssocResp from %pM (capab=0x%x "
1218 "status=%d aid=%d)\n", 1205 "status=%d aid=%d)\n",
1219 sdata->dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), 1206 sdata->dev->name, reassoc ? "Rea" : "A", mgmt->sa,
1220 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); 1207 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
1221 1208
1222 if (status_code != WLAN_STATUS_SUCCESS) { 1209 if (status_code != WLAN_STATUS_SUCCESS) {
@@ -1507,8 +1494,6 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1507 u64 beacon_timestamp, rx_timestamp; 1494 u64 beacon_timestamp, rx_timestamp;
1508 u64 supp_rates = 0; 1495 u64 supp_rates = 0;
1509 enum ieee80211_band band = rx_status->band; 1496 enum ieee80211_band band = rx_status->band;
1510 DECLARE_MAC_BUF(mac);
1511 DECLARE_MAC_BUF(mac2);
1512 1497
1513 if (elems->ds_params && elems->ds_params_len == 1) 1498 if (elems->ds_params && elems->ds_params_len == 1)
1514 freq = ieee80211_channel_to_frequency(elems->ds_params[0]); 1499 freq = ieee80211_channel_to_frequency(elems->ds_params[0]);
@@ -1538,10 +1523,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1538#ifdef CONFIG_MAC80211_IBSS_DEBUG 1523#ifdef CONFIG_MAC80211_IBSS_DEBUG
1539 if (sta->sta.supp_rates[band] != prev_rates) 1524 if (sta->sta.supp_rates[band] != prev_rates)
1540 printk(KERN_DEBUG "%s: updated supp_rates set " 1525 printk(KERN_DEBUG "%s: updated supp_rates set "
1541 "for %s based on beacon info (0x%llx | " 1526 "for %pM based on beacon info (0x%llx | "
1542 "0x%llx -> 0x%llx)\n", 1527 "0x%llx -> 0x%llx)\n",
1543 sdata->dev->name, 1528 sdata->dev->name,
1544 print_mac(mac, sta->sta.addr), 1529 sta->sta.addr,
1545 (unsigned long long) prev_rates, 1530 (unsigned long long) prev_rates,
1546 (unsigned long long) supp_rates, 1531 (unsigned long long) supp_rates,
1547 (unsigned long long) sta->sta.supp_rates[band]); 1532 (unsigned long long) sta->sta.supp_rates[band]);
@@ -1605,10 +1590,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1605 /* can't merge without knowing the TSF */ 1590 /* can't merge without knowing the TSF */
1606 rx_timestamp = -1LLU; 1591 rx_timestamp = -1LLU;
1607#ifdef CONFIG_MAC80211_IBSS_DEBUG 1592#ifdef CONFIG_MAC80211_IBSS_DEBUG
1608 printk(KERN_DEBUG "RX beacon SA=%s BSSID=" 1593 printk(KERN_DEBUG "RX beacon SA=%pM BSSID="
1609 "%s TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", 1594 "%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
1610 print_mac(mac, mgmt->sa), 1595 mgmt->sa, mgmt->bssid,
1611 print_mac(mac2, mgmt->bssid),
1612 (unsigned long long)rx_timestamp, 1596 (unsigned long long)rx_timestamp,
1613 (unsigned long long)beacon_timestamp, 1597 (unsigned long long)beacon_timestamp,
1614 (unsigned long long)(rx_timestamp - beacon_timestamp), 1598 (unsigned long long)(rx_timestamp - beacon_timestamp),
@@ -1617,8 +1601,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1617 if (beacon_timestamp > rx_timestamp) { 1601 if (beacon_timestamp > rx_timestamp) {
1618#ifdef CONFIG_MAC80211_IBSS_DEBUG 1602#ifdef CONFIG_MAC80211_IBSS_DEBUG
1619 printk(KERN_DEBUG "%s: beacon TSF higher than " 1603 printk(KERN_DEBUG "%s: beacon TSF higher than "
1620 "local TSF - IBSS merge with BSSID %s\n", 1604 "local TSF - IBSS merge with BSSID %pM\n",
1621 sdata->dev->name, print_mac(mac, mgmt->bssid)); 1605 sdata->dev->name, mgmt->bssid);
1622#endif 1606#endif
1623 ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss); 1607 ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
1624 ieee80211_ibss_add_sta(sdata, NULL, 1608 ieee80211_ibss_add_sta(sdata, NULL,
@@ -1727,11 +1711,6 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
1727 struct sk_buff *skb; 1711 struct sk_buff *skb;
1728 struct ieee80211_mgmt *resp; 1712 struct ieee80211_mgmt *resp;
1729 u8 *pos, *end; 1713 u8 *pos, *end;
1730 DECLARE_MAC_BUF(mac);
1731#ifdef CONFIG_MAC80211_IBSS_DEBUG
1732 DECLARE_MAC_BUF(mac2);
1733 DECLARE_MAC_BUF(mac3);
1734#endif
1735 1714
1736 if (sdata->vif.type != NL80211_IFTYPE_ADHOC || 1715 if (sdata->vif.type != NL80211_IFTYPE_ADHOC ||
1737 ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED || 1716 ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED ||
@@ -1744,10 +1723,10 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
1744 tx_last_beacon = 1; 1723 tx_last_beacon = 1;
1745 1724
1746#ifdef CONFIG_MAC80211_IBSS_DEBUG 1725#ifdef CONFIG_MAC80211_IBSS_DEBUG
1747 printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" 1726 printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM"
1748 "%s (tx_last_beacon=%d)\n", 1727 " (tx_last_beacon=%d)\n",
1749 sdata->dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), 1728 sdata->dev->name, mgmt->sa, mgmt->da,
1750 print_mac(mac3, mgmt->bssid), tx_last_beacon); 1729 mgmt->bssid, tx_last_beacon);
1751#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 1730#endif /* CONFIG_MAC80211_IBSS_DEBUG */
1752 1731
1753 if (!tx_last_beacon) 1732 if (!tx_last_beacon)
@@ -1763,8 +1742,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
1763 pos + 2 + pos[1] > end) { 1742 pos + 2 + pos[1] > end) {
1764#ifdef CONFIG_MAC80211_IBSS_DEBUG 1743#ifdef CONFIG_MAC80211_IBSS_DEBUG
1765 printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " 1744 printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq "
1766 "from %s\n", 1745 "from %pM\n",
1767 sdata->dev->name, print_mac(mac, mgmt->sa)); 1746 sdata->dev->name, mgmt->sa);
1768#endif 1747#endif
1769 return; 1748 return;
1770 } 1749 }
@@ -1783,8 +1762,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
1783 resp = (struct ieee80211_mgmt *) skb->data; 1762 resp = (struct ieee80211_mgmt *) skb->data;
1784 memcpy(resp->da, mgmt->sa, ETH_ALEN); 1763 memcpy(resp->da, mgmt->sa, ETH_ALEN);
1785#ifdef CONFIG_MAC80211_IBSS_DEBUG 1764#ifdef CONFIG_MAC80211_IBSS_DEBUG
1786 printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", 1765 printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n",
1787 sdata->dev->name, print_mac(mac, resp->da)); 1766 sdata->dev->name, resp->da);
1788#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 1767#endif /* CONFIG_MAC80211_IBSS_DEBUG */
1789 ieee80211_tx_skb(sdata, skb, 0); 1768 ieee80211_tx_skb(sdata, skb, 0);
1790} 1769}
@@ -1990,7 +1969,6 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata,
1990 u8 bssid[ETH_ALEN], *pos; 1969 u8 bssid[ETH_ALEN], *pos;
1991 int i; 1970 int i;
1992 int ret; 1971 int ret;
1993 DECLARE_MAC_BUF(mac);
1994 1972
1995#if 0 1973#if 0
1996 /* Easier testing, use fixed BSSID. */ 1974 /* Easier testing, use fixed BSSID. */
@@ -2006,8 +1984,8 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata,
2006 bssid[0] |= 0x02; 1984 bssid[0] |= 0x02;
2007#endif 1985#endif
2008 1986
2009 printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", 1987 printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n",
2010 sdata->dev->name, print_mac(mac, bssid)); 1988 sdata->dev->name, bssid);
2011 1989
2012 bss = ieee80211_rx_bss_add(local, bssid, 1990 bss = ieee80211_rx_bss_add(local, bssid,
2013 local->hw.conf.channel->center_freq, 1991 local->hw.conf.channel->center_freq,
@@ -2050,8 +2028,6 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2050 int found = 0; 2028 int found = 0;
2051 u8 bssid[ETH_ALEN]; 2029 u8 bssid[ETH_ALEN];
2052 int active_ibss; 2030 int active_ibss;
2053 DECLARE_MAC_BUF(mac);
2054 DECLARE_MAC_BUF(mac2);
2055 2031
2056 if (ifsta->ssid_len == 0) 2032 if (ifsta->ssid_len == 0)
2057 return -EINVAL; 2033 return -EINVAL;
@@ -2068,8 +2044,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2068 || !(bss->capability & WLAN_CAPABILITY_IBSS)) 2044 || !(bss->capability & WLAN_CAPABILITY_IBSS))
2069 continue; 2045 continue;
2070#ifdef CONFIG_MAC80211_IBSS_DEBUG 2046#ifdef CONFIG_MAC80211_IBSS_DEBUG
2071 printk(KERN_DEBUG " bssid=%s found\n", 2047 printk(KERN_DEBUG " bssid=%pM found\n", bss->bssid);
2072 print_mac(mac, bss->bssid));
2073#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2048#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2074 memcpy(bssid, bss->bssid, ETH_ALEN); 2049 memcpy(bssid, bss->bssid, ETH_ALEN);
2075 found = 1; 2050 found = 1;
@@ -2080,9 +2055,8 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2080 2055
2081#ifdef CONFIG_MAC80211_IBSS_DEBUG 2056#ifdef CONFIG_MAC80211_IBSS_DEBUG
2082 if (found) 2057 if (found)
2083 printk(KERN_DEBUG " sta_find_ibss: selected %s current " 2058 printk(KERN_DEBUG " sta_find_ibss: selected %pM current "
2084 "%s\n", print_mac(mac, bssid), 2059 "%pM\n", bssid, ifsta->bssid);
2085 print_mac(mac2, ifsta->bssid));
2086#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2060#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2087 2061
2088 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { 2062 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
@@ -2099,9 +2073,9 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2099 if (!bss) 2073 if (!bss)
2100 goto dont_join; 2074 goto dont_join;
2101 2075
2102 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" 2076 printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
2103 " based on configured SSID\n", 2077 " based on configured SSID\n",
2104 sdata->dev->name, print_mac(mac, bssid)); 2078 sdata->dev->name, bssid);
2105 ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); 2079 ret = ieee80211_sta_join_ibss(sdata, ifsta, bss);
2106 ieee80211_rx_bss_put(local, bss); 2080 ieee80211_rx_bss_put(local, bss);
2107 return ret; 2081 return ret;
@@ -2343,7 +2317,6 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
2343{ 2317{
2344 struct ieee80211_local *local = sdata->local; 2318 struct ieee80211_local *local = sdata->local;
2345 struct sta_info *sta; 2319 struct sta_info *sta;
2346 DECLARE_MAC_BUF(mac);
2347 int band = local->hw.conf.channel->band; 2320 int band = local->hw.conf.channel->band;
2348 2321
2349 /* TODO: Could consider removing the least recently used entry and 2322 /* TODO: Could consider removing the least recently used entry and
@@ -2351,7 +2324,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
2351 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { 2324 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
2352 if (net_ratelimit()) { 2325 if (net_ratelimit()) {
2353 printk(KERN_DEBUG "%s: No room for a new IBSS STA " 2326 printk(KERN_DEBUG "%s: No room for a new IBSS STA "
2354 "entry %s\n", sdata->dev->name, print_mac(mac, addr)); 2327 "entry %pM\n", sdata->dev->name, addr);
2355 } 2328 }
2356 return NULL; 2329 return NULL;
2357 } 2330 }
@@ -2360,8 +2333,8 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
2360 return NULL; 2333 return NULL;
2361 2334
2362#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2335#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
2363 printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", 2336 printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n",
2364 wiphy_name(local->hw.wiphy), print_mac(mac, addr), sdata->dev->name); 2337 wiphy_name(local->hw.wiphy), addr, sdata->dev->name);
2365#endif 2338#endif
2366 2339
2367 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); 2340 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index cf6b121e1bbf..39aaf210e9f5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -653,13 +653,12 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
653static void ap_sta_ps_start(struct sta_info *sta) 653static void ap_sta_ps_start(struct sta_info *sta)
654{ 654{
655 struct ieee80211_sub_if_data *sdata = sta->sdata; 655 struct ieee80211_sub_if_data *sdata = sta->sdata;
656 DECLARE_MAC_BUF(mac);
657 656
658 atomic_inc(&sdata->bss->num_sta_ps); 657 atomic_inc(&sdata->bss->num_sta_ps);
659 set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); 658 set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL);
660#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 659#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
661 printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", 660 printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n",
662 sdata->dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid); 661 sdata->dev->name, sta->sta.addr, sta->sta.aid);
663#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 662#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
664} 663}
665 664
@@ -670,7 +669,6 @@ static int ap_sta_ps_end(struct sta_info *sta)
670 struct sk_buff *skb; 669 struct sk_buff *skb;
671 int sent = 0; 670 int sent = 0;
672 struct ieee80211_tx_info *info; 671 struct ieee80211_tx_info *info;
673 DECLARE_MAC_BUF(mac);
674 672
675 atomic_dec(&sdata->bss->num_sta_ps); 673 atomic_dec(&sdata->bss->num_sta_ps);
676 674
@@ -680,8 +678,8 @@ static int ap_sta_ps_end(struct sta_info *sta)
680 sta_info_clear_tim_bit(sta); 678 sta_info_clear_tim_bit(sta);
681 679
682#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 680#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
683 printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n", 681 printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n",
684 sdata->dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid); 682 sdata->dev->name, sta->sta.addr, sta->sta.aid);
685#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 683#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
686 684
687 /* Send all buffered frames to the station */ 685 /* Send all buffered frames to the station */
@@ -696,9 +694,9 @@ static int ap_sta_ps_end(struct sta_info *sta)
696 local->total_ps_buffered--; 694 local->total_ps_buffered--;
697 sent++; 695 sent++;
698#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 696#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
699 printk(KERN_DEBUG "%s: STA %s aid %d send PS frame " 697 printk(KERN_DEBUG "%s: STA %pM aid %d send PS frame "
700 "since STA not sleeping anymore\n", sdata->dev->name, 698 "since STA not sleeping anymore\n", sdata->dev->name,
701 print_mac(mac, sta->sta.addr), sta->sta.aid); 699 sta->sta.addr, sta->sta.aid);
702#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 700#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
703 info->flags |= IEEE80211_TX_CTL_REQUEUE; 701 info->flags |= IEEE80211_TX_CTL_REQUEUE;
704 dev_queue_xmit(skb); 702 dev_queue_xmit(skb);
@@ -789,15 +787,12 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
789#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 787#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
790 struct ieee80211_hdr *hdr = 788 struct ieee80211_hdr *hdr =
791 (struct ieee80211_hdr *) entry->skb_list.next->data; 789 (struct ieee80211_hdr *) entry->skb_list.next->data;
792 DECLARE_MAC_BUF(mac);
793 DECLARE_MAC_BUF(mac2);
794 printk(KERN_DEBUG "%s: RX reassembly removed oldest " 790 printk(KERN_DEBUG "%s: RX reassembly removed oldest "
795 "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " 791 "fragment entry (idx=%d age=%lu seq=%d last_frag=%d "
796 "addr1=%s addr2=%s\n", 792 "addr1=%pM addr2=%pM\n",
797 sdata->dev->name, idx, 793 sdata->dev->name, idx,
798 jiffies - entry->first_frag_time, entry->seq, 794 jiffies - entry->first_frag_time, entry->seq,
799 entry->last_frag, print_mac(mac, hdr->addr1), 795 entry->last_frag, hdr->addr1, hdr->addr2);
800 print_mac(mac2, hdr->addr2));
801#endif 796#endif
802 __skb_queue_purge(&entry->skb_list); 797 __skb_queue_purge(&entry->skb_list);
803 } 798 }
@@ -866,7 +861,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
866 unsigned int frag, seq; 861 unsigned int frag, seq;
867 struct ieee80211_fragment_entry *entry; 862 struct ieee80211_fragment_entry *entry;
868 struct sk_buff *skb; 863 struct sk_buff *skb;
869 DECLARE_MAC_BUF(mac);
870 864
871 hdr = (struct ieee80211_hdr *)rx->skb->data; 865 hdr = (struct ieee80211_hdr *)rx->skb->data;
872 fc = hdr->frame_control; 866 fc = hdr->frame_control;
@@ -970,7 +964,6 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
970 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 964 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
971 struct sk_buff *skb; 965 struct sk_buff *skb;
972 int no_pending_pkts; 966 int no_pending_pkts;
973 DECLARE_MAC_BUF(mac);
974 __le16 fc = ((struct ieee80211_hdr *)rx->skb->data)->frame_control; 967 __le16 fc = ((struct ieee80211_hdr *)rx->skb->data)->frame_control;
975 968
976 if (likely(!rx->sta || !ieee80211_is_pspoll(fc) || 969 if (likely(!rx->sta || !ieee80211_is_pspoll(fc) ||
@@ -1001,8 +994,8 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
1001 set_sta_flags(rx->sta, WLAN_STA_PSPOLL); 994 set_sta_flags(rx->sta, WLAN_STA_PSPOLL);
1002 995
1003#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 996#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
1004 printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n", 997 printk(KERN_DEBUG "STA %pM aid %d: PS Poll (entries after %d)\n",
1005 print_mac(mac, rx->sta->sta.addr), rx->sta->sta.aid, 998 rx->sta->sta.addr, rx->sta->sta.aid,
1006 skb_queue_len(&rx->sta->ps_tx_buf)); 999 skb_queue_len(&rx->sta->ps_tx_buf));
1007#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 1000#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1008 1001
@@ -1025,9 +1018,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
1025 * Should we send it a null-func frame indicating we 1018 * Should we send it a null-func frame indicating we
1026 * have nothing buffered for it? 1019 * have nothing buffered for it?
1027 */ 1020 */
1028 printk(KERN_DEBUG "%s: STA %s sent PS Poll even " 1021 printk(KERN_DEBUG "%s: STA %pM sent PS Poll even "
1029 "though there are no buffered frames for it\n", 1022 "though there are no buffered frames for it\n",
1030 rx->dev->name, print_mac(mac, rx->sta->sta.addr)); 1023 rx->dev->name, rx->sta->sta.addr);
1031#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 1024#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1032 } 1025 }
1033 1026
@@ -1097,10 +1090,6 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1097 u8 src[ETH_ALEN] __aligned(2); 1090 u8 src[ETH_ALEN] __aligned(2);
1098 struct sk_buff *skb = rx->skb; 1091 struct sk_buff *skb = rx->skb;
1099 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1092 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1100 DECLARE_MAC_BUF(mac);
1101 DECLARE_MAC_BUF(mac2);
1102 DECLARE_MAC_BUF(mac3);
1103 DECLARE_MAC_BUF(mac4);
1104 1093
1105 if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) 1094 if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
1106 return -1; 1095 return -1;
@@ -1279,7 +1268,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1279 int remaining, err; 1268 int remaining, err;
1280 u8 dst[ETH_ALEN]; 1269 u8 dst[ETH_ALEN];
1281 u8 src[ETH_ALEN]; 1270 u8 src[ETH_ALEN];
1282 DECLARE_MAC_BUF(mac);
1283 1271
1284 if (unlikely(!ieee80211_is_data(fc))) 1272 if (unlikely(!ieee80211_is_data(fc)))
1285 return RX_CONTINUE; 1273 return RX_CONTINUE;
@@ -1632,8 +1620,6 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1632{ 1620{
1633 int keyidx; 1621 int keyidx;
1634 unsigned int hdrlen; 1622 unsigned int hdrlen;
1635 DECLARE_MAC_BUF(mac);
1636 DECLARE_MAC_BUF(mac2);
1637 1623
1638 hdrlen = ieee80211_hdrlen(hdr->frame_control); 1624 hdrlen = ieee80211_hdrlen(hdr->frame_control);
1639 if (rx->skb->len >= hdrlen + 4) 1625 if (rx->skb->len >= hdrlen + 4)
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 7fef8ea1f5ec..ca89a848c41e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -137,14 +137,12 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
137static void __sta_info_free(struct ieee80211_local *local, 137static void __sta_info_free(struct ieee80211_local *local,
138 struct sta_info *sta) 138 struct sta_info *sta)
139{ 139{
140 DECLARE_MAC_BUF(mbuf);
141
142 rate_control_free_sta(sta); 140 rate_control_free_sta(sta);
143 rate_control_put(sta->rate_ctrl); 141 rate_control_put(sta->rate_ctrl);
144 142
145#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 143#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
146 printk(KERN_DEBUG "%s: Destroyed STA %s\n", 144 printk(KERN_DEBUG "%s: Destroyed STA %pM\n",
147 wiphy_name(local->hw.wiphy), print_mac(mbuf, sta->sta.addr)); 145 wiphy_name(local->hw.wiphy), sta->sta.addr);
148#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 146#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
149 147
150 kfree(sta); 148 kfree(sta);
@@ -222,7 +220,6 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
222 struct ieee80211_local *local = sdata->local; 220 struct ieee80211_local *local = sdata->local;
223 struct sta_info *sta; 221 struct sta_info *sta;
224 int i; 222 int i;
225 DECLARE_MAC_BUF(mbuf);
226 223
227 sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp); 224 sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
228 if (!sta) 225 if (!sta)
@@ -263,8 +260,8 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
263 skb_queue_head_init(&sta->tx_filtered); 260 skb_queue_head_init(&sta->tx_filtered);
264 261
265#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 262#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
266 printk(KERN_DEBUG "%s: Allocated STA %s\n", 263 printk(KERN_DEBUG "%s: Allocated STA %pM\n",
267 wiphy_name(local->hw.wiphy), print_mac(mbuf, sta->sta.addr)); 264 wiphy_name(local->hw.wiphy), sta->sta.addr);
268#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 265#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
269 266
270#ifdef CONFIG_MAC80211_MESH 267#ifdef CONFIG_MAC80211_MESH
@@ -281,7 +278,6 @@ int sta_info_insert(struct sta_info *sta)
281 struct ieee80211_sub_if_data *sdata = sta->sdata; 278 struct ieee80211_sub_if_data *sdata = sta->sdata;
282 unsigned long flags; 279 unsigned long flags;
283 int err = 0; 280 int err = 0;
284 DECLARE_MAC_BUF(mac);
285 281
286 /* 282 /*
287 * Can't be a WARN_ON because it can be triggered through a race: 283 * Can't be a WARN_ON because it can be triggered through a race:
@@ -322,8 +318,8 @@ int sta_info_insert(struct sta_info *sta)
322 } 318 }
323 319
324#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 320#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
325 printk(KERN_DEBUG "%s: Inserted STA %s\n", 321 printk(KERN_DEBUG "%s: Inserted STA %pM\n",
326 wiphy_name(local->hw.wiphy), print_mac(mac, sta->sta.addr)); 322 wiphy_name(local->hw.wiphy), sta->sta.addr);
327#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 323#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
328 324
329 spin_unlock_irqrestore(&local->sta_lock, flags); 325 spin_unlock_irqrestore(&local->sta_lock, flags);
@@ -423,9 +419,6 @@ static void __sta_info_unlink(struct sta_info **sta)
423{ 419{
424 struct ieee80211_local *local = (*sta)->local; 420 struct ieee80211_local *local = (*sta)->local;
425 struct ieee80211_sub_if_data *sdata = (*sta)->sdata; 421 struct ieee80211_sub_if_data *sdata = (*sta)->sdata;
426#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
427 DECLARE_MAC_BUF(mbuf);
428#endif
429 /* 422 /*
430 * pull caller's reference if we're already gone. 423 * pull caller's reference if we're already gone.
431 */ 424 */
@@ -468,8 +461,8 @@ static void __sta_info_unlink(struct sta_info **sta)
468 } 461 }
469 462
470#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 463#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
471 printk(KERN_DEBUG "%s: Removed STA %s\n", 464 printk(KERN_DEBUG "%s: Removed STA %pM\n",
472 wiphy_name(local->hw.wiphy), print_mac(mbuf, (*sta)->sta.addr)); 465 wiphy_name(local->hw.wiphy), (*sta)->sta.addr);
473#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 466#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
474 467
475 /* 468 /*
@@ -544,7 +537,6 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
544 unsigned long flags; 537 unsigned long flags;
545 struct sk_buff *skb; 538 struct sk_buff *skb;
546 struct ieee80211_sub_if_data *sdata; 539 struct ieee80211_sub_if_data *sdata;
547 DECLARE_MAC_BUF(mac);
548 540
549 if (skb_queue_empty(&sta->ps_tx_buf)) 541 if (skb_queue_empty(&sta->ps_tx_buf))
550 return; 542 return;
@@ -564,8 +556,8 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
564 sdata = sta->sdata; 556 sdata = sta->sdata;
565 local->total_ps_buffered--; 557 local->total_ps_buffered--;
566#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 558#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
567 printk(KERN_DEBUG "Buffered frame expired (STA " 559 printk(KERN_DEBUG "Buffered frame expired (STA %pM)\n",
568 "%s)\n", print_mac(mac, sta->sta.addr)); 560 sta->sta.addr);
569#endif 561#endif
570 dev_kfree_skb(skb); 562 dev_kfree_skb(skb);
571 563
@@ -809,15 +801,14 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
809 struct ieee80211_local *local = sdata->local; 801 struct ieee80211_local *local = sdata->local;
810 struct sta_info *sta, *tmp; 802 struct sta_info *sta, *tmp;
811 LIST_HEAD(tmp_list); 803 LIST_HEAD(tmp_list);
812 DECLARE_MAC_BUF(mac);
813 unsigned long flags; 804 unsigned long flags;
814 805
815 spin_lock_irqsave(&local->sta_lock, flags); 806 spin_lock_irqsave(&local->sta_lock, flags);
816 list_for_each_entry_safe(sta, tmp, &local->sta_list, list) 807 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
817 if (time_after(jiffies, sta->last_rx + exp_time)) { 808 if (time_after(jiffies, sta->last_rx + exp_time)) {
818#ifdef CONFIG_MAC80211_IBSS_DEBUG 809#ifdef CONFIG_MAC80211_IBSS_DEBUG
819 printk(KERN_DEBUG "%s: expiring inactive STA %s\n", 810 printk(KERN_DEBUG "%s: expiring inactive STA %pM\n",
820 sdata->dev->name, print_mac(mac, sta->sta.addr)); 811 sdata->dev->name, sta->sta.addr);
821#endif 812#endif
822 __sta_info_unlink(&sta); 813 __sta_info_unlink(&sta);
823 if (sta) 814 if (sta)
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index 34b32bc8f609..38fa111d2dc6 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -263,10 +263,9 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
263 (iv32 == key->u.tkip.rx[queue].iv32 && 263 (iv32 == key->u.tkip.rx[queue].iv32 &&
264 iv16 <= key->u.tkip.rx[queue].iv16))) { 264 iv16 <= key->u.tkip.rx[queue].iv16))) {
265#ifdef CONFIG_MAC80211_TKIP_DEBUG 265#ifdef CONFIG_MAC80211_TKIP_DEBUG
266 DECLARE_MAC_BUF(mac);
267 printk(KERN_DEBUG "TKIP replay detected for RX frame from " 266 printk(KERN_DEBUG "TKIP replay detected for RX frame from "
268 "%s (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", 267 "%pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
269 print_mac(mac, ta), 268 ta,
270 iv32, iv16, key->u.tkip.rx[queue].iv32, 269 iv32, iv16, key->u.tkip.rx[queue].iv32,
271 key->u.tkip.rx[queue].iv16); 270 key->u.tkip.rx[queue].iv16);
272#endif 271#endif
@@ -287,9 +286,8 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
287 { 286 {
288 int i; 287 int i;
289 u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY; 288 u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY;
290 DECLARE_MAC_BUF(mac); 289 printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%pM"
291 printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%s" 290 " TK=", ta);
292 " TK=", print_mac(mac, ta));
293 for (i = 0; i < 16; i++) 291 for (i = 0; i < 16; i++)
294 printk("%02x ", 292 printk("%02x ",
295 key->conf.key[key_offset + i]); 293 key->conf.key[key_offset + i]);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1460537faf33..9191b510bff8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -201,10 +201,9 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
201 tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && 201 tx->sdata->vif.type != NL80211_IFTYPE_ADHOC &&
202 ieee80211_is_data(hdr->frame_control))) { 202 ieee80211_is_data(hdr->frame_control))) {
203#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 203#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
204 DECLARE_MAC_BUF(mac);
205 printk(KERN_DEBUG "%s: dropped data frame to not " 204 printk(KERN_DEBUG "%s: dropped data frame to not "
206 "associated station %s\n", 205 "associated station %pM\n",
207 tx->dev->name, print_mac(mac, hdr->addr1)); 206 tx->dev->name, hdr->addr1);
208#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 207#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
209 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); 208 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
210 return TX_DROP; 209 return TX_DROP;
@@ -331,7 +330,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
331 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 330 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
332 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 331 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
333 u32 staflags; 332 u32 staflags;
334 DECLARE_MAC_BUF(mac);
335 333
336 if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) 334 if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control)))
337 return TX_CONTINUE; 335 return TX_CONTINUE;
@@ -341,9 +339,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
341 if (unlikely((staflags & WLAN_STA_PS) && 339 if (unlikely((staflags & WLAN_STA_PS) &&
342 !(staflags & WLAN_STA_PSPOLL))) { 340 !(staflags & WLAN_STA_PSPOLL))) {
343#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 341#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
344 printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " 342 printk(KERN_DEBUG "STA %pM aid %d: PS buffer (entries "
345 "before %d)\n", 343 "before %d)\n",
346 print_mac(mac, sta->sta.addr), sta->sta.aid, 344 sta->sta.addr, sta->sta.aid,
347 skb_queue_len(&sta->ps_tx_buf)); 345 skb_queue_len(&sta->ps_tx_buf));
348#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 346#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
349 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) 347 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
@@ -352,9 +350,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
352 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); 350 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
353#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 351#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
354 if (net_ratelimit()) { 352 if (net_ratelimit()) {
355 printk(KERN_DEBUG "%s: STA %s TX " 353 printk(KERN_DEBUG "%s: STA %pM TX "
356 "buffer full - dropping oldest frame\n", 354 "buffer full - dropping oldest frame\n",
357 tx->dev->name, print_mac(mac, sta->sta.addr)); 355 tx->dev->name, sta->sta.addr);
358 } 356 }
359#endif 357#endif
360 dev_kfree_skb(old); 358 dev_kfree_skb(old);
@@ -371,9 +369,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
371 } 369 }
372#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 370#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
373 else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { 371 else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) {
374 printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " 372 printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll "
375 "set -> send frame\n", tx->dev->name, 373 "set -> send frame\n", tx->dev->name,
376 print_mac(mac, sta->sta.addr)); 374 sta->sta.addr);
377 } 375 }
378#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 376#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
379 clear_sta_flags(sta, WLAN_STA_PSPOLL); 377 clear_sta_flags(sta, WLAN_STA_PSPOLL);
@@ -1593,12 +1591,10 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1593 compare_ether_addr(dev->dev_addr, 1591 compare_ether_addr(dev->dev_addr,
1594 skb->data + ETH_ALEN) == 0))) { 1592 skb->data + ETH_ALEN) == 0))) {
1595#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1593#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1596 DECLARE_MAC_BUF(mac);
1597
1598 if (net_ratelimit()) 1594 if (net_ratelimit())
1599 printk(KERN_DEBUG "%s: dropped frame to %s" 1595 printk(KERN_DEBUG "%s: dropped frame to %pM"
1600 " (unauthorized port)\n", dev->name, 1596 " (unauthorized port)\n", dev->name,
1601 print_mac(mac, hdr.addr1)); 1597 hdr.addr1);
1602#endif 1598#endif
1603 1599
1604 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); 1600 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 139b5f267b34..d27ef7f2d4a7 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -206,13 +206,11 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
206 * on the previous queue 206 * on the previous queue
207 * since HT is strict in order */ 207 * since HT is strict in order */
208#ifdef CONFIG_MAC80211_HT_DEBUG 208#ifdef CONFIG_MAC80211_HT_DEBUG
209 if (net_ratelimit()) { 209 if (net_ratelimit())
210 DECLARE_MAC_BUF(mac);
211 printk(KERN_DEBUG "allocated aggregation queue" 210 printk(KERN_DEBUG "allocated aggregation queue"
212 " %d tid %d addr %s pool=0x%lX\n", 211 " %d tid %d addr %pM pool=0x%lX\n",
213 i, tid, print_mac(mac, sta->sta.addr), 212 i, tid, sta->sta.addr,
214 local->queue_pool[0]); 213 local->queue_pool[0]);
215 }
216#endif /* CONFIG_MAC80211_HT_DEBUG */ 214#endif /* CONFIG_MAC80211_HT_DEBUG */
217 return 0; 215 return 0;
218 } 216 }
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 6db649480e8f..3a20b036ef4c 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -90,7 +90,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
90 u8 mic[MICHAEL_MIC_LEN]; 90 u8 mic[MICHAEL_MIC_LEN];
91 struct sk_buff *skb = rx->skb; 91 struct sk_buff *skb = rx->skb;
92 int authenticator = 1, wpa_test = 0; 92 int authenticator = 1, wpa_test = 0;
93 DECLARE_MAC_BUF(mac);
94 93
95 /* 94 /*
96 * No way to verify the MIC if the hardware stripped it 95 * No way to verify the MIC if the hardware stripped it
@@ -227,7 +226,6 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
227 int hdrlen, res, hwaccel = 0, wpa_test = 0; 226 int hdrlen, res, hwaccel = 0, wpa_test = 0;
228 struct ieee80211_key *key = rx->key; 227 struct ieee80211_key *key = rx->key;
229 struct sk_buff *skb = rx->skb; 228 struct sk_buff *skb = rx->skb;
230 DECLARE_MAC_BUF(mac);
231 229
232 hdrlen = ieee80211_hdrlen(hdr->frame_control); 230 hdrlen = ieee80211_hdrlen(hdr->frame_control);
233 231
@@ -453,7 +451,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
453 struct sk_buff *skb = rx->skb; 451 struct sk_buff *skb = rx->skb;
454 u8 pn[CCMP_PN_LEN]; 452 u8 pn[CCMP_PN_LEN];
455 int data_len; 453 int data_len;
456 DECLARE_MAC_BUF(mac);
457 454
458 hdrlen = ieee80211_hdrlen(hdr->frame_control); 455 hdrlen = ieee80211_hdrlen(hdr->frame_control);
459 456
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 9a24332fbed8..60aba45023ff 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -820,13 +820,11 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)
820 820
821#ifdef CONFIG_IP_VS_IPV6 821#ifdef CONFIG_IP_VS_IPV6
822 if (cp->af == AF_INET6) 822 if (cp->af == AF_INET6)
823 seq_printf(seq, 823 seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X %pI6 %04X %-11s %7lu\n",
824 "%-3s " NIP6_FMT " %04X " NIP6_FMT
825 " %04X " NIP6_FMT " %04X %-11s %7lu\n",
826 ip_vs_proto_name(cp->protocol), 824 ip_vs_proto_name(cp->protocol),
827 NIP6(cp->caddr.in6), ntohs(cp->cport), 825 &cp->caddr.in6, ntohs(cp->cport),
828 NIP6(cp->vaddr.in6), ntohs(cp->vport), 826 &cp->vaddr.in6, ntohs(cp->vport),
829 NIP6(cp->daddr.in6), ntohs(cp->dport), 827 &cp->daddr.in6, ntohs(cp->dport),
830 ip_vs_state_name(cp->protocol, cp->state), 828 ip_vs_state_name(cp->protocol, cp->state),
831 (cp->timer.expires-jiffies)/HZ); 829 (cp->timer.expires-jiffies)/HZ);
832 else 830 else
@@ -883,13 +881,11 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v)
883 881
884#ifdef CONFIG_IP_VS_IPV6 882#ifdef CONFIG_IP_VS_IPV6
885 if (cp->af == AF_INET6) 883 if (cp->af == AF_INET6)
886 seq_printf(seq, 884 seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X %pI6 %04X %-11s %-6s %7lu\n",
887 "%-3s " NIP6_FMT " %04X " NIP6_FMT
888 " %04X " NIP6_FMT " %04X %-11s %-6s %7lu\n",
889 ip_vs_proto_name(cp->protocol), 885 ip_vs_proto_name(cp->protocol),
890 NIP6(cp->caddr.in6), ntohs(cp->cport), 886 &cp->caddr.in6, ntohs(cp->cport),
891 NIP6(cp->vaddr.in6), ntohs(cp->vport), 887 &cp->vaddr.in6, ntohs(cp->vport),
892 NIP6(cp->daddr.in6), ntohs(cp->dport), 888 &cp->daddr.in6, ntohs(cp->dport),
893 ip_vs_state_name(cp->protocol, cp->state), 889 ip_vs_state_name(cp->protocol, cp->state),
894 ip_vs_origin_name(cp->flags), 890 ip_vs_origin_name(cp->flags),
895 (cp->timer.expires-jiffies)/HZ); 891 (cp->timer.expires-jiffies)/HZ);
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 958abf3e5f8c..c3c68443b5b1 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -805,9 +805,9 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related)
805 if (ic == NULL) 805 if (ic == NULL)
806 return NF_DROP; 806 return NF_DROP;
807 807
808 IP_VS_DBG(12, "Outgoing ICMPv6 (%d,%d) " NIP6_FMT "->" NIP6_FMT "\n", 808 IP_VS_DBG(12, "Outgoing ICMPv6 (%d,%d) %pI6->%pI6\n",
809 ic->icmp6_type, ntohs(icmpv6_id(ic)), 809 ic->icmp6_type, ntohs(icmpv6_id(ic)),
810 NIP6(iph->saddr), NIP6(iph->daddr)); 810 &iph->saddr, &iph->daddr);
811 811
812 /* 812 /*
813 * Work through seeing if this is for us. 813 * Work through seeing if this is for us.
@@ -1175,9 +1175,9 @@ ip_vs_in_icmp_v6(struct sk_buff *skb, int *related, unsigned int hooknum)
1175 if (ic == NULL) 1175 if (ic == NULL)
1176 return NF_DROP; 1176 return NF_DROP;
1177 1177
1178 IP_VS_DBG(12, "Incoming ICMPv6 (%d,%d) " NIP6_FMT "->" NIP6_FMT "\n", 1178 IP_VS_DBG(12, "Incoming ICMPv6 (%d,%d) %pI6->%pI6\n",
1179 ic->icmp6_type, ntohs(icmpv6_id(ic)), 1179 ic->icmp6_type, ntohs(icmpv6_id(ic)),
1180 NIP6(iph->saddr), NIP6(iph->daddr)); 1180 &iph->saddr, &iph->daddr);
1181 1181
1182 /* 1182 /*
1183 * Work through seeing if this is for us. 1183 * Work through seeing if this is for us.
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 0302cf3e5039..76db27ec9633 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1867,9 +1867,9 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
1867 if (iter->table == ip_vs_svc_table) { 1867 if (iter->table == ip_vs_svc_table) {
1868#ifdef CONFIG_IP_VS_IPV6 1868#ifdef CONFIG_IP_VS_IPV6
1869 if (svc->af == AF_INET6) 1869 if (svc->af == AF_INET6)
1870 seq_printf(seq, "%s [" NIP6_FMT "]:%04X %s ", 1870 seq_printf(seq, "%s [%pI6]:%04X %s ",
1871 ip_vs_proto_name(svc->protocol), 1871 ip_vs_proto_name(svc->protocol),
1872 NIP6(svc->addr.in6), 1872 &svc->addr.in6,
1873 ntohs(svc->port), 1873 ntohs(svc->port),
1874 svc->scheduler->name); 1874 svc->scheduler->name);
1875 else 1875 else
@@ -1895,9 +1895,9 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
1895#ifdef CONFIG_IP_VS_IPV6 1895#ifdef CONFIG_IP_VS_IPV6
1896 if (dest->af == AF_INET6) 1896 if (dest->af == AF_INET6)
1897 seq_printf(seq, 1897 seq_printf(seq,
1898 " -> [" NIP6_FMT "]:%04X" 1898 " -> [%pI6]:%04X"
1899 " %-7s %-6d %-10d %-10d\n", 1899 " %-7s %-6d %-10d %-10d\n",
1900 NIP6(dest->addr.in6), 1900 &dest->addr.in6,
1901 ntohs(dest->port), 1901 ntohs(dest->port),
1902 ip_vs_fwd_name(atomic_read(&dest->conn_flags)), 1902 ip_vs_fwd_name(atomic_read(&dest->conn_flags)),
1903 atomic_read(&dest->weight), 1903 atomic_read(&dest->weight),
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index 0791f9e08feb..54cd67fbfe74 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -203,26 +203,21 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp,
203 if (ih == NULL) 203 if (ih == NULL)
204 sprintf(buf, "%s TRUNCATED", pp->name); 204 sprintf(buf, "%s TRUNCATED", pp->name);
205 else if (ih->nexthdr == IPPROTO_FRAGMENT) 205 else if (ih->nexthdr == IPPROTO_FRAGMENT)
206 sprintf(buf, "%s " NIP6_FMT "->" NIP6_FMT " frag", 206 sprintf(buf, "%s %pI6->%pI6 frag",
207 pp->name, NIP6(ih->saddr), 207 pp->name, &ih->saddr, &ih->daddr);
208 NIP6(ih->daddr));
209 else { 208 else {
210 __be16 _ports[2], *pptr; 209 __be16 _ports[2], *pptr;
211 210
212 pptr = skb_header_pointer(skb, offset + sizeof(struct ipv6hdr), 211 pptr = skb_header_pointer(skb, offset + sizeof(struct ipv6hdr),
213 sizeof(_ports), _ports); 212 sizeof(_ports), _ports);
214 if (pptr == NULL) 213 if (pptr == NULL)
215 sprintf(buf, "%s TRUNCATED " NIP6_FMT "->" NIP6_FMT, 214 sprintf(buf, "%s TRUNCATED %pI6->%pI6",
216 pp->name, 215 pp->name, &ih->saddr, &ih->daddr);
217 NIP6(ih->saddr),
218 NIP6(ih->daddr));
219 else 216 else
220 sprintf(buf, "%s " NIP6_FMT ":%u->" NIP6_FMT ":%u", 217 sprintf(buf, "%s %pI6:%u->%pI6:%u",
221 pp->name, 218 pp->name,
222 NIP6(ih->saddr), 219 &ih->saddr, ntohs(pptr[0]),
223 ntohs(pptr[0]), 220 &ih->daddr, ntohs(pptr[1]));
224 NIP6(ih->daddr),
225 ntohs(pptr[1]));
226 } 221 }
227 222
228 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 223 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf);
diff --git a/net/netfilter/ipvs/ip_vs_proto_ah_esp.c b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c
index 80ab0c8e5b4a..6ede88812044 100644
--- a/net/netfilter/ipvs/ip_vs_proto_ah_esp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c
@@ -154,9 +154,8 @@ ah_esp_debug_packet_v6(struct ip_vs_protocol *pp, const struct sk_buff *skb,
154 if (ih == NULL) 154 if (ih == NULL)
155 sprintf(buf, "%s TRUNCATED", pp->name); 155 sprintf(buf, "%s TRUNCATED", pp->name);
156 else 156 else
157 sprintf(buf, "%s " NIP6_FMT "->" NIP6_FMT, 157 sprintf(buf, "%s %pI6->%pI6",
158 pp->name, NIP6(ih->saddr), 158 pp->name, &ih->saddr, &ih->daddr);
159 NIP6(ih->daddr));
160 159
161 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 160 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf);
162} 161}
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index 02ddc2b3ce2e..fc342dda950a 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -141,14 +141,13 @@ __ip_vs_get_out_rt_v6(struct ip_vs_conn *cp)
141 NULL, &fl); 141 NULL, &fl);
142 if (!rt) { 142 if (!rt) {
143 spin_unlock(&dest->dst_lock); 143 spin_unlock(&dest->dst_lock);
144 IP_VS_DBG_RL("ip6_route_output error, " 144 IP_VS_DBG_RL("ip6_route_output error, dest: %pI6\n",
145 "dest: " NIP6_FMT "\n", 145 &dest->addr.in6);
146 NIP6(dest->addr.in6));
147 return NULL; 146 return NULL;
148 } 147 }
149 __ip_vs_dst_set(dest, 0, dst_clone(&rt->u.dst)); 148 __ip_vs_dst_set(dest, 0, dst_clone(&rt->u.dst));
150 IP_VS_DBG(10, "new dst " NIP6_FMT ", refcnt=%d\n", 149 IP_VS_DBG(10, "new dst %pI6, refcnt=%d\n",
151 NIP6(dest->addr.in6), 150 &dest->addr.in6,
152 atomic_read(&rt->u.dst.__refcnt)); 151 atomic_read(&rt->u.dst.__refcnt));
153 } 152 }
154 spin_unlock(&dest->dst_lock); 153 spin_unlock(&dest->dst_lock);
@@ -167,8 +166,8 @@ __ip_vs_get_out_rt_v6(struct ip_vs_conn *cp)
167 166
168 rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl); 167 rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl);
169 if (!rt) { 168 if (!rt) {
170 IP_VS_DBG_RL("ip6_route_output error, dest: " 169 IP_VS_DBG_RL("ip6_route_output error, dest: %pI6\n",
171 NIP6_FMT "\n", NIP6(cp->daddr.in6)); 170 &cp->daddr.in6);
172 return NULL; 171 return NULL;
173 } 172 }
174 } 173 }
@@ -301,8 +300,8 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
301 300
302 rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl); 301 rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl);
303 if (!rt) { 302 if (!rt) {
304 IP_VS_DBG_RL("ip_vs_bypass_xmit_v6(): ip6_route_output error, " 303 IP_VS_DBG_RL("ip_vs_bypass_xmit_v6(): ip6_route_output error, dest: %pI6\n",
305 "dest: " NIP6_FMT "\n", NIP6(iph->daddr)); 304 &iph->daddr);
306 goto tx_error_icmp; 305 goto tx_error_icmp;
307 } 306 }
308 307
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index 4f7107107e99..8cab6d595909 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -467,11 +467,9 @@ static int help(struct sk_buff *skb,
467 NIPQUAD(cmd.u3.ip), 467 NIPQUAD(cmd.u3.ip),
468 NIPQUAD(ct->tuplehash[dir].tuple.src.u3.ip)); 468 NIPQUAD(ct->tuplehash[dir].tuple.src.u3.ip));
469 } else { 469 } else {
470 pr_debug("conntrack_ftp: NOT RECORDING: " NIP6_FMT 470 pr_debug("conntrack_ftp: NOT RECORDING: %pI6 != %pI6\n",
471 " != " NIP6_FMT "\n", 471 cmd.u3.ip6,
472 NIP6(*((struct in6_addr *)cmd.u3.ip6)), 472 ct->tuplehash[dir].tuple.src.u3.ip6);
473 NIP6(*((struct in6_addr *)
474 ct->tuplehash[dir].tuple.src.u3.ip6)));
475 } 473 }
476 474
477 /* Thanks to Cristiano Lincoln Mattos 475 /* Thanks to Cristiano Lincoln Mattos
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index c1504f71cdff..99bc803d1dd1 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -850,10 +850,8 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
850 get_h225_addr(ct, *data, &setup->destCallSignalAddress, 850 get_h225_addr(ct, *data, &setup->destCallSignalAddress,
851 &addr, &port) && 851 &addr, &port) &&
852 memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) { 852 memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) {
853 pr_debug("nf_ct_q931: set destCallSignalAddress " 853 pr_debug("nf_ct_q931: set destCallSignalAddress %pI6:%hu->%pI6:%hu\n",
854 NIP6_FMT ":%hu->" NIP6_FMT ":%hu\n", 854 &addr, ntohs(port), &ct->tuplehash[!dir].tuple.src.u3,
855 NIP6(*(struct in6_addr *)&addr), ntohs(port),
856 NIP6(*(struct in6_addr *)&ct->tuplehash[!dir].tuple.src.u3),
857 ntohs(ct->tuplehash[!dir].tuple.src.u.tcp.port)); 855 ntohs(ct->tuplehash[!dir].tuple.src.u.tcp.port));
858 ret = set_h225_addr(skb, data, dataoff, 856 ret = set_h225_addr(skb, data, dataoff,
859 &setup->destCallSignalAddress, 857 &setup->destCallSignalAddress,
@@ -868,10 +866,8 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
868 get_h225_addr(ct, *data, &setup->sourceCallSignalAddress, 866 get_h225_addr(ct, *data, &setup->sourceCallSignalAddress,
869 &addr, &port) && 867 &addr, &port) &&
870 memcmp(&addr, &ct->tuplehash[!dir].tuple.dst.u3, sizeof(addr))) { 868 memcmp(&addr, &ct->tuplehash[!dir].tuple.dst.u3, sizeof(addr))) {
871 pr_debug("nf_ct_q931: set sourceCallSignalAddress " 869 pr_debug("nf_ct_q931: set sourceCallSignalAddress %pI6:%hu->%pI6:%hu\n",
872 NIP6_FMT ":%hu->" NIP6_FMT ":%hu\n", 870 &addr, ntohs(port), &ct->tuplehash[!dir].tuple.dst.u3,
873 NIP6(*(struct in6_addr *)&addr), ntohs(port),
874 NIP6(*(struct in6_addr *)&ct->tuplehash[!dir].tuple.dst.u3),
875 ntohs(ct->tuplehash[!dir].tuple.dst.u.tcp.port)); 871 ntohs(ct->tuplehash[!dir].tuple.dst.u.tcp.port));
876 ret = set_h225_addr(skb, data, dataoff, 872 ret = set_h225_addr(skb, data, dataoff,
877 &setup->sourceCallSignalAddress, 873 &setup->sourceCallSignalAddress,
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 6fc4292d46e6..6379717f9044 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -904,12 +904,11 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
904 ent->rateinfo.cost); 904 ent->rateinfo.cost);
905#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 905#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
906 case NFPROTO_IPV6: 906 case NFPROTO_IPV6:
907 return seq_printf(s, "%ld " NIP6_FMT ":%u->" 907 return seq_printf(s, "%ld %pI6:%u->%pI6:%u %u %u %u\n",
908 NIP6_FMT ":%u %u %u %u\n",
909 (long)(ent->expires - jiffies)/HZ, 908 (long)(ent->expires - jiffies)/HZ,
910 NIP6(*(struct in6_addr *)&ent->dst.ip6.src), 909 &ent->dst.ip6.src,
911 ntohs(ent->dst.src_port), 910 ntohs(ent->dst.src_port),
912 NIP6(*(struct in6_addr *)&ent->dst.ip6.dst), 911 &ent->dst.ip6.dst,
913 ntohs(ent->dst.dst_port), 912 ntohs(ent->dst.dst_port),
914 ent->rateinfo.credit, ent->rateinfo.credit_cap, 913 ent->rateinfo.credit, ent->rateinfo.credit_cap,
915 ent->rateinfo.cost); 914 ent->rateinfo.cost);
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 280c471bcdf4..b785727a5bf7 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -426,9 +426,8 @@ static int recent_seq_show(struct seq_file *seq, void *v)
426 "oldest_pkt: %u", NIPQUAD(e->addr.ip), e->ttl, 426 "oldest_pkt: %u", NIPQUAD(e->addr.ip), e->ttl,
427 e->stamps[i], e->index); 427 e->stamps[i], e->index);
428 else 428 else
429 seq_printf(seq, "src=" NIP6_FMT " ttl: %u last_seen: %lu " 429 seq_printf(seq, "src=%pI6 ttl: %u last_seen: %lu oldest_pkt: %u",
430 "oldest_pkt: %u", NIP6(e->addr.in6), e->ttl, 430 &e->addr.in6, e->ttl, e->stamps[i], e->index);
431 e->stamps[i], e->index);
432 for (i = 0; i < e->nstamps; i++) 431 for (i = 0; i < e->nstamps; i++)
433 seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]); 432 seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]);
434 seq_printf(seq, "\n"); 433 seq_printf(seq, "\n");
diff --git a/net/netlabel/netlabel_addrlist.c b/net/netlabel/netlabel_addrlist.c
index 249f6b92f153..2fc49e56c5a7 100644
--- a/net/netlabel/netlabel_addrlist.c
+++ b/net/netlabel/netlabel_addrlist.c
@@ -371,7 +371,7 @@ void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf,
371 371
372 if (dev != NULL) 372 if (dev != NULL)
373 audit_log_format(audit_buf, " netif=%s", dev); 373 audit_log_format(audit_buf, " netif=%s", dev);
374 audit_log_format(audit_buf, " %s=" NIP6_FMT, dir, NIP6(*addr)); 374 audit_log_format(audit_buf, " %s=%pI6", dir, addr);
375 if (ntohl(mask->s6_addr32[3]) != 0xffffffff) { 375 if (ntohl(mask->s6_addr32[3]) != 0xffffffff) {
376 u32 mask_len = 0; 376 u32 mask_len = 0;
377 u32 mask_val; 377 u32 mask_val;
diff --git a/net/netlink/attr.c b/net/netlink/attr.c
index 2d106cfe1d27..c83fea7da9a8 100644
--- a/net/netlink/attr.c
+++ b/net/netlink/attr.c
@@ -233,7 +233,7 @@ size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
233 * 233 *
234 * Returns the number of bytes copied. 234 * Returns the number of bytes copied.
235 */ 235 */
236int nla_memcpy(void *dest, struct nlattr *src, int count) 236int nla_memcpy(void *dest, const struct nlattr *src, int count)
237{ 237{
238 int minlen = min_t(int, count, nla_len(src)); 238 int minlen = min_t(int, count, nla_len(src));
239 239
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 4124bbb99947..ceaa4aa066ea 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -223,10 +223,9 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
223 ipv6_addr_copy(&fl.fl6_dst, rt0->addr); 223 ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
224 } 224 }
225 225
226 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " 226 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI6 dst:%pI6\n",
227 "src:" NIP6_FMT " dst:" NIP6_FMT "\n",
228 __func__, skb, skb->len, 227 __func__, skb, skb->len,
229 NIP6(fl.fl6_src), NIP6(fl.fl6_dst)); 228 &fl.fl6_src, &fl.fl6_dst);
230 229
231 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 230 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
232 231
@@ -252,23 +251,19 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
252 fl.oif = daddr->v6.sin6_scope_id; 251 fl.oif = daddr->v6.sin6_scope_id;
253 252
254 253
255 SCTP_DEBUG_PRINTK("%s: DST=" NIP6_FMT " ", 254 SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl.fl6_dst);
256 __func__, NIP6(fl.fl6_dst));
257 255
258 if (saddr) { 256 if (saddr) {
259 ipv6_addr_copy(&fl.fl6_src, &saddr->v6.sin6_addr); 257 ipv6_addr_copy(&fl.fl6_src, &saddr->v6.sin6_addr);
260 SCTP_DEBUG_PRINTK( 258 SCTP_DEBUG_PRINTK("SRC=%pI6 - ", &fl.fl6_src);
261 "SRC=" NIP6_FMT " - ",
262 NIP6(fl.fl6_src));
263 } 259 }
264 260
265 dst = ip6_route_output(&init_net, NULL, &fl); 261 dst = ip6_route_output(&init_net, NULL, &fl);
266 if (!dst->error) { 262 if (!dst->error) {
267 struct rt6_info *rt; 263 struct rt6_info *rt;
268 rt = (struct rt6_info *)dst; 264 rt = (struct rt6_info *)dst;
269 SCTP_DEBUG_PRINTK( 265 SCTP_DEBUG_PRINTK("rt6_dst:%pI6 rt6_src:%pI6\n",
270 "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n", 266 &rt->rt6i_dst.addr, &rt->rt6i_src.addr);
271 NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr));
272 return dst; 267 return dst;
273 } 268 }
274 SCTP_DEBUG_PRINTK("NO ROUTE\n"); 269 SCTP_DEBUG_PRINTK("NO ROUTE\n");
@@ -314,9 +309,8 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
314 __u8 matchlen = 0; 309 __u8 matchlen = 0;
315 __u8 bmatchlen; 310 __u8 bmatchlen;
316 311
317 SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p " 312 SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p daddr:%pI6 ",
318 "daddr:" NIP6_FMT " ", 313 __func__, asoc, dst, &daddr->v6.sin6_addr);
319 __func__, asoc, dst, NIP6(daddr->v6.sin6_addr));
320 314
321 if (!asoc) { 315 if (!asoc) {
322 ipv6_dev_get_saddr(sock_net(sctp_opt2sk(sk)), 316 ipv6_dev_get_saddr(sock_net(sctp_opt2sk(sk)),
@@ -324,8 +318,8 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
324 &daddr->v6.sin6_addr, 318 &daddr->v6.sin6_addr,
325 inet6_sk(&sk->inet.sk)->srcprefs, 319 inet6_sk(&sk->inet.sk)->srcprefs,
326 &saddr->v6.sin6_addr); 320 &saddr->v6.sin6_addr);
327 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n", 321 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
328 NIP6(saddr->v6.sin6_addr)); 322 &saddr->v6.sin6_addr);
329 return; 323 return;
330 } 324 }
331 325
@@ -353,12 +347,11 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
353 347
354 if (baddr) { 348 if (baddr) {
355 memcpy(saddr, baddr, sizeof(union sctp_addr)); 349 memcpy(saddr, baddr, sizeof(union sctp_addr));
356 SCTP_DEBUG_PRINTK("saddr: " NIP6_FMT "\n", 350 SCTP_DEBUG_PRINTK("saddr: %pI6\n", &saddr->v6.sin6_addr);
357 NIP6(saddr->v6.sin6_addr));
358 } else { 351 } else {
359 printk(KERN_ERR "%s: asoc:%p Could not find a valid source " 352 printk(KERN_ERR "%s: asoc:%p Could not find a valid source "
360 "address for the dest:" NIP6_FMT "\n", 353 "address for the dest:%pI6\n",
361 __func__, asoc, NIP6(daddr->v6.sin6_addr)); 354 __func__, asoc, &daddr->v6.sin6_addr);
362 } 355 }
363 356
364 rcu_read_unlock(); 357 rcu_read_unlock();
@@ -727,7 +720,7 @@ static int sctp_v6_is_ce(const struct sk_buff *skb)
727/* Dump the v6 addr to the seq file. */ 720/* Dump the v6 addr to the seq file. */
728static void sctp_v6_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) 721static void sctp_v6_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr)
729{ 722{
730 seq_printf(seq, NIP6_FMT " ", NIP6(addr->v6.sin6_addr)); 723 seq_printf(seq, "%pI6 ", &addr->v6.sin6_addr);
731} 724}
732 725
733static void sctp_v6_ecn_capable(struct sock *sk) 726static void sctp_v6_ecn_capable(struct sock *sk)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index a6a0ea71ae93..d07b484b873a 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1123,11 +1123,10 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
1123 if (from_addr.sa.sa_family == AF_INET6) { 1123 if (from_addr.sa.sa_family == AF_INET6) {
1124 if (net_ratelimit()) 1124 if (net_ratelimit())
1125 printk(KERN_WARNING 1125 printk(KERN_WARNING
1126 "%s association %p could not find address " 1126 "%s association %p could not find address %pI6\n",
1127 NIP6_FMT "\n",
1128 __func__, 1127 __func__,
1129 asoc, 1128 asoc,
1130 NIP6(from_addr.v6.sin6_addr)); 1129 &from_addr.v6.sin6_addr);
1131 } else { 1130 } else {
1132 if (net_ratelimit()) 1131 if (net_ratelimit())
1133 printk(KERN_WARNING 1132 printk(KERN_WARNING
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 4895c341e46d..8f067497c212 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -278,8 +278,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
278 case AF_INET6: { 278 case AF_INET6: {
279 struct sockaddr_in6 *sin = 279 struct sockaddr_in6 *sin =
280 (struct sockaddr_in6 *)args->address; 280 (struct sockaddr_in6 *)args->address;
281 snprintf(servername, sizeof(servername), NIP6_FMT, 281 snprintf(servername, sizeof(servername), "%pI6",
282 NIP6(sin->sin6_addr)); 282 &sin->sin6_addr);
283 break; 283 break;
284 } 284 }
285 default: 285 default:
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 41013dd66ac3..4c8adadc214d 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -305,9 +305,9 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
305 snprintf(buf, sizeof(buf), "::.%u.%u", 305 snprintf(buf, sizeof(buf), "::.%u.%u",
306 port >> 8, port & 0xff); 306 port >> 8, port & 0xff);
307 else 307 else
308 snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u", 308 snprintf(buf, sizeof(buf), "%pI6.%u.%u",
309 NIP6(address_to_register->sin6_addr), 309 &address_to_register->sin6_addr,
310 port >> 8, port & 0xff); 310 port >> 8, port & 0xff);
311 map->r_addr = buf; 311 map->r_addr = buf;
312 312
313 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " 313 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index f24800f2c098..16f714a247bc 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -168,7 +168,7 @@ static void ip_map_request(struct cache_detail *cd,
168 ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff, 168 ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff,
169 ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff); 169 ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff);
170 } else { 170 } else {
171 snprintf(text_addr, 40, NIP6_FMT, NIP6(im->m_addr)); 171 snprintf(text_addr, 40, "%pI6", &im->m_addr);
172 } 172 }
173 qword_add(bpp, blen, im->m_class); 173 qword_add(bpp, blen, im->m_class);
174 qword_add(bpp, blen, text_addr); 174 qword_add(bpp, blen, text_addr);
@@ -214,7 +214,7 @@ static int ip_map_parse(struct cache_detail *cd,
214 addr.s6_addr32[2] = htonl(0xffff); 214 addr.s6_addr32[2] = htonl(0xffff);
215 addr.s6_addr32[3] = 215 addr.s6_addr32[3] =
216 htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); 216 htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
217 } else if (sscanf(buf, NIP6_FMT "%c", 217 } else if (sscanf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x%c",
218 &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) { 218 &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) {
219 addr.s6_addr16[0] = htons(b1); 219 addr.s6_addr16[0] = htons(b1);
220 addr.s6_addr16[1] = htons(b2); 220 addr.s6_addr16[1] = htons(b2);
@@ -286,8 +286,7 @@ static int ip_map_show(struct seq_file *m,
286 ntohl(addr.s6_addr32[3]) >> 0 & 0xff, 286 ntohl(addr.s6_addr32[3]) >> 0 & 0xff,
287 dom); 287 dom);
288 } else { 288 } else {
289 seq_printf(m, "%s " NIP6_FMT " %s\n", 289 seq_printf(m, "%s %pI6 %s\n", im->m_class, &addr, dom);
290 im->m_class, NIP6(addr), dom);
291 } 290 }
292 return 0; 291 return 0;
293} 292}
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 0a50361e3d83..82a9b6286dd3 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -342,8 +342,7 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
342 342
343 buf = kzalloc(40, GFP_KERNEL); 343 buf = kzalloc(40, GFP_KERNEL);
344 if (buf) { 344 if (buf) {
345 snprintf(buf, 40, NIP6_FMT, 345 snprintf(buf, 40, "%pI6",&addr->sin6_addr);
346 NIP6(addr->sin6_addr));
347 } 346 }
348 xprt->address_strings[RPC_DISPLAY_ADDR] = buf; 347 xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
349 348
@@ -358,18 +357,17 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
358 357
359 buf = kzalloc(64, GFP_KERNEL); 358 buf = kzalloc(64, GFP_KERNEL);
360 if (buf) { 359 if (buf) {
361 snprintf(buf, 64, "addr="NIP6_FMT" port=%u proto=%s", 360 snprintf(buf, 64, "addr=%pI6 port=%u proto=%s",
362 NIP6(addr->sin6_addr), 361 &addr->sin6_addr,
363 ntohs(addr->sin6_port), 362 ntohs(addr->sin6_port),
364 protocol); 363 protocol);
365 } 364 }
366 xprt->address_strings[RPC_DISPLAY_ALL] = buf; 365 xprt->address_strings[RPC_DISPLAY_ALL] = buf;
367 366
368 buf = kzalloc(36, GFP_KERNEL); 367 buf = kzalloc(36, GFP_KERNEL);
369 if (buf) { 368 if (buf)
370 snprintf(buf, 36, NIP6_SEQFMT, 369 snprintf(buf, 36, "%pi6", &addr->sin6_addr);
371 NIP6(addr->sin6_addr)); 370
372 }
373 xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf; 371 xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf;
374 372
375 buf = kzalloc(8, GFP_KERNEL); 373 buf = kzalloc(8, GFP_KERNEL);
@@ -381,10 +379,10 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
381 379
382 buf = kzalloc(50, GFP_KERNEL); 380 buf = kzalloc(50, GFP_KERNEL);
383 if (buf) { 381 if (buf) {
384 snprintf(buf, 50, NIP6_FMT".%u.%u", 382 snprintf(buf, 50, "%pI6.%u.%u",
385 NIP6(addr->sin6_addr), 383 &addr->sin6_addr,
386 ntohs(addr->sin6_port) >> 8, 384 ntohs(addr->sin6_port) >> 8,
387 ntohs(addr->sin6_port) & 0xff); 385 ntohs(addr->sin6_port) & 0xff);
388 } 386 }
389 xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf; 387 xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf;
390 388
@@ -1448,8 +1446,8 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock)
1448 if (port > last) 1446 if (port > last)
1449 nloop++; 1447 nloop++;
1450 } while (err == -EADDRINUSE && nloop != 2); 1448 } while (err == -EADDRINUSE && nloop != 2);
1451 dprintk("RPC: xs_bind6 "NIP6_FMT":%u: %s (%d)\n", 1449 dprintk("RPC: xs_bind6 %pI6:%u: %s (%d)\n",
1452 NIP6(myaddr.sin6_addr), port, err ? "failed" : "ok", err); 1450 &myaddr.sin6_addr, port, err ? "failed" : "ok", err);
1453 return err; 1451 return err;
1454} 1452}
1455 1453
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index fe43ef7dd7e3..f72ba774c246 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -243,12 +243,11 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
243static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) 243static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size)
244{ 244{
245 unchar *addr = (unchar *)&a->dev_addr; 245 unchar *addr = (unchar *)&a->dev_addr;
246 DECLARE_MAC_BUF(mac);
247 246
248 if (str_size < 18) 247 if (str_size < 18)
249 *str_buf = '\0'; 248 *str_buf = '\0';
250 else 249 else
251 sprintf(str_buf, "%s", print_mac(mac, addr)); 250 sprintf(str_buf, "%pM", addr);
252 return str_buf; 251 return str_buf;
253} 252}
254 253
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 25872747762c..9d88c3df804a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2469,13 +2469,11 @@ static void xfrm_audit_common_policyinfo(struct xfrm_policy *xp,
2469 sel->prefixlen_d); 2469 sel->prefixlen_d);
2470 break; 2470 break;
2471 case AF_INET6: 2471 case AF_INET6:
2472 audit_log_format(audit_buf, " src=" NIP6_FMT, 2472 audit_log_format(audit_buf, " src=%pI6", sel->saddr.a6);
2473 NIP6(*(struct in6_addr *)sel->saddr.a6));
2474 if (sel->prefixlen_s != 128) 2473 if (sel->prefixlen_s != 128)
2475 audit_log_format(audit_buf, " src_prefixlen=%d", 2474 audit_log_format(audit_buf, " src_prefixlen=%d",
2476 sel->prefixlen_s); 2475 sel->prefixlen_s);
2477 audit_log_format(audit_buf, " dst=" NIP6_FMT, 2476 audit_log_format(audit_buf, " dst=%pI6", sel->daddr.a6);
2478 NIP6(*(struct in6_addr *)sel->daddr.a6));
2479 if (sel->prefixlen_d != 128) 2477 if (sel->prefixlen_d != 128)
2480 audit_log_format(audit_buf, " dst_prefixlen=%d", 2478 audit_log_format(audit_buf, " dst_prefixlen=%d",
2481 sel->prefixlen_d); 2479 sel->prefixlen_d);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 508337f97249..304eca4ac970 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2115,10 +2115,8 @@ static void xfrm_audit_helper_sainfo(struct xfrm_state *x,
2115 NIPQUAD(x->id.daddr.a4)); 2115 NIPQUAD(x->id.daddr.a4));
2116 break; 2116 break;
2117 case AF_INET6: 2117 case AF_INET6:
2118 audit_log_format(audit_buf, 2118 audit_log_format(audit_buf, " src=%pI6 dst=%pI6",
2119 " src=" NIP6_FMT " dst=" NIP6_FMT, 2119 x->props.saddr.a6, x->id.daddr.a6);
2120 NIP6(*(struct in6_addr *)x->props.saddr.a6),
2121 NIP6(*(struct in6_addr *)x->id.daddr.a6));
2122 break; 2120 break;
2123 } 2121 }
2124 2122
@@ -2142,10 +2140,8 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family,
2142 case AF_INET6: 2140 case AF_INET6:
2143 iph6 = ipv6_hdr(skb); 2141 iph6 = ipv6_hdr(skb);
2144 audit_log_format(audit_buf, 2142 audit_log_format(audit_buf,
2145 " src=" NIP6_FMT " dst=" NIP6_FMT 2143 " src=%pI6 dst=%pI6 flowlbl=0x%x%02x%02x",
2146 " flowlbl=0x%x%02x%02x", 2144 &iph6->saddr,&iph6->daddr,
2147 NIP6(iph6->saddr),
2148 NIP6(iph6->daddr),
2149 iph6->flow_lbl[0] & 0x0f, 2145 iph6->flow_lbl[0] & 0x0f,
2150 iph6->flow_lbl[1], 2146 iph6->flow_lbl[1],
2151 iph6->flow_lbl[2]); 2147 iph6->flow_lbl[2]);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 4a8a1abb59ee..76cf56d5d834 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2503,6 +2503,57 @@ static int xfrm_send_report(u8 proto, struct xfrm_selector *sel,
2503 return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_REPORT, GFP_ATOMIC); 2503 return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_REPORT, GFP_ATOMIC);
2504} 2504}
2505 2505
2506static inline size_t xfrm_mapping_msgsize(void)
2507{
2508 return NLMSG_ALIGN(sizeof(struct xfrm_user_mapping));
2509}
2510
2511static int build_mapping(struct sk_buff *skb, struct xfrm_state *x,
2512 xfrm_address_t *new_saddr, __be16 new_sport)
2513{
2514 struct xfrm_user_mapping *um;
2515 struct nlmsghdr *nlh;
2516
2517 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_MAPPING, sizeof(*um), 0);
2518 if (nlh == NULL)
2519 return -EMSGSIZE;
2520
2521 um = nlmsg_data(nlh);
2522
2523 memcpy(&um->id.daddr, &x->id.daddr, sizeof(um->id.daddr));
2524 um->id.spi = x->id.spi;
2525 um->id.family = x->props.family;
2526 um->id.proto = x->id.proto;
2527 memcpy(&um->new_saddr, new_saddr, sizeof(um->new_saddr));
2528 memcpy(&um->old_saddr, &x->props.saddr, sizeof(um->old_saddr));
2529 um->new_sport = new_sport;
2530 um->old_sport = x->encap->encap_sport;
2531 um->reqid = x->props.reqid;
2532
2533 return nlmsg_end(skb, nlh);
2534}
2535
2536static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,
2537 __be16 sport)
2538{
2539 struct sk_buff *skb;
2540
2541 if (x->id.proto != IPPROTO_ESP)
2542 return -EINVAL;
2543
2544 if (!x->encap)
2545 return -EINVAL;
2546
2547 skb = nlmsg_new(xfrm_mapping_msgsize(), GFP_ATOMIC);
2548 if (skb == NULL)
2549 return -ENOMEM;
2550
2551 if (build_mapping(skb, x, ipaddr, sport) < 0)
2552 BUG();
2553
2554 return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_MAPPING, GFP_ATOMIC);
2555}
2556
2506static struct xfrm_mgr netlink_mgr = { 2557static struct xfrm_mgr netlink_mgr = {
2507 .id = "netlink", 2558 .id = "netlink",
2508 .notify = xfrm_send_state_notify, 2559 .notify = xfrm_send_state_notify,
@@ -2511,6 +2562,7 @@ static struct xfrm_mgr netlink_mgr = {
2511 .notify_policy = xfrm_send_policy_notify, 2562 .notify_policy = xfrm_send_policy_notify,
2512 .report = xfrm_send_report, 2563 .report = xfrm_send_report,
2513 .migrate = xfrm_send_migrate, 2564 .migrate = xfrm_send_migrate,
2565 .new_mapping = xfrm_send_mapping,
2514}; 2566};
2515 2567
2516static int __init xfrm_user_init(void) 2568static int __init xfrm_user_init(void)