diff options
Diffstat (limited to 'net')
267 files changed, 5154 insertions, 3834 deletions
diff --git a/net/802/tr.c b/net/802/tr.c index 18c66475d8c3..158150fee462 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 | { | 288 | printk("source routing for %pM\n", trh->daddr); |
289 | DECLARE_MAC_BUF(mac); | ||
290 | printk("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 | { | 416 | printk("updating rif_entry: addr:%pM rcf:%04X\n", |
421 | DECLARE_MAC_BUF(mac); | 417 | trh->saddr, ntohs(trh->rcf)); |
422 | printk("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) |
@@ -643,7 +635,7 @@ static struct ctl_table tr_table[] = { | |||
643 | .data = &sysctl_tr_rif_timeout, | 635 | .data = &sysctl_tr_rif_timeout, |
644 | .maxlen = sizeof(int), | 636 | .maxlen = sizeof(int), |
645 | .mode = 0644, | 637 | .mode = 0644, |
646 | .proc_handler = &proc_dointvec | 638 | .proc_handler = proc_dointvec |
647 | }, | 639 | }, |
648 | { 0 }, | 640 | { 0 }, |
649 | }; | 641 | }; |
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) */ |
47 | static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; | 47 | static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; |
48 | 48 | ||
49 | static char vlan_fullname[] = "802.1Q VLAN Support"; | 49 | const char vlan_fullname[] = "802.1Q VLAN Support"; |
50 | static char vlan_version[] = DRV_VERSION; | 50 | const char vlan_version[] = DRV_VERSION; |
51 | static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; | 51 | static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; |
52 | static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; | 52 | static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; |
53 | 53 | ||
54 | static struct packet_type vlan_packet_type = { | 54 | static 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; } | |||
108 | static inline void vlan_gvrp_uninit(void) {} | 108 | static inline void vlan_gvrp_uninit(void) {} |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | int vlan_netlink_init(void); | 111 | extern const char vlan_fullname[]; |
112 | void vlan_netlink_fini(void); | 112 | extern const char vlan_version[]; |
113 | extern int vlan_netlink_init(void); | ||
114 | extern void vlan_netlink_fini(void); | ||
113 | 115 | ||
114 | extern struct rtnl_link_ops vlan_link_ops; | 116 | extern struct rtnl_link_ops vlan_link_ops; |
115 | 117 | ||
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 68ced4bf158c..dd86a1dc4cd0 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -47,8 +47,6 @@ int vlan_hwaccel_do_receive(struct sk_buff *skb) | |||
47 | skb->priority = vlan_get_ingress_priority(dev, skb->vlan_tci); | 47 | skb->priority = vlan_get_ingress_priority(dev, skb->vlan_tci); |
48 | skb->vlan_tci = 0; | 48 | skb->vlan_tci = 0; |
49 | 49 | ||
50 | dev->last_rx = jiffies; | ||
51 | |||
52 | stats = &dev->stats; | 50 | stats = &dev->stats; |
53 | stats->rx_packets++; | 51 | stats->rx_packets++; |
54 | stats->rx_bytes += skb->len; | 52 | stats->rx_bytes += skb->len; |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 8883e9c8a223..e4bf39f87032 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -163,8 +163,6 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
163 | goto err_unlock; | 163 | goto err_unlock; |
164 | } | 164 | } |
165 | 165 | ||
166 | skb->dev->last_rx = jiffies; | ||
167 | |||
168 | stats = &skb->dev->stats; | 166 | stats = &skb->dev->stats; |
169 | stats->rx_packets++; | 167 | stats->rx_packets++; |
170 | stats->rx_bytes += skb->len; | 168 | stats->rx_bytes += skb->len; |
@@ -648,6 +646,26 @@ static void vlan_dev_uninit(struct net_device *dev) | |||
648 | } | 646 | } |
649 | } | 647 | } |
650 | 648 | ||
649 | static int vlan_ethtool_get_settings(struct net_device *dev, | ||
650 | struct ethtool_cmd *cmd) | ||
651 | { | ||
652 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | ||
653 | struct net_device *real_dev = vlan->real_dev; | ||
654 | |||
655 | if (!real_dev->ethtool_ops->get_settings) | ||
656 | return -EOPNOTSUPP; | ||
657 | |||
658 | return real_dev->ethtool_ops->get_settings(real_dev, cmd); | ||
659 | } | ||
660 | |||
661 | static void vlan_ethtool_get_drvinfo(struct net_device *dev, | ||
662 | struct ethtool_drvinfo *info) | ||
663 | { | ||
664 | strcpy(info->driver, vlan_fullname); | ||
665 | strcpy(info->version, vlan_version); | ||
666 | strcpy(info->fw_version, "N/A"); | ||
667 | } | ||
668 | |||
651 | static u32 vlan_ethtool_get_rx_csum(struct net_device *dev) | 669 | static u32 vlan_ethtool_get_rx_csum(struct net_device *dev) |
652 | { | 670 | { |
653 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | 671 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); |
@@ -672,6 +690,8 @@ static u32 vlan_ethtool_get_flags(struct net_device *dev) | |||
672 | } | 690 | } |
673 | 691 | ||
674 | static const struct ethtool_ops vlan_ethtool_ops = { | 692 | static const struct ethtool_ops vlan_ethtool_ops = { |
693 | .get_settings = vlan_ethtool_get_settings, | ||
694 | .get_drvinfo = vlan_ethtool_get_drvinfo, | ||
675 | .get_link = ethtool_op_get_link, | 695 | .get_link = ethtool_op_get_link, |
676 | .get_rx_csum = vlan_ethtool_get_rx_csum, | 696 | .get_rx_csum = vlan_ethtool_get_rx_csum, |
677 | .get_flags = vlan_ethtool_get_flags, | 697 | .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" | |||
27 | config NET_NS | 27 | config 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/appletalk/sysctl_net_atalk.c b/net/appletalk/sysctl_net_atalk.c index 621805dfa2f4..8d237b15183b 100644 --- a/net/appletalk/sysctl_net_atalk.c +++ b/net/appletalk/sysctl_net_atalk.c | |||
@@ -17,8 +17,8 @@ static struct ctl_table atalk_table[] = { | |||
17 | .data = &sysctl_aarp_expiry_time, | 17 | .data = &sysctl_aarp_expiry_time, |
18 | .maxlen = sizeof(int), | 18 | .maxlen = sizeof(int), |
19 | .mode = 0644, | 19 | .mode = 0644, |
20 | .proc_handler = &proc_dointvec_jiffies, | 20 | .proc_handler = proc_dointvec_jiffies, |
21 | .strategy = &sysctl_jiffies, | 21 | .strategy = sysctl_jiffies, |
22 | }, | 22 | }, |
23 | { | 23 | { |
24 | .ctl_name = NET_ATALK_AARP_TICK_TIME, | 24 | .ctl_name = NET_ATALK_AARP_TICK_TIME, |
@@ -26,8 +26,8 @@ static struct ctl_table atalk_table[] = { | |||
26 | .data = &sysctl_aarp_tick_time, | 26 | .data = &sysctl_aarp_tick_time, |
27 | .maxlen = sizeof(int), | 27 | .maxlen = sizeof(int), |
28 | .mode = 0644, | 28 | .mode = 0644, |
29 | .proc_handler = &proc_dointvec_jiffies, | 29 | .proc_handler = proc_dointvec_jiffies, |
30 | .strategy = &sysctl_jiffies, | 30 | .strategy = sysctl_jiffies, |
31 | }, | 31 | }, |
32 | { | 32 | { |
33 | .ctl_name = NET_ATALK_AARP_RETRANSMIT_LIMIT, | 33 | .ctl_name = NET_ATALK_AARP_RETRANSMIT_LIMIT, |
@@ -35,7 +35,7 @@ static struct ctl_table atalk_table[] = { | |||
35 | .data = &sysctl_aarp_retransmit_limit, | 35 | .data = &sysctl_aarp_retransmit_limit, |
36 | .maxlen = sizeof(int), | 36 | .maxlen = sizeof(int), |
37 | .mode = 0644, | 37 | .mode = 0644, |
38 | .proc_handler = &proc_dointvec, | 38 | .proc_handler = proc_dointvec, |
39 | }, | 39 | }, |
40 | { | 40 | { |
41 | .ctl_name = NET_ATALK_AARP_RESOLVE_TIME, | 41 | .ctl_name = NET_ATALK_AARP_RESOLVE_TIME, |
@@ -43,8 +43,8 @@ static struct ctl_table atalk_table[] = { | |||
43 | .data = &sysctl_aarp_resolve_time, | 43 | .data = &sysctl_aarp_resolve_time, |
44 | .maxlen = sizeof(int), | 44 | .maxlen = sizeof(int), |
45 | .mode = 0644, | 45 | .mode = 0644, |
46 | .proc_handler = &proc_dointvec_jiffies, | 46 | .proc_handler = proc_dointvec_jiffies, |
47 | .strategy = &sysctl_jiffies, | 47 | .strategy = sysctl_jiffies, |
48 | }, | 48 | }, |
49 | { 0 }, | 49 | { 0 }, |
50 | }; | 50 | }; |
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 1b88311f2130..b5674dc2083d 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
@@ -149,7 +149,7 @@ int atm_register_sysfs(struct atm_dev *adev) | |||
149 | cdev->class = &atm_class; | 149 | cdev->class = &atm_class; |
150 | dev_set_drvdata(cdev, adev); | 150 | dev_set_drvdata(cdev, adev); |
151 | 151 | ||
152 | snprintf(cdev->bus_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); | 152 | dev_set_name(cdev, "%s%d", adev->type, adev->number); |
153 | err = device_register(cdev); | 153 | err = device_register(cdev); |
154 | if (err < 0) | 154 | if (err < 0) |
155 | return err; | 155 | return err; |
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/clip.c b/net/atm/clip.c index 5b5b96344ce6..2d33a83be799 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -822,8 +822,8 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev, | |||
822 | seq_printf(seq, "%-6s%-4s%-4s%5ld ", | 822 | seq_printf(seq, "%-6s%-4s%-4s%5ld ", |
823 | dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp); | 823 | dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp); |
824 | 824 | ||
825 | off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", | 825 | off = scnprintf(buf, sizeof(buf) - 1, "%pI4", |
826 | NIPQUAD(entry->ip)); | 826 | &entry->ip); |
827 | while (off < 16) | 827 | while (off < 16) |
828 | buf[off++] = ' '; | 828 | buf[off++] = ' '; |
829 | buf[off] = '\0'; | 829 | buf[off] = '\0'; |
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/atm/mpc.c b/net/atm/mpc.c index 11b16d16661c..010b1d2a5a8f 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -232,8 +232,8 @@ void atm_mpoa_disp_qos(struct seq_file *m) | |||
232 | seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n"); | 232 | seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n"); |
233 | 233 | ||
234 | while (qos != NULL) { | 234 | while (qos != NULL) { |
235 | seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", | 235 | seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", |
236 | NIPQUAD(qos->ipaddr), | 236 | &qos->ipaddr, |
237 | qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, | 237 | qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, |
238 | qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); | 238 | qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); |
239 | qos = qos->next; | 239 | qos = qos->next; |
@@ -595,8 +595,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
595 | if (in_entry != NULL) mpc->in_ops->put(in_entry); | 595 | if (in_entry != NULL) mpc->in_ops->put(in_entry); |
596 | return -EINVAL; | 596 | return -EINVAL; |
597 | } | 597 | } |
598 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n", | 598 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %pI4\n", |
599 | mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip)); | 599 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
600 | in_entry->shortcut = vcc; | 600 | in_entry->shortcut = vcc; |
601 | mpc->in_ops->put(in_entry); | 601 | mpc->in_ops->put(in_entry); |
602 | } else { | 602 | } else { |
@@ -627,8 +627,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) | |||
627 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); | 627 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); |
628 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); | 628 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); |
629 | if (in_entry) { | 629 | if (in_entry) { |
630 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n", | 630 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %pI4\n", |
631 | mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip)); | 631 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
632 | in_entry->shortcut = NULL; | 632 | in_entry->shortcut = NULL; |
633 | mpc->in_ops->put(in_entry); | 633 | mpc->in_ops->put(in_entry); |
634 | } | 634 | } |
@@ -1098,7 +1098,8 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien | |||
1098 | entry->shortcut = eg_entry->shortcut; | 1098 | entry->shortcut = eg_entry->shortcut; |
1099 | } | 1099 | } |
1100 | if(entry->shortcut){ | 1100 | if(entry->shortcut){ |
1101 | dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip)); | 1101 | dprintk("mpoa: (%s) using egress SVC to reach %pI4\n", |
1102 | client->dev->name, &dst_ip); | ||
1102 | client->eg_ops->put(eg_entry); | 1103 | client->eg_ops->put(eg_entry); |
1103 | return; | 1104 | return; |
1104 | } | 1105 | } |
@@ -1123,7 +1124,8 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1123 | __be32 dst_ip = msg->content.in_info.in_dst_ip; | 1124 | __be32 dst_ip = msg->content.in_info.in_dst_ip; |
1124 | in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); | 1125 | in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); |
1125 | 1126 | ||
1126 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip)); | 1127 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %pI4\n", |
1128 | mpc->dev->name, &dst_ip); | ||
1127 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); | 1129 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); |
1128 | if(entry == NULL){ | 1130 | if(entry == NULL){ |
1129 | printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); | 1131 | printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); |
@@ -1171,14 +1173,14 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1171 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); | 1173 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); |
1172 | 1174 | ||
1173 | if(entry == NULL){ | 1175 | if(entry == NULL){ |
1174 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name); | 1176 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ip = %pI4\n", |
1175 | printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); | 1177 | mpc->dev->name, &dst_ip); |
1176 | return; | 1178 | return; |
1177 | } | 1179 | } |
1178 | 1180 | ||
1179 | do { | 1181 | do { |
1180 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" , | 1182 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %pI4\n", |
1181 | mpc->dev->name, NIPQUAD(dst_ip)); | 1183 | mpc->dev->name, &dst_ip); |
1182 | write_lock_bh(&mpc->ingress_lock); | 1184 | write_lock_bh(&mpc->ingress_lock); |
1183 | mpc->in_ops->remove_entry(entry, mpc); | 1185 | mpc->in_ops->remove_entry(entry, mpc); |
1184 | write_unlock_bh(&mpc->ingress_lock); | 1186 | write_unlock_bh(&mpc->ingress_lock); |
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c index 24799e3e78f7..4504a4b339bb 100644 --- a/net/atm/mpoa_caches.c +++ b/net/atm/mpoa_caches.c | |||
@@ -94,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(__be32 dst_ip, | |||
94 | return NULL; | 94 | return NULL; |
95 | } | 95 | } |
96 | 96 | ||
97 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); | 97 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %pI4\n", &dst_ip); |
98 | 98 | ||
99 | atomic_set(&entry->use, 1); | 99 | atomic_set(&entry->use, 1); |
100 | dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); | 100 | dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); |
@@ -150,7 +150,8 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) | |||
150 | 150 | ||
151 | if( entry->count > mpc->parameters.mpc_p1 && | 151 | if( entry->count > mpc->parameters.mpc_p1 && |
152 | entry->entry_state == INGRESS_INVALID){ | 152 | entry->entry_state == INGRESS_INVALID){ |
153 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, NIPQUAD(entry->ctrl_info.in_dst_ip)); | 153 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %pI4, sending MPOA res req\n", |
154 | mpc->dev->name, &entry->ctrl_info.in_dst_ip); | ||
154 | entry->entry_state = INGRESS_RESOLVING; | 155 | entry->entry_state = INGRESS_RESOLVING; |
155 | msg.type = SND_MPOA_RES_RQST; | 156 | msg.type = SND_MPOA_RES_RQST; |
156 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); | 157 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); |
@@ -184,7 +185,8 @@ static void in_cache_remove_entry(in_cache_entry *entry, | |||
184 | struct k_message msg; | 185 | struct k_message msg; |
185 | 186 | ||
186 | vcc = entry->shortcut; | 187 | vcc = entry->shortcut; |
187 | dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",NIPQUAD(entry->ctrl_info.in_dst_ip)); | 188 | dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %pI4\n", |
189 | &entry->ctrl_info.in_dst_ip); | ||
188 | 190 | ||
189 | if (entry->prev != NULL) | 191 | if (entry->prev != NULL) |
190 | entry->prev->next = entry->next; | 192 | entry->prev->next = entry->next; |
@@ -228,7 +230,8 @@ static void clear_count_and_expired(struct mpoa_client *client) | |||
228 | next_entry = entry->next; | 230 | next_entry = entry->next; |
229 | if((now.tv_sec - entry->tv.tv_sec) | 231 | if((now.tv_sec - entry->tv.tv_sec) |
230 | > entry->ctrl_info.holding_time){ | 232 | > entry->ctrl_info.holding_time){ |
231 | dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(entry->ctrl_info.in_dst_ip)); | 233 | dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %pI4\n", |
234 | &entry->ctrl_info.in_dst_ip); | ||
232 | client->in_ops->remove_entry(entry, client); | 235 | client->in_ops->remove_entry(entry, client); |
233 | } | 236 | } |
234 | entry = next_entry; | 237 | entry = next_entry; |
@@ -453,7 +456,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli | |||
453 | return NULL; | 456 | return NULL; |
454 | } | 457 | } |
455 | 458 | ||
456 | dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip)); | 459 | dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %pI4, this should be our IP\n", |
460 | &msg->content.eg_info.eg_dst_ip); | ||
457 | 461 | ||
458 | atomic_set(&entry->use, 1); | 462 | atomic_set(&entry->use, 1); |
459 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n"); | 463 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n"); |
@@ -469,8 +473,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli | |||
469 | do_gettimeofday(&(entry->tv)); | 473 | do_gettimeofday(&(entry->tv)); |
470 | entry->entry_state = EGRESS_RESOLVED; | 474 | entry->entry_state = EGRESS_RESOLVED; |
471 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); | 475 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); |
472 | dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n", | 476 | dprintk("mpoa: mpoa_caches.c: mps_ip = %pI4\n", |
473 | NIPQUAD(entry->ctrl_info.mps_ip)); | 477 | &entry->ctrl_info.mps_ip); |
474 | atomic_inc(&entry->use); | 478 | atomic_inc(&entry->use); |
475 | 479 | ||
476 | write_unlock_irq(&client->egress_lock); | 480 | write_unlock_irq(&client->egress_lock); |
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c index f288fc4aef9b..c1d877bb5dff 100644 --- a/net/ax25/sysctl_net_ax25.c +++ b/net/ax25/sysctl_net_ax25.c | |||
@@ -43,8 +43,8 @@ static const ctl_table ax25_param_table[] = { | |||
43 | .procname = "ip_default_mode", | 43 | .procname = "ip_default_mode", |
44 | .maxlen = sizeof(int), | 44 | .maxlen = sizeof(int), |
45 | .mode = 0644, | 45 | .mode = 0644, |
46 | .proc_handler = &proc_dointvec_minmax, | 46 | .proc_handler = proc_dointvec_minmax, |
47 | .strategy = &sysctl_intvec, | 47 | .strategy = sysctl_intvec, |
48 | .extra1 = &min_ipdefmode, | 48 | .extra1 = &min_ipdefmode, |
49 | .extra2 = &max_ipdefmode | 49 | .extra2 = &max_ipdefmode |
50 | }, | 50 | }, |
@@ -53,8 +53,8 @@ static const ctl_table ax25_param_table[] = { | |||
53 | .procname = "ax25_default_mode", | 53 | .procname = "ax25_default_mode", |
54 | .maxlen = sizeof(int), | 54 | .maxlen = sizeof(int), |
55 | .mode = 0644, | 55 | .mode = 0644, |
56 | .proc_handler = &proc_dointvec_minmax, | 56 | .proc_handler = proc_dointvec_minmax, |
57 | .strategy = &sysctl_intvec, | 57 | .strategy = sysctl_intvec, |
58 | .extra1 = &min_axdefmode, | 58 | .extra1 = &min_axdefmode, |
59 | .extra2 = &max_axdefmode | 59 | .extra2 = &max_axdefmode |
60 | }, | 60 | }, |
@@ -63,8 +63,8 @@ static const ctl_table ax25_param_table[] = { | |||
63 | .procname = "backoff_type", | 63 | .procname = "backoff_type", |
64 | .maxlen = sizeof(int), | 64 | .maxlen = sizeof(int), |
65 | .mode = 0644, | 65 | .mode = 0644, |
66 | .proc_handler = &proc_dointvec_minmax, | 66 | .proc_handler = proc_dointvec_minmax, |
67 | .strategy = &sysctl_intvec, | 67 | .strategy = sysctl_intvec, |
68 | .extra1 = &min_backoff, | 68 | .extra1 = &min_backoff, |
69 | .extra2 = &max_backoff | 69 | .extra2 = &max_backoff |
70 | }, | 70 | }, |
@@ -73,8 +73,8 @@ static const ctl_table ax25_param_table[] = { | |||
73 | .procname = "connect_mode", | 73 | .procname = "connect_mode", |
74 | .maxlen = sizeof(int), | 74 | .maxlen = sizeof(int), |
75 | .mode = 0644, | 75 | .mode = 0644, |
76 | .proc_handler = &proc_dointvec_minmax, | 76 | .proc_handler = proc_dointvec_minmax, |
77 | .strategy = &sysctl_intvec, | 77 | .strategy = sysctl_intvec, |
78 | .extra1 = &min_conmode, | 78 | .extra1 = &min_conmode, |
79 | .extra2 = &max_conmode | 79 | .extra2 = &max_conmode |
80 | }, | 80 | }, |
@@ -83,8 +83,8 @@ static const ctl_table ax25_param_table[] = { | |||
83 | .procname = "standard_window_size", | 83 | .procname = "standard_window_size", |
84 | .maxlen = sizeof(int), | 84 | .maxlen = sizeof(int), |
85 | .mode = 0644, | 85 | .mode = 0644, |
86 | .proc_handler = &proc_dointvec_minmax, | 86 | .proc_handler = proc_dointvec_minmax, |
87 | .strategy = &sysctl_intvec, | 87 | .strategy = sysctl_intvec, |
88 | .extra1 = &min_window, | 88 | .extra1 = &min_window, |
89 | .extra2 = &max_window | 89 | .extra2 = &max_window |
90 | }, | 90 | }, |
@@ -93,8 +93,8 @@ static const ctl_table ax25_param_table[] = { | |||
93 | .procname = "extended_window_size", | 93 | .procname = "extended_window_size", |
94 | .maxlen = sizeof(int), | 94 | .maxlen = sizeof(int), |
95 | .mode = 0644, | 95 | .mode = 0644, |
96 | .proc_handler = &proc_dointvec_minmax, | 96 | .proc_handler = proc_dointvec_minmax, |
97 | .strategy = &sysctl_intvec, | 97 | .strategy = sysctl_intvec, |
98 | .extra1 = &min_ewindow, | 98 | .extra1 = &min_ewindow, |
99 | .extra2 = &max_ewindow | 99 | .extra2 = &max_ewindow |
100 | }, | 100 | }, |
@@ -103,8 +103,8 @@ static const ctl_table ax25_param_table[] = { | |||
103 | .procname = "t1_timeout", | 103 | .procname = "t1_timeout", |
104 | .maxlen = sizeof(int), | 104 | .maxlen = sizeof(int), |
105 | .mode = 0644, | 105 | .mode = 0644, |
106 | .proc_handler = &proc_dointvec_minmax, | 106 | .proc_handler = proc_dointvec_minmax, |
107 | .strategy = &sysctl_intvec, | 107 | .strategy = sysctl_intvec, |
108 | .extra1 = &min_t1, | 108 | .extra1 = &min_t1, |
109 | .extra2 = &max_t1 | 109 | .extra2 = &max_t1 |
110 | }, | 110 | }, |
@@ -113,8 +113,8 @@ static const ctl_table ax25_param_table[] = { | |||
113 | .procname = "t2_timeout", | 113 | .procname = "t2_timeout", |
114 | .maxlen = sizeof(int), | 114 | .maxlen = sizeof(int), |
115 | .mode = 0644, | 115 | .mode = 0644, |
116 | .proc_handler = &proc_dointvec_minmax, | 116 | .proc_handler = proc_dointvec_minmax, |
117 | .strategy = &sysctl_intvec, | 117 | .strategy = sysctl_intvec, |
118 | .extra1 = &min_t2, | 118 | .extra1 = &min_t2, |
119 | .extra2 = &max_t2 | 119 | .extra2 = &max_t2 |
120 | }, | 120 | }, |
@@ -123,8 +123,8 @@ static const ctl_table ax25_param_table[] = { | |||
123 | .procname = "t3_timeout", | 123 | .procname = "t3_timeout", |
124 | .maxlen = sizeof(int), | 124 | .maxlen = sizeof(int), |
125 | .mode = 0644, | 125 | .mode = 0644, |
126 | .proc_handler = &proc_dointvec_minmax, | 126 | .proc_handler = proc_dointvec_minmax, |
127 | .strategy = &sysctl_intvec, | 127 | .strategy = sysctl_intvec, |
128 | .extra1 = &min_t3, | 128 | .extra1 = &min_t3, |
129 | .extra2 = &max_t3 | 129 | .extra2 = &max_t3 |
130 | }, | 130 | }, |
@@ -133,8 +133,8 @@ static const ctl_table ax25_param_table[] = { | |||
133 | .procname = "idle_timeout", | 133 | .procname = "idle_timeout", |
134 | .maxlen = sizeof(int), | 134 | .maxlen = sizeof(int), |
135 | .mode = 0644, | 135 | .mode = 0644, |
136 | .proc_handler = &proc_dointvec_minmax, | 136 | .proc_handler = proc_dointvec_minmax, |
137 | .strategy = &sysctl_intvec, | 137 | .strategy = sysctl_intvec, |
138 | .extra1 = &min_idle, | 138 | .extra1 = &min_idle, |
139 | .extra2 = &max_idle | 139 | .extra2 = &max_idle |
140 | }, | 140 | }, |
@@ -143,8 +143,8 @@ static const ctl_table ax25_param_table[] = { | |||
143 | .procname = "maximum_retry_count", | 143 | .procname = "maximum_retry_count", |
144 | .maxlen = sizeof(int), | 144 | .maxlen = sizeof(int), |
145 | .mode = 0644, | 145 | .mode = 0644, |
146 | .proc_handler = &proc_dointvec_minmax, | 146 | .proc_handler = proc_dointvec_minmax, |
147 | .strategy = &sysctl_intvec, | 147 | .strategy = sysctl_intvec, |
148 | .extra1 = &min_n2, | 148 | .extra1 = &min_n2, |
149 | .extra2 = &max_n2 | 149 | .extra2 = &max_n2 |
150 | }, | 150 | }, |
@@ -153,8 +153,8 @@ static const ctl_table ax25_param_table[] = { | |||
153 | .procname = "maximum_packet_length", | 153 | .procname = "maximum_packet_length", |
154 | .maxlen = sizeof(int), | 154 | .maxlen = sizeof(int), |
155 | .mode = 0644, | 155 | .mode = 0644, |
156 | .proc_handler = &proc_dointvec_minmax, | 156 | .proc_handler = proc_dointvec_minmax, |
157 | .strategy = &sysctl_intvec, | 157 | .strategy = sysctl_intvec, |
158 | .extra1 = &min_paclen, | 158 | .extra1 = &min_paclen, |
159 | .extra2 = &max_paclen | 159 | .extra2 = &max_paclen |
160 | }, | 160 | }, |
@@ -163,8 +163,8 @@ static const ctl_table ax25_param_table[] = { | |||
163 | .procname = "protocol", | 163 | .procname = "protocol", |
164 | .maxlen = sizeof(int), | 164 | .maxlen = sizeof(int), |
165 | .mode = 0644, | 165 | .mode = 0644, |
166 | .proc_handler = &proc_dointvec_minmax, | 166 | .proc_handler = proc_dointvec_minmax, |
167 | .strategy = &sysctl_intvec, | 167 | .strategy = sysctl_intvec, |
168 | .extra1 = &min_proto, | 168 | .extra1 = &min_proto, |
169 | .extra2 = &max_proto | 169 | .extra2 = &max_proto |
170 | }, | 170 | }, |
@@ -174,8 +174,8 @@ static const ctl_table ax25_param_table[] = { | |||
174 | .procname = "dama_slave_timeout", | 174 | .procname = "dama_slave_timeout", |
175 | .maxlen = sizeof(int), | 175 | .maxlen = sizeof(int), |
176 | .mode = 0644, | 176 | .mode = 0644, |
177 | .proc_handler = &proc_dointvec_minmax, | 177 | .proc_handler = proc_dointvec_minmax, |
178 | .strategy = &sysctl_intvec, | 178 | .strategy = sysctl_intvec, |
179 | .extra1 = &min_ds_timeout, | 179 | .extra1 = &min_ds_timeout, |
180 | .extra2 = &max_ds_timeout | 180 | .extra2 = &max_ds_timeout |
181 | }, | 181 | }, |
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 80ba30cf4b68..7a4d5303b4fe 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -311,7 +311,6 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) | |||
311 | struct sk_buff *nskb; | 311 | struct sk_buff *nskb; |
312 | u8 type; | 312 | u8 type; |
313 | 313 | ||
314 | dev->last_rx = jiffies; | ||
315 | s->stats.rx_bytes += skb->len; | 314 | s->stats.rx_bytes += skb->len; |
316 | 315 | ||
317 | type = *(u8 *) skb->data; skb_pull(skb, 1); | 316 | type = *(u8 *) skb->data; skb_pull(skb, 1); |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index f4f6615cad9f..f2bbb2f65434 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -113,8 +113,7 @@ void hci_conn_add_sysfs(struct hci_conn *conn) | |||
113 | conn->dev.class = bt_class; | 113 | conn->dev.class = bt_class; |
114 | conn->dev.parent = &hdev->dev; | 114 | conn->dev.parent = &hdev->dev; |
115 | 115 | ||
116 | snprintf(conn->dev.bus_id, BUS_ID_SIZE, "%s:%d", | 116 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); |
117 | hdev->name, conn->handle); | ||
118 | 117 | ||
119 | dev_set_drvdata(&conn->dev, conn); | 118 | dev_set_drvdata(&conn->dev, conn); |
120 | 119 | ||
@@ -132,7 +131,7 @@ void hci_conn_add_sysfs(struct hci_conn *conn) | |||
132 | */ | 131 | */ |
133 | static int __match_tty(struct device *dev, void *data) | 132 | static int __match_tty(struct device *dev, void *data) |
134 | { | 133 | { |
135 | return !strncmp(dev->bus_id, "rfcomm", 6); | 134 | return !strncmp(dev_name(dev), "rfcomm", 6); |
136 | } | 135 | } |
137 | 136 | ||
138 | static void del_conn(struct work_struct *work) | 137 | static void del_conn(struct work_struct *work) |
@@ -421,7 +420,7 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
421 | dev->class = bt_class; | 420 | dev->class = bt_class; |
422 | dev->parent = hdev->parent; | 421 | dev->parent = hdev->parent; |
423 | 422 | ||
424 | strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE); | 423 | dev_set_name(dev, hdev->name); |
425 | 424 | ||
426 | dev_set_drvdata(dev, hdev); | 425 | dev_set_drvdata(dev, hdev); |
427 | 426 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index fa5cda4e552a..db6176d96e71 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -938,35 +938,35 @@ static ctl_table brnf_table[] = { | |||
938 | .data = &brnf_call_arptables, | 938 | .data = &brnf_call_arptables, |
939 | .maxlen = sizeof(int), | 939 | .maxlen = sizeof(int), |
940 | .mode = 0644, | 940 | .mode = 0644, |
941 | .proc_handler = &brnf_sysctl_call_tables, | 941 | .proc_handler = brnf_sysctl_call_tables, |
942 | }, | 942 | }, |
943 | { | 943 | { |
944 | .procname = "bridge-nf-call-iptables", | 944 | .procname = "bridge-nf-call-iptables", |
945 | .data = &brnf_call_iptables, | 945 | .data = &brnf_call_iptables, |
946 | .maxlen = sizeof(int), | 946 | .maxlen = sizeof(int), |
947 | .mode = 0644, | 947 | .mode = 0644, |
948 | .proc_handler = &brnf_sysctl_call_tables, | 948 | .proc_handler = brnf_sysctl_call_tables, |
949 | }, | 949 | }, |
950 | { | 950 | { |
951 | .procname = "bridge-nf-call-ip6tables", | 951 | .procname = "bridge-nf-call-ip6tables", |
952 | .data = &brnf_call_ip6tables, | 952 | .data = &brnf_call_ip6tables, |
953 | .maxlen = sizeof(int), | 953 | .maxlen = sizeof(int), |
954 | .mode = 0644, | 954 | .mode = 0644, |
955 | .proc_handler = &brnf_sysctl_call_tables, | 955 | .proc_handler = brnf_sysctl_call_tables, |
956 | }, | 956 | }, |
957 | { | 957 | { |
958 | .procname = "bridge-nf-filter-vlan-tagged", | 958 | .procname = "bridge-nf-filter-vlan-tagged", |
959 | .data = &brnf_filter_vlan_tagged, | 959 | .data = &brnf_filter_vlan_tagged, |
960 | .maxlen = sizeof(int), | 960 | .maxlen = sizeof(int), |
961 | .mode = 0644, | 961 | .mode = 0644, |
962 | .proc_handler = &brnf_sysctl_call_tables, | 962 | .proc_handler = brnf_sysctl_call_tables, |
963 | }, | 963 | }, |
964 | { | 964 | { |
965 | .procname = "bridge-nf-filter-pppoe-tagged", | 965 | .procname = "bridge-nf-filter-pppoe-tagged", |
966 | .data = &brnf_filter_pppoe_tagged, | 966 | .data = &brnf_filter_pppoe_tagged, |
967 | .maxlen = sizeof(int), | 967 | .maxlen = sizeof(int), |
968 | .mode = 0644, | 968 | .mode = 0644, |
969 | .proc_handler = &brnf_sysctl_call_tables, | 969 | .proc_handler = brnf_sysctl_call_tables, |
970 | }, | 970 | }, |
971 | { .ctl_name = 0 } | 971 | { .ctl_name = 0 } |
972 | }; | 972 | }; |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index 3d33c608906a..d44cbf8c374a 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -79,7 +79,6 @@ print_ports(const struct sk_buff *skb, uint8_t protocol, int offset) | |||
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | #define myNIPQUAD(a) a[0], a[1], a[2], a[3] | ||
83 | static void | 82 | static void |
84 | ebt_log_packet(u_int8_t pf, unsigned int hooknum, | 83 | ebt_log_packet(u_int8_t pf, unsigned int hooknum, |
85 | const struct sk_buff *skb, const struct net_device *in, | 84 | const struct sk_buff *skb, const struct net_device *in, |
@@ -113,9 +112,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, | |||
113 | printk(" INCOMPLETE IP header"); | 112 | printk(" INCOMPLETE IP header"); |
114 | goto out; | 113 | goto out; |
115 | } | 114 | } |
116 | printk(" IP SRC=%u.%u.%u.%u IP DST=%u.%u.%u.%u, IP " | 115 | printk(" IP SRC=%pI4 IP DST=%pI4, IP tos=0x%02X, IP proto=%d", |
117 | "tos=0x%02X, IP proto=%d", NIPQUAD(ih->saddr), | 116 | &ih->saddr, &ih->daddr, ih->tos, ih->protocol); |
118 | NIPQUAD(ih->daddr), ih->tos, ih->protocol); | ||
119 | print_ports(skb, ih->protocol, ih->ihl*4); | 117 | print_ports(skb, ih->protocol, ih->ihl*4); |
120 | goto out; | 118 | goto out; |
121 | } | 119 | } |
@@ -133,10 +131,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, | |||
133 | printk(" INCOMPLETE IPv6 header"); | 131 | printk(" INCOMPLETE IPv6 header"); |
134 | goto out; | 132 | goto out; |
135 | } | 133 | } |
136 | printk(" IPv6 SRC=%x:%x:%x:%x:%x:%x:%x:%x " | 134 | 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 " | 135 | &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; | 136 | nexthdr = ih->nexthdr; |
141 | offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr); | 137 | offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr); |
142 | if (offset_ph == -1) | 138 | if (offset_ph == -1) |
@@ -177,12 +173,10 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, | |||
177 | } | 173 | } |
178 | printk(" ARP MAC SRC="); | 174 | printk(" ARP MAC SRC="); |
179 | print_MAC(ap->mac_src); | 175 | print_MAC(ap->mac_src); |
180 | printk(" ARP IP SRC=%u.%u.%u.%u", | 176 | printk(" ARP IP SRC=%pI4", ap->ip_src); |
181 | myNIPQUAD(ap->ip_src)); | ||
182 | printk(" ARP MAC DST="); | 177 | printk(" ARP MAC DST="); |
183 | print_MAC(ap->mac_dst); | 178 | print_MAC(ap->mac_dst); |
184 | printk(" ARP IP DST=%u.%u.%u.%u", | 179 | printk(" ARP IP DST=%pI4", ap->ip_dst); |
185 | myNIPQUAD(ap->ip_dst)); | ||
186 | } | 180 | } |
187 | } | 181 | } |
188 | out: | 182 | out: |
diff --git a/net/core/datagram.c b/net/core/datagram.c index ee631843c2f5..5e2ac0c4b07c 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -209,7 +209,7 @@ struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | |||
209 | void skb_free_datagram(struct sock *sk, struct sk_buff *skb) | 209 | void skb_free_datagram(struct sock *sk, struct sk_buff *skb) |
210 | { | 210 | { |
211 | kfree_skb(skb); | 211 | kfree_skb(skb); |
212 | sk_mem_reclaim(sk); | 212 | sk_mem_reclaim_partial(sk); |
213 | } | 213 | } |
214 | 214 | ||
215 | /** | 215 | /** |
@@ -248,8 +248,7 @@ int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) | |||
248 | spin_unlock_bh(&sk->sk_receive_queue.lock); | 248 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
249 | } | 249 | } |
250 | 250 | ||
251 | kfree_skb(skb); | 251 | skb_free_datagram(sk, skb); |
252 | sk_mem_reclaim(sk); | ||
253 | return err; | 252 | return err; |
254 | } | 253 | } |
255 | 254 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 9174c77d3112..31568b2068ac 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 | ||
926 | rollback: | 926 | rollback: |
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); |
@@ -2251,8 +2256,10 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2251 | rcu_read_lock(); | 2256 | rcu_read_lock(); |
2252 | 2257 | ||
2253 | /* Don't receive packets in an exiting network namespace */ | 2258 | /* Don't receive packets in an exiting network namespace */ |
2254 | if (!net_alive(dev_net(skb->dev))) | 2259 | if (!net_alive(dev_net(skb->dev))) { |
2260 | kfree_skb(skb); | ||
2255 | goto out; | 2261 | goto out; |
2262 | } | ||
2256 | 2263 | ||
2257 | #ifdef CONFIG_NET_CLS_ACT | 2264 | #ifdef CONFIG_NET_CLS_ACT |
2258 | if (skb->tc_verd & TC_NCLS) { | 2265 | if (skb->tc_verd & TC_NCLS) { |
@@ -2371,7 +2378,7 @@ EXPORT_SYMBOL(__napi_schedule); | |||
2371 | static void net_rx_action(struct softirq_action *h) | 2378 | static void net_rx_action(struct softirq_action *h) |
2372 | { | 2379 | { |
2373 | struct list_head *list = &__get_cpu_var(softnet_data).poll_list; | 2380 | struct list_head *list = &__get_cpu_var(softnet_data).poll_list; |
2374 | unsigned long start_time = jiffies; | 2381 | unsigned long time_limit = jiffies + 2; |
2375 | int budget = netdev_budget; | 2382 | int budget = netdev_budget; |
2376 | void *have; | 2383 | void *have; |
2377 | 2384 | ||
@@ -2382,13 +2389,10 @@ static void net_rx_action(struct softirq_action *h) | |||
2382 | int work, weight; | 2389 | int work, weight; |
2383 | 2390 | ||
2384 | /* If softirq window is exhuasted then punt. | 2391 | /* If softirq window is exhuasted then punt. |
2385 | * | 2392 | * Allow this to run for 2 jiffies since which will allow |
2386 | * Note that this is a slight policy change from the | 2393 | * an average latency of 1.5/HZ. |
2387 | * previous NAPI code, which would allow up to 2 | ||
2388 | * jiffies to pass before breaking out. The test | ||
2389 | * used to be "jiffies - start_time > 1". | ||
2390 | */ | 2394 | */ |
2391 | if (unlikely(budget <= 0 || jiffies != start_time)) | 2395 | if (unlikely(budget <= 0 || time_after(jiffies, time_limit))) |
2392 | goto softnet_break; | 2396 | goto softnet_break; |
2393 | 2397 | ||
2394 | local_irq_enable(); | 2398 | local_irq_enable(); |
@@ -4463,6 +4467,15 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4463 | if (dev->features & NETIF_F_NETNS_LOCAL) | 4467 | if (dev->features & NETIF_F_NETNS_LOCAL) |
4464 | goto out; | 4468 | goto out; |
4465 | 4469 | ||
4470 | #ifdef CONFIG_SYSFS | ||
4471 | /* Don't allow real devices to be moved when sysfs | ||
4472 | * is enabled. | ||
4473 | */ | ||
4474 | err = -EINVAL; | ||
4475 | if (dev->dev.parent) | ||
4476 | goto out; | ||
4477 | #endif | ||
4478 | |||
4466 | /* Ensure the device has been registrered */ | 4479 | /* Ensure the device has been registrered */ |
4467 | err = -EINVAL; | 4480 | err = -EINVAL; |
4468 | if (dev->reg_state != NETREG_REGISTERED) | 4481 | if (dev->reg_state != NETREG_REGISTERED) |
@@ -4520,6 +4533,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4520 | */ | 4533 | */ |
4521 | dev_addr_discard(dev); | 4534 | dev_addr_discard(dev); |
4522 | 4535 | ||
4536 | netdev_unregister_kobject(dev); | ||
4537 | |||
4523 | /* Actually switch the network namespace */ | 4538 | /* Actually switch the network namespace */ |
4524 | dev_net_set(dev, net); | 4539 | dev_net_set(dev, net); |
4525 | 4540 | ||
@@ -4536,7 +4551,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4536 | } | 4551 | } |
4537 | 4552 | ||
4538 | /* Fixup kobjects */ | 4553 | /* Fixup kobjects */ |
4539 | netdev_unregister_kobject(dev); | ||
4540 | err = netdev_register_kobject(dev); | 4554 | err = netdev_register_kobject(dev); |
4541 | WARN_ON(err); | 4555 | WARN_ON(err); |
4542 | 4556 | ||
@@ -4843,6 +4857,12 @@ static void __net_exit default_device_exit(struct net *net) | |||
4843 | if (dev->features & NETIF_F_NETNS_LOCAL) | 4857 | if (dev->features & NETIF_F_NETNS_LOCAL) |
4844 | continue; | 4858 | continue; |
4845 | 4859 | ||
4860 | /* Delete virtual devices */ | ||
4861 | if (dev->rtnl_link_ops && dev->rtnl_link_ops->dellink) { | ||
4862 | dev->rtnl_link_ops->dellink(dev); | ||
4863 | continue; | ||
4864 | } | ||
4865 | |||
4846 | /* Push remaing network devices to init_net */ | 4866 | /* Push remaing network devices to init_net */ |
4847 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); | 4867 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); |
4848 | err = dev_change_net_namespace(dev, &init_net, fb_name); | 4868 | err = dev_change_net_namespace(dev, &init_net, fb_name); |
@@ -4889,9 +4909,6 @@ static int __init net_dev_init(void) | |||
4889 | if (register_pernet_subsys(&netdev_net_ops)) | 4909 | if (register_pernet_subsys(&netdev_net_ops)) |
4890 | goto out; | 4910 | goto out; |
4891 | 4911 | ||
4892 | if (register_pernet_device(&default_device_ops)) | ||
4893 | goto out; | ||
4894 | |||
4895 | /* | 4912 | /* |
4896 | * Initialise the packet receive queues. | 4913 | * Initialise the packet receive queues. |
4897 | */ | 4914 | */ |
@@ -4908,10 +4925,25 @@ static int __init net_dev_init(void) | |||
4908 | queue->backlog.weight = weight_p; | 4925 | queue->backlog.weight = weight_p; |
4909 | } | 4926 | } |
4910 | 4927 | ||
4911 | netdev_dma_register(); | ||
4912 | |||
4913 | dev_boot_phase = 0; | 4928 | dev_boot_phase = 0; |
4914 | 4929 | ||
4930 | /* The loopback device is special if any other network devices | ||
4931 | * is present in a network namespace the loopback device must | ||
4932 | * be present. Since we now dynamically allocate and free the | ||
4933 | * loopback device ensure this invariant is maintained by | ||
4934 | * keeping the loopback device as the first device on the | ||
4935 | * list of network devices. Ensuring the loopback devices | ||
4936 | * is the first device that appears and the last network device | ||
4937 | * that disappears. | ||
4938 | */ | ||
4939 | if (register_pernet_device(&loopback_net_ops)) | ||
4940 | goto out; | ||
4941 | |||
4942 | if (register_pernet_device(&default_device_ops)) | ||
4943 | goto out; | ||
4944 | |||
4945 | netdev_dma_register(); | ||
4946 | |||
4915 | open_softirq(NET_TX_SOFTIRQ, net_tx_action); | 4947 | open_softirq(NET_TX_SOFTIRQ, net_tx_action); |
4916 | open_softirq(NET_RX_SOFTIRQ, net_rx_action); | 4948 | open_softirq(NET_RX_SOFTIRQ, net_rx_action); |
4917 | 4949 | ||
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 79de3b14a8d1..32b3a0152d7a 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -664,17 +664,18 @@ static int __init fib_rules_init(void) | |||
664 | rtnl_register(PF_UNSPEC, RTM_DELRULE, fib_nl_delrule, NULL); | 664 | rtnl_register(PF_UNSPEC, RTM_DELRULE, fib_nl_delrule, NULL); |
665 | rtnl_register(PF_UNSPEC, RTM_GETRULE, NULL, fib_nl_dumprule); | 665 | rtnl_register(PF_UNSPEC, RTM_GETRULE, NULL, fib_nl_dumprule); |
666 | 666 | ||
667 | err = register_netdevice_notifier(&fib_rules_notifier); | 667 | err = register_pernet_subsys(&fib_rules_net_ops); |
668 | if (err < 0) | 668 | if (err < 0) |
669 | goto fail; | 669 | goto fail; |
670 | 670 | ||
671 | err = register_pernet_subsys(&fib_rules_net_ops); | 671 | err = register_netdevice_notifier(&fib_rules_notifier); |
672 | if (err < 0) | 672 | if (err < 0) |
673 | goto fail_unregister; | 673 | goto fail_unregister; |
674 | |||
674 | return 0; | 675 | return 0; |
675 | 676 | ||
676 | fail_unregister: | 677 | fail_unregister: |
677 | unregister_netdevice_notifier(&fib_rules_notifier); | 678 | unregister_pernet_subsys(&fib_rules_net_ops); |
678 | fail: | 679 | fail: |
679 | rtnl_unregister(PF_UNSPEC, RTM_NEWRULE); | 680 | rtnl_unregister(PF_UNSPEC, RTM_NEWRULE); |
680 | rtnl_unregister(PF_UNSPEC, RTM_DELRULE); | 681 | rtnl_unregister(PF_UNSPEC, RTM_DELRULE); |
diff --git a/net/core/flow.c b/net/core/flow.c index 5cf81052d044..d323388dd1ba 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
@@ -307,7 +307,7 @@ void flow_cache_flush(void) | |||
307 | put_online_cpus(); | 307 | put_online_cpus(); |
308 | } | 308 | } |
309 | 309 | ||
310 | static void __devinit flow_cache_cpu_prepare(int cpu) | 310 | static void __init flow_cache_cpu_prepare(int cpu) |
311 | { | 311 | { |
312 | struct tasklet_struct *tasklet; | 312 | struct tasklet_struct *tasklet; |
313 | unsigned long order; | 313 | unsigned long order; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 1dc728b38589..d9bbe010e0ee 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 | ||
@@ -2568,128 +2566,128 @@ static struct neigh_sysctl_table { | |||
2568 | .procname = "mcast_solicit", | 2566 | .procname = "mcast_solicit", |
2569 | .maxlen = sizeof(int), | 2567 | .maxlen = sizeof(int), |
2570 | .mode = 0644, | 2568 | .mode = 0644, |
2571 | .proc_handler = &proc_dointvec, | 2569 | .proc_handler = proc_dointvec, |
2572 | }, | 2570 | }, |
2573 | { | 2571 | { |
2574 | .ctl_name = NET_NEIGH_UCAST_SOLICIT, | 2572 | .ctl_name = NET_NEIGH_UCAST_SOLICIT, |
2575 | .procname = "ucast_solicit", | 2573 | .procname = "ucast_solicit", |
2576 | .maxlen = sizeof(int), | 2574 | .maxlen = sizeof(int), |
2577 | .mode = 0644, | 2575 | .mode = 0644, |
2578 | .proc_handler = &proc_dointvec, | 2576 | .proc_handler = proc_dointvec, |
2579 | }, | 2577 | }, |
2580 | { | 2578 | { |
2581 | .ctl_name = NET_NEIGH_APP_SOLICIT, | 2579 | .ctl_name = NET_NEIGH_APP_SOLICIT, |
2582 | .procname = "app_solicit", | 2580 | .procname = "app_solicit", |
2583 | .maxlen = sizeof(int), | 2581 | .maxlen = sizeof(int), |
2584 | .mode = 0644, | 2582 | .mode = 0644, |
2585 | .proc_handler = &proc_dointvec, | 2583 | .proc_handler = proc_dointvec, |
2586 | }, | 2584 | }, |
2587 | { | 2585 | { |
2588 | .procname = "retrans_time", | 2586 | .procname = "retrans_time", |
2589 | .maxlen = sizeof(int), | 2587 | .maxlen = sizeof(int), |
2590 | .mode = 0644, | 2588 | .mode = 0644, |
2591 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2589 | .proc_handler = proc_dointvec_userhz_jiffies, |
2592 | }, | 2590 | }, |
2593 | { | 2591 | { |
2594 | .ctl_name = NET_NEIGH_REACHABLE_TIME, | 2592 | .ctl_name = NET_NEIGH_REACHABLE_TIME, |
2595 | .procname = "base_reachable_time", | 2593 | .procname = "base_reachable_time", |
2596 | .maxlen = sizeof(int), | 2594 | .maxlen = sizeof(int), |
2597 | .mode = 0644, | 2595 | .mode = 0644, |
2598 | .proc_handler = &proc_dointvec_jiffies, | 2596 | .proc_handler = proc_dointvec_jiffies, |
2599 | .strategy = &sysctl_jiffies, | 2597 | .strategy = sysctl_jiffies, |
2600 | }, | 2598 | }, |
2601 | { | 2599 | { |
2602 | .ctl_name = NET_NEIGH_DELAY_PROBE_TIME, | 2600 | .ctl_name = NET_NEIGH_DELAY_PROBE_TIME, |
2603 | .procname = "delay_first_probe_time", | 2601 | .procname = "delay_first_probe_time", |
2604 | .maxlen = sizeof(int), | 2602 | .maxlen = sizeof(int), |
2605 | .mode = 0644, | 2603 | .mode = 0644, |
2606 | .proc_handler = &proc_dointvec_jiffies, | 2604 | .proc_handler = proc_dointvec_jiffies, |
2607 | .strategy = &sysctl_jiffies, | 2605 | .strategy = sysctl_jiffies, |
2608 | }, | 2606 | }, |
2609 | { | 2607 | { |
2610 | .ctl_name = NET_NEIGH_GC_STALE_TIME, | 2608 | .ctl_name = NET_NEIGH_GC_STALE_TIME, |
2611 | .procname = "gc_stale_time", | 2609 | .procname = "gc_stale_time", |
2612 | .maxlen = sizeof(int), | 2610 | .maxlen = sizeof(int), |
2613 | .mode = 0644, | 2611 | .mode = 0644, |
2614 | .proc_handler = &proc_dointvec_jiffies, | 2612 | .proc_handler = proc_dointvec_jiffies, |
2615 | .strategy = &sysctl_jiffies, | 2613 | .strategy = sysctl_jiffies, |
2616 | }, | 2614 | }, |
2617 | { | 2615 | { |
2618 | .ctl_name = NET_NEIGH_UNRES_QLEN, | 2616 | .ctl_name = NET_NEIGH_UNRES_QLEN, |
2619 | .procname = "unres_qlen", | 2617 | .procname = "unres_qlen", |
2620 | .maxlen = sizeof(int), | 2618 | .maxlen = sizeof(int), |
2621 | .mode = 0644, | 2619 | .mode = 0644, |
2622 | .proc_handler = &proc_dointvec, | 2620 | .proc_handler = proc_dointvec, |
2623 | }, | 2621 | }, |
2624 | { | 2622 | { |
2625 | .ctl_name = NET_NEIGH_PROXY_QLEN, | 2623 | .ctl_name = NET_NEIGH_PROXY_QLEN, |
2626 | .procname = "proxy_qlen", | 2624 | .procname = "proxy_qlen", |
2627 | .maxlen = sizeof(int), | 2625 | .maxlen = sizeof(int), |
2628 | .mode = 0644, | 2626 | .mode = 0644, |
2629 | .proc_handler = &proc_dointvec, | 2627 | .proc_handler = proc_dointvec, |
2630 | }, | 2628 | }, |
2631 | { | 2629 | { |
2632 | .procname = "anycast_delay", | 2630 | .procname = "anycast_delay", |
2633 | .maxlen = sizeof(int), | 2631 | .maxlen = sizeof(int), |
2634 | .mode = 0644, | 2632 | .mode = 0644, |
2635 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2633 | .proc_handler = proc_dointvec_userhz_jiffies, |
2636 | }, | 2634 | }, |
2637 | { | 2635 | { |
2638 | .procname = "proxy_delay", | 2636 | .procname = "proxy_delay", |
2639 | .maxlen = sizeof(int), | 2637 | .maxlen = sizeof(int), |
2640 | .mode = 0644, | 2638 | .mode = 0644, |
2641 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2639 | .proc_handler = proc_dointvec_userhz_jiffies, |
2642 | }, | 2640 | }, |
2643 | { | 2641 | { |
2644 | .procname = "locktime", | 2642 | .procname = "locktime", |
2645 | .maxlen = sizeof(int), | 2643 | .maxlen = sizeof(int), |
2646 | .mode = 0644, | 2644 | .mode = 0644, |
2647 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2645 | .proc_handler = proc_dointvec_userhz_jiffies, |
2648 | }, | 2646 | }, |
2649 | { | 2647 | { |
2650 | .ctl_name = NET_NEIGH_RETRANS_TIME_MS, | 2648 | .ctl_name = NET_NEIGH_RETRANS_TIME_MS, |
2651 | .procname = "retrans_time_ms", | 2649 | .procname = "retrans_time_ms", |
2652 | .maxlen = sizeof(int), | 2650 | .maxlen = sizeof(int), |
2653 | .mode = 0644, | 2651 | .mode = 0644, |
2654 | .proc_handler = &proc_dointvec_ms_jiffies, | 2652 | .proc_handler = proc_dointvec_ms_jiffies, |
2655 | .strategy = &sysctl_ms_jiffies, | 2653 | .strategy = sysctl_ms_jiffies, |
2656 | }, | 2654 | }, |
2657 | { | 2655 | { |
2658 | .ctl_name = NET_NEIGH_REACHABLE_TIME_MS, | 2656 | .ctl_name = NET_NEIGH_REACHABLE_TIME_MS, |
2659 | .procname = "base_reachable_time_ms", | 2657 | .procname = "base_reachable_time_ms", |
2660 | .maxlen = sizeof(int), | 2658 | .maxlen = sizeof(int), |
2661 | .mode = 0644, | 2659 | .mode = 0644, |
2662 | .proc_handler = &proc_dointvec_ms_jiffies, | 2660 | .proc_handler = proc_dointvec_ms_jiffies, |
2663 | .strategy = &sysctl_ms_jiffies, | 2661 | .strategy = sysctl_ms_jiffies, |
2664 | }, | 2662 | }, |
2665 | { | 2663 | { |
2666 | .ctl_name = NET_NEIGH_GC_INTERVAL, | 2664 | .ctl_name = NET_NEIGH_GC_INTERVAL, |
2667 | .procname = "gc_interval", | 2665 | .procname = "gc_interval", |
2668 | .maxlen = sizeof(int), | 2666 | .maxlen = sizeof(int), |
2669 | .mode = 0644, | 2667 | .mode = 0644, |
2670 | .proc_handler = &proc_dointvec_jiffies, | 2668 | .proc_handler = proc_dointvec_jiffies, |
2671 | .strategy = &sysctl_jiffies, | 2669 | .strategy = sysctl_jiffies, |
2672 | }, | 2670 | }, |
2673 | { | 2671 | { |
2674 | .ctl_name = NET_NEIGH_GC_THRESH1, | 2672 | .ctl_name = NET_NEIGH_GC_THRESH1, |
2675 | .procname = "gc_thresh1", | 2673 | .procname = "gc_thresh1", |
2676 | .maxlen = sizeof(int), | 2674 | .maxlen = sizeof(int), |
2677 | .mode = 0644, | 2675 | .mode = 0644, |
2678 | .proc_handler = &proc_dointvec, | 2676 | .proc_handler = proc_dointvec, |
2679 | }, | 2677 | }, |
2680 | { | 2678 | { |
2681 | .ctl_name = NET_NEIGH_GC_THRESH2, | 2679 | .ctl_name = NET_NEIGH_GC_THRESH2, |
2682 | .procname = "gc_thresh2", | 2680 | .procname = "gc_thresh2", |
2683 | .maxlen = sizeof(int), | 2681 | .maxlen = sizeof(int), |
2684 | .mode = 0644, | 2682 | .mode = 0644, |
2685 | .proc_handler = &proc_dointvec, | 2683 | .proc_handler = proc_dointvec, |
2686 | }, | 2684 | }, |
2687 | { | 2685 | { |
2688 | .ctl_name = NET_NEIGH_GC_THRESH3, | 2686 | .ctl_name = NET_NEIGH_GC_THRESH3, |
2689 | .procname = "gc_thresh3", | 2687 | .procname = "gc_thresh3", |
2690 | .maxlen = sizeof(int), | 2688 | .maxlen = sizeof(int), |
2691 | .mode = 0644, | 2689 | .mode = 0644, |
2692 | .proc_handler = &proc_dointvec, | 2690 | .proc_handler = proc_dointvec, |
2693 | }, | 2691 | }, |
2694 | {}, | 2692 | {}, |
2695 | }, | 2693 | }, |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 92d6b9467314..146dcfeb060e 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 | ||
@@ -490,7 +494,7 @@ int netdev_register_kobject(struct net_device *net) | |||
490 | dev->groups = groups; | 494 | dev->groups = groups; |
491 | 495 | ||
492 | BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ); | 496 | BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ); |
493 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); | 497 | dev_set_name(dev, net->name); |
494 | 498 | ||
495 | #ifdef CONFIG_SYSFS | 499 | #ifdef CONFIG_SYSFS |
496 | *groups++ = &netstat_group; | 500 | *groups++ = &netstat_group; |
@@ -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 | ||
554 | void netpoll_print_options(struct netpoll *np) | 554 | void 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 | ||
571 | int netpoll_parse_options(struct netpoll *np, char *opt) | 570 | int netpoll_parse_options(struct netpoll *np, char *opt) |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index a47f5bad110d..a4f5ad1ab352 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -422,6 +422,7 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, | |||
422 | const char *ifname); | 422 | const char *ifname); |
423 | static int pktgen_device_event(struct notifier_block *, unsigned long, void *); | 423 | static int pktgen_device_event(struct notifier_block *, unsigned long, void *); |
424 | static void pktgen_run_all_threads(void); | 424 | static void pktgen_run_all_threads(void); |
425 | static void pktgen_reset_all_threads(void); | ||
425 | static void pktgen_stop_all_threads_ifs(void); | 426 | static void pktgen_stop_all_threads_ifs(void); |
426 | static int pktgen_stop_device(struct pktgen_dev *pkt_dev); | 427 | static int pktgen_stop_device(struct pktgen_dev *pkt_dev); |
427 | static void pktgen_stop(struct pktgen_thread *t); | 428 | static void pktgen_stop(struct pktgen_thread *t); |
@@ -480,6 +481,9 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf, | |||
480 | else if (!strcmp(data, "start")) | 481 | else if (!strcmp(data, "start")) |
481 | pktgen_run_all_threads(); | 482 | pktgen_run_all_threads(); |
482 | 483 | ||
484 | else if (!strcmp(data, "reset")) | ||
485 | pktgen_reset_all_threads(); | ||
486 | |||
483 | else | 487 | else |
484 | printk(KERN_WARNING "pktgen: Unknown command: %s\n", data); | 488 | printk(KERN_WARNING "pktgen: Unknown command: %s\n", data); |
485 | 489 | ||
@@ -509,7 +513,6 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
509 | __u64 sa; | 513 | __u64 sa; |
510 | __u64 stopped; | 514 | __u64 stopped; |
511 | __u64 now = getCurUs(); | 515 | __u64 now = getCurUs(); |
512 | DECLARE_MAC_BUF(mac); | ||
513 | 516 | ||
514 | seq_printf(seq, | 517 | seq_printf(seq, |
515 | "Params: count %llu min_pkt_size: %u max_pkt_size: %u\n", | 518 | "Params: count %llu min_pkt_size: %u max_pkt_size: %u\n", |
@@ -554,12 +557,12 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
554 | 557 | ||
555 | seq_puts(seq, " src_mac: "); | 558 | seq_puts(seq, " src_mac: "); |
556 | 559 | ||
557 | seq_printf(seq, "%s ", | 560 | seq_printf(seq, "%pM ", |
558 | print_mac(mac, is_zero_ether_addr(pkt_dev->src_mac) ? | 561 | is_zero_ether_addr(pkt_dev->src_mac) ? |
559 | pkt_dev->odev->dev_addr : pkt_dev->src_mac)); | 562 | pkt_dev->odev->dev_addr : pkt_dev->src_mac); |
560 | 563 | ||
561 | seq_printf(seq, "dst_mac: "); | 564 | seq_printf(seq, "dst_mac: "); |
562 | seq_printf(seq, "%s\n", print_mac(mac, pkt_dev->dst_mac)); | 565 | seq_printf(seq, "%pM\n", pkt_dev->dst_mac); |
563 | 566 | ||
564 | seq_printf(seq, | 567 | seq_printf(seq, |
565 | " udp_src_min: %d udp_src_max: %d udp_dst_min: %d udp_dst_max: %d\n", | 568 | " udp_src_min: %d udp_src_max: %d udp_dst_min: %d udp_dst_max: %d\n", |
@@ -3174,6 +3177,24 @@ static void pktgen_run_all_threads(void) | |||
3174 | pktgen_wait_all_threads_run(); | 3177 | pktgen_wait_all_threads_run(); |
3175 | } | 3178 | } |
3176 | 3179 | ||
3180 | static void pktgen_reset_all_threads(void) | ||
3181 | { | ||
3182 | struct pktgen_thread *t; | ||
3183 | |||
3184 | pr_debug("pktgen: entering pktgen_reset_all_threads.\n"); | ||
3185 | |||
3186 | mutex_lock(&pktgen_thread_lock); | ||
3187 | |||
3188 | list_for_each_entry(t, &pktgen_threads, th_list) | ||
3189 | t->control |= (T_REMDEVALL); | ||
3190 | |||
3191 | mutex_unlock(&pktgen_thread_lock); | ||
3192 | |||
3193 | schedule_timeout_interruptible(msecs_to_jiffies(125)); /* Propagate thread->control */ | ||
3194 | |||
3195 | pktgen_wait_all_threads_run(); | ||
3196 | } | ||
3197 | |||
3177 | static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) | 3198 | static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) |
3178 | { | 3199 | { |
3179 | __u64 total_us, bps, mbps, pps, idle; | 3200 | __u64 total_us, bps, mbps, pps, idle; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index d49ef8301b5b..267185a848f6 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -501,7 +501,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
501 | new->network_header = old->network_header; | 501 | new->network_header = old->network_header; |
502 | new->mac_header = old->mac_header; | 502 | new->mac_header = old->mac_header; |
503 | new->dst = dst_clone(old->dst); | 503 | new->dst = dst_clone(old->dst); |
504 | #ifdef CONFIG_INET | 504 | #ifdef CONFIG_XFRM |
505 | new->sp = secpath_get(old->sp); | 505 | new->sp = secpath_get(old->sp); |
506 | #endif | 506 | #endif |
507 | memcpy(new->cb, old->cb, sizeof(old->cb)); | 507 | memcpy(new->cb, old->cb, sizeof(old->cb)); |
@@ -556,6 +556,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb) | |||
556 | C(truesize); | 556 | C(truesize); |
557 | #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) | 557 | #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) |
558 | C(do_not_encrypt); | 558 | C(do_not_encrypt); |
559 | C(requeue); | ||
559 | #endif | 560 | #endif |
560 | atomic_set(&n->users, 1); | 561 | atomic_set(&n->users, 1); |
561 | 562 | ||
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/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index f686467ff12b..2bc0384b0448 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -22,7 +22,7 @@ static struct ctl_table net_core_table[] = { | |||
22 | .data = &sysctl_wmem_max, | 22 | .data = &sysctl_wmem_max, |
23 | .maxlen = sizeof(int), | 23 | .maxlen = sizeof(int), |
24 | .mode = 0644, | 24 | .mode = 0644, |
25 | .proc_handler = &proc_dointvec | 25 | .proc_handler = proc_dointvec |
26 | }, | 26 | }, |
27 | { | 27 | { |
28 | .ctl_name = NET_CORE_RMEM_MAX, | 28 | .ctl_name = NET_CORE_RMEM_MAX, |
@@ -30,7 +30,7 @@ static struct ctl_table net_core_table[] = { | |||
30 | .data = &sysctl_rmem_max, | 30 | .data = &sysctl_rmem_max, |
31 | .maxlen = sizeof(int), | 31 | .maxlen = sizeof(int), |
32 | .mode = 0644, | 32 | .mode = 0644, |
33 | .proc_handler = &proc_dointvec | 33 | .proc_handler = proc_dointvec |
34 | }, | 34 | }, |
35 | { | 35 | { |
36 | .ctl_name = NET_CORE_WMEM_DEFAULT, | 36 | .ctl_name = NET_CORE_WMEM_DEFAULT, |
@@ -38,7 +38,7 @@ static struct ctl_table net_core_table[] = { | |||
38 | .data = &sysctl_wmem_default, | 38 | .data = &sysctl_wmem_default, |
39 | .maxlen = sizeof(int), | 39 | .maxlen = sizeof(int), |
40 | .mode = 0644, | 40 | .mode = 0644, |
41 | .proc_handler = &proc_dointvec | 41 | .proc_handler = proc_dointvec |
42 | }, | 42 | }, |
43 | { | 43 | { |
44 | .ctl_name = NET_CORE_RMEM_DEFAULT, | 44 | .ctl_name = NET_CORE_RMEM_DEFAULT, |
@@ -46,7 +46,7 @@ static struct ctl_table net_core_table[] = { | |||
46 | .data = &sysctl_rmem_default, | 46 | .data = &sysctl_rmem_default, |
47 | .maxlen = sizeof(int), | 47 | .maxlen = sizeof(int), |
48 | .mode = 0644, | 48 | .mode = 0644, |
49 | .proc_handler = &proc_dointvec | 49 | .proc_handler = proc_dointvec |
50 | }, | 50 | }, |
51 | { | 51 | { |
52 | .ctl_name = NET_CORE_DEV_WEIGHT, | 52 | .ctl_name = NET_CORE_DEV_WEIGHT, |
@@ -54,7 +54,7 @@ static struct ctl_table net_core_table[] = { | |||
54 | .data = &weight_p, | 54 | .data = &weight_p, |
55 | .maxlen = sizeof(int), | 55 | .maxlen = sizeof(int), |
56 | .mode = 0644, | 56 | .mode = 0644, |
57 | .proc_handler = &proc_dointvec | 57 | .proc_handler = proc_dointvec |
58 | }, | 58 | }, |
59 | { | 59 | { |
60 | .ctl_name = NET_CORE_MAX_BACKLOG, | 60 | .ctl_name = NET_CORE_MAX_BACKLOG, |
@@ -62,7 +62,7 @@ static struct ctl_table net_core_table[] = { | |||
62 | .data = &netdev_max_backlog, | 62 | .data = &netdev_max_backlog, |
63 | .maxlen = sizeof(int), | 63 | .maxlen = sizeof(int), |
64 | .mode = 0644, | 64 | .mode = 0644, |
65 | .proc_handler = &proc_dointvec | 65 | .proc_handler = proc_dointvec |
66 | }, | 66 | }, |
67 | { | 67 | { |
68 | .ctl_name = NET_CORE_MSG_COST, | 68 | .ctl_name = NET_CORE_MSG_COST, |
@@ -70,8 +70,8 @@ static struct ctl_table net_core_table[] = { | |||
70 | .data = &net_ratelimit_state.interval, | 70 | .data = &net_ratelimit_state.interval, |
71 | .maxlen = sizeof(int), | 71 | .maxlen = sizeof(int), |
72 | .mode = 0644, | 72 | .mode = 0644, |
73 | .proc_handler = &proc_dointvec_jiffies, | 73 | .proc_handler = proc_dointvec_jiffies, |
74 | .strategy = &sysctl_jiffies, | 74 | .strategy = sysctl_jiffies, |
75 | }, | 75 | }, |
76 | { | 76 | { |
77 | .ctl_name = NET_CORE_MSG_BURST, | 77 | .ctl_name = NET_CORE_MSG_BURST, |
@@ -79,7 +79,7 @@ static struct ctl_table net_core_table[] = { | |||
79 | .data = &net_ratelimit_state.burst, | 79 | .data = &net_ratelimit_state.burst, |
80 | .maxlen = sizeof(int), | 80 | .maxlen = sizeof(int), |
81 | .mode = 0644, | 81 | .mode = 0644, |
82 | .proc_handler = &proc_dointvec, | 82 | .proc_handler = proc_dointvec, |
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | .ctl_name = NET_CORE_OPTMEM_MAX, | 85 | .ctl_name = NET_CORE_OPTMEM_MAX, |
@@ -87,7 +87,7 @@ static struct ctl_table net_core_table[] = { | |||
87 | .data = &sysctl_optmem_max, | 87 | .data = &sysctl_optmem_max, |
88 | .maxlen = sizeof(int), | 88 | .maxlen = sizeof(int), |
89 | .mode = 0644, | 89 | .mode = 0644, |
90 | .proc_handler = &proc_dointvec | 90 | .proc_handler = proc_dointvec |
91 | }, | 91 | }, |
92 | #ifdef CONFIG_XFRM | 92 | #ifdef CONFIG_XFRM |
93 | { | 93 | { |
@@ -96,7 +96,7 @@ static struct ctl_table net_core_table[] = { | |||
96 | .data = &sysctl_xfrm_aevent_etime, | 96 | .data = &sysctl_xfrm_aevent_etime, |
97 | .maxlen = sizeof(u32), | 97 | .maxlen = sizeof(u32), |
98 | .mode = 0644, | 98 | .mode = 0644, |
99 | .proc_handler = &proc_dointvec | 99 | .proc_handler = proc_dointvec |
100 | }, | 100 | }, |
101 | { | 101 | { |
102 | .ctl_name = NET_CORE_AEVENT_RSEQTH, | 102 | .ctl_name = NET_CORE_AEVENT_RSEQTH, |
@@ -104,7 +104,7 @@ static struct ctl_table net_core_table[] = { | |||
104 | .data = &sysctl_xfrm_aevent_rseqth, | 104 | .data = &sysctl_xfrm_aevent_rseqth, |
105 | .maxlen = sizeof(u32), | 105 | .maxlen = sizeof(u32), |
106 | .mode = 0644, | 106 | .mode = 0644, |
107 | .proc_handler = &proc_dointvec | 107 | .proc_handler = proc_dointvec |
108 | }, | 108 | }, |
109 | { | 109 | { |
110 | .ctl_name = CTL_UNNUMBERED, | 110 | .ctl_name = CTL_UNNUMBERED, |
@@ -112,7 +112,7 @@ static struct ctl_table net_core_table[] = { | |||
112 | .data = &sysctl_xfrm_larval_drop, | 112 | .data = &sysctl_xfrm_larval_drop, |
113 | .maxlen = sizeof(int), | 113 | .maxlen = sizeof(int), |
114 | .mode = 0644, | 114 | .mode = 0644, |
115 | .proc_handler = &proc_dointvec | 115 | .proc_handler = proc_dointvec |
116 | }, | 116 | }, |
117 | { | 117 | { |
118 | .ctl_name = CTL_UNNUMBERED, | 118 | .ctl_name = CTL_UNNUMBERED, |
@@ -120,7 +120,7 @@ static struct ctl_table net_core_table[] = { | |||
120 | .data = &sysctl_xfrm_acq_expires, | 120 | .data = &sysctl_xfrm_acq_expires, |
121 | .maxlen = sizeof(int), | 121 | .maxlen = sizeof(int), |
122 | .mode = 0644, | 122 | .mode = 0644, |
123 | .proc_handler = &proc_dointvec | 123 | .proc_handler = proc_dointvec |
124 | }, | 124 | }, |
125 | #endif /* CONFIG_XFRM */ | 125 | #endif /* CONFIG_XFRM */ |
126 | #endif /* CONFIG_NET */ | 126 | #endif /* CONFIG_NET */ |
@@ -130,7 +130,7 @@ static struct ctl_table net_core_table[] = { | |||
130 | .data = &netdev_budget, | 130 | .data = &netdev_budget, |
131 | .maxlen = sizeof(int), | 131 | .maxlen = sizeof(int), |
132 | .mode = 0644, | 132 | .mode = 0644, |
133 | .proc_handler = &proc_dointvec | 133 | .proc_handler = proc_dointvec |
134 | }, | 134 | }, |
135 | { | 135 | { |
136 | .ctl_name = NET_CORE_WARNINGS, | 136 | .ctl_name = NET_CORE_WARNINGS, |
@@ -138,7 +138,7 @@ static struct ctl_table net_core_table[] = { | |||
138 | .data = &net_msg_warn, | 138 | .data = &net_msg_warn, |
139 | .maxlen = sizeof(int), | 139 | .maxlen = sizeof(int), |
140 | .mode = 0644, | 140 | .mode = 0644, |
141 | .proc_handler = &proc_dointvec | 141 | .proc_handler = proc_dointvec |
142 | }, | 142 | }, |
143 | { .ctl_name = 0 } | 143 | { .ctl_name = 0 } |
144 | }; | 144 | }; |
@@ -150,7 +150,7 @@ static struct ctl_table netns_core_table[] = { | |||
150 | .data = &init_net.core.sysctl_somaxconn, | 150 | .data = &init_net.core.sysctl_somaxconn, |
151 | .maxlen = sizeof(int), | 151 | .maxlen = sizeof(int), |
152 | .mode = 0644, | 152 | .mode = 0644, |
153 | .proc_handler = &proc_dointvec | 153 | .proc_handler = proc_dointvec |
154 | }, | 154 | }, |
155 | { .ctl_name = 0 } | 155 | { .ctl_name = 0 } |
156 | }; | 156 | }; |
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index b4bc6e095a0e..dee4a90886d6 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -252,7 +252,8 @@ extern const char *dccp_state_name(const int state); | |||
252 | extern void dccp_set_state(struct sock *sk, const int state); | 252 | extern void dccp_set_state(struct sock *sk, const int state); |
253 | extern void dccp_done(struct sock *sk); | 253 | extern void dccp_done(struct sock *sk); |
254 | 254 | ||
255 | extern void dccp_reqsk_init(struct request_sock *req, struct sk_buff *skb); | 255 | extern int dccp_reqsk_init(struct request_sock *rq, struct dccp_sock const *dp, |
256 | struct sk_buff const *skb); | ||
256 | 257 | ||
257 | extern int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb); | 258 | extern int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb); |
258 | 259 | ||
@@ -441,6 +442,8 @@ static inline int dccp_ack_pending(const struct sock *sk) | |||
441 | inet_csk_ack_scheduled(sk); | 442 | inet_csk_ack_scheduled(sk); |
442 | } | 443 | } |
443 | 444 | ||
445 | extern void dccp_feat_list_purge(struct list_head *fn_list); | ||
446 | |||
444 | extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb); | 447 | extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb); |
445 | extern int dccp_insert_options_rsk(struct dccp_request_sock*, struct sk_buff*); | 448 | extern int dccp_insert_options_rsk(struct dccp_request_sock*, struct sk_buff*); |
446 | extern int dccp_insert_option_elapsed_time(struct sock *sk, | 449 | extern int dccp_insert_option_elapsed_time(struct sock *sk, |
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 933a0ecf8d46..069d8ffe4c6f 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
@@ -23,6 +23,171 @@ | |||
23 | 23 | ||
24 | #define DCCP_FEAT_SP_NOAGREE (-123) | 24 | #define DCCP_FEAT_SP_NOAGREE (-123) |
25 | 25 | ||
26 | static const struct { | ||
27 | u8 feat_num; /* DCCPF_xxx */ | ||
28 | enum dccp_feat_type rxtx; /* RX or TX */ | ||
29 | enum dccp_feat_type reconciliation; /* SP or NN */ | ||
30 | u8 default_value; /* as in 6.4 */ | ||
31 | /* | ||
32 | * Lookup table for location and type of features (from RFC 4340/4342) | ||
33 | * +--------------------------+----+-----+----+----+---------+-----------+ | ||
34 | * | Feature | Location | Reconc. | Initial | Section | | ||
35 | * | | RX | TX | SP | NN | Value | Reference | | ||
36 | * +--------------------------+----+-----+----+----+---------+-----------+ | ||
37 | * | DCCPF_CCID | | X | X | | 2 | 10 | | ||
38 | * | DCCPF_SHORT_SEQNOS | | X | X | | 0 | 7.6.1 | | ||
39 | * | DCCPF_SEQUENCE_WINDOW | | X | | X | 100 | 7.5.2 | | ||
40 | * | DCCPF_ECN_INCAPABLE | X | | X | | 0 | 12.1 | | ||
41 | * | DCCPF_ACK_RATIO | | X | | X | 2 | 11.3 | | ||
42 | * | DCCPF_SEND_ACK_VECTOR | X | | X | | 0 | 11.5 | | ||
43 | * | DCCPF_SEND_NDP_COUNT | | X | X | | 0 | 7.7.2 | | ||
44 | * | DCCPF_MIN_CSUM_COVER | X | | X | | 0 | 9.2.1 | | ||
45 | * | DCCPF_DATA_CHECKSUM | X | | X | | 0 | 9.3.1 | | ||
46 | * | DCCPF_SEND_LEV_RATE | X | | X | | 0 | 4342/8.4 | | ||
47 | * +--------------------------+----+-----+----+----+---------+-----------+ | ||
48 | */ | ||
49 | } dccp_feat_table[] = { | ||
50 | { DCCPF_CCID, FEAT_AT_TX, FEAT_SP, 2 }, | ||
51 | { DCCPF_SHORT_SEQNOS, FEAT_AT_TX, FEAT_SP, 0 }, | ||
52 | { DCCPF_SEQUENCE_WINDOW, FEAT_AT_TX, FEAT_NN, 100 }, | ||
53 | { DCCPF_ECN_INCAPABLE, FEAT_AT_RX, FEAT_SP, 0 }, | ||
54 | { DCCPF_ACK_RATIO, FEAT_AT_TX, FEAT_NN, 2 }, | ||
55 | { DCCPF_SEND_ACK_VECTOR, FEAT_AT_RX, FEAT_SP, 0 }, | ||
56 | { DCCPF_SEND_NDP_COUNT, FEAT_AT_TX, FEAT_SP, 0 }, | ||
57 | { DCCPF_MIN_CSUM_COVER, FEAT_AT_RX, FEAT_SP, 0 }, | ||
58 | { DCCPF_DATA_CHECKSUM, FEAT_AT_RX, FEAT_SP, 0 }, | ||
59 | { DCCPF_SEND_LEV_RATE, FEAT_AT_RX, FEAT_SP, 0 }, | ||
60 | }; | ||
61 | #define DCCP_FEAT_SUPPORTED_MAX ARRAY_SIZE(dccp_feat_table) | ||
62 | |||
63 | /** | ||
64 | * dccp_feat_index - Hash function to map feature number into array position | ||
65 | * Returns consecutive array index or -1 if the feature is not understood. | ||
66 | */ | ||
67 | static int dccp_feat_index(u8 feat_num) | ||
68 | { | ||
69 | /* The first 9 entries are occupied by the types from RFC 4340, 6.4 */ | ||
70 | if (feat_num > DCCPF_RESERVED && feat_num <= DCCPF_DATA_CHECKSUM) | ||
71 | return feat_num - 1; | ||
72 | |||
73 | /* | ||
74 | * Other features: add cases for new feature types here after adding | ||
75 | * them to the above table. | ||
76 | */ | ||
77 | switch (feat_num) { | ||
78 | case DCCPF_SEND_LEV_RATE: | ||
79 | return DCCP_FEAT_SUPPORTED_MAX - 1; | ||
80 | } | ||
81 | return -1; | ||
82 | } | ||
83 | |||
84 | static u8 dccp_feat_type(u8 feat_num) | ||
85 | { | ||
86 | int idx = dccp_feat_index(feat_num); | ||
87 | |||
88 | if (idx < 0) | ||
89 | return FEAT_UNKNOWN; | ||
90 | return dccp_feat_table[idx].reconciliation; | ||
91 | } | ||
92 | |||
93 | /* copy constructor, fval must not already contain allocated memory */ | ||
94 | static int dccp_feat_clone_sp_val(dccp_feat_val *fval, u8 const *val, u8 len) | ||
95 | { | ||
96 | fval->sp.len = len; | ||
97 | if (fval->sp.len > 0) { | ||
98 | fval->sp.vec = kmemdup(val, len, gfp_any()); | ||
99 | if (fval->sp.vec == NULL) { | ||
100 | fval->sp.len = 0; | ||
101 | return -ENOBUFS; | ||
102 | } | ||
103 | } | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static void dccp_feat_val_destructor(u8 feat_num, dccp_feat_val *val) | ||
108 | { | ||
109 | if (unlikely(val == NULL)) | ||
110 | return; | ||
111 | if (dccp_feat_type(feat_num) == FEAT_SP) | ||
112 | kfree(val->sp.vec); | ||
113 | memset(val, 0, sizeof(*val)); | ||
114 | } | ||
115 | |||
116 | static struct dccp_feat_entry * | ||
117 | dccp_feat_clone_entry(struct dccp_feat_entry const *original) | ||
118 | { | ||
119 | struct dccp_feat_entry *new; | ||
120 | u8 type = dccp_feat_type(original->feat_num); | ||
121 | |||
122 | if (type == FEAT_UNKNOWN) | ||
123 | return NULL; | ||
124 | |||
125 | new = kmemdup(original, sizeof(struct dccp_feat_entry), gfp_any()); | ||
126 | if (new == NULL) | ||
127 | return NULL; | ||
128 | |||
129 | if (type == FEAT_SP && dccp_feat_clone_sp_val(&new->val, | ||
130 | original->val.sp.vec, | ||
131 | original->val.sp.len)) { | ||
132 | kfree(new); | ||
133 | return NULL; | ||
134 | } | ||
135 | return new; | ||
136 | } | ||
137 | |||
138 | static void dccp_feat_entry_destructor(struct dccp_feat_entry *entry) | ||
139 | { | ||
140 | if (entry != NULL) { | ||
141 | dccp_feat_val_destructor(entry->feat_num, &entry->val); | ||
142 | kfree(entry); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * List management functions | ||
148 | * | ||
149 | * Feature negotiation lists rely on and maintain the following invariants: | ||
150 | * - each feat_num in the list is known, i.e. we know its type and default value | ||
151 | * - each feat_num/is_local combination is unique (old entries are overwritten) | ||
152 | * - SP values are always freshly allocated | ||
153 | * - list is sorted in increasing order of feature number (faster lookup) | ||
154 | */ | ||
155 | |||
156 | static inline void dccp_feat_list_pop(struct dccp_feat_entry *entry) | ||
157 | { | ||
158 | list_del(&entry->node); | ||
159 | dccp_feat_entry_destructor(entry); | ||
160 | } | ||
161 | |||
162 | void dccp_feat_list_purge(struct list_head *fn_list) | ||
163 | { | ||
164 | struct dccp_feat_entry *entry, *next; | ||
165 | |||
166 | list_for_each_entry_safe(entry, next, fn_list, node) | ||
167 | dccp_feat_entry_destructor(entry); | ||
168 | INIT_LIST_HEAD(fn_list); | ||
169 | } | ||
170 | EXPORT_SYMBOL_GPL(dccp_feat_list_purge); | ||
171 | |||
172 | /* generate @to as full clone of @from - @to must not contain any nodes */ | ||
173 | int dccp_feat_clone_list(struct list_head const *from, struct list_head *to) | ||
174 | { | ||
175 | struct dccp_feat_entry *entry, *new; | ||
176 | |||
177 | INIT_LIST_HEAD(to); | ||
178 | list_for_each_entry(entry, from, node) { | ||
179 | new = dccp_feat_clone_entry(entry); | ||
180 | if (new == NULL) | ||
181 | goto cloning_failed; | ||
182 | list_add_tail(&new->node, to); | ||
183 | } | ||
184 | return 0; | ||
185 | |||
186 | cloning_failed: | ||
187 | dccp_feat_list_purge(to); | ||
188 | return -ENOMEM; | ||
189 | } | ||
190 | |||
26 | int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, | 191 | int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, |
27 | u8 *val, u8 len, gfp_t gfp) | 192 | u8 *val, u8 len, gfp_t gfp) |
28 | { | 193 | { |
@@ -639,6 +804,8 @@ const char *dccp_feat_name(const u8 feat) | |||
639 | if (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC) | 804 | if (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC) |
640 | return feature_names[DCCPF_RESERVED]; | 805 | return feature_names[DCCPF_RESERVED]; |
641 | 806 | ||
807 | if (feat == DCCPF_SEND_LEV_RATE) | ||
808 | return "Send Loss Event Rate"; | ||
642 | if (feat >= DCCPF_MIN_CCID_SPECIFIC) | 809 | if (feat >= DCCPF_MIN_CCID_SPECIFIC) |
643 | return "CCID-specific"; | 810 | return "CCID-specific"; |
644 | 811 | ||
diff --git a/net/dccp/feat.h b/net/dccp/feat.h index e272222c7ace..f5e99b39712a 100644 --- a/net/dccp/feat.h +++ b/net/dccp/feat.h | |||
@@ -14,6 +14,67 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include "dccp.h" | 15 | #include "dccp.h" |
16 | 16 | ||
17 | enum dccp_feat_type { | ||
18 | FEAT_AT_RX = 1, /* located at RX side of half-connection */ | ||
19 | FEAT_AT_TX = 2, /* located at TX side of half-connection */ | ||
20 | FEAT_SP = 4, /* server-priority reconciliation (6.3.1) */ | ||
21 | FEAT_NN = 8, /* non-negotiable reconciliation (6.3.2) */ | ||
22 | FEAT_UNKNOWN = 0xFF /* not understood or invalid feature */ | ||
23 | }; | ||
24 | |||
25 | enum dccp_feat_state { | ||
26 | FEAT_DEFAULT = 0, /* using default values from 6.4 */ | ||
27 | FEAT_INITIALISING, /* feature is being initialised */ | ||
28 | FEAT_CHANGING, /* Change sent but not confirmed yet */ | ||
29 | FEAT_UNSTABLE, /* local modification in state CHANGING */ | ||
30 | FEAT_STABLE /* both ends (think they) agree */ | ||
31 | }; | ||
32 | |||
33 | /** | ||
34 | * dccp_feat_val - Container for SP or NN feature values | ||
35 | * @nn: single NN value | ||
36 | * @sp.vec: single SP value plus optional preference list | ||
37 | * @sp.len: length of @sp.vec in bytes | ||
38 | */ | ||
39 | typedef union { | ||
40 | u64 nn; | ||
41 | struct { | ||
42 | u8 *vec; | ||
43 | u8 len; | ||
44 | } sp; | ||
45 | } dccp_feat_val; | ||
46 | |||
47 | /** | ||
48 | * struct feat_entry - Data structure to perform feature negotiation | ||
49 | * @val: feature's current value (SP features may have preference list) | ||
50 | * @state: feature's current state | ||
51 | * @feat_num: one of %dccp_feature_numbers | ||
52 | * @needs_mandatory: whether Mandatory options should be sent | ||
53 | * @needs_confirm: whether to send a Confirm instead of a Change | ||
54 | * @empty_confirm: whether to send an empty Confirm (depends on @needs_confirm) | ||
55 | * @is_local: feature location (1) or feature-remote (0) | ||
56 | * @node: list pointers, entries arranged in FIFO order | ||
57 | */ | ||
58 | struct dccp_feat_entry { | ||
59 | dccp_feat_val val; | ||
60 | enum dccp_feat_state state:8; | ||
61 | u8 feat_num; | ||
62 | |||
63 | bool needs_mandatory, | ||
64 | needs_confirm, | ||
65 | empty_confirm, | ||
66 | is_local; | ||
67 | |||
68 | struct list_head node; | ||
69 | }; | ||
70 | |||
71 | static inline u8 dccp_feat_genopt(struct dccp_feat_entry *entry) | ||
72 | { | ||
73 | if (entry->needs_confirm) | ||
74 | return entry->is_local ? DCCPO_CONFIRM_L : DCCPO_CONFIRM_R; | ||
75 | return entry->is_local ? DCCPO_CHANGE_L : DCCPO_CHANGE_R; | ||
76 | } | ||
77 | |||
17 | #ifdef CONFIG_IP_DCCP_DEBUG | 78 | #ifdef CONFIG_IP_DCCP_DEBUG |
18 | extern const char *dccp_feat_typename(const u8 type); | 79 | extern const char *dccp_feat_typename(const u8 type); |
19 | extern const char *dccp_feat_name(const u8 feat); | 80 | extern const char *dccp_feat_name(const u8 feat); |
@@ -35,6 +96,7 @@ extern int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature, | |||
35 | u8 *val, u8 len); | 96 | u8 *val, u8 len); |
36 | extern void dccp_feat_clean(struct dccp_minisock *dmsk); | 97 | extern void dccp_feat_clean(struct dccp_minisock *dmsk); |
37 | extern int dccp_feat_clone(struct sock *oldsk, struct sock *newsk); | 98 | extern int dccp_feat_clone(struct sock *oldsk, struct sock *newsk); |
99 | extern int dccp_feat_clone_list(struct list_head const *, struct list_head *); | ||
38 | extern int dccp_feat_init(struct dccp_minisock *dmsk); | 100 | extern int dccp_feat_init(struct dccp_minisock *dmsk); |
39 | 101 | ||
40 | #endif /* _DCCP_FEAT_H */ | 102 | #endif /* _DCCP_FEAT_H */ |
diff --git a/net/dccp/input.c b/net/dccp/input.c index 779d0ed9ae94..3070015edc75 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -590,8 +590,6 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
590 | if (inet_csk(sk)->icsk_af_ops->conn_request(sk, | 590 | if (inet_csk(sk)->icsk_af_ops->conn_request(sk, |
591 | skb) < 0) | 591 | skb) < 0) |
592 | return 1; | 592 | return 1; |
593 | |||
594 | /* FIXME: do congestion control initialization */ | ||
595 | goto discard; | 593 | goto discard; |
596 | } | 594 | } |
597 | if (dh->dccph_type == DCCP_PKT_RESET) | 595 | if (dh->dccph_type == DCCP_PKT_RESET) |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index e3dfddab21cc..528baa2e5be4 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -545,6 +545,7 @@ out: | |||
545 | 545 | ||
546 | static void dccp_v4_reqsk_destructor(struct request_sock *req) | 546 | static void dccp_v4_reqsk_destructor(struct request_sock *req) |
547 | { | 547 | { |
548 | dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); | ||
548 | kfree(inet_rsk(req)->opt); | 549 | kfree(inet_rsk(req)->opt); |
549 | } | 550 | } |
550 | 551 | ||
@@ -595,7 +596,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
595 | if (req == NULL) | 596 | if (req == NULL) |
596 | goto drop; | 597 | goto drop; |
597 | 598 | ||
598 | dccp_reqsk_init(req, skb); | 599 | if (dccp_reqsk_init(req, dccp_sk(sk), skb)) |
600 | goto drop_and_free; | ||
599 | 601 | ||
600 | dreq = dccp_rsk(req); | 602 | dreq = dccp_rsk(req); |
601 | if (dccp_parse_options(sk, dreq, skb)) | 603 | if (dccp_parse_options(sk, dreq, skb)) |
@@ -792,12 +794,10 @@ static int dccp_v4_rcv(struct sk_buff *skb) | |||
792 | DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(dh); | 794 | DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(dh); |
793 | DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type; | 795 | DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type; |
794 | 796 | ||
795 | dccp_pr_debug("%8.8s " | 797 | dccp_pr_debug("%8.8s src=%pI4@%-5d dst=%pI4@%-5d seq=%llu", |
796 | "src=%u.%u.%u.%u@%-5d " | ||
797 | "dst=%u.%u.%u.%u@%-5d seq=%llu", | ||
798 | dccp_packet_name(dh->dccph_type), | 798 | dccp_packet_name(dh->dccph_type), |
799 | NIPQUAD(iph->saddr), ntohs(dh->dccph_sport), | 799 | &iph->saddr, ntohs(dh->dccph_sport), |
800 | NIPQUAD(iph->daddr), ntohs(dh->dccph_dport), | 800 | &iph->daddr, ntohs(dh->dccph_dport), |
801 | (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq); | 801 | (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq); |
802 | 802 | ||
803 | if (dccp_packet_without_ack(skb)) { | 803 | if (dccp_packet_without_ack(skb)) { |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d4ce1224e008..4aa1148cdb20 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -304,6 +304,7 @@ done: | |||
304 | 304 | ||
305 | static void dccp_v6_reqsk_destructor(struct request_sock *req) | 305 | static void dccp_v6_reqsk_destructor(struct request_sock *req) |
306 | { | 306 | { |
307 | dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); | ||
307 | if (inet6_rsk(req)->pktopts != NULL) | 308 | if (inet6_rsk(req)->pktopts != NULL) |
308 | kfree_skb(inet6_rsk(req)->pktopts); | 309 | kfree_skb(inet6_rsk(req)->pktopts); |
309 | } | 310 | } |
@@ -426,7 +427,8 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
426 | if (req == NULL) | 427 | if (req == NULL) |
427 | goto drop; | 428 | goto drop; |
428 | 429 | ||
429 | dccp_reqsk_init(req, skb); | 430 | if (dccp_reqsk_init(req, dccp_sk(sk), skb)) |
431 | goto drop_and_free; | ||
430 | 432 | ||
431 | dreq = dccp_rsk(req); | 433 | dreq = dccp_rsk(req); |
432 | if (dccp_parse_options(sk, dreq, skb)) | 434 | if (dccp_parse_options(sk, dreq, skb)) |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index e6bf99e3e41a..afdacbb94d75 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -125,6 +125,7 @@ struct sock *dccp_create_openreq_child(struct sock *sk, | |||
125 | newdp->dccps_timestamp_time = dreq->dreq_timestamp_time; | 125 | newdp->dccps_timestamp_time = dreq->dreq_timestamp_time; |
126 | newicsk->icsk_rto = DCCP_TIMEOUT_INIT; | 126 | newicsk->icsk_rto = DCCP_TIMEOUT_INIT; |
127 | 127 | ||
128 | INIT_LIST_HEAD(&newdp->dccps_featneg); | ||
128 | if (dccp_feat_clone(sk, newsk)) | 129 | if (dccp_feat_clone(sk, newsk)) |
129 | goto out_free; | 130 | goto out_free; |
130 | 131 | ||
@@ -304,7 +305,8 @@ void dccp_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
304 | 305 | ||
305 | EXPORT_SYMBOL_GPL(dccp_reqsk_send_ack); | 306 | EXPORT_SYMBOL_GPL(dccp_reqsk_send_ack); |
306 | 307 | ||
307 | void dccp_reqsk_init(struct request_sock *req, struct sk_buff *skb) | 308 | int dccp_reqsk_init(struct request_sock *req, |
309 | struct dccp_sock const *dp, struct sk_buff const *skb) | ||
308 | { | 310 | { |
309 | struct dccp_request_sock *dreq = dccp_rsk(req); | 311 | struct dccp_request_sock *dreq = dccp_rsk(req); |
310 | 312 | ||
@@ -313,6 +315,9 @@ void dccp_reqsk_init(struct request_sock *req, struct sk_buff *skb) | |||
313 | inet_rsk(req)->acked = 0; | 315 | inet_rsk(req)->acked = 0; |
314 | req->rcv_wnd = sysctl_dccp_feat_sequence_window; | 316 | req->rcv_wnd = sysctl_dccp_feat_sequence_window; |
315 | dreq->dreq_timestamp_echo = 0; | 317 | dreq->dreq_timestamp_echo = 0; |
318 | |||
319 | /* inherit feature negotiation options from listening socket */ | ||
320 | return dccp_feat_clone_list(&dp->dccps_featneg, &dreq->dreq_featneg); | ||
316 | } | 321 | } |
317 | 322 | ||
318 | EXPORT_SYMBOL_GPL(dccp_reqsk_init); | 323 | EXPORT_SYMBOL_GPL(dccp_reqsk_init); |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 81368a7f5379..49ba8d5ec4b5 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
@@ -86,18 +86,18 @@ static int jdccp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
86 | if (port == 0 || ntohs(inet->dport) == port || | 86 | if (port == 0 || ntohs(inet->dport) == port || |
87 | ntohs(inet->sport) == port) { | 87 | ntohs(inet->sport) == port) { |
88 | if (hctx) | 88 | if (hctx) |
89 | printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %d %d %d %u " | 89 | printl("%pI4:%u %pI4:%u %d %d %d %d %u " |
90 | "%llu %llu %d\n", | 90 | "%llu %llu %d\n", |
91 | NIPQUAD(inet->saddr), ntohs(inet->sport), | 91 | &inet->saddr, ntohs(inet->sport), |
92 | NIPQUAD(inet->daddr), ntohs(inet->dport), size, | 92 | &inet->daddr, ntohs(inet->dport), size, |
93 | hctx->ccid3hctx_s, hctx->ccid3hctx_rtt, | 93 | hctx->ccid3hctx_s, hctx->ccid3hctx_rtt, |
94 | hctx->ccid3hctx_p, hctx->ccid3hctx_x_calc, | 94 | hctx->ccid3hctx_p, hctx->ccid3hctx_x_calc, |
95 | hctx->ccid3hctx_x_recv >> 6, | 95 | hctx->ccid3hctx_x_recv >> 6, |
96 | hctx->ccid3hctx_x >> 6, hctx->ccid3hctx_t_ipi); | 96 | hctx->ccid3hctx_x >> 6, hctx->ccid3hctx_t_ipi); |
97 | else | 97 | else |
98 | printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d\n", | 98 | printl("%pI4:%u %pI4:%u %d\n", |
99 | NIPQUAD(inet->saddr), ntohs(inet->sport), | 99 | &inet->saddr, ntohs(inet->sport), |
100 | NIPQUAD(inet->daddr), ntohs(inet->dport), size); | 100 | &inet->daddr, ntohs(inet->dport), size); |
101 | } | 101 | } |
102 | 102 | ||
103 | jprobe_return(); | 103 | jprobe_return(); |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index d0bd34819761..dafcefd86594 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -193,6 +193,7 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized) | |||
193 | 193 | ||
194 | dccp_init_xmit_timers(sk); | 194 | dccp_init_xmit_timers(sk); |
195 | 195 | ||
196 | INIT_LIST_HEAD(&dp->dccps_featneg); | ||
196 | /* | 197 | /* |
197 | * FIXME: We're hardcoding the CCID, and doing this at this point makes | 198 | * FIXME: We're hardcoding the CCID, and doing this at this point makes |
198 | * the listening (master) sock get CCID control blocks, which is not | 199 | * the listening (master) sock get CCID control blocks, which is not |
@@ -267,7 +268,7 @@ void dccp_destroy_sock(struct sock *sk) | |||
267 | dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; | 268 | dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; |
268 | 269 | ||
269 | /* clean up feature negotiation state */ | 270 | /* clean up feature negotiation state */ |
270 | dccp_feat_clean(dmsk); | 271 | dccp_feat_list_purge(&dp->dccps_featneg); |
271 | } | 272 | } |
272 | 273 | ||
273 | EXPORT_SYMBOL_GPL(dccp_destroy_sock); | 274 | EXPORT_SYMBOL_GPL(dccp_destroy_sock); |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 36400b266896..2f360a1e5e49 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -354,8 +354,8 @@ static ctl_table dn_table[] = { | |||
354 | .data = node_name, | 354 | .data = node_name, |
355 | .maxlen = 7, | 355 | .maxlen = 7, |
356 | .mode = 0644, | 356 | .mode = 0644, |
357 | .proc_handler = &proc_dostring, | 357 | .proc_handler = proc_dostring, |
358 | .strategy = &sysctl_string, | 358 | .strategy = sysctl_string, |
359 | }, | 359 | }, |
360 | { | 360 | { |
361 | .ctl_name = NET_DECNET_DEFAULT_DEVICE, | 361 | .ctl_name = NET_DECNET_DEFAULT_DEVICE, |
@@ -371,8 +371,8 @@ static ctl_table dn_table[] = { | |||
371 | .data = &decnet_time_wait, | 371 | .data = &decnet_time_wait, |
372 | .maxlen = sizeof(int), | 372 | .maxlen = sizeof(int), |
373 | .mode = 0644, | 373 | .mode = 0644, |
374 | .proc_handler = &proc_dointvec_minmax, | 374 | .proc_handler = proc_dointvec_minmax, |
375 | .strategy = &sysctl_intvec, | 375 | .strategy = sysctl_intvec, |
376 | .extra1 = &min_decnet_time_wait, | 376 | .extra1 = &min_decnet_time_wait, |
377 | .extra2 = &max_decnet_time_wait | 377 | .extra2 = &max_decnet_time_wait |
378 | }, | 378 | }, |
@@ -382,8 +382,8 @@ static ctl_table dn_table[] = { | |||
382 | .data = &decnet_dn_count, | 382 | .data = &decnet_dn_count, |
383 | .maxlen = sizeof(int), | 383 | .maxlen = sizeof(int), |
384 | .mode = 0644, | 384 | .mode = 0644, |
385 | .proc_handler = &proc_dointvec_minmax, | 385 | .proc_handler = proc_dointvec_minmax, |
386 | .strategy = &sysctl_intvec, | 386 | .strategy = sysctl_intvec, |
387 | .extra1 = &min_state_count, | 387 | .extra1 = &min_state_count, |
388 | .extra2 = &max_state_count | 388 | .extra2 = &max_state_count |
389 | }, | 389 | }, |
@@ -393,8 +393,8 @@ static ctl_table dn_table[] = { | |||
393 | .data = &decnet_di_count, | 393 | .data = &decnet_di_count, |
394 | .maxlen = sizeof(int), | 394 | .maxlen = sizeof(int), |
395 | .mode = 0644, | 395 | .mode = 0644, |
396 | .proc_handler = &proc_dointvec_minmax, | 396 | .proc_handler = proc_dointvec_minmax, |
397 | .strategy = &sysctl_intvec, | 397 | .strategy = sysctl_intvec, |
398 | .extra1 = &min_state_count, | 398 | .extra1 = &min_state_count, |
399 | .extra2 = &max_state_count | 399 | .extra2 = &max_state_count |
400 | }, | 400 | }, |
@@ -404,8 +404,8 @@ static ctl_table dn_table[] = { | |||
404 | .data = &decnet_dr_count, | 404 | .data = &decnet_dr_count, |
405 | .maxlen = sizeof(int), | 405 | .maxlen = sizeof(int), |
406 | .mode = 0644, | 406 | .mode = 0644, |
407 | .proc_handler = &proc_dointvec_minmax, | 407 | .proc_handler = proc_dointvec_minmax, |
408 | .strategy = &sysctl_intvec, | 408 | .strategy = sysctl_intvec, |
409 | .extra1 = &min_state_count, | 409 | .extra1 = &min_state_count, |
410 | .extra2 = &max_state_count | 410 | .extra2 = &max_state_count |
411 | }, | 411 | }, |
@@ -415,8 +415,8 @@ static ctl_table dn_table[] = { | |||
415 | .data = &decnet_dst_gc_interval, | 415 | .data = &decnet_dst_gc_interval, |
416 | .maxlen = sizeof(int), | 416 | .maxlen = sizeof(int), |
417 | .mode = 0644, | 417 | .mode = 0644, |
418 | .proc_handler = &proc_dointvec_minmax, | 418 | .proc_handler = proc_dointvec_minmax, |
419 | .strategy = &sysctl_intvec, | 419 | .strategy = sysctl_intvec, |
420 | .extra1 = &min_decnet_dst_gc_interval, | 420 | .extra1 = &min_decnet_dst_gc_interval, |
421 | .extra2 = &max_decnet_dst_gc_interval | 421 | .extra2 = &max_decnet_dst_gc_interval |
422 | }, | 422 | }, |
@@ -426,8 +426,8 @@ static ctl_table dn_table[] = { | |||
426 | .data = &decnet_no_fc_max_cwnd, | 426 | .data = &decnet_no_fc_max_cwnd, |
427 | .maxlen = sizeof(int), | 427 | .maxlen = sizeof(int), |
428 | .mode = 0644, | 428 | .mode = 0644, |
429 | .proc_handler = &proc_dointvec_minmax, | 429 | .proc_handler = proc_dointvec_minmax, |
430 | .strategy = &sysctl_intvec, | 430 | .strategy = sysctl_intvec, |
431 | .extra1 = &min_decnet_no_fc_max_cwnd, | 431 | .extra1 = &min_decnet_no_fc_max_cwnd, |
432 | .extra2 = &max_decnet_no_fc_max_cwnd | 432 | .extra2 = &max_decnet_no_fc_max_cwnd |
433 | }, | 433 | }, |
@@ -437,8 +437,8 @@ static ctl_table dn_table[] = { | |||
437 | .data = &sysctl_decnet_mem, | 437 | .data = &sysctl_decnet_mem, |
438 | .maxlen = sizeof(sysctl_decnet_mem), | 438 | .maxlen = sizeof(sysctl_decnet_mem), |
439 | .mode = 0644, | 439 | .mode = 0644, |
440 | .proc_handler = &proc_dointvec, | 440 | .proc_handler = proc_dointvec, |
441 | .strategy = &sysctl_intvec, | 441 | .strategy = sysctl_intvec, |
442 | }, | 442 | }, |
443 | { | 443 | { |
444 | .ctl_name = NET_DECNET_RMEM, | 444 | .ctl_name = NET_DECNET_RMEM, |
@@ -446,8 +446,8 @@ static ctl_table dn_table[] = { | |||
446 | .data = &sysctl_decnet_rmem, | 446 | .data = &sysctl_decnet_rmem, |
447 | .maxlen = sizeof(sysctl_decnet_rmem), | 447 | .maxlen = sizeof(sysctl_decnet_rmem), |
448 | .mode = 0644, | 448 | .mode = 0644, |
449 | .proc_handler = &proc_dointvec, | 449 | .proc_handler = proc_dointvec, |
450 | .strategy = &sysctl_intvec, | 450 | .strategy = sysctl_intvec, |
451 | }, | 451 | }, |
452 | { | 452 | { |
453 | .ctl_name = NET_DECNET_WMEM, | 453 | .ctl_name = NET_DECNET_WMEM, |
@@ -455,8 +455,8 @@ static ctl_table dn_table[] = { | |||
455 | .data = &sysctl_decnet_wmem, | 455 | .data = &sysctl_decnet_wmem, |
456 | .maxlen = sizeof(sysctl_decnet_wmem), | 456 | .maxlen = sizeof(sysctl_decnet_wmem), |
457 | .mode = 0644, | 457 | .mode = 0644, |
458 | .proc_handler = &proc_dointvec, | 458 | .proc_handler = proc_dointvec, |
459 | .strategy = &sysctl_intvec, | 459 | .strategy = sysctl_intvec, |
460 | }, | 460 | }, |
461 | { | 461 | { |
462 | .ctl_name = NET_DECNET_DEBUG_LEVEL, | 462 | .ctl_name = NET_DECNET_DEBUG_LEVEL, |
@@ -464,8 +464,8 @@ static ctl_table dn_table[] = { | |||
464 | .data = &decnet_debug_level, | 464 | .data = &decnet_debug_level, |
465 | .maxlen = sizeof(int), | 465 | .maxlen = sizeof(int), |
466 | .mode = 0644, | 466 | .mode = 0644, |
467 | .proc_handler = &proc_dointvec, | 467 | .proc_handler = proc_dointvec, |
468 | .strategy = &sysctl_intvec, | 468 | .strategy = sysctl_intvec, |
469 | }, | 469 | }, |
470 | {0} | 470 | {0} |
471 | }; | 471 | }; |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 1af5a79309e9..a3a410d20da0 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -352,7 +352,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
352 | netif_carrier_off(slave_dev); | 352 | netif_carrier_off(slave_dev); |
353 | 353 | ||
354 | if (p->phy != NULL) { | 354 | if (p->phy != NULL) { |
355 | phy_attach(slave_dev, p->phy->dev.bus_id, | 355 | phy_attach(slave_dev, dev_name(&p->phy->dev), |
356 | 0, PHY_INTERFACE_MODE_GMII); | 356 | 0, PHY_INTERFACE_MODE_GMII); |
357 | 357 | ||
358 | p->phy->autoneg = AUTONEG_ENABLE; | 358 | p->phy->autoneg = AUTONEG_ENABLE; |
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index 31866543332e..f99a019b939e 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c | |||
@@ -162,7 +162,6 @@ static int dsa_rcv(struct sk_buff *skb, struct net_device *dev, | |||
162 | skb->pkt_type = PACKET_HOST; | 162 | skb->pkt_type = PACKET_HOST; |
163 | skb->protocol = eth_type_trans(skb, skb->dev); | 163 | skb->protocol = eth_type_trans(skb, skb->dev); |
164 | 164 | ||
165 | skb->dev->last_rx = jiffies; | ||
166 | skb->dev->stats.rx_packets++; | 165 | skb->dev->stats.rx_packets++; |
167 | skb->dev->stats.rx_bytes += skb->len; | 166 | skb->dev->stats.rx_bytes += skb->len; |
168 | 167 | ||
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index 9f4ce55eae59..328ec957f786 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c | |||
@@ -181,7 +181,6 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev, | |||
181 | skb->pkt_type = PACKET_HOST; | 181 | skb->pkt_type = PACKET_HOST; |
182 | skb->protocol = eth_type_trans(skb, skb->dev); | 182 | skb->protocol = eth_type_trans(skb, skb->dev); |
183 | 183 | ||
184 | skb->dev->last_rx = jiffies; | ||
185 | skb->dev->stats.rx_packets++; | 184 | skb->dev->stats.rx_packets++; |
186 | skb->dev->stats.rx_bytes += skb->len; | 185 | skb->dev->stats.rx_bytes += skb->len; |
187 | 186 | ||
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index efd26697e716..b59132878ad1 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c | |||
@@ -98,7 +98,6 @@ static int trailer_rcv(struct sk_buff *skb, struct net_device *dev, | |||
98 | skb->pkt_type = PACKET_HOST; | 98 | skb->pkt_type = PACKET_HOST; |
99 | skb->protocol = eth_type_trans(skb, skb->dev); | 99 | skb->protocol = eth_type_trans(skb, skb->dev); |
100 | 100 | ||
101 | skb->dev->last_rx = jiffies; | ||
102 | skb->dev->stats.rx_packets++; | 101 | skb->dev->stats.rx_packets++; |
103 | skb->dev->stats.rx_bytes += skb->len; | 102 | skb->dev->stats.rx_bytes += skb->len; |
104 | 103 | ||
diff --git a/net/ieee80211/Kconfig b/net/ieee80211/Kconfig index 94ed7d3cd9da..d2282bb2e4f1 100644 --- a/net/ieee80211/Kconfig +++ b/net/ieee80211/Kconfig | |||
@@ -1,12 +1,24 @@ | |||
1 | config IEEE80211 | 1 | config IEEE80211 |
2 | tristate "Generic IEEE 802.11 Networking Stack (DEPRECATED)" | 2 | tristate |
3 | select WIRELESS_EXT | ||
4 | select CRYPTO | ||
5 | select CRYPTO_ARC4 | ||
6 | select CRYPTO_ECB | ||
7 | select CRYPTO_AES | ||
8 | select CRYPTO_MICHAEL_MIC | ||
9 | select CRYPTO_ECB | ||
10 | select CRC32 | ||
11 | select IEEE80211_CRYPT_WEP | ||
12 | select IEEE80211_CRYPT_TKIP | ||
13 | select IEEE80211_CRYPT_CCMP | ||
14 | select LIB80211 | ||
3 | ---help--- | 15 | ---help--- |
4 | This option enables the hardware independent IEEE 802.11 | 16 | This option enables the hardware independent IEEE 802.11 |
5 | networking stack. This component is deprecated in favor of the | 17 | networking stack. This component is deprecated in favor of the |
6 | mac80211 component. | 18 | mac80211 component. |
7 | 19 | ||
8 | config IEEE80211_DEBUG | 20 | config IEEE80211_DEBUG |
9 | bool "Enable full debugging output" | 21 | bool "Full debugging output for the old IEEE80211 stack" |
10 | depends on IEEE80211 | 22 | depends on IEEE80211 |
11 | ---help--- | 23 | ---help--- |
12 | This option will enable debug tracing output for the | 24 | This option will enable debug tracing output for the |
@@ -29,45 +41,10 @@ config IEEE80211_DEBUG | |||
29 | subsystem, you most likely want to say N here. | 41 | subsystem, you most likely want to say N here. |
30 | 42 | ||
31 | config IEEE80211_CRYPT_WEP | 43 | config IEEE80211_CRYPT_WEP |
32 | tristate "IEEE 802.11 WEP encryption (802.1x)" | 44 | tristate |
33 | depends on IEEE80211 | ||
34 | select CRYPTO | ||
35 | select CRYPTO_ARC4 | ||
36 | select CRYPTO_ECB | ||
37 | select CRC32 | ||
38 | ---help--- | ||
39 | Include software based cipher suites in support of IEEE | ||
40 | 802.11's WEP. This is needed for WEP as well as 802.1x. | ||
41 | |||
42 | This can be compiled as a module and it will be called | ||
43 | "ieee80211_crypt_wep". | ||
44 | 45 | ||
45 | config IEEE80211_CRYPT_CCMP | 46 | config IEEE80211_CRYPT_CCMP |
46 | tristate "IEEE 802.11i CCMP support" | 47 | tristate |
47 | depends on IEEE80211 | ||
48 | select CRYPTO | ||
49 | select CRYPTO_AES | ||
50 | ---help--- | ||
51 | Include software based cipher suites in support of IEEE 802.11i | ||
52 | (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with CCMP enabled | ||
53 | networks. | ||
54 | |||
55 | This can be compiled as a module and it will be called | ||
56 | "ieee80211_crypt_ccmp". | ||
57 | 48 | ||
58 | config IEEE80211_CRYPT_TKIP | 49 | config IEEE80211_CRYPT_TKIP |
59 | tristate "IEEE 802.11i TKIP encryption" | 50 | tristate |
60 | depends on IEEE80211 | ||
61 | select WIRELESS_EXT | ||
62 | select CRYPTO | ||
63 | select CRYPTO_MICHAEL_MIC | ||
64 | select CRYPTO_ECB | ||
65 | select CRC32 | ||
66 | ---help--- | ||
67 | Include software based cipher suites in support of IEEE 802.11i | ||
68 | (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with TKIP enabled | ||
69 | networks. | ||
70 | |||
71 | This can be compiled as a module and it will be called | ||
72 | "ieee80211_crypt_tkip". | ||
73 | |||
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_module.c b/net/ieee80211/ieee80211_module.c index 949772a5a7dc..d34d4e79b6f7 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -308,31 +308,5 @@ MODULE_PARM_DESC(debug, "debug output mask"); | |||
308 | module_exit(ieee80211_exit); | 308 | module_exit(ieee80211_exit); |
309 | module_init(ieee80211_init); | 309 | module_init(ieee80211_init); |
310 | 310 | ||
311 | const char *escape_essid(const char *essid, u8 essid_len) | ||
312 | { | ||
313 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
314 | const char *s = essid; | ||
315 | char *d = escaped; | ||
316 | |||
317 | if (ieee80211_is_empty_essid(essid, essid_len)) { | ||
318 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
319 | return escaped; | ||
320 | } | ||
321 | |||
322 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); | ||
323 | while (essid_len--) { | ||
324 | if (*s == '\0') { | ||
325 | *d++ = '\\'; | ||
326 | *d++ = '0'; | ||
327 | s++; | ||
328 | } else { | ||
329 | *d++ = *s++; | ||
330 | } | ||
331 | } | ||
332 | *d = '\0'; | ||
333 | return escaped; | ||
334 | } | ||
335 | |||
336 | EXPORT_SYMBOL(alloc_ieee80211); | 311 | EXPORT_SYMBOL(alloc_ieee80211); |
337 | EXPORT_SYMBOL(free_ieee80211); | 312 | EXPORT_SYMBOL(free_ieee80211); |
338 | EXPORT_SYMBOL(escape_essid); | ||
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 69dbc342a464..3dd58b594f6a 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <linux/ctype.h> | 33 | #include <linux/ctype.h> |
34 | 34 | ||
35 | #include <net/lib80211.h> | ||
35 | #include <net/ieee80211.h> | 36 | #include <net/ieee80211.h> |
36 | 37 | ||
37 | static void ieee80211_monitor_rx(struct ieee80211_device *ieee, | 38 | static void ieee80211_monitor_rx(struct ieee80211_device *ieee, |
@@ -39,7 +40,7 @@ static void ieee80211_monitor_rx(struct ieee80211_device *ieee, | |||
39 | struct ieee80211_rx_stats *rx_stats) | 40 | struct ieee80211_rx_stats *rx_stats) |
40 | { | 41 | { |
41 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 42 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
42 | u16 fc = le16_to_cpu(hdr->frame_ctl); | 43 | u16 fc = le16_to_cpu(hdr->frame_control); |
43 | 44 | ||
44 | skb->dev = ieee->dev; | 45 | skb->dev = ieee->dev; |
45 | skb_reset_mac_header(skb); | 46 | skb_reset_mac_header(skb); |
@@ -282,12 +283,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
282 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); | 283 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); |
283 | atomic_dec(&crypt->refcnt); | 284 | atomic_dec(&crypt->refcnt); |
284 | if (res < 0) { | 285 | if (res < 0) { |
285 | IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT | 286 | IEEE80211_DEBUG_DROP("decryption failed (SA=%pM) res=%d\n", |
286 | ") res=%d\n", | 287 | 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) | 288 | if (res == -2) |
292 | IEEE80211_DEBUG_DROP("Decryption failed ICV " | 289 | IEEE80211_DEBUG_DROP("Decryption failed ICV " |
293 | "mismatch (key %d)\n", | 290 | "mismatch (key %d)\n", |
@@ -319,11 +316,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, | |||
319 | atomic_dec(&crypt->refcnt); | 316 | atomic_dec(&crypt->refcnt); |
320 | if (res < 0) { | 317 | if (res < 0) { |
321 | printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" | 318 | printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" |
322 | " (SA=" MAC_FMT " keyidx=%d)\n", | 319 | " (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); | 320 | keyidx); |
328 | return -1; | 321 | return -1; |
329 | } | 322 | } |
@@ -358,7 +351,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
358 | struct ieee80211_crypt_data *crypt = NULL; | 351 | struct ieee80211_crypt_data *crypt = NULL; |
359 | int keyidx = 0; | 352 | int keyidx = 0; |
360 | int can_be_decrypted = 0; | 353 | int can_be_decrypted = 0; |
361 | DECLARE_MAC_BUF(mac); | ||
362 | 354 | ||
363 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | 355 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
364 | stats = &ieee->stats; | 356 | stats = &ieee->stats; |
@@ -468,10 +460,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
468 | * frames silently instead of filling system log with | 460 | * frames silently instead of filling system log with |
469 | * these reports. */ | 461 | * these reports. */ |
470 | IEEE80211_DEBUG_DROP("Decryption failed (not set)" | 462 | IEEE80211_DEBUG_DROP("Decryption failed (not set)" |
471 | " (SA=" MAC_FMT ")\n", | 463 | " (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++; | 464 | ieee->ieee_stats.rx_discards_undecryptable++; |
476 | goto rx_dropped; | 465 | goto rx_dropped; |
477 | } | 466 | } |
@@ -482,10 +471,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
482 | fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && | 471 | fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && |
483 | (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { | 472 | (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { |
484 | printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " | 473 | printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " |
485 | "from " MAC_FMT "\n", dev->name, | 474 | "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 | 475 | /* TODO: could inform hostapd about this so that it |
490 | * could send auth failure report */ | 476 | * could send auth failure report */ |
491 | goto rx_dropped; | 477 | goto rx_dropped; |
@@ -547,8 +533,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
547 | } | 533 | } |
548 | #endif | 534 | #endif |
549 | 535 | ||
550 | dev->last_rx = jiffies; | ||
551 | |||
552 | #ifdef NOT_YET | 536 | #ifdef NOT_YET |
553 | if ((ieee->iw_mode == IW_MODE_MASTER || | 537 | if ((ieee->iw_mode == IW_MODE_MASTER || |
554 | ieee->iw_mode == IW_MODE_REPEAT) && !from_assoc_ap) { | 538 | ieee->iw_mode == IW_MODE_REPEAT) && !from_assoc_ap) { |
@@ -663,11 +647,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
663 | * configured */ | 647 | * configured */ |
664 | } else { | 648 | } else { |
665 | IEEE80211_DEBUG_DROP("encryption configured, but RX " | 649 | IEEE80211_DEBUG_DROP("encryption configured, but RX " |
666 | "frame not encrypted (SA=" | 650 | "frame not encrypted (SA=%pM)\n", |
667 | MAC_FMT ")\n", | 651 | 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; | 652 | goto rx_dropped; |
672 | } | 653 | } |
673 | } | 654 | } |
@@ -675,11 +656,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
675 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && | 656 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && |
676 | !ieee80211_is_eapol_frame(ieee, skb)) { | 657 | !ieee80211_is_eapol_frame(ieee, skb)) { |
677 | IEEE80211_DEBUG_DROP("dropped unencrypted RX data " | 658 | IEEE80211_DEBUG_DROP("dropped unencrypted RX data " |
678 | "frame from " MAC_FMT | 659 | "frame from %pM (drop_unencrypted=1)\n", |
679 | " (drop_unencrypted=1)\n", | 660 | 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; | 661 | goto rx_dropped; |
684 | } | 662 | } |
685 | 663 | ||
@@ -1144,6 +1122,7 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1144 | *info_element, u16 length, | 1122 | *info_element, u16 length, |
1145 | struct ieee80211_network *network) | 1123 | struct ieee80211_network *network) |
1146 | { | 1124 | { |
1125 | DECLARE_SSID_BUF(ssid); | ||
1147 | u8 i; | 1126 | u8 i; |
1148 | #ifdef CONFIG_IEEE80211_DEBUG | 1127 | #ifdef CONFIG_IEEE80211_DEBUG |
1149 | char rates_str[64]; | 1128 | char rates_str[64]; |
@@ -1166,12 +1145,6 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1166 | 1145 | ||
1167 | switch (info_element->id) { | 1146 | switch (info_element->id) { |
1168 | case MFIE_TYPE_SSID: | 1147 | case MFIE_TYPE_SSID: |
1169 | if (ieee80211_is_empty_essid(info_element->data, | ||
1170 | info_element->len)) { | ||
1171 | network->flags |= NETWORK_EMPTY_ESSID; | ||
1172 | break; | ||
1173 | } | ||
1174 | |||
1175 | network->ssid_len = min(info_element->len, | 1148 | network->ssid_len = min(info_element->len, |
1176 | (u8) IW_ESSID_MAX_SIZE); | 1149 | (u8) IW_ESSID_MAX_SIZE); |
1177 | memcpy(network->ssid, info_element->data, | 1150 | memcpy(network->ssid, info_element->data, |
@@ -1181,7 +1154,9 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1181 | IW_ESSID_MAX_SIZE - network->ssid_len); | 1154 | IW_ESSID_MAX_SIZE - network->ssid_len); |
1182 | 1155 | ||
1183 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_SSID: '%s' len=%d.\n", | 1156 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_SSID: '%s' len=%d.\n", |
1184 | network->ssid, network->ssid_len); | 1157 | print_ssid(ssid, network->ssid, |
1158 | network->ssid_len), | ||
1159 | network->ssid_len); | ||
1185 | break; | 1160 | break; |
1186 | 1161 | ||
1187 | case MFIE_TYPE_RATES: | 1162 | case MFIE_TYPE_RATES: |
@@ -1411,9 +1386,6 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee | |||
1411 | network->mode |= IEEE_B; | 1386 | network->mode |= IEEE_B; |
1412 | } | 1387 | } |
1413 | 1388 | ||
1414 | if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) | ||
1415 | network->flags |= NETWORK_EMPTY_ESSID; | ||
1416 | |||
1417 | memcpy(&network->stats, stats, sizeof(network->stats)); | 1389 | memcpy(&network->stats, stats, sizeof(network->stats)); |
1418 | 1390 | ||
1419 | if (ieee->handle_assoc_response != NULL) | 1391 | if (ieee->handle_assoc_response != NULL) |
@@ -1429,7 +1401,7 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021 | |||
1429 | struct ieee80211_network *network, | 1401 | struct ieee80211_network *network, |
1430 | struct ieee80211_rx_stats *stats) | 1402 | struct ieee80211_rx_stats *stats) |
1431 | { | 1403 | { |
1432 | DECLARE_MAC_BUF(mac); | 1404 | DECLARE_SSID_BUF(ssid); |
1433 | 1405 | ||
1434 | network->qos_data.active = 0; | 1406 | network->qos_data.active = 0; |
1435 | network->qos_data.supported = 0; | 1407 | network->qos_data.supported = 0; |
@@ -1477,17 +1449,14 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021 | |||
1477 | } | 1449 | } |
1478 | 1450 | ||
1479 | if (network->mode == 0) { | 1451 | if (network->mode == 0) { |
1480 | IEEE80211_DEBUG_SCAN("Filtered out '%s (%s)' " | 1452 | IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' " |
1481 | "network.\n", | 1453 | "network.\n", |
1482 | escape_essid(network->ssid, | 1454 | print_ssid(ssid, network->ssid, |
1483 | network->ssid_len), | 1455 | network->ssid_len), |
1484 | print_mac(mac, network->bssid)); | 1456 | network->bssid); |
1485 | return 1; | 1457 | return 1; |
1486 | } | 1458 | } |
1487 | 1459 | ||
1488 | if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) | ||
1489 | network->flags |= NETWORK_EMPTY_ESSID; | ||
1490 | |||
1491 | memcpy(&network->stats, stats, sizeof(network->stats)); | 1460 | memcpy(&network->stats, stats, sizeof(network->stats)); |
1492 | 1461 | ||
1493 | return 0; | 1462 | return 0; |
@@ -1510,7 +1479,6 @@ static void update_network(struct ieee80211_network *dst, | |||
1510 | { | 1479 | { |
1511 | int qos_active; | 1480 | int qos_active; |
1512 | u8 old_param; | 1481 | u8 old_param; |
1513 | DECLARE_MAC_BUF(mac); | ||
1514 | 1482 | ||
1515 | ieee80211_network_reset(dst); | 1483 | ieee80211_network_reset(dst); |
1516 | dst->ibss_dfs = src->ibss_dfs; | 1484 | dst->ibss_dfs = src->ibss_dfs; |
@@ -1524,8 +1492,8 @@ static void update_network(struct ieee80211_network *dst, | |||
1524 | memcpy(&dst->stats, &src->stats, | 1492 | memcpy(&dst->stats, &src->stats, |
1525 | sizeof(struct ieee80211_rx_stats)); | 1493 | sizeof(struct ieee80211_rx_stats)); |
1526 | else | 1494 | else |
1527 | IEEE80211_DEBUG_SCAN("Network %s info received " | 1495 | IEEE80211_DEBUG_SCAN("Network %pM info received " |
1528 | "off channel (%d vs. %d)\n", print_mac(mac, src->bssid), | 1496 | "off channel (%d vs. %d)\n", src->bssid, |
1529 | dst->channel, src->stats.received_channel); | 1497 | dst->channel, src->stats.received_channel); |
1530 | 1498 | ||
1531 | dst->capability = src->capability; | 1499 | dst->capability = src->capability; |
@@ -1597,12 +1565,12 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1597 | struct ieee80211_info_element *info_element = beacon->info_element; | 1565 | struct ieee80211_info_element *info_element = beacon->info_element; |
1598 | #endif | 1566 | #endif |
1599 | unsigned long flags; | 1567 | unsigned long flags; |
1600 | DECLARE_MAC_BUF(mac); | 1568 | DECLARE_SSID_BUF(ssid); |
1601 | 1569 | ||
1602 | IEEE80211_DEBUG_SCAN("'%s' (%s" | 1570 | IEEE80211_DEBUG_SCAN("'%s' (%pM" |
1603 | "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", | 1571 | "): %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), | 1572 | print_ssid(ssid, info_element->data, info_element->len), |
1605 | print_mac(mac, beacon->header.addr3), | 1573 | beacon->header.addr3, |
1606 | (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', | 1574 | (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', |
1607 | (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0', | 1575 | (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0', |
1608 | (beacon->capability & cpu_to_le16(1 << 0xd)) ? '1' : '0', | 1576 | (beacon->capability & cpu_to_le16(1 << 0xd)) ? '1' : '0', |
@@ -1621,10 +1589,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1621 | (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0'); | 1589 | (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0'); |
1622 | 1590 | ||
1623 | if (ieee80211_network_init(ieee, beacon, &network, stats)) { | 1591 | if (ieee80211_network_init(ieee, beacon, &network, stats)) { |
1624 | IEEE80211_DEBUG_SCAN("Dropped '%s' (%s) via %s.\n", | 1592 | IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", |
1625 | escape_essid(info_element->data, | 1593 | print_ssid(ssid, info_element->data, |
1626 | info_element->len), | 1594 | info_element->len), |
1627 | print_mac(mac, beacon->header.addr3), | 1595 | beacon->header.addr3, |
1628 | is_beacon(beacon->header.frame_ctl) ? | 1596 | is_beacon(beacon->header.frame_ctl) ? |
1629 | "BEACON" : "PROBE RESPONSE"); | 1597 | "BEACON" : "PROBE RESPONSE"); |
1630 | return; | 1598 | return; |
@@ -1658,11 +1626,11 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1658 | /* If there are no more slots, expire the oldest */ | 1626 | /* If there are no more slots, expire the oldest */ |
1659 | list_del(&oldest->list); | 1627 | list_del(&oldest->list); |
1660 | target = oldest; | 1628 | target = oldest; |
1661 | IEEE80211_DEBUG_SCAN("Expired '%s' (%s) from " | 1629 | IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from " |
1662 | "network list.\n", | 1630 | "network list.\n", |
1663 | escape_essid(target->ssid, | 1631 | print_ssid(ssid, target->ssid, |
1664 | target->ssid_len), | 1632 | target->ssid_len), |
1665 | print_mac(mac, target->bssid)); | 1633 | target->bssid); |
1666 | ieee80211_network_reset(target); | 1634 | ieee80211_network_reset(target); |
1667 | } else { | 1635 | } else { |
1668 | /* Otherwise just pull from the free list */ | 1636 | /* Otherwise just pull from the free list */ |
@@ -1672,10 +1640,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1672 | } | 1640 | } |
1673 | 1641 | ||
1674 | #ifdef CONFIG_IEEE80211_DEBUG | 1642 | #ifdef CONFIG_IEEE80211_DEBUG |
1675 | IEEE80211_DEBUG_SCAN("Adding '%s' (%s) via %s.\n", | 1643 | IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", |
1676 | escape_essid(network.ssid, | 1644 | print_ssid(ssid, network.ssid, |
1677 | network.ssid_len), | 1645 | network.ssid_len), |
1678 | print_mac(mac, network.bssid), | 1646 | network.bssid, |
1679 | is_beacon(beacon->header.frame_ctl) ? | 1647 | is_beacon(beacon->header.frame_ctl) ? |
1680 | "BEACON" : "PROBE RESPONSE"); | 1648 | "BEACON" : "PROBE RESPONSE"); |
1681 | #endif | 1649 | #endif |
@@ -1683,10 +1651,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device | |||
1683 | network.ibss_dfs = NULL; | 1651 | network.ibss_dfs = NULL; |
1684 | list_add_tail(&target->list, &ieee->network_list); | 1652 | list_add_tail(&target->list, &ieee->network_list); |
1685 | } else { | 1653 | } else { |
1686 | IEEE80211_DEBUG_SCAN("Updating '%s' (%s) via %s.\n", | 1654 | IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", |
1687 | escape_essid(target->ssid, | 1655 | print_ssid(ssid, target->ssid, |
1688 | target->ssid_len), | 1656 | target->ssid_len), |
1689 | print_mac(mac, target->bssid), | 1657 | target->bssid, |
1690 | is_beacon(beacon->header.frame_ctl) ? | 1658 | is_beacon(beacon->header.frame_ctl) ? |
1691 | "BEACON" : "PROBE RESPONSE"); | 1659 | "BEACON" : "PROBE RESPONSE"); |
1692 | update_network(target, &network); | 1660 | update_network(target, &network); |
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 973832dd7faf..7cc4e5ee3660 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/jiffies.h> | 35 | #include <linux/jiffies.h> |
36 | 36 | ||
37 | #include <net/lib80211.h> | ||
37 | #include <net/ieee80211.h> | 38 | #include <net/ieee80211.h> |
38 | #include <linux/wireless.h> | 39 | #include <linux/wireless.h> |
39 | 40 | ||
@@ -65,15 +66,9 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee, | |||
65 | /* Add the ESSID */ | 66 | /* Add the ESSID */ |
66 | iwe.cmd = SIOCGIWESSID; | 67 | iwe.cmd = SIOCGIWESSID; |
67 | iwe.u.data.flags = 1; | 68 | iwe.u.data.flags = 1; |
68 | if (network->flags & NETWORK_EMPTY_ESSID) { | 69 | iwe.u.data.length = min(network->ssid_len, (u8) 32); |
69 | iwe.u.data.length = sizeof("<hidden>"); | 70 | start = iwe_stream_add_point(info, start, stop, |
70 | start = iwe_stream_add_point(info, start, stop, | 71 | &iwe, network->ssid); |
71 | &iwe, "<hidden>"); | ||
72 | } else { | ||
73 | iwe.u.data.length = min(network->ssid_len, (u8) 32); | ||
74 | start = iwe_stream_add_point(info, start, stop, | ||
75 | &iwe, network->ssid); | ||
76 | } | ||
77 | 72 | ||
78 | /* Add the protocol name */ | 73 | /* Add the protocol name */ |
79 | iwe.cmd = SIOCGIWNAME; | 74 | iwe.cmd = SIOCGIWNAME; |
@@ -264,7 +259,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | |||
264 | char *ev = extra; | 259 | char *ev = extra; |
265 | char *stop = ev + wrqu->data.length; | 260 | char *stop = ev + wrqu->data.length; |
266 | int i = 0; | 261 | int i = 0; |
267 | DECLARE_MAC_BUF(mac); | 262 | DECLARE_SSID_BUF(ssid); |
268 | 263 | ||
269 | IEEE80211_DEBUG_WX("Getting scan\n"); | 264 | IEEE80211_DEBUG_WX("Getting scan\n"); |
270 | 265 | ||
@@ -283,10 +278,10 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | |||
283 | info); | 278 | info); |
284 | else | 279 | else |
285 | IEEE80211_DEBUG_SCAN("Not showing network '%s (" | 280 | IEEE80211_DEBUG_SCAN("Not showing network '%s (" |
286 | "%s)' due to age (%dms).\n", | 281 | "%pM)' due to age (%dms).\n", |
287 | escape_essid(network->ssid, | 282 | print_ssid(ssid, network->ssid, |
288 | network->ssid_len), | 283 | network->ssid_len), |
289 | print_mac(mac, network->bssid), | 284 | network->bssid, |
290 | jiffies_to_msecs(jiffies - | 285 | jiffies_to_msecs(jiffies - |
291 | network-> | 286 | network-> |
292 | last_scanned)); | 287 | last_scanned)); |
@@ -314,6 +309,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
314 | int i, key, key_provided, len; | 309 | int i, key, key_provided, len; |
315 | struct ieee80211_crypt_data **crypt; | 310 | struct ieee80211_crypt_data **crypt; |
316 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt || ieee->host_build_iv; | 311 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt || ieee->host_build_iv; |
312 | DECLARE_SSID_BUF(ssid); | ||
317 | 313 | ||
318 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); | 314 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); |
319 | 315 | ||
@@ -403,13 +399,17 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
403 | 399 | ||
404 | /* If a new key was provided, set it up */ | 400 | /* If a new key was provided, set it up */ |
405 | if (erq->length > 0) { | 401 | if (erq->length > 0) { |
402 | #ifdef CONFIG_IEEE80211_DEBUG | ||
403 | DECLARE_SSID_BUF(ssid); | ||
404 | #endif | ||
405 | |||
406 | len = erq->length <= 5 ? 5 : 13; | 406 | len = erq->length <= 5 ? 5 : 13; |
407 | memcpy(sec.keys[key], keybuf, erq->length); | 407 | memcpy(sec.keys[key], keybuf, erq->length); |
408 | if (len > erq->length) | 408 | if (len > erq->length) |
409 | memset(sec.keys[key] + erq->length, 0, | 409 | memset(sec.keys[key] + erq->length, 0, |
410 | len - erq->length); | 410 | len - erq->length); |
411 | IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", | 411 | IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", |
412 | key, escape_essid(sec.keys[key], len), | 412 | key, print_ssid(ssid, sec.keys[key], len), |
413 | erq->length, len); | 413 | erq->length, len); |
414 | sec.key_sizes[key] = len; | 414 | sec.key_sizes[key] = len; |
415 | if (*crypt) | 415 | if (*crypt) |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1fbff5fa4241..e3286814c8d9 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1070,11 +1070,8 @@ static int inet_sk_reselect_saddr(struct sock *sk) | |||
1070 | return 0; | 1070 | return 0; |
1071 | 1071 | ||
1072 | if (sysctl_ip_dynaddr > 1) { | 1072 | if (sysctl_ip_dynaddr > 1) { |
1073 | printk(KERN_INFO "%s(): shifting inet->" | 1073 | printk(KERN_INFO "%s(): shifting inet->saddr from %pI4 to %pI4\n", |
1074 | "saddr from " NIPQUAD_FMT " to " NIPQUAD_FMT "\n", | 1074 | __func__, &old_saddr, &new_saddr); |
1075 | __func__, | ||
1076 | NIPQUAD(old_saddr), | ||
1077 | NIPQUAD(new_saddr)); | ||
1078 | } | 1075 | } |
1079 | 1076 | ||
1080 | inet->saddr = inet->rcv_saddr = new_saddr; | 1077 | inet->saddr = inet->rcv_saddr = new_saddr; |
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 8219b7e0968d..3f205181712d 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -201,8 +201,8 @@ out: | |||
201 | 201 | ||
202 | static void ah4_err(struct sk_buff *skb, u32 info) | 202 | static void ah4_err(struct sk_buff *skb, u32 info) |
203 | { | 203 | { |
204 | struct iphdr *iph = (struct iphdr*)skb->data; | 204 | struct iphdr *iph = (struct iphdr *)skb->data; |
205 | struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+(iph->ihl<<2)); | 205 | struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+(iph->ihl<<2)); |
206 | struct xfrm_state *x; | 206 | struct xfrm_state *x; |
207 | 207 | ||
208 | if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH || | 208 | if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH || |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 1a9dd66511fc..957c87dc8e16 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -506,7 +506,7 @@ int arp_bind_neighbour(struct dst_entry *dst) | |||
506 | if (dev == NULL) | 506 | if (dev == NULL) |
507 | return -EINVAL; | 507 | return -EINVAL; |
508 | if (n == NULL) { | 508 | if (n == NULL) { |
509 | __be32 nexthop = ((struct rtable*)dst)->rt_gateway; | 509 | __be32 nexthop = ((struct rtable *)dst)->rt_gateway; |
510 | if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)) | 510 | if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)) |
511 | nexthop = 0; | 511 | nexthop = 0; |
512 | n = __neigh_lookup_errno( | 512 | n = __neigh_lookup_errno( |
@@ -640,14 +640,14 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, | |||
640 | arp_ptr=(unsigned char *)(arp+1); | 640 | arp_ptr=(unsigned char *)(arp+1); |
641 | 641 | ||
642 | memcpy(arp_ptr, src_hw, dev->addr_len); | 642 | memcpy(arp_ptr, src_hw, dev->addr_len); |
643 | arp_ptr+=dev->addr_len; | 643 | arp_ptr += dev->addr_len; |
644 | memcpy(arp_ptr, &src_ip,4); | 644 | memcpy(arp_ptr, &src_ip, 4); |
645 | arp_ptr+=4; | 645 | arp_ptr += 4; |
646 | if (target_hw != NULL) | 646 | if (target_hw != NULL) |
647 | memcpy(arp_ptr, target_hw, dev->addr_len); | 647 | memcpy(arp_ptr, target_hw, dev->addr_len); |
648 | else | 648 | else |
649 | memset(arp_ptr, 0, dev->addr_len); | 649 | memset(arp_ptr, 0, dev->addr_len); |
650 | arp_ptr+=dev->addr_len; | 650 | arp_ptr += dev->addr_len; |
651 | memcpy(arp_ptr, &dest_ip, 4); | 651 | memcpy(arp_ptr, &dest_ip, 4); |
652 | 652 | ||
653 | return skb; | 653 | return skb; |
@@ -823,9 +823,9 @@ static int arp_process(struct sk_buff *skb) | |||
823 | int dont_send = 0; | 823 | int dont_send = 0; |
824 | 824 | ||
825 | if (!dont_send) | 825 | if (!dont_send) |
826 | dont_send |= arp_ignore(in_dev,sip,tip); | 826 | dont_send |= arp_ignore(in_dev, sip, tip); |
827 | if (!dont_send && IN_DEV_ARPFILTER(in_dev)) | 827 | if (!dont_send && IN_DEV_ARPFILTER(in_dev)) |
828 | dont_send |= arp_filter(sip,tip,dev); | 828 | dont_send |= arp_filter(sip, tip, dev); |
829 | if (!dont_send) | 829 | if (!dont_send) |
830 | arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); | 830 | arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); |
831 | 831 | ||
@@ -1308,7 +1308,7 @@ static void arp_format_neigh_entry(struct seq_file *seq, | |||
1308 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 1308 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
1309 | } | 1309 | } |
1310 | #endif | 1310 | #endif |
1311 | sprintf(tbuf, NIPQUAD_FMT, NIPQUAD(*(u32*)n->primary_key)); | 1311 | sprintf(tbuf, "%pI4", n->primary_key); |
1312 | seq_printf(seq, "%-16s 0x%-10x0x%-10x%s * %s\n", | 1312 | seq_printf(seq, "%-16s 0x%-10x0x%-10x%s * %s\n", |
1313 | tbuf, hatype, arp_state_to_flags(n), hbuffer, dev->name); | 1313 | tbuf, hatype, arp_state_to_flags(n), hbuffer, dev->name); |
1314 | read_unlock(&n->lock); | 1314 | read_unlock(&n->lock); |
@@ -1321,7 +1321,7 @@ static void arp_format_pneigh_entry(struct seq_file *seq, | |||
1321 | int hatype = dev ? dev->type : 0; | 1321 | int hatype = dev ? dev->type : 0; |
1322 | char tbuf[16]; | 1322 | char tbuf[16]; |
1323 | 1323 | ||
1324 | sprintf(tbuf, NIPQUAD_FMT, NIPQUAD(*(u32*)n->key)); | 1324 | sprintf(tbuf, "%pI4", n->key); |
1325 | seq_printf(seq, "%-16s 0x%-10x0x%-10x%s * %s\n", | 1325 | seq_printf(seq, "%-16s 0x%-10x0x%-10x%s * %s\n", |
1326 | tbuf, hatype, ATF_PUBL | ATF_PERM, "00:00:00:00:00:00", | 1326 | tbuf, hatype, ATF_PUBL | ATF_PERM, "00:00:00:00:00:00", |
1327 | dev ? dev->name : "*"); | 1327 | dev ? dev->name : "*"); |
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..309997edc8a5 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 | ||
113 | static struct in_ifaddr *inet_alloc_ifa(void) | 113 | static 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 | ||
124 | static void inet_rcu_free_ifa(struct rcu_head *head) | 118 | static 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; |
@@ -1108,7 +1101,7 @@ out: | |||
1108 | } | 1101 | } |
1109 | 1102 | ||
1110 | static struct notifier_block ip_netdev_notifier = { | 1103 | static struct notifier_block ip_netdev_notifier = { |
1111 | .notifier_call =inetdev_event, | 1104 | .notifier_call = inetdev_event, |
1112 | }; | 1105 | }; |
1113 | 1106 | ||
1114 | static inline size_t inet_nlmsg_size(void) | 1107 | static inline size_t inet_nlmsg_size(void) |
@@ -1195,7 +1188,7 @@ done: | |||
1195 | return skb->len; | 1188 | return skb->len; |
1196 | } | 1189 | } |
1197 | 1190 | ||
1198 | static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh, | 1191 | static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, |
1199 | u32 pid) | 1192 | u32 pid) |
1200 | { | 1193 | { |
1201 | struct sk_buff *skb; | 1194 | struct sk_buff *skb; |
@@ -1262,7 +1255,7 @@ static void inet_forward_change(struct net *net) | |||
1262 | } | 1255 | } |
1263 | 1256 | ||
1264 | static int devinet_conf_proc(ctl_table *ctl, int write, | 1257 | static int devinet_conf_proc(ctl_table *ctl, int write, |
1265 | struct file* filp, void __user *buffer, | 1258 | struct file *filp, void __user *buffer, |
1266 | size_t *lenp, loff_t *ppos) | 1259 | size_t *lenp, loff_t *ppos) |
1267 | { | 1260 | { |
1268 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1261 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); |
@@ -1334,7 +1327,7 @@ static int devinet_conf_sysctl(ctl_table *table, | |||
1334 | } | 1327 | } |
1335 | 1328 | ||
1336 | static int devinet_sysctl_forward(ctl_table *ctl, int write, | 1329 | static int devinet_sysctl_forward(ctl_table *ctl, int write, |
1337 | struct file* filp, void __user *buffer, | 1330 | struct file *filp, void __user *buffer, |
1338 | size_t *lenp, loff_t *ppos) | 1331 | size_t *lenp, loff_t *ppos) |
1339 | { | 1332 | { |
1340 | int *valp = ctl->data; | 1333 | int *valp = ctl->data; |
@@ -1363,7 +1356,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1363 | } | 1356 | } |
1364 | 1357 | ||
1365 | int ipv4_doint_and_flush(ctl_table *ctl, int write, | 1358 | int ipv4_doint_and_flush(ctl_table *ctl, int write, |
1366 | struct file* filp, void __user *buffer, | 1359 | struct file *filp, void __user *buffer, |
1367 | size_t *lenp, loff_t *ppos) | 1360 | size_t *lenp, loff_t *ppos) |
1368 | { | 1361 | { |
1369 | int *valp = ctl->data; | 1362 | int *valp = ctl->data; |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 21515d4c49eb..95a9c65003f8 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -413,8 +413,8 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) | |||
413 | 413 | ||
414 | static void esp4_err(struct sk_buff *skb, u32 info) | 414 | static void esp4_err(struct sk_buff *skb, u32 info) |
415 | { | 415 | { |
416 | struct iphdr *iph = (struct iphdr*)skb->data; | 416 | struct iphdr *iph = (struct iphdr *)skb->data; |
417 | struct ip_esp_hdr *esph = (struct ip_esp_hdr*)(skb->data+(iph->ihl<<2)); | 417 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2)); |
418 | struct xfrm_state *x; | 418 | struct xfrm_state *x; |
419 | 419 | ||
420 | if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH || | 420 | if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH || |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 65c1503f8cc8..741e4fa3e474 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -578,7 +578,7 @@ errout: | |||
578 | return err; | 578 | return err; |
579 | } | 579 | } |
580 | 580 | ||
581 | static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 581 | static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
582 | { | 582 | { |
583 | struct net *net = sock_net(skb->sk); | 583 | struct net *net = sock_net(skb->sk); |
584 | struct fib_config cfg; | 584 | struct fib_config cfg; |
@@ -600,7 +600,7 @@ errout: | |||
600 | return err; | 600 | return err; |
601 | } | 601 | } |
602 | 602 | ||
603 | static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 603 | static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
604 | { | 604 | { |
605 | struct net *net = sock_net(skb->sk); | 605 | struct net *net = sock_net(skb->sk); |
606 | struct fib_config cfg; | 606 | struct fib_config cfg; |
@@ -903,7 +903,7 @@ static void fib_disable_ip(struct net_device *dev, int force) | |||
903 | 903 | ||
904 | static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr) | 904 | static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr) |
905 | { | 905 | { |
906 | struct in_ifaddr *ifa = (struct in_ifaddr*)ptr; | 906 | struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; |
907 | struct net_device *dev = ifa->ifa_dev->dev; | 907 | struct net_device *dev = ifa->ifa_dev->dev; |
908 | 908 | ||
909 | switch (event) { | 909 | switch (event) { |
@@ -964,11 +964,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo | |||
964 | } | 964 | } |
965 | 965 | ||
966 | static struct notifier_block fib_inetaddr_notifier = { | 966 | static struct notifier_block fib_inetaddr_notifier = { |
967 | .notifier_call =fib_inetaddr_event, | 967 | .notifier_call = fib_inetaddr_event, |
968 | }; | 968 | }; |
969 | 969 | ||
970 | static struct notifier_block fib_netdev_notifier = { | 970 | static struct notifier_block fib_netdev_notifier = { |
971 | .notifier_call =fib_netdev_event, | 971 | .notifier_call = fib_netdev_event, |
972 | }; | 972 | }; |
973 | 973 | ||
974 | static int __net_init ip_fib_net_init(struct net *net) | 974 | static int __net_init ip_fib_net_init(struct net *net) |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index c8cac6c7f881..ded8c44fb848 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -247,7 +247,7 @@ fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result | |||
247 | { | 247 | { |
248 | int err; | 248 | int err; |
249 | struct fn_zone *fz; | 249 | struct fn_zone *fz; |
250 | struct fn_hash *t = (struct fn_hash*)tb->tb_data; | 250 | struct fn_hash *t = (struct fn_hash *)tb->tb_data; |
251 | 251 | ||
252 | read_lock(&fib_hash_lock); | 252 | read_lock(&fib_hash_lock); |
253 | for (fz = t->fn_zone_list; fz; fz = fz->fz_next) { | 253 | for (fz = t->fn_zone_list; fz; fz = fz->fz_next) { |
@@ -283,7 +283,7 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib | |||
283 | struct fib_node *f; | 283 | struct fib_node *f; |
284 | struct fib_info *fi = NULL; | 284 | struct fib_info *fi = NULL; |
285 | struct fib_info *last_resort; | 285 | struct fib_info *last_resort; |
286 | struct fn_hash *t = (struct fn_hash*)tb->tb_data; | 286 | struct fn_hash *t = (struct fn_hash *)tb->tb_data; |
287 | struct fn_zone *fz = t->fn_zones[0]; | 287 | struct fn_zone *fz = t->fn_zones[0]; |
288 | 288 | ||
289 | if (fz == NULL) | 289 | if (fz == NULL) |
@@ -548,7 +548,7 @@ out: | |||
548 | 548 | ||
549 | static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg) | 549 | static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg) |
550 | { | 550 | { |
551 | struct fn_hash *table = (struct fn_hash*)tb->tb_data; | 551 | struct fn_hash *table = (struct fn_hash *)tb->tb_data; |
552 | struct fib_node *f; | 552 | struct fib_node *f; |
553 | struct fib_alias *fa, *fa_to_delete; | 553 | struct fib_alias *fa, *fa_to_delete; |
554 | struct fn_zone *fz; | 554 | struct fn_zone *fz; |
@@ -748,7 +748,7 @@ static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin | |||
748 | { | 748 | { |
749 | int m, s_m; | 749 | int m, s_m; |
750 | struct fn_zone *fz; | 750 | struct fn_zone *fz; |
751 | struct fn_hash *table = (struct fn_hash*)tb->tb_data; | 751 | struct fn_hash *table = (struct fn_hash *)tb->tb_data; |
752 | 752 | ||
753 | s_m = cb->args[2]; | 753 | s_m = cb->args[2]; |
754 | read_lock(&fib_hash_lock); | 754 | read_lock(&fib_hash_lock); |
@@ -845,10 +845,10 @@ static struct fib_alias *fib_get_first(struct seq_file *seq) | |||
845 | struct hlist_node *node; | 845 | struct hlist_node *node; |
846 | struct fib_node *fn; | 846 | struct fib_node *fn; |
847 | 847 | ||
848 | hlist_for_each_entry(fn,node,iter->hash_head,fn_hash) { | 848 | hlist_for_each_entry(fn, node, iter->hash_head, fn_hash) { |
849 | struct fib_alias *fa; | 849 | struct fib_alias *fa; |
850 | 850 | ||
851 | list_for_each_entry(fa,&fn->fn_alias,fa_list) { | 851 | list_for_each_entry(fa, &fn->fn_alias, fa_list) { |
852 | iter->fn = fn; | 852 | iter->fn = fn; |
853 | iter->fa = fa; | 853 | iter->fa = fa; |
854 | goto out; | 854 | goto out; |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index ded2ae34eab1..4817dea3bc73 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -63,16 +63,16 @@ static DEFINE_SPINLOCK(fib_multipath_lock); | |||
63 | for (nhsel=0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) | 63 | for (nhsel=0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) |
64 | 64 | ||
65 | #define change_nexthops(fi) { int nhsel; struct fib_nh * nh; \ | 65 | #define change_nexthops(fi) { int nhsel; struct fib_nh * nh; \ |
66 | for (nhsel=0, nh = (struct fib_nh*)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++, nhsel++) | 66 | for (nhsel=0, nh = (struct fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++, nhsel++) |
67 | 67 | ||
68 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ | 68 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
69 | 69 | ||
70 | /* Hope, that gcc will optimize it to get rid of dummy loop */ | 70 | /* Hope, that gcc will optimize it to get rid of dummy loop */ |
71 | 71 | ||
72 | #define for_nexthops(fi) { int nhsel=0; const struct fib_nh * nh = (fi)->fib_nh; \ | 72 | #define for_nexthops(fi) { int nhsel = 0; const struct fib_nh * nh = (fi)->fib_nh; \ |
73 | for (nhsel=0; nhsel < 1; nhsel++) | 73 | for (nhsel=0; nhsel < 1; nhsel++) |
74 | 74 | ||
75 | #define change_nexthops(fi) { int nhsel=0; struct fib_nh * nh = (struct fib_nh*)((fi)->fib_nh); \ | 75 | #define change_nexthops(fi) { int nhsel = 0; struct fib_nh * nh = (struct fib_nh *)((fi)->fib_nh); \ |
76 | for (nhsel=0; nhsel < 1; nhsel++) | 76 | for (nhsel=0; nhsel < 1; nhsel++) |
77 | 77 | ||
78 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ | 78 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
@@ -358,7 +358,7 @@ int fib_detect_death(struct fib_info *fi, int order, | |||
358 | state = n->nud_state; | 358 | state = n->nud_state; |
359 | neigh_release(n); | 359 | neigh_release(n); |
360 | } | 360 | } |
361 | if (state==NUD_REACHABLE) | 361 | if (state == NUD_REACHABLE) |
362 | return 0; | 362 | return 0; |
363 | if ((state&NUD_VALID) && order != dflt) | 363 | if ((state&NUD_VALID) && order != dflt) |
364 | return 0; | 364 | return 0; |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 5cb72786a8af..ec0ae490f0b6 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2399,8 +2399,8 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2399 | __be32 prf = htonl(mask_pfx(tn->key, tn->pos)); | 2399 | __be32 prf = htonl(mask_pfx(tn->key, tn->pos)); |
2400 | 2400 | ||
2401 | seq_indent(seq, iter->depth-1); | 2401 | seq_indent(seq, iter->depth-1); |
2402 | seq_printf(seq, " +-- " NIPQUAD_FMT "/%d %d %d %d\n", | 2402 | seq_printf(seq, " +-- %pI4/%d %d %d %d\n", |
2403 | NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, | 2403 | &prf, tn->pos, tn->bits, tn->full_children, |
2404 | tn->empty_children); | 2404 | tn->empty_children); |
2405 | 2405 | ||
2406 | } else { | 2406 | } else { |
@@ -2410,7 +2410,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2410 | __be32 val = htonl(l->key); | 2410 | __be32 val = htonl(l->key); |
2411 | 2411 | ||
2412 | seq_indent(seq, iter->depth); | 2412 | seq_indent(seq, iter->depth); |
2413 | seq_printf(seq, " |-- " NIPQUAD_FMT "\n", NIPQUAD(val)); | 2413 | seq_printf(seq, " |-- %pI4\n", &val); |
2414 | 2414 | ||
2415 | hlist_for_each_entry_rcu(li, node, &l->list, hlist) { | 2415 | hlist_for_each_entry_rcu(li, node, &l->list, hlist) { |
2416 | struct fib_alias *fa; | 2416 | struct fib_alias *fa; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 72b2de76f1cd..21e497efbd7f 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -683,10 +683,8 @@ static void icmp_unreach(struct sk_buff *skb) | |||
683 | break; | 683 | break; |
684 | case ICMP_FRAG_NEEDED: | 684 | case ICMP_FRAG_NEEDED: |
685 | if (ipv4_config.no_pmtu_disc) { | 685 | if (ipv4_config.no_pmtu_disc) { |
686 | LIMIT_NETDEBUG(KERN_INFO "ICMP: " NIPQUAD_FMT ": " | 686 | LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: fragmentation needed and DF set.\n", |
687 | "fragmentation needed " | 687 | &iph->daddr); |
688 | "and DF set.\n", | ||
689 | NIPQUAD(iph->daddr)); | ||
690 | } else { | 688 | } else { |
691 | info = ip_rt_frag_needed(net, iph, | 689 | info = ip_rt_frag_needed(net, iph, |
692 | ntohs(icmph->un.frag.mtu), | 690 | ntohs(icmph->un.frag.mtu), |
@@ -696,9 +694,8 @@ static void icmp_unreach(struct sk_buff *skb) | |||
696 | } | 694 | } |
697 | break; | 695 | break; |
698 | case ICMP_SR_FAILED: | 696 | case ICMP_SR_FAILED: |
699 | LIMIT_NETDEBUG(KERN_INFO "ICMP: " NIPQUAD_FMT ": Source " | 697 | LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: Source Route Failed.\n", |
700 | "Route Failed.\n", | 698 | &iph->daddr); |
701 | NIPQUAD(iph->daddr)); | ||
702 | break; | 699 | break; |
703 | default: | 700 | default: |
704 | break; | 701 | break; |
@@ -729,12 +726,12 @@ static void icmp_unreach(struct sk_buff *skb) | |||
729 | if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses && | 726 | if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses && |
730 | inet_addr_type(net, iph->daddr) == RTN_BROADCAST) { | 727 | inet_addr_type(net, iph->daddr) == RTN_BROADCAST) { |
731 | if (net_ratelimit()) | 728 | if (net_ratelimit()) |
732 | printk(KERN_WARNING NIPQUAD_FMT " sent an invalid ICMP " | 729 | printk(KERN_WARNING "%pI4 sent an invalid ICMP " |
733 | "type %u, code %u " | 730 | "type %u, code %u " |
734 | "error to a broadcast: " NIPQUAD_FMT " on %s\n", | 731 | "error to a broadcast: %pI4 on %s\n", |
735 | NIPQUAD(ip_hdr(skb)->saddr), | 732 | &ip_hdr(skb)->saddr, |
736 | icmph->type, icmph->code, | 733 | icmph->type, icmph->code, |
737 | NIPQUAD(iph->daddr), | 734 | &iph->daddr, |
738 | skb->dev->name); | 735 | skb->dev->name); |
739 | goto out; | 736 | goto out; |
740 | } | 737 | } |
@@ -952,9 +949,8 @@ static void icmp_address_reply(struct sk_buff *skb) | |||
952 | break; | 949 | break; |
953 | } | 950 | } |
954 | if (!ifa && net_ratelimit()) { | 951 | if (!ifa && net_ratelimit()) { |
955 | printk(KERN_INFO "Wrong address mask " NIPQUAD_FMT " from " | 952 | printk(KERN_INFO "Wrong address mask %pI4 from %s/%pI4\n", |
956 | "%s/" NIPQUAD_FMT "\n", | 953 | mp, dev->name, &rt->rt_src); |
957 | NIPQUAD(*mp), dev->name, NIPQUAD(rt->rt_src)); | ||
958 | } | 954 | } |
959 | } | 955 | } |
960 | rcu_read_unlock(); | 956 | rcu_read_unlock(); |
@@ -976,9 +972,10 @@ int icmp_rcv(struct sk_buff *skb) | |||
976 | struct net *net = dev_net(rt->u.dst.dev); | 972 | struct net *net = dev_net(rt->u.dst.dev); |
977 | 973 | ||
978 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 974 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
975 | struct sec_path *sp = skb_sec_path(skb); | ||
979 | int nh; | 976 | int nh; |
980 | 977 | ||
981 | if (!(skb->sp && skb->sp->xvec[skb->sp->len - 1]->props.flags & | 978 | if (!(sp && sp->xvec[sp->len - 1]->props.flags & |
982 | XFRM_STATE_ICMP)) | 979 | XFRM_STATE_ICMP)) |
983 | goto drop; | 980 | goto drop; |
984 | 981 | ||
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index a0d86455c53e..f92733e15c9f 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -167,7 +167,7 @@ static __inline__ void igmp_stop_timer(struct ip_mc_list *im) | |||
167 | spin_lock_bh(&im->lock); | 167 | spin_lock_bh(&im->lock); |
168 | if (del_timer(&im->timer)) | 168 | if (del_timer(&im->timer)) |
169 | atomic_dec(&im->refcnt); | 169 | atomic_dec(&im->refcnt); |
170 | im->tm_running=0; | 170 | im->tm_running = 0; |
171 | im->reporter = 0; | 171 | im->reporter = 0; |
172 | im->unsolicit_count = 0; | 172 | im->unsolicit_count = 0; |
173 | spin_unlock_bh(&im->lock); | 173 | spin_unlock_bh(&im->lock); |
@@ -176,9 +176,9 @@ static __inline__ void igmp_stop_timer(struct ip_mc_list *im) | |||
176 | /* It must be called with locked im->lock */ | 176 | /* It must be called with locked im->lock */ |
177 | static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | 177 | static void igmp_start_timer(struct ip_mc_list *im, int max_delay) |
178 | { | 178 | { |
179 | int tv=net_random() % max_delay; | 179 | int tv = net_random() % max_delay; |
180 | 180 | ||
181 | im->tm_running=1; | 181 | im->tm_running = 1; |
182 | if (!mod_timer(&im->timer, jiffies+tv+2)) | 182 | if (!mod_timer(&im->timer, jiffies+tv+2)) |
183 | atomic_inc(&im->refcnt); | 183 | atomic_inc(&im->refcnt); |
184 | } | 184 | } |
@@ -207,7 +207,7 @@ static void igmp_mod_timer(struct ip_mc_list *im, int max_delay) | |||
207 | if (del_timer(&im->timer)) { | 207 | if (del_timer(&im->timer)) { |
208 | if ((long)(im->timer.expires-jiffies) < max_delay) { | 208 | if ((long)(im->timer.expires-jiffies) < max_delay) { |
209 | add_timer(&im->timer); | 209 | add_timer(&im->timer); |
210 | im->tm_running=1; | 210 | im->tm_running = 1; |
211 | spin_unlock_bh(&im->lock); | 211 | spin_unlock_bh(&im->lock); |
212 | return; | 212 | return; |
213 | } | 213 | } |
@@ -358,7 +358,7 @@ static int igmpv3_sendpack(struct sk_buff *skb) | |||
358 | 358 | ||
359 | static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel) | 359 | static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel) |
360 | { | 360 | { |
361 | return sizeof(struct igmpv3_grec) + 4*igmp_scount(pmc,type,gdel,sdel); | 361 | return sizeof(struct igmpv3_grec) + 4*igmp_scount(pmc, type, gdel, sdel); |
362 | } | 362 | } |
363 | 363 | ||
364 | static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, | 364 | static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, |
@@ -653,7 +653,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
653 | return -1; | 653 | return -1; |
654 | } | 654 | } |
655 | 655 | ||
656 | skb=alloc_skb(IGMP_SIZE+LL_ALLOCATED_SPACE(dev), GFP_ATOMIC); | 656 | skb = alloc_skb(IGMP_SIZE+LL_ALLOCATED_SPACE(dev), GFP_ATOMIC); |
657 | if (skb == NULL) { | 657 | if (skb == NULL) { |
658 | ip_rt_put(rt); | 658 | ip_rt_put(rt); |
659 | return -1; | 659 | return -1; |
@@ -682,11 +682,11 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
682 | ((u8*)&iph[1])[3] = 0; | 682 | ((u8*)&iph[1])[3] = 0; |
683 | 683 | ||
684 | ih = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); | 684 | ih = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); |
685 | ih->type=type; | 685 | ih->type = type; |
686 | ih->code=0; | 686 | ih->code = 0; |
687 | ih->csum=0; | 687 | ih->csum = 0; |
688 | ih->group=group; | 688 | ih->group = group; |
689 | ih->csum=ip_compute_csum((void *)ih, sizeof(struct igmphdr)); | 689 | ih->csum = ip_compute_csum((void *)ih, sizeof(struct igmphdr)); |
690 | 690 | ||
691 | return ip_local_out(skb); | 691 | return ip_local_out(skb); |
692 | } | 692 | } |
@@ -728,7 +728,7 @@ static void igmp_timer_expire(unsigned long data) | |||
728 | struct in_device *in_dev = im->interface; | 728 | struct in_device *in_dev = im->interface; |
729 | 729 | ||
730 | spin_lock(&im->lock); | 730 | spin_lock(&im->lock); |
731 | im->tm_running=0; | 731 | im->tm_running = 0; |
732 | 732 | ||
733 | if (im->unsolicit_count) { | 733 | if (im->unsolicit_count) { |
734 | im->unsolicit_count--; | 734 | im->unsolicit_count--; |
@@ -997,7 +997,7 @@ static void ip_mc_filter_add(struct in_device *in_dev, __be32 addr) | |||
997 | --ANK | 997 | --ANK |
998 | */ | 998 | */ |
999 | if (arp_mc_map(addr, buf, dev, 0) == 0) | 999 | if (arp_mc_map(addr, buf, dev, 0) == 0) |
1000 | dev_mc_add(dev,buf,dev->addr_len,0); | 1000 | dev_mc_add(dev, buf, dev->addr_len, 0); |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | /* | 1003 | /* |
@@ -1010,7 +1010,7 @@ static void ip_mc_filter_del(struct in_device *in_dev, __be32 addr) | |||
1010 | struct net_device *dev = in_dev->dev; | 1010 | struct net_device *dev = in_dev->dev; |
1011 | 1011 | ||
1012 | if (arp_mc_map(addr, buf, dev, 0) == 0) | 1012 | if (arp_mc_map(addr, buf, dev, 0) == 0) |
1013 | dev_mc_delete(dev,buf,dev->addr_len,0); | 1013 | dev_mc_delete(dev, buf, dev->addr_len, 0); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | #ifdef CONFIG_IP_MULTICAST | 1016 | #ifdef CONFIG_IP_MULTICAST |
@@ -1210,10 +1210,10 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) | |||
1210 | if (!im) | 1210 | if (!im) |
1211 | goto out; | 1211 | goto out; |
1212 | 1212 | ||
1213 | im->users=1; | 1213 | im->users = 1; |
1214 | im->interface=in_dev; | 1214 | im->interface = in_dev; |
1215 | in_dev_hold(in_dev); | 1215 | in_dev_hold(in_dev); |
1216 | im->multiaddr=addr; | 1216 | im->multiaddr = addr; |
1217 | /* initial mode is (EX, empty) */ | 1217 | /* initial mode is (EX, empty) */ |
1218 | im->sfmode = MCAST_EXCLUDE; | 1218 | im->sfmode = MCAST_EXCLUDE; |
1219 | im->sfcount[MCAST_INCLUDE] = 0; | 1219 | im->sfcount[MCAST_INCLUDE] = 0; |
@@ -1224,7 +1224,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) | |||
1224 | atomic_set(&im->refcnt, 1); | 1224 | atomic_set(&im->refcnt, 1); |
1225 | spin_lock_init(&im->lock); | 1225 | spin_lock_init(&im->lock); |
1226 | #ifdef CONFIG_IP_MULTICAST | 1226 | #ifdef CONFIG_IP_MULTICAST |
1227 | im->tm_running=0; | 1227 | im->tm_running = 0; |
1228 | setup_timer(&im->timer, &igmp_timer_expire, (unsigned long)im); | 1228 | setup_timer(&im->timer, &igmp_timer_expire, (unsigned long)im); |
1229 | im->unsolicit_count = IGMP_Unsolicited_Report_Count; | 1229 | im->unsolicit_count = IGMP_Unsolicited_Report_Count; |
1230 | im->reporter = 0; | 1230 | im->reporter = 0; |
@@ -1232,8 +1232,8 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) | |||
1232 | #endif | 1232 | #endif |
1233 | im->loaded = 0; | 1233 | im->loaded = 0; |
1234 | write_lock_bh(&in_dev->mc_list_lock); | 1234 | write_lock_bh(&in_dev->mc_list_lock); |
1235 | im->next=in_dev->mc_list; | 1235 | im->next = in_dev->mc_list; |
1236 | in_dev->mc_list=im; | 1236 | in_dev->mc_list = im; |
1237 | in_dev->mc_count++; | 1237 | in_dev->mc_count++; |
1238 | write_unlock_bh(&in_dev->mc_list_lock); | 1238 | write_unlock_bh(&in_dev->mc_list_lock); |
1239 | #ifdef CONFIG_IP_MULTICAST | 1239 | #ifdef CONFIG_IP_MULTICAST |
@@ -1279,7 +1279,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) | |||
1279 | ASSERT_RTNL(); | 1279 | ASSERT_RTNL(); |
1280 | 1280 | ||
1281 | for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { | 1281 | for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { |
1282 | if (i->multiaddr==addr) { | 1282 | if (i->multiaddr == addr) { |
1283 | if (--i->users == 0) { | 1283 | if (--i->users == 0) { |
1284 | write_lock_bh(&in_dev->mc_list_lock); | 1284 | write_lock_bh(&in_dev->mc_list_lock); |
1285 | *ip = i->next; | 1285 | *ip = i->next; |
@@ -1738,7 +1738,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) | |||
1738 | { | 1738 | { |
1739 | int err; | 1739 | int err; |
1740 | __be32 addr = imr->imr_multiaddr.s_addr; | 1740 | __be32 addr = imr->imr_multiaddr.s_addr; |
1741 | struct ip_mc_socklist *iml=NULL, *i; | 1741 | struct ip_mc_socklist *iml = NULL, *i; |
1742 | struct in_device *in_dev; | 1742 | struct in_device *in_dev; |
1743 | struct inet_sock *inet = inet_sk(sk); | 1743 | struct inet_sock *inet = inet_sk(sk); |
1744 | struct net *net = sock_net(sk); | 1744 | struct net *net = sock_net(sk); |
@@ -1769,7 +1769,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) | |||
1769 | err = -ENOBUFS; | 1769 | err = -ENOBUFS; |
1770 | if (count >= sysctl_igmp_max_memberships) | 1770 | if (count >= sysctl_igmp_max_memberships) |
1771 | goto done; | 1771 | goto done; |
1772 | iml = sock_kmalloc(sk,sizeof(*iml),GFP_KERNEL); | 1772 | iml = sock_kmalloc(sk, sizeof(*iml), GFP_KERNEL); |
1773 | if (iml == NULL) | 1773 | if (iml == NULL) |
1774 | goto done; | 1774 | goto done; |
1775 | 1775 | ||
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index bd1278a2d828..36f4cbc7da3a 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -323,7 +323,7 @@ void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long len) | |||
323 | 323 | ||
324 | EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); | 324 | EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); |
325 | 325 | ||
326 | struct dst_entry* inet_csk_route_req(struct sock *sk, | 326 | struct dst_entry *inet_csk_route_req(struct sock *sk, |
327 | const struct request_sock *req) | 327 | const struct request_sock *req) |
328 | { | 328 | { |
329 | struct rtable *rt; | 329 | struct rtable *rt; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index a456ceeac3f2..b1fbe18feb5a 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -144,7 +144,7 @@ static void unlink_from_unused(struct inet_peer *p) | |||
144 | * _stack is known to be NULL or not at compile time, | 144 | * _stack is known to be NULL or not at compile time, |
145 | * so compiler will optimize the if (_stack) tests. | 145 | * so compiler will optimize the if (_stack) tests. |
146 | */ | 146 | */ |
147 | #define lookup(_daddr,_stack) \ | 147 | #define lookup(_daddr, _stack) \ |
148 | ({ \ | 148 | ({ \ |
149 | struct inet_peer *u, **v; \ | 149 | struct inet_peer *u, **v; \ |
150 | if (_stack != NULL) { \ | 150 | if (_stack != NULL) { \ |
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/ip_fragment.c b/net/ipv4/ip_fragment.c index e4f81f54befe..6659ac000eeb 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -56,7 +56,7 @@ struct ipfrag_skb_cb | |||
56 | int offset; | 56 | int offset; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | #define FRAG_CB(skb) ((struct ipfrag_skb_cb*)((skb)->cb)) | 59 | #define FRAG_CB(skb) ((struct ipfrag_skb_cb *)((skb)->cb)) |
60 | 60 | ||
61 | /* Describe an entry in the "incomplete datagrams" queue. */ | 61 | /* Describe an entry in the "incomplete datagrams" queue. */ |
62 | struct ipq { | 62 | struct ipq { |
@@ -559,9 +559,8 @@ out_nomem: | |||
559 | goto out_fail; | 559 | goto out_fail; |
560 | out_oversize: | 560 | out_oversize: |
561 | if (net_ratelimit()) | 561 | if (net_ratelimit()) |
562 | printk(KERN_INFO | 562 | printk(KERN_INFO "Oversized IP packet from %pI4.\n", |
563 | "Oversized IP packet from " NIPQUAD_FMT ".\n", | 563 | &qp->saddr); |
564 | NIPQUAD(qp->saddr)); | ||
565 | out_fail: | 564 | out_fail: |
566 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS); | 565 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS); |
567 | return err; | 566 | return err; |
@@ -608,7 +607,7 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = { | |||
608 | .data = &init_net.ipv4.frags.high_thresh, | 607 | .data = &init_net.ipv4.frags.high_thresh, |
609 | .maxlen = sizeof(int), | 608 | .maxlen = sizeof(int), |
610 | .mode = 0644, | 609 | .mode = 0644, |
611 | .proc_handler = &proc_dointvec | 610 | .proc_handler = proc_dointvec |
612 | }, | 611 | }, |
613 | { | 612 | { |
614 | .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH, | 613 | .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH, |
@@ -616,7 +615,7 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = { | |||
616 | .data = &init_net.ipv4.frags.low_thresh, | 615 | .data = &init_net.ipv4.frags.low_thresh, |
617 | .maxlen = sizeof(int), | 616 | .maxlen = sizeof(int), |
618 | .mode = 0644, | 617 | .mode = 0644, |
619 | .proc_handler = &proc_dointvec | 618 | .proc_handler = proc_dointvec |
620 | }, | 619 | }, |
621 | { | 620 | { |
622 | .ctl_name = NET_IPV4_IPFRAG_TIME, | 621 | .ctl_name = NET_IPV4_IPFRAG_TIME, |
@@ -624,8 +623,8 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = { | |||
624 | .data = &init_net.ipv4.frags.timeout, | 623 | .data = &init_net.ipv4.frags.timeout, |
625 | .maxlen = sizeof(int), | 624 | .maxlen = sizeof(int), |
626 | .mode = 0644, | 625 | .mode = 0644, |
627 | .proc_handler = &proc_dointvec_jiffies, | 626 | .proc_handler = proc_dointvec_jiffies, |
628 | .strategy = &sysctl_jiffies | 627 | .strategy = sysctl_jiffies |
629 | }, | 628 | }, |
630 | { } | 629 | { } |
631 | }; | 630 | }; |
@@ -637,15 +636,15 @@ static struct ctl_table ip4_frags_ctl_table[] = { | |||
637 | .data = &ip4_frags.secret_interval, | 636 | .data = &ip4_frags.secret_interval, |
638 | .maxlen = sizeof(int), | 637 | .maxlen = sizeof(int), |
639 | .mode = 0644, | 638 | .mode = 0644, |
640 | .proc_handler = &proc_dointvec_jiffies, | 639 | .proc_handler = proc_dointvec_jiffies, |
641 | .strategy = &sysctl_jiffies | 640 | .strategy = sysctl_jiffies |
642 | }, | 641 | }, |
643 | { | 642 | { |
644 | .procname = "ipfrag_max_dist", | 643 | .procname = "ipfrag_max_dist", |
645 | .data = &sysctl_ipfrag_max_dist, | 644 | .data = &sysctl_ipfrag_max_dist, |
646 | .maxlen = sizeof(int), | 645 | .maxlen = sizeof(int), |
647 | .mode = 0644, | 646 | .mode = 0644, |
648 | .proc_handler = &proc_dointvec_minmax, | 647 | .proc_handler = proc_dointvec_minmax, |
649 | .extra1 = &zero | 648 | .extra1 = &zero |
650 | }, | 649 | }, |
651 | { } | 650 | { } |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 85c487b8572b..191ef7588134 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -371,7 +371,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info) | |||
371 | by themself??? | 371 | by themself??? |
372 | */ | 372 | */ |
373 | 373 | ||
374 | struct iphdr *iph = (struct iphdr*)skb->data; | 374 | struct iphdr *iph = (struct iphdr *)skb->data; |
375 | __be16 *p = (__be16*)(skb->data+(iph->ihl<<2)); | 375 | __be16 *p = (__be16*)(skb->data+(iph->ihl<<2)); |
376 | int grehlen = (iph->ihl<<2) + 4; | 376 | int grehlen = (iph->ihl<<2) + 4; |
377 | const int type = icmp_hdr(skb)->type; | 377 | const int type = icmp_hdr(skb)->type; |
@@ -632,7 +632,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
632 | 632 | ||
633 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { | 633 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { |
634 | gre_hlen = 0; | 634 | gre_hlen = 0; |
635 | tiph = (struct iphdr*)skb->data; | 635 | tiph = (struct iphdr *)skb->data; |
636 | } else { | 636 | } else { |
637 | gre_hlen = tunnel->hlen; | 637 | gre_hlen = tunnel->hlen; |
638 | tiph = &tunnel->parms.iph; | 638 | tiph = &tunnel->parms.iph; |
@@ -660,7 +660,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
660 | if (neigh == NULL) | 660 | if (neigh == NULL) |
661 | goto tx_error; | 661 | goto tx_error; |
662 | 662 | ||
663 | addr6 = (struct in6_addr*)&neigh->primary_key; | 663 | addr6 = (struct in6_addr *)&neigh->primary_key; |
664 | addr_type = ipv6_addr_type(addr6); | 664 | addr_type = ipv6_addr_type(addr6); |
665 | 665 | ||
666 | if (addr_type == IPV6_ADDR_ANY) { | 666 | if (addr_type == IPV6_ADDR_ANY) { |
@@ -726,7 +726,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
726 | } | 726 | } |
727 | #ifdef CONFIG_IPV6 | 727 | #ifdef CONFIG_IPV6 |
728 | else if (skb->protocol == htons(ETH_P_IPV6)) { | 728 | else if (skb->protocol == htons(ETH_P_IPV6)) { |
729 | struct rt6_info *rt6 = (struct rt6_info*)skb->dst; | 729 | struct rt6_info *rt6 = (struct rt6_info *)skb->dst; |
730 | 730 | ||
731 | if (rt6 && mtu < dst_mtu(skb->dst) && mtu >= IPV6_MIN_MTU) { | 731 | if (rt6 && mtu < dst_mtu(skb->dst) && mtu >= IPV6_MIN_MTU) { |
732 | if ((tunnel->parms.iph.daddr && | 732 | if ((tunnel->parms.iph.daddr && |
@@ -800,7 +800,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
800 | iph->ttl = old_iph->ttl; | 800 | iph->ttl = old_iph->ttl; |
801 | #ifdef CONFIG_IPV6 | 801 | #ifdef CONFIG_IPV6 |
802 | else if (skb->protocol == htons(ETH_P_IPV6)) | 802 | else if (skb->protocol == htons(ETH_P_IPV6)) |
803 | iph->ttl = ((struct ipv6hdr*)old_iph)->hop_limit; | 803 | iph->ttl = ((struct ipv6hdr *)old_iph)->hop_limit; |
804 | #endif | 804 | #endif |
805 | else | 805 | else |
806 | iph->ttl = dst_metric(&rt->u.dst, RTAX_HOPLIMIT); | 806 | iph->ttl = dst_metric(&rt->u.dst, RTAX_HOPLIMIT); |
@@ -962,7 +962,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
962 | break; | 962 | break; |
963 | } | 963 | } |
964 | } else { | 964 | } else { |
965 | unsigned nflags=0; | 965 | unsigned nflags = 0; |
966 | 966 | ||
967 | t = netdev_priv(dev); | 967 | t = netdev_priv(dev); |
968 | 968 | ||
@@ -1104,7 +1104,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, | |||
1104 | 1104 | ||
1105 | static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) | 1105 | static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) |
1106 | { | 1106 | { |
1107 | struct iphdr *iph = (struct iphdr*) skb_mac_header(skb); | 1107 | struct iphdr *iph = (struct iphdr *) skb_mac_header(skb); |
1108 | memcpy(haddr, &iph->saddr, 4); | 1108 | memcpy(haddr, &iph->saddr, 4); |
1109 | return 4; | 1109 | return 4; |
1110 | } | 1110 | } |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 861978a4f1a8..70bedab03b09 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -294,10 +294,8 @@ static inline int ip_rcv_options(struct sk_buff *skb) | |||
294 | if (!IN_DEV_SOURCE_ROUTE(in_dev)) { | 294 | if (!IN_DEV_SOURCE_ROUTE(in_dev)) { |
295 | if (IN_DEV_LOG_MARTIANS(in_dev) && | 295 | if (IN_DEV_LOG_MARTIANS(in_dev) && |
296 | net_ratelimit()) | 296 | net_ratelimit()) |
297 | printk(KERN_INFO "source route option " | 297 | printk(KERN_INFO "source route option %pI4 -> %pI4\n", |
298 | NIPQUAD_FMT " -> " NIPQUAD_FMT "\n", | 298 | &iph->saddr, &iph->daddr); |
299 | NIPQUAD(iph->saddr), | ||
300 | NIPQUAD(iph->daddr)); | ||
301 | in_dev_put(in_dev); | 299 | in_dev_put(in_dev); |
302 | goto drop; | 300 | goto drop; |
303 | } | 301 | } |
@@ -342,9 +340,9 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
342 | struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id()); | 340 | struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id()); |
343 | u32 idx = skb->dst->tclassid; | 341 | u32 idx = skb->dst->tclassid; |
344 | st[idx&0xFF].o_packets++; | 342 | st[idx&0xFF].o_packets++; |
345 | st[idx&0xFF].o_bytes+=skb->len; | 343 | st[idx&0xFF].o_bytes += skb->len; |
346 | st[(idx>>16)&0xFF].i_packets++; | 344 | st[(idx>>16)&0xFF].i_packets++; |
347 | st[(idx>>16)&0xFF].i_bytes+=skb->len; | 345 | st[(idx>>16)&0xFF].i_bytes += skb->len; |
348 | } | 346 | } |
349 | #endif | 347 | #endif |
350 | 348 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index d2a8f8bb78a6..46d7be233eac 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -430,7 +430,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
430 | * single device frame, and queue such a frame for sending. | 430 | * single device frame, and queue such a frame for sending. |
431 | */ | 431 | */ |
432 | 432 | ||
433 | int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) | 433 | int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) |
434 | { | 434 | { |
435 | struct iphdr *iph; | 435 | struct iphdr *iph; |
436 | int raw = 0; | 436 | int raw = 0; |
@@ -720,7 +720,7 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
720 | int getfrag(void *from, char *to, int offset, int len, | 720 | int getfrag(void *from, char *to, int offset, int len, |
721 | int odd, struct sk_buff *skb), | 721 | int odd, struct sk_buff *skb), |
722 | void *from, int length, int hh_len, int fragheaderlen, | 722 | void *from, int length, int hh_len, int fragheaderlen, |
723 | int transhdrlen, int mtu,unsigned int flags) | 723 | int transhdrlen, int mtu, unsigned int flags) |
724 | { | 724 | { |
725 | struct sk_buff *skb; | 725 | struct sk_buff *skb; |
726 | int err; | 726 | int err; |
@@ -741,7 +741,7 @@ static inline int ip_ufo_append_data(struct sock *sk, | |||
741 | skb_reserve(skb, hh_len); | 741 | skb_reserve(skb, hh_len); |
742 | 742 | ||
743 | /* create space for UDP/IP header */ | 743 | /* create space for UDP/IP header */ |
744 | skb_put(skb,fragheaderlen + transhdrlen); | 744 | skb_put(skb, fragheaderlen + transhdrlen); |
745 | 745 | ||
746 | /* initialize network header pointer */ | 746 | /* initialize network header pointer */ |
747 | skb_reset_network_header(skb); | 747 | skb_reset_network_header(skb); |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 465abf0a9869..e976efeb1456 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -94,7 +94,7 @@ static void ip_cmsg_recv_opts(struct msghdr *msg, struct sk_buff *skb) | |||
94 | static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb) | 94 | static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb) |
95 | { | 95 | { |
96 | unsigned char optbuf[sizeof(struct ip_options) + 40]; | 96 | unsigned char optbuf[sizeof(struct ip_options) + 40]; |
97 | struct ip_options * opt = (struct ip_options*)optbuf; | 97 | struct ip_options * opt = (struct ip_options *)optbuf; |
98 | 98 | ||
99 | if (IPCB(skb)->opt.optlen == 0) | 99 | if (IPCB(skb)->opt.optlen == 0) |
100 | return; | 100 | return; |
@@ -411,7 +411,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
411 | int optname, char __user *optval, int optlen) | 411 | int optname, char __user *optval, int optlen) |
412 | { | 412 | { |
413 | struct inet_sock *inet = inet_sk(sk); | 413 | struct inet_sock *inet = inet_sk(sk); |
414 | int val=0,err; | 414 | int val = 0, err; |
415 | 415 | ||
416 | if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | | 416 | if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | |
417 | (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | | 417 | (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | |
@@ -437,7 +437,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
437 | /* If optlen==0, it is equivalent to val == 0 */ | 437 | /* If optlen==0, it is equivalent to val == 0 */ |
438 | 438 | ||
439 | if (ip_mroute_opt(optname)) | 439 | if (ip_mroute_opt(optname)) |
440 | return ip_mroute_setsockopt(sk,optname,optval,optlen); | 440 | return ip_mroute_setsockopt(sk, optname, optval, optlen); |
441 | 441 | ||
442 | err = 0; | 442 | err = 0; |
443 | lock_sock(sk); | 443 | lock_sock(sk); |
@@ -549,7 +549,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
549 | goto e_inval; | 549 | goto e_inval; |
550 | if (optlen<1) | 550 | if (optlen<1) |
551 | goto e_inval; | 551 | goto e_inval; |
552 | if (val==-1) | 552 | if (val == -1) |
553 | val = 1; | 553 | val = 1; |
554 | if (val < 0 || val > 255) | 554 | if (val < 0 || val > 255) |
555 | goto e_inval; | 555 | goto e_inval; |
@@ -573,12 +573,12 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
573 | 573 | ||
574 | err = -EFAULT; | 574 | err = -EFAULT; |
575 | if (optlen >= sizeof(struct ip_mreqn)) { | 575 | if (optlen >= sizeof(struct ip_mreqn)) { |
576 | if (copy_from_user(&mreq,optval,sizeof(mreq))) | 576 | if (copy_from_user(&mreq, optval, sizeof(mreq))) |
577 | break; | 577 | break; |
578 | } else { | 578 | } else { |
579 | memset(&mreq, 0, sizeof(mreq)); | 579 | memset(&mreq, 0, sizeof(mreq)); |
580 | if (optlen >= sizeof(struct in_addr) && | 580 | if (optlen >= sizeof(struct in_addr) && |
581 | copy_from_user(&mreq.imr_address,optval,sizeof(struct in_addr))) | 581 | copy_from_user(&mreq.imr_address, optval, sizeof(struct in_addr))) |
582 | break; | 582 | break; |
583 | } | 583 | } |
584 | 584 | ||
@@ -626,11 +626,11 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
626 | goto e_inval; | 626 | goto e_inval; |
627 | err = -EFAULT; | 627 | err = -EFAULT; |
628 | if (optlen >= sizeof(struct ip_mreqn)) { | 628 | if (optlen >= sizeof(struct ip_mreqn)) { |
629 | if (copy_from_user(&mreq,optval,sizeof(mreq))) | 629 | if (copy_from_user(&mreq, optval, sizeof(mreq))) |
630 | break; | 630 | break; |
631 | } else { | 631 | } else { |
632 | memset(&mreq, 0, sizeof(mreq)); | 632 | memset(&mreq, 0, sizeof(mreq)); |
633 | if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq))) | 633 | if (copy_from_user(&mreq, optval, sizeof(struct ip_mreq))) |
634 | break; | 634 | break; |
635 | } | 635 | } |
636 | 636 | ||
@@ -808,7 +808,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
808 | err = -ENOBUFS; | 808 | err = -ENOBUFS; |
809 | break; | 809 | break; |
810 | } | 810 | } |
811 | gsf = kmalloc(optlen,GFP_KERNEL); | 811 | gsf = kmalloc(optlen, GFP_KERNEL); |
812 | if (!gsf) { | 812 | if (!gsf) { |
813 | err = -ENOBUFS; | 813 | err = -ENOBUFS; |
814 | break; | 814 | break; |
@@ -828,7 +828,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
828 | goto mc_msf_out; | 828 | goto mc_msf_out; |
829 | } | 829 | } |
830 | msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); | 830 | msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); |
831 | msf = kmalloc(msize,GFP_KERNEL); | 831 | msf = kmalloc(msize, GFP_KERNEL); |
832 | if (!msf) { | 832 | if (!msf) { |
833 | err = -ENOBUFS; | 833 | err = -ENOBUFS; |
834 | goto mc_msf_out; | 834 | goto mc_msf_out; |
@@ -971,9 +971,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
971 | return -EOPNOTSUPP; | 971 | return -EOPNOTSUPP; |
972 | 972 | ||
973 | if (ip_mroute_opt(optname)) | 973 | if (ip_mroute_opt(optname)) |
974 | return ip_mroute_getsockopt(sk,optname,optval,optlen); | 974 | return ip_mroute_getsockopt(sk, optname, optval, optlen); |
975 | 975 | ||
976 | if (get_user(len,optlen)) | 976 | if (get_user(len, optlen)) |
977 | return -EFAULT; | 977 | return -EFAULT; |
978 | if (len < 0) | 978 | if (len < 0) |
979 | return -EINVAL; | 979 | return -EINVAL; |
@@ -984,7 +984,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
984 | case IP_OPTIONS: | 984 | case IP_OPTIONS: |
985 | { | 985 | { |
986 | unsigned char optbuf[sizeof(struct ip_options)+40]; | 986 | unsigned char optbuf[sizeof(struct ip_options)+40]; |
987 | struct ip_options * opt = (struct ip_options*)optbuf; | 987 | struct ip_options * opt = (struct ip_options *)optbuf; |
988 | opt->optlen = 0; | 988 | opt->optlen = 0; |
989 | if (inet->opt) | 989 | if (inet->opt) |
990 | memcpy(optbuf, inet->opt, | 990 | memcpy(optbuf, inet->opt, |
@@ -1154,13 +1154,13 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
1154 | len = 1; | 1154 | len = 1; |
1155 | if (put_user(len, optlen)) | 1155 | if (put_user(len, optlen)) |
1156 | return -EFAULT; | 1156 | return -EFAULT; |
1157 | if (copy_to_user(optval,&ucval,1)) | 1157 | if (copy_to_user(optval, &ucval, 1)) |
1158 | return -EFAULT; | 1158 | return -EFAULT; |
1159 | } else { | 1159 | } else { |
1160 | len = min_t(unsigned int, sizeof(int), len); | 1160 | len = min_t(unsigned int, sizeof(int), len); |
1161 | if (put_user(len, optlen)) | 1161 | if (put_user(len, optlen)) |
1162 | return -EFAULT; | 1162 | return -EFAULT; |
1163 | if (copy_to_user(optval,&val,len)) | 1163 | if (copy_to_user(optval, &val, len)) |
1164 | return -EFAULT; | 1164 | return -EFAULT; |
1165 | } | 1165 | } |
1166 | return 0; | 1166 | return 0; |
@@ -1178,7 +1178,7 @@ int ip_getsockopt(struct sock *sk, int level, | |||
1178 | !ip_mroute_opt(optname)) { | 1178 | !ip_mroute_opt(optname)) { |
1179 | int len; | 1179 | int len; |
1180 | 1180 | ||
1181 | if (get_user(len,optlen)) | 1181 | if (get_user(len, optlen)) |
1182 | return -EFAULT; | 1182 | return -EFAULT; |
1183 | 1183 | ||
1184 | lock_sock(sk); | 1184 | lock_sock(sk); |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 38ccb6dfb02e..ec8264ae45c2 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -39,8 +39,8 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
39 | spi, IPPROTO_COMP, AF_INET); | 39 | spi, IPPROTO_COMP, AF_INET); |
40 | if (!x) | 40 | if (!x) |
41 | return; | 41 | return; |
42 | NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/" NIPQUAD_FMT "\n", | 42 | NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%pI4\n", |
43 | spi, NIPQUAD(iph->daddr)); | 43 | spi, &iph->daddr); |
44 | xfrm_state_put(x); | 44 | xfrm_state_put(x); |
45 | } | 45 | } |
46 | 46 | ||
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 42065fff46c4..42a0f3dd3fd6 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -374,7 +374,7 @@ static int __init ic_defaults(void) | |||
374 | */ | 374 | */ |
375 | 375 | ||
376 | if (!ic_host_name_set) | 376 | if (!ic_host_name_set) |
377 | sprintf(init_utsname()->nodename, NIPQUAD_FMT, NIPQUAD(ic_myaddr)); | 377 | sprintf(init_utsname()->nodename, "%pI4", &ic_myaddr); |
378 | 378 | ||
379 | if (root_server_addr == NONE) | 379 | if (root_server_addr == NONE) |
380 | root_server_addr = ic_servaddr; | 380 | root_server_addr = ic_servaddr; |
@@ -387,11 +387,11 @@ static int __init ic_defaults(void) | |||
387 | else if (IN_CLASSC(ntohl(ic_myaddr))) | 387 | else if (IN_CLASSC(ntohl(ic_myaddr))) |
388 | ic_netmask = htonl(IN_CLASSC_NET); | 388 | ic_netmask = htonl(IN_CLASSC_NET); |
389 | else { | 389 | else { |
390 | printk(KERN_ERR "IP-Config: Unable to guess netmask for address " NIPQUAD_FMT "\n", | 390 | printk(KERN_ERR "IP-Config: Unable to guess netmask for address %pI4\n", |
391 | NIPQUAD(ic_myaddr)); | 391 | &ic_myaddr); |
392 | return -1; | 392 | return -1; |
393 | } | 393 | } |
394 | printk("IP-Config: Guessing netmask " NIPQUAD_FMT "\n", NIPQUAD(ic_netmask)); | 394 | printk("IP-Config: Guessing netmask %pI4\n", &ic_netmask); |
395 | } | 395 | } |
396 | 396 | ||
397 | return 0; | 397 | return 0; |
@@ -979,10 +979,8 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str | |||
979 | ic_myaddr = b->your_ip; | 979 | ic_myaddr = b->your_ip; |
980 | ic_servaddr = server_id; | 980 | ic_servaddr = server_id; |
981 | #ifdef IPCONFIG_DEBUG | 981 | #ifdef IPCONFIG_DEBUG |
982 | printk("DHCP: Offered address " NIPQUAD_FMT, | 982 | printk("DHCP: Offered address %pI4 by server %pI4\n", |
983 | NIPQUAD(ic_myaddr)); | 983 | &ic_myaddr, &ic_servaddr); |
984 | printk(" by server " NIPQUAD_FMT "\n", | ||
985 | NIPQUAD(ic_servaddr)); | ||
986 | #endif | 984 | #endif |
987 | /* The DHCP indicated server address takes | 985 | /* The DHCP indicated server address takes |
988 | * precedence over the bootp header one if | 986 | * precedence over the bootp header one if |
@@ -1177,11 +1175,11 @@ static int __init ic_dynamic(void) | |||
1177 | return -1; | 1175 | return -1; |
1178 | } | 1176 | } |
1179 | 1177 | ||
1180 | printk("IP-Config: Got %s answer from " NIPQUAD_FMT ", ", | 1178 | printk("IP-Config: Got %s answer from %pI4, ", |
1181 | ((ic_got_reply & IC_RARP) ? "RARP" | 1179 | ((ic_got_reply & IC_RARP) ? "RARP" |
1182 | : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), | 1180 | : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), |
1183 | NIPQUAD(ic_servaddr)); | 1181 | &ic_servaddr); |
1184 | printk("my address is " NIPQUAD_FMT "\n", NIPQUAD(ic_myaddr)); | 1182 | printk("my address is %pI4\n", &ic_myaddr); |
1185 | 1183 | ||
1186 | return 0; | 1184 | return 0; |
1187 | } | 1185 | } |
@@ -1206,14 +1204,12 @@ static int pnp_seq_show(struct seq_file *seq, void *v) | |||
1206 | "domain %s\n", ic_domain); | 1204 | "domain %s\n", ic_domain); |
1207 | for (i = 0; i < CONF_NAMESERVERS_MAX; i++) { | 1205 | for (i = 0; i < CONF_NAMESERVERS_MAX; i++) { |
1208 | if (ic_nameservers[i] != NONE) | 1206 | if (ic_nameservers[i] != NONE) |
1209 | seq_printf(seq, | 1207 | seq_printf(seq, "nameserver %pI4\n", |
1210 | "nameserver " NIPQUAD_FMT "\n", | 1208 | &ic_nameservers[i]); |
1211 | NIPQUAD(ic_nameservers[i])); | ||
1212 | } | 1209 | } |
1213 | if (ic_servaddr != NONE) | 1210 | if (ic_servaddr != NONE) |
1214 | seq_printf(seq, | 1211 | seq_printf(seq, "bootserver %pI4\n", |
1215 | "bootserver " NIPQUAD_FMT "\n", | 1212 | &ic_servaddr); |
1216 | NIPQUAD(ic_servaddr)); | ||
1217 | return 0; | 1213 | return 0; |
1218 | } | 1214 | } |
1219 | 1215 | ||
@@ -1387,13 +1383,13 @@ static int __init ip_auto_config(void) | |||
1387 | */ | 1383 | */ |
1388 | printk("IP-Config: Complete:"); | 1384 | printk("IP-Config: Complete:"); |
1389 | printk("\n device=%s", ic_dev->name); | 1385 | printk("\n device=%s", ic_dev->name); |
1390 | printk(", addr=" NIPQUAD_FMT, NIPQUAD(ic_myaddr)); | 1386 | printk(", addr=%pI4", &ic_myaddr); |
1391 | printk(", mask=" NIPQUAD_FMT, NIPQUAD(ic_netmask)); | 1387 | printk(", mask=%pI4", &ic_netmask); |
1392 | printk(", gw=" NIPQUAD_FMT, NIPQUAD(ic_gateway)); | 1388 | printk(", gw=%pI4", &ic_gateway); |
1393 | printk(",\n host=%s, domain=%s, nis-domain=%s", | 1389 | printk(",\n host=%s, domain=%s, nis-domain=%s", |
1394 | utsname()->nodename, ic_domain, utsname()->domainname); | 1390 | utsname()->nodename, ic_domain, utsname()->domainname); |
1395 | printk(",\n bootserver=" NIPQUAD_FMT, NIPQUAD(ic_servaddr)); | 1391 | printk(",\n bootserver=%pI4", &ic_servaddr); |
1396 | printk(", rootserver=" NIPQUAD_FMT, NIPQUAD(root_server_addr)); | 1392 | printk(", rootserver=%pI4", &root_server_addr); |
1397 | printk(", rootpath=%s", root_server_path); | 1393 | printk(", rootpath=%s", root_server_path); |
1398 | printk("\n"); | 1394 | printk("\n"); |
1399 | #endif /* !SILENT */ | 1395 | #endif /* !SILENT */ |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 29609d29df76..b3c3d7b0d116 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -281,7 +281,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) | |||
281 | 8 bytes of packet payload. It means, that precise relaying of | 281 | 8 bytes of packet payload. It means, that precise relaying of |
282 | ICMP in the real Internet is absolutely infeasible. | 282 | ICMP in the real Internet is absolutely infeasible. |
283 | */ | 283 | */ |
284 | struct iphdr *iph = (struct iphdr*)skb->data; | 284 | struct iphdr *iph = (struct iphdr *)skb->data; |
285 | const int type = icmp_hdr(skb)->type; | 285 | const int type = icmp_hdr(skb)->type; |
286 | const int code = icmp_hdr(skb)->code; | 286 | const int code = icmp_hdr(skb)->code; |
287 | struct ip_tunnel *t; | 287 | struct ip_tunnel *t; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index b42e082cc170..05ed336f798a 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -331,7 +331,7 @@ static void ipmr_destroy_unres(struct mfc_cache *c) | |||
331 | 331 | ||
332 | atomic_dec(&cache_resolve_queue_len); | 332 | atomic_dec(&cache_resolve_queue_len); |
333 | 333 | ||
334 | while ((skb=skb_dequeue(&c->mfc_un.unres.unresolved))) { | 334 | while ((skb = skb_dequeue(&c->mfc_un.unres.unresolved))) { |
335 | if (ip_hdr(skb)->version == 0) { | 335 | if (ip_hdr(skb)->version == 0) { |
336 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | 336 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); |
337 | nlh->nlmsg_type = NLMSG_ERROR; | 337 | nlh->nlmsg_type = NLMSG_ERROR; |
@@ -477,13 +477,13 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
477 | /* | 477 | /* |
478 | * Fill in the VIF structures | 478 | * Fill in the VIF structures |
479 | */ | 479 | */ |
480 | v->rate_limit=vifc->vifc_rate_limit; | 480 | v->rate_limit = vifc->vifc_rate_limit; |
481 | v->local=vifc->vifc_lcl_addr.s_addr; | 481 | v->local = vifc->vifc_lcl_addr.s_addr; |
482 | v->remote=vifc->vifc_rmt_addr.s_addr; | 482 | v->remote = vifc->vifc_rmt_addr.s_addr; |
483 | v->flags=vifc->vifc_flags; | 483 | v->flags = vifc->vifc_flags; |
484 | if (!mrtsock) | 484 | if (!mrtsock) |
485 | v->flags |= VIFF_STATIC; | 485 | v->flags |= VIFF_STATIC; |
486 | v->threshold=vifc->vifc_threshold; | 486 | v->threshold = vifc->vifc_threshold; |
487 | v->bytes_in = 0; | 487 | v->bytes_in = 0; |
488 | v->bytes_out = 0; | 488 | v->bytes_out = 0; |
489 | v->pkt_in = 0; | 489 | v->pkt_in = 0; |
@@ -494,7 +494,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
494 | 494 | ||
495 | /* And finish update writing critical data */ | 495 | /* And finish update writing critical data */ |
496 | write_lock_bh(&mrt_lock); | 496 | write_lock_bh(&mrt_lock); |
497 | v->dev=dev; | 497 | v->dev = dev; |
498 | #ifdef CONFIG_IP_PIMSM | 498 | #ifdef CONFIG_IP_PIMSM |
499 | if (v->flags&VIFF_REGISTER) | 499 | if (v->flags&VIFF_REGISTER) |
500 | reg_vif_num = vifi; | 500 | reg_vif_num = vifi; |
@@ -507,7 +507,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
507 | 507 | ||
508 | static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp) | 508 | static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp) |
509 | { | 509 | { |
510 | int line=MFC_HASH(mcastgrp,origin); | 510 | int line = MFC_HASH(mcastgrp, origin); |
511 | struct mfc_cache *c; | 511 | struct mfc_cache *c; |
512 | 512 | ||
513 | for (c=mfc_cache_array[line]; c; c = c->next) { | 513 | for (c=mfc_cache_array[line]; c; c = c->next) { |
@@ -522,8 +522,8 @@ static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp) | |||
522 | */ | 522 | */ |
523 | static struct mfc_cache *ipmr_cache_alloc(void) | 523 | static struct mfc_cache *ipmr_cache_alloc(void) |
524 | { | 524 | { |
525 | struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); | 525 | struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); |
526 | if (c==NULL) | 526 | if (c == NULL) |
527 | return NULL; | 527 | return NULL; |
528 | c->mfc_un.res.minvif = MAXVIFS; | 528 | c->mfc_un.res.minvif = MAXVIFS; |
529 | return c; | 529 | return c; |
@@ -531,8 +531,8 @@ static struct mfc_cache *ipmr_cache_alloc(void) | |||
531 | 531 | ||
532 | static struct mfc_cache *ipmr_cache_alloc_unres(void) | 532 | static struct mfc_cache *ipmr_cache_alloc_unres(void) |
533 | { | 533 | { |
534 | struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC); | 534 | struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC); |
535 | if (c==NULL) | 535 | if (c == NULL) |
536 | return NULL; | 536 | return NULL; |
537 | skb_queue_head_init(&c->mfc_un.unres.unresolved); | 537 | skb_queue_head_init(&c->mfc_un.unres.unresolved); |
538 | c->mfc_un.unres.expires = jiffies + 10*HZ; | 538 | c->mfc_un.unres.expires = jiffies + 10*HZ; |
@@ -552,7 +552,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) | |||
552 | * Play the pending entries through our router | 552 | * Play the pending entries through our router |
553 | */ | 553 | */ |
554 | 554 | ||
555 | while ((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) { | 555 | while ((skb = __skb_dequeue(&uc->mfc_un.unres.unresolved))) { |
556 | if (ip_hdr(skb)->version == 0) { | 556 | if (ip_hdr(skb)->version == 0) { |
557 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | 557 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); |
558 | 558 | ||
@@ -637,7 +637,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) | |||
637 | * Add our header | 637 | * Add our header |
638 | */ | 638 | */ |
639 | 639 | ||
640 | igmp=(struct igmphdr *)skb_put(skb,sizeof(struct igmphdr)); | 640 | igmp=(struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); |
641 | igmp->type = | 641 | igmp->type = |
642 | msg->im_msgtype = assert; | 642 | msg->im_msgtype = assert; |
643 | igmp->code = 0; | 643 | igmp->code = 0; |
@@ -653,7 +653,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) | |||
653 | /* | 653 | /* |
654 | * Deliver to mrouted | 654 | * Deliver to mrouted |
655 | */ | 655 | */ |
656 | if ((ret=sock_queue_rcv_skb(mroute_socket,skb))<0) { | 656 | if ((ret = sock_queue_rcv_skb(mroute_socket, skb))<0) { |
657 | if (net_ratelimit()) | 657 | if (net_ratelimit()) |
658 | printk(KERN_WARNING "mroute: pending queue full, dropping entries.\n"); | 658 | printk(KERN_WARNING "mroute: pending queue full, dropping entries.\n"); |
659 | kfree_skb(skb); | 659 | kfree_skb(skb); |
@@ -685,7 +685,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) | |||
685 | * Create a new entry if allowable | 685 | * Create a new entry if allowable |
686 | */ | 686 | */ |
687 | 687 | ||
688 | if (atomic_read(&cache_resolve_queue_len)>=10 || | 688 | if (atomic_read(&cache_resolve_queue_len) >= 10 || |
689 | (c=ipmr_cache_alloc_unres())==NULL) { | 689 | (c=ipmr_cache_alloc_unres())==NULL) { |
690 | spin_unlock_bh(&mfc_unres_lock); | 690 | spin_unlock_bh(&mfc_unres_lock); |
691 | 691 | ||
@@ -728,7 +728,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) | |||
728 | kfree_skb(skb); | 728 | kfree_skb(skb); |
729 | err = -ENOBUFS; | 729 | err = -ENOBUFS; |
730 | } else { | 730 | } else { |
731 | skb_queue_tail(&c->mfc_un.unres.unresolved,skb); | 731 | skb_queue_tail(&c->mfc_un.unres.unresolved, skb); |
732 | err = 0; | 732 | err = 0; |
733 | } | 733 | } |
734 | 734 | ||
@@ -745,7 +745,7 @@ static int ipmr_mfc_delete(struct mfcctl *mfc) | |||
745 | int line; | 745 | int line; |
746 | struct mfc_cache *c, **cp; | 746 | struct mfc_cache *c, **cp; |
747 | 747 | ||
748 | line=MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); | 748 | line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); |
749 | 749 | ||
750 | for (cp=&mfc_cache_array[line]; (c=*cp) != NULL; cp = &c->next) { | 750 | for (cp=&mfc_cache_array[line]; (c=*cp) != NULL; cp = &c->next) { |
751 | if (c->mfc_origin == mfc->mfcc_origin.s_addr && | 751 | if (c->mfc_origin == mfc->mfcc_origin.s_addr && |
@@ -766,7 +766,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock) | |||
766 | int line; | 766 | int line; |
767 | struct mfc_cache *uc, *c, **cp; | 767 | struct mfc_cache *uc, *c, **cp; |
768 | 768 | ||
769 | line=MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); | 769 | line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); |
770 | 770 | ||
771 | for (cp=&mfc_cache_array[line]; (c=*cp) != NULL; cp = &c->next) { | 771 | for (cp=&mfc_cache_array[line]; (c=*cp) != NULL; cp = &c->next) { |
772 | if (c->mfc_origin == mfc->mfcc_origin.s_addr && | 772 | if (c->mfc_origin == mfc->mfcc_origin.s_addr && |
@@ -787,13 +787,13 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock) | |||
787 | if (!ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr)) | 787 | if (!ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr)) |
788 | return -EINVAL; | 788 | return -EINVAL; |
789 | 789 | ||
790 | c=ipmr_cache_alloc(); | 790 | c = ipmr_cache_alloc(); |
791 | if (c==NULL) | 791 | if (c == NULL) |
792 | return -ENOMEM; | 792 | return -ENOMEM; |
793 | 793 | ||
794 | c->mfc_origin=mfc->mfcc_origin.s_addr; | 794 | c->mfc_origin = mfc->mfcc_origin.s_addr; |
795 | c->mfc_mcastgrp=mfc->mfcc_mcastgrp.s_addr; | 795 | c->mfc_mcastgrp = mfc->mfcc_mcastgrp.s_addr; |
796 | c->mfc_parent=mfc->mfcc_parent; | 796 | c->mfc_parent = mfc->mfcc_parent; |
797 | ipmr_update_thresholds(c, mfc->mfcc_ttls); | 797 | ipmr_update_thresholds(c, mfc->mfcc_ttls); |
798 | if (!mrtsock) | 798 | if (!mrtsock) |
799 | c->mfc_flags |= MFC_STATIC; | 799 | c->mfc_flags |= MFC_STATIC; |
@@ -846,7 +846,7 @@ static void mroute_clean_tables(struct sock *sk) | |||
846 | /* | 846 | /* |
847 | * Wipe the cache | 847 | * Wipe the cache |
848 | */ | 848 | */ |
849 | for (i=0;i<MFC_LINES;i++) { | 849 | for (i=0; i<MFC_LINES; i++) { |
850 | struct mfc_cache *c, **cp; | 850 | struct mfc_cache *c, **cp; |
851 | 851 | ||
852 | cp = &mfc_cache_array[i]; | 852 | cp = &mfc_cache_array[i]; |
@@ -887,7 +887,7 @@ static void mrtsock_destruct(struct sock *sk) | |||
887 | IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)--; | 887 | IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)--; |
888 | 888 | ||
889 | write_lock_bh(&mrt_lock); | 889 | write_lock_bh(&mrt_lock); |
890 | mroute_socket=NULL; | 890 | mroute_socket = NULL; |
891 | write_unlock_bh(&mrt_lock); | 891 | write_unlock_bh(&mrt_lock); |
892 | 892 | ||
893 | mroute_clean_tables(sk); | 893 | mroute_clean_tables(sk); |
@@ -902,7 +902,7 @@ static void mrtsock_destruct(struct sock *sk) | |||
902 | * MOSPF/PIM router set up we can clean this up. | 902 | * MOSPF/PIM router set up we can clean this up. |
903 | */ | 903 | */ |
904 | 904 | ||
905 | int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen) | 905 | int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int optlen) |
906 | { | 906 | { |
907 | int ret; | 907 | int ret; |
908 | struct vifctl vif; | 908 | struct vifctl vif; |
@@ -918,7 +918,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
918 | if (sk->sk_type != SOCK_RAW || | 918 | if (sk->sk_type != SOCK_RAW || |
919 | inet_sk(sk)->num != IPPROTO_IGMP) | 919 | inet_sk(sk)->num != IPPROTO_IGMP) |
920 | return -EOPNOTSUPP; | 920 | return -EOPNOTSUPP; |
921 | if (optlen!=sizeof(int)) | 921 | if (optlen != sizeof(int)) |
922 | return -ENOPROTOOPT; | 922 | return -ENOPROTOOPT; |
923 | 923 | ||
924 | rtnl_lock(); | 924 | rtnl_lock(); |
@@ -930,7 +930,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
930 | ret = ip_ra_control(sk, 1, mrtsock_destruct); | 930 | ret = ip_ra_control(sk, 1, mrtsock_destruct); |
931 | if (ret == 0) { | 931 | if (ret == 0) { |
932 | write_lock_bh(&mrt_lock); | 932 | write_lock_bh(&mrt_lock); |
933 | mroute_socket=sk; | 933 | mroute_socket = sk; |
934 | write_unlock_bh(&mrt_lock); | 934 | write_unlock_bh(&mrt_lock); |
935 | 935 | ||
936 | IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)++; | 936 | IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)++; |
@@ -938,19 +938,19 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
938 | rtnl_unlock(); | 938 | rtnl_unlock(); |
939 | return ret; | 939 | return ret; |
940 | case MRT_DONE: | 940 | case MRT_DONE: |
941 | if (sk!=mroute_socket) | 941 | if (sk != mroute_socket) |
942 | return -EACCES; | 942 | return -EACCES; |
943 | return ip_ra_control(sk, 0, NULL); | 943 | return ip_ra_control(sk, 0, NULL); |
944 | case MRT_ADD_VIF: | 944 | case MRT_ADD_VIF: |
945 | case MRT_DEL_VIF: | 945 | case MRT_DEL_VIF: |
946 | if (optlen!=sizeof(vif)) | 946 | if (optlen != sizeof(vif)) |
947 | return -EINVAL; | 947 | return -EINVAL; |
948 | if (copy_from_user(&vif,optval,sizeof(vif))) | 948 | if (copy_from_user(&vif, optval, sizeof(vif))) |
949 | return -EFAULT; | 949 | return -EFAULT; |
950 | if (vif.vifc_vifi >= MAXVIFS) | 950 | if (vif.vifc_vifi >= MAXVIFS) |
951 | return -ENFILE; | 951 | return -ENFILE; |
952 | rtnl_lock(); | 952 | rtnl_lock(); |
953 | if (optname==MRT_ADD_VIF) { | 953 | if (optname == MRT_ADD_VIF) { |
954 | ret = vif_add(&vif, sk==mroute_socket); | 954 | ret = vif_add(&vif, sk==mroute_socket); |
955 | } else { | 955 | } else { |
956 | ret = vif_delete(vif.vifc_vifi, 0); | 956 | ret = vif_delete(vif.vifc_vifi, 0); |
@@ -964,12 +964,12 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
964 | */ | 964 | */ |
965 | case MRT_ADD_MFC: | 965 | case MRT_ADD_MFC: |
966 | case MRT_DEL_MFC: | 966 | case MRT_DEL_MFC: |
967 | if (optlen!=sizeof(mfc)) | 967 | if (optlen != sizeof(mfc)) |
968 | return -EINVAL; | 968 | return -EINVAL; |
969 | if (copy_from_user(&mfc,optval, sizeof(mfc))) | 969 | if (copy_from_user(&mfc, optval, sizeof(mfc))) |
970 | return -EFAULT; | 970 | return -EFAULT; |
971 | rtnl_lock(); | 971 | rtnl_lock(); |
972 | if (optname==MRT_DEL_MFC) | 972 | if (optname == MRT_DEL_MFC) |
973 | ret = ipmr_mfc_delete(&mfc); | 973 | ret = ipmr_mfc_delete(&mfc); |
974 | else | 974 | else |
975 | ret = ipmr_mfc_add(&mfc, sk==mroute_socket); | 975 | ret = ipmr_mfc_add(&mfc, sk==mroute_socket); |
@@ -1028,12 +1028,12 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
1028 | * Getsock opt support for the multicast routing system. | 1028 | * Getsock opt support for the multicast routing system. |
1029 | */ | 1029 | */ |
1030 | 1030 | ||
1031 | int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen) | 1031 | int ip_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int __user *optlen) |
1032 | { | 1032 | { |
1033 | int olr; | 1033 | int olr; |
1034 | int val; | 1034 | int val; |
1035 | 1035 | ||
1036 | if (optname!=MRT_VERSION && | 1036 | if (optname != MRT_VERSION && |
1037 | #ifdef CONFIG_IP_PIMSM | 1037 | #ifdef CONFIG_IP_PIMSM |
1038 | optname!=MRT_PIM && | 1038 | optname!=MRT_PIM && |
1039 | #endif | 1039 | #endif |
@@ -1047,17 +1047,17 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u | |||
1047 | if (olr < 0) | 1047 | if (olr < 0) |
1048 | return -EINVAL; | 1048 | return -EINVAL; |
1049 | 1049 | ||
1050 | if (put_user(olr,optlen)) | 1050 | if (put_user(olr, optlen)) |
1051 | return -EFAULT; | 1051 | return -EFAULT; |
1052 | if (optname==MRT_VERSION) | 1052 | if (optname == MRT_VERSION) |
1053 | val=0x0305; | 1053 | val = 0x0305; |
1054 | #ifdef CONFIG_IP_PIMSM | 1054 | #ifdef CONFIG_IP_PIMSM |
1055 | else if (optname==MRT_PIM) | 1055 | else if (optname == MRT_PIM) |
1056 | val=mroute_do_pim; | 1056 | val = mroute_do_pim; |
1057 | #endif | 1057 | #endif |
1058 | else | 1058 | else |
1059 | val=mroute_do_assert; | 1059 | val = mroute_do_assert; |
1060 | if (copy_to_user(optval,&val,olr)) | 1060 | if (copy_to_user(optval, &val, olr)) |
1061 | return -EFAULT; | 1061 | return -EFAULT; |
1062 | return 0; | 1062 | return 0; |
1063 | } | 1063 | } |
@@ -1075,27 +1075,27 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) | |||
1075 | 1075 | ||
1076 | switch (cmd) { | 1076 | switch (cmd) { |
1077 | case SIOCGETVIFCNT: | 1077 | case SIOCGETVIFCNT: |
1078 | if (copy_from_user(&vr,arg,sizeof(vr))) | 1078 | if (copy_from_user(&vr, arg, sizeof(vr))) |
1079 | return -EFAULT; | 1079 | return -EFAULT; |
1080 | if (vr.vifi>=maxvif) | 1080 | if (vr.vifi >= maxvif) |
1081 | return -EINVAL; | 1081 | return -EINVAL; |
1082 | read_lock(&mrt_lock); | 1082 | read_lock(&mrt_lock); |
1083 | vif=&vif_table[vr.vifi]; | 1083 | vif=&vif_table[vr.vifi]; |
1084 | if (VIF_EXISTS(vr.vifi)) { | 1084 | if (VIF_EXISTS(vr.vifi)) { |
1085 | vr.icount=vif->pkt_in; | 1085 | vr.icount = vif->pkt_in; |
1086 | vr.ocount=vif->pkt_out; | 1086 | vr.ocount = vif->pkt_out; |
1087 | vr.ibytes=vif->bytes_in; | 1087 | vr.ibytes = vif->bytes_in; |
1088 | vr.obytes=vif->bytes_out; | 1088 | vr.obytes = vif->bytes_out; |
1089 | read_unlock(&mrt_lock); | 1089 | read_unlock(&mrt_lock); |
1090 | 1090 | ||
1091 | if (copy_to_user(arg,&vr,sizeof(vr))) | 1091 | if (copy_to_user(arg, &vr, sizeof(vr))) |
1092 | return -EFAULT; | 1092 | return -EFAULT; |
1093 | return 0; | 1093 | return 0; |
1094 | } | 1094 | } |
1095 | read_unlock(&mrt_lock); | 1095 | read_unlock(&mrt_lock); |
1096 | return -EADDRNOTAVAIL; | 1096 | return -EADDRNOTAVAIL; |
1097 | case SIOCGETSGCNT: | 1097 | case SIOCGETSGCNT: |
1098 | if (copy_from_user(&sr,arg,sizeof(sr))) | 1098 | if (copy_from_user(&sr, arg, sizeof(sr))) |
1099 | return -EFAULT; | 1099 | return -EFAULT; |
1100 | 1100 | ||
1101 | read_lock(&mrt_lock); | 1101 | read_lock(&mrt_lock); |
@@ -1106,7 +1106,7 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) | |||
1106 | sr.wrong_if = c->mfc_un.res.wrong_if; | 1106 | sr.wrong_if = c->mfc_un.res.wrong_if; |
1107 | read_unlock(&mrt_lock); | 1107 | read_unlock(&mrt_lock); |
1108 | 1108 | ||
1109 | if (copy_to_user(arg,&sr,sizeof(sr))) | 1109 | if (copy_to_user(arg, &sr, sizeof(sr))) |
1110 | return -EFAULT; | 1110 | return -EFAULT; |
1111 | return 0; | 1111 | return 0; |
1112 | } | 1112 | } |
@@ -1130,15 +1130,15 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v | |||
1130 | if (event != NETDEV_UNREGISTER) | 1130 | if (event != NETDEV_UNREGISTER) |
1131 | return NOTIFY_DONE; | 1131 | return NOTIFY_DONE; |
1132 | v=&vif_table[0]; | 1132 | v=&vif_table[0]; |
1133 | for (ct=0;ct<maxvif;ct++,v++) { | 1133 | for (ct=0; ct<maxvif; ct++,v++) { |
1134 | if (v->dev==dev) | 1134 | if (v->dev == dev) |
1135 | vif_delete(ct, 1); | 1135 | vif_delete(ct, 1); |
1136 | } | 1136 | } |
1137 | return NOTIFY_DONE; | 1137 | return NOTIFY_DONE; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | 1140 | ||
1141 | static struct notifier_block ip_mr_notifier={ | 1141 | static struct notifier_block ip_mr_notifier = { |
1142 | .notifier_call = ipmr_device_event, | 1142 | .notifier_call = ipmr_device_event, |
1143 | }; | 1143 | }; |
1144 | 1144 | ||
@@ -1204,7 +1204,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) | |||
1204 | #ifdef CONFIG_IP_PIMSM | 1204 | #ifdef CONFIG_IP_PIMSM |
1205 | if (vif->flags & VIFF_REGISTER) { | 1205 | if (vif->flags & VIFF_REGISTER) { |
1206 | vif->pkt_out++; | 1206 | vif->pkt_out++; |
1207 | vif->bytes_out+=skb->len; | 1207 | vif->bytes_out += skb->len; |
1208 | vif->dev->stats.tx_bytes += skb->len; | 1208 | vif->dev->stats.tx_bytes += skb->len; |
1209 | vif->dev->stats.tx_packets++; | 1209 | vif->dev->stats.tx_packets++; |
1210 | ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); | 1210 | ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); |
@@ -1254,7 +1254,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) | |||
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | vif->pkt_out++; | 1256 | vif->pkt_out++; |
1257 | vif->bytes_out+=skb->len; | 1257 | vif->bytes_out += skb->len; |
1258 | 1258 | ||
1259 | dst_release(skb->dst); | 1259 | dst_release(skb->dst); |
1260 | skb->dst = &rt->u.dst; | 1260 | skb->dst = &rt->u.dst; |
@@ -1352,7 +1352,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local | |||
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | vif_table[vif].pkt_in++; | 1354 | vif_table[vif].pkt_in++; |
1355 | vif_table[vif].bytes_in+=skb->len; | 1355 | vif_table[vif].bytes_in += skb->len; |
1356 | 1356 | ||
1357 | /* | 1357 | /* |
1358 | * Forward the frame | 1358 | * Forward the frame |
@@ -1364,7 +1364,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local | |||
1364 | if (skb2) | 1364 | if (skb2) |
1365 | ipmr_queue_xmit(skb2, cache, psend); | 1365 | ipmr_queue_xmit(skb2, cache, psend); |
1366 | } | 1366 | } |
1367 | psend=ct; | 1367 | psend = ct; |
1368 | } | 1368 | } |
1369 | } | 1369 | } |
1370 | if (psend != -1) { | 1370 | if (psend != -1) { |
@@ -1428,7 +1428,7 @@ int ip_mr_input(struct sk_buff *skb) | |||
1428 | /* | 1428 | /* |
1429 | * No usable cache entry | 1429 | * No usable cache entry |
1430 | */ | 1430 | */ |
1431 | if (cache==NULL) { | 1431 | if (cache == NULL) { |
1432 | int vif; | 1432 | int vif; |
1433 | 1433 | ||
1434 | if (local) { | 1434 | if (local) { |
@@ -1602,13 +1602,13 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) | |||
1602 | if (dev) | 1602 | if (dev) |
1603 | RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); | 1603 | RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); |
1604 | 1604 | ||
1605 | mp_head = (struct rtattr*)skb_put(skb, RTA_LENGTH(0)); | 1605 | mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); |
1606 | 1606 | ||
1607 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { | 1607 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { |
1608 | if (c->mfc_un.res.ttls[ct] < 255) { | 1608 | if (c->mfc_un.res.ttls[ct] < 255) { |
1609 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) | 1609 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) |
1610 | goto rtattr_failure; | 1610 | goto rtattr_failure; |
1611 | nhp = (struct rtnexthop*)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); | 1611 | nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); |
1612 | nhp->rtnh_flags = 0; | 1612 | nhp->rtnh_flags = 0; |
1613 | nhp->rtnh_hops = c->mfc_un.res.ttls[ct]; | 1613 | nhp->rtnh_hops = c->mfc_un.res.ttls[ct]; |
1614 | nhp->rtnh_ifindex = vif_table[ct].dev->ifindex; | 1614 | nhp->rtnh_ifindex = vif_table[ct].dev->ifindex; |
@@ -1634,7 +1634,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait) | |||
1634 | read_lock(&mrt_lock); | 1634 | read_lock(&mrt_lock); |
1635 | cache = ipmr_cache_find(rt->rt_src, rt->rt_dst); | 1635 | cache = ipmr_cache_find(rt->rt_src, rt->rt_dst); |
1636 | 1636 | ||
1637 | if (cache==NULL) { | 1637 | if (cache == NULL) { |
1638 | struct sk_buff *skb2; | 1638 | struct sk_buff *skb2; |
1639 | struct iphdr *iph; | 1639 | struct iphdr *iph; |
1640 | struct net_device *dev; | 1640 | struct net_device *dev; |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 8d70d29f1ccf..7ea88b61cb0d 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -142,15 +142,15 @@ static inline int arp_packet_match(const struct arphdr *arphdr, | |||
142 | ARPT_INV_TGTIP)) { | 142 | ARPT_INV_TGTIP)) { |
143 | dprintf("Source or target IP address mismatch.\n"); | 143 | dprintf("Source or target IP address mismatch.\n"); |
144 | 144 | ||
145 | dprintf("SRC: %u.%u.%u.%u. Mask: %u.%u.%u.%u. Target: %u.%u.%u.%u.%s\n", | 145 | dprintf("SRC: %pI4. Mask: %pI4. Target: %pI4.%s\n", |
146 | NIPQUAD(src_ipaddr), | 146 | &src_ipaddr, |
147 | NIPQUAD(arpinfo->smsk.s_addr), | 147 | &arpinfo->smsk.s_addr, |
148 | NIPQUAD(arpinfo->src.s_addr), | 148 | &arpinfo->src.s_addr, |
149 | arpinfo->invflags & ARPT_INV_SRCIP ? " (INV)" : ""); | 149 | arpinfo->invflags & ARPT_INV_SRCIP ? " (INV)" : ""); |
150 | dprintf("TGT: %u.%u.%u.%u Mask: %u.%u.%u.%u Target: %u.%u.%u.%u.%s\n", | 150 | dprintf("TGT: %pI4 Mask: %pI4 Target: %pI4.%s\n", |
151 | NIPQUAD(tgt_ipaddr), | 151 | &tgt_ipaddr, |
152 | NIPQUAD(arpinfo->tmsk.s_addr), | 152 | &arpinfo->tmsk.s_addr, |
153 | NIPQUAD(arpinfo->tgt.s_addr), | 153 | &arpinfo->tgt.s_addr, |
154 | arpinfo->invflags & ARPT_INV_TGTIP ? " (INV)" : ""); | 154 | arpinfo->invflags & ARPT_INV_TGTIP ? " (INV)" : ""); |
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 213fb27debc1..ef8b6ca068b2 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -94,15 +94,11 @@ ip_packet_match(const struct iphdr *ip, | |||
94 | IPT_INV_DSTIP)) { | 94 | IPT_INV_DSTIP)) { |
95 | dprintf("Source or dest mismatch.\n"); | 95 | dprintf("Source or dest mismatch.\n"); |
96 | 96 | ||
97 | dprintf("SRC: %u.%u.%u.%u. Mask: %u.%u.%u.%u. Target: %u.%u.%u.%u.%s\n", | 97 | dprintf("SRC: %pI4. Mask: %pI4. Target: %pI4.%s\n", |
98 | NIPQUAD(ip->saddr), | 98 | &ip->saddr, &ipinfo->smsk.s_addr, &ipinfo->src.s_addr, |
99 | NIPQUAD(ipinfo->smsk.s_addr), | ||
100 | NIPQUAD(ipinfo->src.s_addr), | ||
101 | ipinfo->invflags & IPT_INV_SRCIP ? " (INV)" : ""); | 99 | ipinfo->invflags & IPT_INV_SRCIP ? " (INV)" : ""); |
102 | dprintf("DST: %u.%u.%u.%u Mask: %u.%u.%u.%u Target: %u.%u.%u.%u.%s\n", | 100 | dprintf("DST: %pI4 Mask: %pI4 Target: %pI4.%s\n", |
103 | NIPQUAD(ip->daddr), | 101 | &ip->daddr, &ipinfo->dmsk.s_addr, &ipinfo->dst.s_addr, |
104 | NIPQUAD(ipinfo->dmsk.s_addr), | ||
105 | NIPQUAD(ipinfo->dst.s_addr), | ||
106 | ipinfo->invflags & IPT_INV_DSTIP ? " (INV)" : ""); | 102 | ipinfo->invflags & IPT_INV_DSTIP ? " (INV)" : ""); |
107 | return false; | 103 | return false; |
108 | } | 104 | } |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 7ac1677419a9..2e4f98b85524 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -168,7 +168,7 @@ clusterip_config_init(const struct ipt_clusterip_tgt_info *i, __be32 ip, | |||
168 | char buffer[16]; | 168 | char buffer[16]; |
169 | 169 | ||
170 | /* create proc dir entry */ | 170 | /* create proc dir entry */ |
171 | sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); | 171 | sprintf(buffer, "%pI4", &ip); |
172 | c->pde = proc_create_data(buffer, S_IWUSR|S_IRUSR, | 172 | c->pde = proc_create_data(buffer, S_IWUSR|S_IRUSR, |
173 | clusterip_procdir, | 173 | clusterip_procdir, |
174 | &clusterip_proc_fops, c); | 174 | &clusterip_proc_fops, c); |
@@ -373,7 +373,7 @@ static bool clusterip_tg_check(const struct xt_tgchk_param *par) | |||
373 | config = clusterip_config_find_get(e->ip.dst.s_addr, 1); | 373 | config = clusterip_config_find_get(e->ip.dst.s_addr, 1); |
374 | if (!config) { | 374 | if (!config) { |
375 | if (!(cipinfo->flags & CLUSTERIP_FLAG_NEW)) { | 375 | if (!(cipinfo->flags & CLUSTERIP_FLAG_NEW)) { |
376 | printk(KERN_WARNING "CLUSTERIP: no config found for %u.%u.%u.%u, need 'new'\n", NIPQUAD(e->ip.dst.s_addr)); | 376 | printk(KERN_WARNING "CLUSTERIP: no config found for %pI4, need 'new'\n", &e->ip.dst.s_addr); |
377 | return false; | 377 | return false; |
378 | } else { | 378 | } else { |
379 | struct net_device *dev; | 379 | struct net_device *dev; |
@@ -478,9 +478,8 @@ static void arp_print(struct arp_payload *payload) | |||
478 | } | 478 | } |
479 | hbuffer[--k]='\0'; | 479 | hbuffer[--k]='\0'; |
480 | 480 | ||
481 | printk("src %u.%u.%u.%u@%s, dst %u.%u.%u.%u\n", | 481 | printk("src %pI4@%s, dst %pI4\n", |
482 | NIPQUAD(payload->src_ip), hbuffer, | 482 | &payload->src_ip, hbuffer, &payload->dst_ip); |
483 | NIPQUAD(payload->dst_ip)); | ||
484 | } | 483 | } |
485 | #endif | 484 | #endif |
486 | 485 | ||
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index fc6ce04a3e35..4614a696f1b0 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -54,8 +54,8 @@ static void dump_packet(const struct nf_loginfo *info, | |||
54 | /* Important fields: | 54 | /* Important fields: |
55 | * TOS, len, DF/MF, fragment offset, TTL, src, dst, options. */ | 55 | * TOS, len, DF/MF, fragment offset, TTL, src, dst, options. */ |
56 | /* Max length: 40 "SRC=255.255.255.255 DST=255.255.255.255 " */ | 56 | /* Max length: 40 "SRC=255.255.255.255 DST=255.255.255.255 " */ |
57 | printk("SRC=%u.%u.%u.%u DST=%u.%u.%u.%u ", | 57 | printk("SRC=%pI4 DST=%pI4 ", |
58 | NIPQUAD(ih->saddr), NIPQUAD(ih->daddr)); | 58 | &ih->saddr, &ih->daddr); |
59 | 59 | ||
60 | /* Max length: 46 "LEN=65535 TOS=0xFF PREC=0xFF TTL=255 ID=65535 " */ | 60 | /* Max length: 46 "LEN=65535 TOS=0xFF PREC=0xFF TTL=255 ID=65535 " */ |
61 | printk("LEN=%u TOS=0x%02X PREC=0x%02X TTL=%u ID=%u ", | 61 | printk("LEN=%u TOS=0x%02X PREC=0x%02X TTL=%u ID=%u ", |
@@ -262,8 +262,7 @@ static void dump_packet(const struct nf_loginfo *info, | |||
262 | break; | 262 | break; |
263 | case ICMP_REDIRECT: | 263 | case ICMP_REDIRECT: |
264 | /* Max length: 24 "GATEWAY=255.255.255.255 " */ | 264 | /* Max length: 24 "GATEWAY=255.255.255.255 " */ |
265 | printk("GATEWAY=%u.%u.%u.%u ", | 265 | printk("GATEWAY=%pI4 ", &ich->un.gateway); |
266 | NIPQUAD(ich->un.gateway)); | ||
267 | /* Fall through */ | 266 | /* Fall through */ |
268 | case ICMP_DEST_UNREACH: | 267 | case ICMP_DEST_UNREACH: |
269 | case ICMP_SOURCE_QUENCH: | 268 | case ICMP_SOURCE_QUENCH: |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 4a7c35275396..b2141e11575e 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -60,9 +60,8 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
60 | static int ipv4_print_tuple(struct seq_file *s, | 60 | static int ipv4_print_tuple(struct seq_file *s, |
61 | const struct nf_conntrack_tuple *tuple) | 61 | const struct nf_conntrack_tuple *tuple) |
62 | { | 62 | { |
63 | return seq_printf(s, "src=%u.%u.%u.%u dst=%u.%u.%u.%u ", | 63 | return seq_printf(s, "src=%pI4 dst=%pI4 ", |
64 | NIPQUAD(tuple->src.u3.ip), | 64 | &tuple->src.u3.ip, &tuple->dst.u3.ip); |
65 | NIPQUAD(tuple->dst.u3.ip)); | ||
66 | } | 65 | } |
67 | 66 | ||
68 | static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 67 | static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
@@ -198,7 +197,7 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
198 | .data = &nf_conntrack_max, | 197 | .data = &nf_conntrack_max, |
199 | .maxlen = sizeof(int), | 198 | .maxlen = sizeof(int), |
200 | .mode = 0644, | 199 | .mode = 0644, |
201 | .proc_handler = &proc_dointvec, | 200 | .proc_handler = proc_dointvec, |
202 | }, | 201 | }, |
203 | { | 202 | { |
204 | .ctl_name = NET_IPV4_NF_CONNTRACK_COUNT, | 203 | .ctl_name = NET_IPV4_NF_CONNTRACK_COUNT, |
@@ -206,7 +205,7 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
206 | .data = &init_net.ct.count, | 205 | .data = &init_net.ct.count, |
207 | .maxlen = sizeof(int), | 206 | .maxlen = sizeof(int), |
208 | .mode = 0444, | 207 | .mode = 0444, |
209 | .proc_handler = &proc_dointvec, | 208 | .proc_handler = proc_dointvec, |
210 | }, | 209 | }, |
211 | { | 210 | { |
212 | .ctl_name = NET_IPV4_NF_CONNTRACK_BUCKETS, | 211 | .ctl_name = NET_IPV4_NF_CONNTRACK_BUCKETS, |
@@ -214,7 +213,7 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
214 | .data = &nf_conntrack_htable_size, | 213 | .data = &nf_conntrack_htable_size, |
215 | .maxlen = sizeof(unsigned int), | 214 | .maxlen = sizeof(unsigned int), |
216 | .mode = 0444, | 215 | .mode = 0444, |
217 | .proc_handler = &proc_dointvec, | 216 | .proc_handler = proc_dointvec, |
218 | }, | 217 | }, |
219 | { | 218 | { |
220 | .ctl_name = NET_IPV4_NF_CONNTRACK_CHECKSUM, | 219 | .ctl_name = NET_IPV4_NF_CONNTRACK_CHECKSUM, |
@@ -222,7 +221,7 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
222 | .data = &init_net.ct.sysctl_checksum, | 221 | .data = &init_net.ct.sysctl_checksum, |
223 | .maxlen = sizeof(int), | 222 | .maxlen = sizeof(int), |
224 | .mode = 0644, | 223 | .mode = 0644, |
225 | .proc_handler = &proc_dointvec, | 224 | .proc_handler = proc_dointvec, |
226 | }, | 225 | }, |
227 | { | 226 | { |
228 | .ctl_name = NET_IPV4_NF_CONNTRACK_LOG_INVALID, | 227 | .ctl_name = NET_IPV4_NF_CONNTRACK_LOG_INVALID, |
@@ -230,8 +229,8 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
230 | .data = &init_net.ct.sysctl_log_invalid, | 229 | .data = &init_net.ct.sysctl_log_invalid, |
231 | .maxlen = sizeof(unsigned int), | 230 | .maxlen = sizeof(unsigned int), |
232 | .mode = 0644, | 231 | .mode = 0644, |
233 | .proc_handler = &proc_dointvec_minmax, | 232 | .proc_handler = proc_dointvec_minmax, |
234 | .strategy = &sysctl_intvec, | 233 | .strategy = sysctl_intvec, |
235 | .extra1 = &log_invalid_proto_min, | 234 | .extra1 = &log_invalid_proto_min, |
236 | .extra2 = &log_invalid_proto_max, | 235 | .extra2 = &log_invalid_proto_max, |
237 | }, | 236 | }, |
@@ -284,17 +283,17 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
284 | .tuple.dst.u3.ip; | 283 | .tuple.dst.u3.ip; |
285 | memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); | 284 | memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); |
286 | 285 | ||
287 | pr_debug("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", | 286 | pr_debug("SO_ORIGINAL_DST: %pI4 %u\n", |
288 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); | 287 | &sin.sin_addr.s_addr, ntohs(sin.sin_port)); |
289 | nf_ct_put(ct); | 288 | nf_ct_put(ct); |
290 | if (copy_to_user(user, &sin, sizeof(sin)) != 0) | 289 | if (copy_to_user(user, &sin, sizeof(sin)) != 0) |
291 | return -EFAULT; | 290 | return -EFAULT; |
292 | else | 291 | else |
293 | return 0; | 292 | return 0; |
294 | } | 293 | } |
295 | pr_debug("SO_ORIGINAL_DST: Can't find %u.%u.%u.%u/%u-%u.%u.%u.%u/%u.\n", | 294 | pr_debug("SO_ORIGINAL_DST: Can't find %pI4/%u-%pI4/%u.\n", |
296 | NIPQUAD(tuple.src.u3.ip), ntohs(tuple.src.u.tcp.port), | 295 | &tuple.src.u3.ip, ntohs(tuple.src.u.tcp.port), |
297 | NIPQUAD(tuple.dst.u3.ip), ntohs(tuple.dst.u.tcp.port)); | 296 | &tuple.dst.u3.ip, ntohs(tuple.dst.u.tcp.port)); |
298 | return -ENOENT; | 297 | return -ENOENT; |
299 | } | 298 | } |
300 | 299 | ||
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 4e8879220222..1fd3ef7718b6 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -272,7 +272,7 @@ static struct ctl_table icmp_sysctl_table[] = { | |||
272 | .data = &nf_ct_icmp_timeout, | 272 | .data = &nf_ct_icmp_timeout, |
273 | .maxlen = sizeof(unsigned int), | 273 | .maxlen = sizeof(unsigned int), |
274 | .mode = 0644, | 274 | .mode = 0644, |
275 | .proc_handler = &proc_dointvec_jiffies, | 275 | .proc_handler = proc_dointvec_jiffies, |
276 | }, | 276 | }, |
277 | { | 277 | { |
278 | .ctl_name = 0 | 278 | .ctl_name = 0 |
@@ -285,7 +285,7 @@ static struct ctl_table icmp_compat_sysctl_table[] = { | |||
285 | .data = &nf_ct_icmp_timeout, | 285 | .data = &nf_ct_icmp_timeout, |
286 | .maxlen = sizeof(unsigned int), | 286 | .maxlen = sizeof(unsigned int), |
287 | .mode = 0644, | 287 | .mode = 0644, |
288 | .proc_handler = &proc_dointvec_jiffies, | 288 | .proc_handler = proc_dointvec_jiffies, |
289 | }, | 289 | }, |
290 | { | 290 | { |
291 | .ctl_name = 0 | 291 | .ctl_name = 0 |
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c index ee47bf28c825..7e8e6fc75413 100644 --- a/net/ipv4/netfilter/nf_nat_h323.c +++ b/net/ipv4/netfilter/nf_nat_h323.c | |||
@@ -119,10 +119,9 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct, | |||
119 | (ntohl(addr.ip) & 0xff000000) == 0x7f000000) | 119 | (ntohl(addr.ip) & 0xff000000) == 0x7f000000) |
120 | i = 0; | 120 | i = 0; |
121 | 121 | ||
122 | pr_debug("nf_nat_ras: set signal address " | 122 | pr_debug("nf_nat_ras: set signal address %pI4:%hu->%pI4:%hu\n", |
123 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 123 | &addr.ip, port, |
124 | NIPQUAD(addr.ip), port, | 124 | &ct->tuplehash[!dir].tuple.dst.u3.ip, |
125 | NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip), | ||
126 | info->sig_port[!dir]); | 125 | info->sig_port[!dir]); |
127 | return set_h225_addr(skb, data, 0, &taddr[i], | 126 | return set_h225_addr(skb, data, 0, &taddr[i], |
128 | &ct->tuplehash[!dir]. | 127 | &ct->tuplehash[!dir]. |
@@ -131,10 +130,9 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct, | |||
131 | } else if (addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && | 130 | } else if (addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && |
132 | port == info->sig_port[dir]) { | 131 | port == info->sig_port[dir]) { |
133 | /* GK->GW */ | 132 | /* GK->GW */ |
134 | pr_debug("nf_nat_ras: set signal address " | 133 | pr_debug("nf_nat_ras: set signal address %pI4:%hu->%pI4:%hu\n", |
135 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 134 | &addr.ip, port, |
136 | NIPQUAD(addr.ip), port, | 135 | &ct->tuplehash[!dir].tuple.src.u3.ip, |
137 | NIPQUAD(ct->tuplehash[!dir].tuple.src.u3.ip), | ||
138 | info->sig_port[!dir]); | 136 | info->sig_port[!dir]); |
139 | return set_h225_addr(skb, data, 0, &taddr[i], | 137 | return set_h225_addr(skb, data, 0, &taddr[i], |
140 | &ct->tuplehash[!dir]. | 138 | &ct->tuplehash[!dir]. |
@@ -162,10 +160,9 @@ static int set_ras_addr(struct sk_buff *skb, struct nf_conn *ct, | |||
162 | if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) && | 160 | if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) && |
163 | addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && | 161 | addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && |
164 | port == ct->tuplehash[dir].tuple.src.u.udp.port) { | 162 | port == ct->tuplehash[dir].tuple.src.u.udp.port) { |
165 | pr_debug("nf_nat_ras: set rasAddress " | 163 | pr_debug("nf_nat_ras: set rasAddress %pI4:%hu->%pI4:%hu\n", |
166 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 164 | &addr.ip, ntohs(port), |
167 | NIPQUAD(addr.ip), ntohs(port), | 165 | &ct->tuplehash[!dir].tuple.dst.u3.ip, |
168 | NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip), | ||
169 | ntohs(ct->tuplehash[!dir].tuple.dst.u.udp.port)); | 166 | ntohs(ct->tuplehash[!dir].tuple.dst.u.udp.port)); |
170 | return set_h225_addr(skb, data, 0, &taddr[i], | 167 | return set_h225_addr(skb, data, 0, &taddr[i], |
171 | &ct->tuplehash[!dir].tuple.dst.u3, | 168 | &ct->tuplehash[!dir].tuple.dst.u3, |
@@ -257,15 +254,15 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct, | |||
257 | } | 254 | } |
258 | 255 | ||
259 | /* Success */ | 256 | /* Success */ |
260 | pr_debug("nf_nat_h323: expect RTP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 257 | pr_debug("nf_nat_h323: expect RTP %pI4:%hu->%pI4:%hu\n", |
261 | NIPQUAD(rtp_exp->tuple.src.u3.ip), | 258 | &rtp_exp->tuple.src.u3.ip, |
262 | ntohs(rtp_exp->tuple.src.u.udp.port), | 259 | ntohs(rtp_exp->tuple.src.u.udp.port), |
263 | NIPQUAD(rtp_exp->tuple.dst.u3.ip), | 260 | &rtp_exp->tuple.dst.u3.ip, |
264 | ntohs(rtp_exp->tuple.dst.u.udp.port)); | 261 | ntohs(rtp_exp->tuple.dst.u.udp.port)); |
265 | pr_debug("nf_nat_h323: expect RTCP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 262 | pr_debug("nf_nat_h323: expect RTCP %pI4:%hu->%pI4:%hu\n", |
266 | NIPQUAD(rtcp_exp->tuple.src.u3.ip), | 263 | &rtcp_exp->tuple.src.u3.ip, |
267 | ntohs(rtcp_exp->tuple.src.u.udp.port), | 264 | ntohs(rtcp_exp->tuple.src.u.udp.port), |
268 | NIPQUAD(rtcp_exp->tuple.dst.u3.ip), | 265 | &rtcp_exp->tuple.dst.u3.ip, |
269 | ntohs(rtcp_exp->tuple.dst.u.udp.port)); | 266 | ntohs(rtcp_exp->tuple.dst.u.udp.port)); |
270 | 267 | ||
271 | return 0; | 268 | return 0; |
@@ -307,10 +304,10 @@ static int nat_t120(struct sk_buff *skb, struct nf_conn *ct, | |||
307 | return -1; | 304 | return -1; |
308 | } | 305 | } |
309 | 306 | ||
310 | pr_debug("nf_nat_h323: expect T.120 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 307 | pr_debug("nf_nat_h323: expect T.120 %pI4:%hu->%pI4:%hu\n", |
311 | NIPQUAD(exp->tuple.src.u3.ip), | 308 | &exp->tuple.src.u3.ip, |
312 | ntohs(exp->tuple.src.u.tcp.port), | 309 | ntohs(exp->tuple.src.u.tcp.port), |
313 | NIPQUAD(exp->tuple.dst.u3.ip), | 310 | &exp->tuple.dst.u3.ip, |
314 | ntohs(exp->tuple.dst.u.tcp.port)); | 311 | ntohs(exp->tuple.dst.u.tcp.port)); |
315 | 312 | ||
316 | return 0; | 313 | return 0; |
@@ -361,10 +358,10 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct, | |||
361 | return -1; | 358 | return -1; |
362 | } | 359 | } |
363 | 360 | ||
364 | pr_debug("nf_nat_q931: expect H.245 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 361 | pr_debug("nf_nat_q931: expect H.245 %pI4:%hu->%pI4:%hu\n", |
365 | NIPQUAD(exp->tuple.src.u3.ip), | 362 | &exp->tuple.src.u3.ip, |
366 | ntohs(exp->tuple.src.u.tcp.port), | 363 | ntohs(exp->tuple.src.u.tcp.port), |
367 | NIPQUAD(exp->tuple.dst.u3.ip), | 364 | &exp->tuple.dst.u3.ip, |
368 | ntohs(exp->tuple.dst.u.tcp.port)); | 365 | ntohs(exp->tuple.dst.u.tcp.port)); |
369 | 366 | ||
370 | return 0; | 367 | return 0; |
@@ -455,10 +452,10 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct, | |||
455 | } | 452 | } |
456 | 453 | ||
457 | /* Success */ | 454 | /* Success */ |
458 | pr_debug("nf_nat_ras: expect Q.931 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 455 | pr_debug("nf_nat_ras: expect Q.931 %pI4:%hu->%pI4:%hu\n", |
459 | NIPQUAD(exp->tuple.src.u3.ip), | 456 | &exp->tuple.src.u3.ip, |
460 | ntohs(exp->tuple.src.u.tcp.port), | 457 | ntohs(exp->tuple.src.u.tcp.port), |
461 | NIPQUAD(exp->tuple.dst.u3.ip), | 458 | &exp->tuple.dst.u3.ip, |
462 | ntohs(exp->tuple.dst.u.tcp.port)); | 459 | ntohs(exp->tuple.dst.u.tcp.port)); |
463 | 460 | ||
464 | return 0; | 461 | return 0; |
@@ -524,11 +521,10 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct, | |||
524 | } | 521 | } |
525 | 522 | ||
526 | /* Success */ | 523 | /* Success */ |
527 | pr_debug("nf_nat_q931: expect Call Forwarding " | 524 | pr_debug("nf_nat_q931: expect Call Forwarding %pI4:%hu->%pI4:%hu\n", |
528 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 525 | &exp->tuple.src.u3.ip, |
529 | NIPQUAD(exp->tuple.src.u3.ip), | ||
530 | ntohs(exp->tuple.src.u.tcp.port), | 526 | ntohs(exp->tuple.src.u.tcp.port), |
531 | NIPQUAD(exp->tuple.dst.u3.ip), | 527 | &exp->tuple.dst.u3.ip, |
532 | ntohs(exp->tuple.dst.u.tcp.port)); | 528 | ntohs(exp->tuple.dst.u.tcp.port)); |
533 | 529 | ||
534 | return 0; | 530 | return 0; |
diff --git a/net/ipv4/netfilter/nf_nat_irc.c b/net/ipv4/netfilter/nf_nat_irc.c index fe6f9cef6c85..ea83a886b03e 100644 --- a/net/ipv4/netfilter/nf_nat_irc.c +++ b/net/ipv4/netfilter/nf_nat_irc.c | |||
@@ -55,8 +55,8 @@ static unsigned int help(struct sk_buff *skb, | |||
55 | 55 | ||
56 | ip = ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip); | 56 | ip = ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip); |
57 | sprintf(buffer, "%u %u", ip, port); | 57 | sprintf(buffer, "%u %u", ip, port); |
58 | pr_debug("nf_nat_irc: inserting '%s' == %u.%u.%u.%u, port %u\n", | 58 | pr_debug("nf_nat_irc: inserting '%s' == %pI4, port %u\n", |
59 | buffer, NIPQUAD(ip), port); | 59 | buffer, &ip, port); |
60 | 60 | ||
61 | ret = nf_nat_mangle_tcp_packet(skb, exp->master, ctinfo, | 61 | ret = nf_nat_mangle_tcp_packet(skb, exp->master, ctinfo, |
62 | matchoff, matchlen, buffer, | 62 | matchoff, matchlen, buffer, |
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c index bea54a685109..a4f1c3479e23 100644 --- a/net/ipv4/netfilter/nf_nat_rule.c +++ b/net/ipv4/netfilter/nf_nat_rule.c | |||
@@ -98,8 +98,7 @@ static void warn_if_extra_mangle(struct net *net, __be32 dstip, __be32 srcip) | |||
98 | 98 | ||
99 | if (rt->rt_src != srcip && !warned) { | 99 | if (rt->rt_src != srcip && !warned) { |
100 | printk("NAT: no longer support implicit source local NAT\n"); | 100 | printk("NAT: no longer support implicit source local NAT\n"); |
101 | printk("NAT: packet src %u.%u.%u.%u -> dst %u.%u.%u.%u\n", | 101 | printk("NAT: packet src %pI4 -> dst %pI4\n", &srcip, &dstip); |
102 | NIPQUAD(srcip), NIPQUAD(dstip)); | ||
103 | warned = 1; | 102 | warned = 1; |
104 | } | 103 | } |
105 | ip_rt_put(rt); | 104 | ip_rt_put(rt); |
@@ -166,8 +165,7 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) | |||
166 | struct nf_nat_range range | 165 | struct nf_nat_range range |
167 | = { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } }; | 166 | = { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } }; |
168 | 167 | ||
169 | pr_debug("Allocating NULL binding for %p (%u.%u.%u.%u)\n", | 168 | pr_debug("Allocating NULL binding for %p (%pI4)\n", ct, &ip); |
170 | ct, NIPQUAD(ip)); | ||
171 | return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum)); | 169 | return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum)); |
172 | } | 170 | } |
173 | 171 | ||
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c index 14544320c545..07d61a57613c 100644 --- a/net/ipv4/netfilter/nf_nat_sip.c +++ b/net/ipv4/netfilter/nf_nat_sip.c | |||
@@ -74,8 +74,7 @@ static int map_addr(struct sk_buff *skb, | |||
74 | if (newaddr == addr->ip && newport == port) | 74 | if (newaddr == addr->ip && newport == port) |
75 | return 1; | 75 | return 1; |
76 | 76 | ||
77 | buflen = sprintf(buffer, "%u.%u.%u.%u:%u", | 77 | buflen = sprintf(buffer, "%pI4:%u", &newaddr, ntohs(newport)); |
78 | NIPQUAD(newaddr), ntohs(newport)); | ||
79 | 78 | ||
80 | return mangle_packet(skb, dptr, datalen, matchoff, matchlen, | 79 | return mangle_packet(skb, dptr, datalen, matchoff, matchlen, |
81 | buffer, buflen); | 80 | buffer, buflen); |
@@ -152,8 +151,8 @@ static unsigned int ip_nat_sip(struct sk_buff *skb, | |||
152 | &addr) > 0 && | 151 | &addr) > 0 && |
153 | addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && | 152 | addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && |
154 | addr.ip != ct->tuplehash[!dir].tuple.dst.u3.ip) { | 153 | addr.ip != ct->tuplehash[!dir].tuple.dst.u3.ip) { |
155 | __be32 ip = ct->tuplehash[!dir].tuple.dst.u3.ip; | 154 | buflen = sprintf(buffer, "%pI4", |
156 | buflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); | 155 | &ct->tuplehash[!dir].tuple.dst.u3.ip); |
157 | if (!mangle_packet(skb, dptr, datalen, poff, plen, | 156 | if (!mangle_packet(skb, dptr, datalen, poff, plen, |
158 | buffer, buflen)) | 157 | buffer, buflen)) |
159 | return NF_DROP; | 158 | return NF_DROP; |
@@ -166,8 +165,8 @@ static unsigned int ip_nat_sip(struct sk_buff *skb, | |||
166 | &addr) > 0 && | 165 | &addr) > 0 && |
167 | addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && | 166 | addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && |
168 | addr.ip != ct->tuplehash[!dir].tuple.src.u3.ip) { | 167 | addr.ip != ct->tuplehash[!dir].tuple.src.u3.ip) { |
169 | __be32 ip = ct->tuplehash[!dir].tuple.src.u3.ip; | 168 | buflen = sprintf(buffer, "%pI4", |
170 | buflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); | 169 | &ct->tuplehash[!dir].tuple.src.u3.ip); |
171 | if (!mangle_packet(skb, dptr, datalen, poff, plen, | 170 | if (!mangle_packet(skb, dptr, datalen, poff, plen, |
172 | buffer, buflen)) | 171 | buffer, buflen)) |
173 | return NF_DROP; | 172 | return NF_DROP; |
@@ -279,8 +278,7 @@ static unsigned int ip_nat_sip_expect(struct sk_buff *skb, | |||
279 | 278 | ||
280 | if (exp->tuple.dst.u3.ip != exp->saved_ip || | 279 | if (exp->tuple.dst.u3.ip != exp->saved_ip || |
281 | exp->tuple.dst.u.udp.port != exp->saved_proto.udp.port) { | 280 | exp->tuple.dst.u.udp.port != exp->saved_proto.udp.port) { |
282 | buflen = sprintf(buffer, "%u.%u.%u.%u:%u", | 281 | buflen = sprintf(buffer, "%pI4:%u", &newip, port); |
283 | NIPQUAD(newip), port); | ||
284 | if (!mangle_packet(skb, dptr, datalen, matchoff, matchlen, | 282 | if (!mangle_packet(skb, dptr, datalen, matchoff, matchlen, |
285 | buffer, buflen)) | 283 | buffer, buflen)) |
286 | goto err; | 284 | goto err; |
@@ -345,7 +343,7 @@ static unsigned int ip_nat_sdp_addr(struct sk_buff *skb, const char **dptr, | |||
345 | char buffer[sizeof("nnn.nnn.nnn.nnn")]; | 343 | char buffer[sizeof("nnn.nnn.nnn.nnn")]; |
346 | unsigned int buflen; | 344 | unsigned int buflen; |
347 | 345 | ||
348 | buflen = sprintf(buffer, NIPQUAD_FMT, NIPQUAD(addr->ip)); | 346 | buflen = sprintf(buffer, "%pI4", &addr->ip); |
349 | if (mangle_sdp_packet(skb, dptr, dataoff, datalen, type, term, | 347 | if (mangle_sdp_packet(skb, dptr, dataoff, datalen, type, term, |
350 | buffer, buflen)) | 348 | buffer, buflen)) |
351 | return 0; | 349 | return 0; |
@@ -380,7 +378,7 @@ static unsigned int ip_nat_sdp_session(struct sk_buff *skb, const char **dptr, | |||
380 | unsigned int buflen; | 378 | unsigned int buflen; |
381 | 379 | ||
382 | /* Mangle session description owner and contact addresses */ | 380 | /* Mangle session description owner and contact addresses */ |
383 | buflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(addr->ip)); | 381 | buflen = sprintf(buffer, "%pI4", &addr->ip); |
384 | if (mangle_sdp_packet(skb, dptr, dataoff, datalen, | 382 | if (mangle_sdp_packet(skb, dptr, dataoff, datalen, |
385 | SDP_HDR_OWNER_IP4, SDP_HDR_MEDIA, | 383 | SDP_HDR_OWNER_IP4, SDP_HDR_MEDIA, |
386 | buffer, buflen)) | 384 | buffer, buflen)) |
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c index 8303e4b406c0..182f845de92f 100644 --- a/net/ipv4/netfilter/nf_nat_snmp_basic.c +++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c | |||
@@ -930,8 +930,8 @@ static inline void mangle_address(unsigned char *begin, | |||
930 | } | 930 | } |
931 | 931 | ||
932 | if (debug) | 932 | if (debug) |
933 | printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to " | 933 | printk(KERN_DEBUG "bsalg: mapped %pI4 to %pI4\n", |
934 | "%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr)); | 934 | &old, addr); |
935 | } | 935 | } |
936 | } | 936 | } |
937 | 937 | ||
@@ -1267,9 +1267,8 @@ static int help(struct sk_buff *skb, unsigned int protoff, | |||
1267 | */ | 1267 | */ |
1268 | if (ntohs(udph->len) != skb->len - (iph->ihl << 2)) { | 1268 | if (ntohs(udph->len) != skb->len - (iph->ihl << 2)) { |
1269 | if (net_ratelimit()) | 1269 | if (net_ratelimit()) |
1270 | printk(KERN_WARNING "SNMP: dropping malformed packet " | 1270 | printk(KERN_WARNING "SNMP: dropping malformed packet src=%pI4 dst=%pI4\n", |
1271 | "src=%u.%u.%u.%u dst=%u.%u.%u.%u\n", | 1271 | &iph->saddr, &iph->daddr); |
1272 | NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); | ||
1273 | return NF_DROP; | 1272 | return NF_DROP; |
1274 | } | 1273 | } |
1275 | 1274 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index cd975743bcd2..998fcffc9e15 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -247,7 +247,7 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info) | |||
247 | } | 247 | } |
248 | 248 | ||
249 | if (inet->recverr) { | 249 | if (inet->recverr) { |
250 | struct iphdr *iph = (struct iphdr*)skb->data; | 250 | struct iphdr *iph = (struct iphdr *)skb->data; |
251 | u8 *payload = skb->data + (iph->ihl << 2); | 251 | u8 *payload = skb->data + (iph->ihl << 2); |
252 | 252 | ||
253 | if (inet->hdrincl) | 253 | if (inet->hdrincl) |
@@ -465,7 +465,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
465 | */ | 465 | */ |
466 | 466 | ||
467 | if (msg->msg_namelen) { | 467 | if (msg->msg_namelen) { |
468 | struct sockaddr_in *usin = (struct sockaddr_in*)msg->msg_name; | 468 | struct sockaddr_in *usin = (struct sockaddr_in *)msg->msg_name; |
469 | err = -EINVAL; | 469 | err = -EINVAL; |
470 | if (msg->msg_namelen < sizeof(*usin)) | 470 | if (msg->msg_namelen < sizeof(*usin)) |
471 | goto out; | 471 | goto out; |
@@ -851,7 +851,7 @@ struct proto raw_prot = { | |||
851 | static struct sock *raw_get_first(struct seq_file *seq) | 851 | static struct sock *raw_get_first(struct seq_file *seq) |
852 | { | 852 | { |
853 | struct sock *sk; | 853 | struct sock *sk; |
854 | struct raw_iter_state* state = raw_seq_private(seq); | 854 | struct raw_iter_state *state = raw_seq_private(seq); |
855 | 855 | ||
856 | for (state->bucket = 0; state->bucket < RAW_HTABLE_SIZE; | 856 | for (state->bucket = 0; state->bucket < RAW_HTABLE_SIZE; |
857 | ++state->bucket) { | 857 | ++state->bucket) { |
@@ -868,7 +868,7 @@ found: | |||
868 | 868 | ||
869 | static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) | 869 | static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) |
870 | { | 870 | { |
871 | struct raw_iter_state* state = raw_seq_private(seq); | 871 | struct raw_iter_state *state = raw_seq_private(seq); |
872 | 872 | ||
873 | do { | 873 | do { |
874 | sk = sk_next(sk); | 874 | sk = sk_next(sk); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2ea6dcc3e2cc..0dc0c3826763 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; | |||
129 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; | 129 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; |
130 | static int ip_rt_min_advmss __read_mostly = 256; | 130 | static int ip_rt_min_advmss __read_mostly = 256; |
131 | static int ip_rt_secret_interval __read_mostly = 10 * 60 * HZ; | 131 | static int ip_rt_secret_interval __read_mostly = 10 * 60 * HZ; |
132 | static int rt_chain_length_max __read_mostly = 20; | ||
132 | 133 | ||
133 | static void rt_worker_func(struct work_struct *work); | 134 | static void rt_worker_func(struct work_struct *work); |
134 | static DECLARE_DELAYED_WORK(expires_work, rt_worker_func); | 135 | static DECLARE_DELAYED_WORK(expires_work, rt_worker_func); |
@@ -145,6 +146,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); | |||
145 | static void ipv4_link_failure(struct sk_buff *skb); | 146 | static void ipv4_link_failure(struct sk_buff *skb); |
146 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu); | 147 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu); |
147 | static int rt_garbage_collect(struct dst_ops *ops); | 148 | static int rt_garbage_collect(struct dst_ops *ops); |
149 | static void rt_emergency_hash_rebuild(struct net *net); | ||
148 | 150 | ||
149 | 151 | ||
150 | static struct dst_ops ipv4_dst_ops = { | 152 | static struct dst_ops ipv4_dst_ops = { |
@@ -201,6 +203,7 @@ const __u8 ip_tos2prio[16] = { | |||
201 | struct rt_hash_bucket { | 203 | struct 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 | ||
680 | static 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 | |||
686 | static 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 | |||
677 | static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) | 694 | static 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 | |||
756 | static void rt_check_expire(void) | 784 | static 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 | ||
914 | static 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 | |||
924 | static 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; | |||
989 | static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp) | 1069 | static 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,14 +1206,17 @@ 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; |
1105 | printk(KERN_DEBUG "rt_cache @%02x: " NIPQUAD_FMT, hash, | 1217 | printk(KERN_DEBUG "rt_cache @%02x: %pI4", hash, &rt->rt_dst); |
1106 | NIPQUAD(rt->rt_dst)); | ||
1107 | for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next) | 1218 | for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next) |
1108 | printk(" . " NIPQUAD_FMT, NIPQUAD(trt->rt_dst)); | 1219 | printk(" . %pI4", &trt->rt_dst); |
1109 | printk("\n"); | 1220 | printk("\n"); |
1110 | } | 1221 | } |
1111 | #endif | 1222 | #endif |
@@ -1114,7 +1225,11 @@ restart: | |||
1114 | * previous writes to rt are comitted to memory | 1225 | * previous writes to rt are comitted to memory |
1115 | * before making rt visible to other CPUS. | 1226 | * before making rt visible to other CPUS. |
1116 | */ | 1227 | */ |
1117 | rcu_assign_pointer(rt_hash_table[hash].chain, rt); | 1228 | if (rthi) |
1229 | rcu_assign_pointer(rthi->u.dst.rt_next, rt); | ||
1230 | else | ||
1231 | rcu_assign_pointer(rt_hash_table[hash].chain, rt); | ||
1232 | |||
1118 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1233 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1119 | *rp = rt; | 1234 | *rp = rt; |
1120 | return 0; | 1235 | return 0; |
@@ -1217,6 +1332,9 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1217 | || ipv4_is_zeronet(new_gw)) | 1332 | || ipv4_is_zeronet(new_gw)) |
1218 | goto reject_redirect; | 1333 | goto reject_redirect; |
1219 | 1334 | ||
1335 | if (!rt_caching(net)) | ||
1336 | goto reject_redirect; | ||
1337 | |||
1220 | if (!IN_DEV_SHARED_MEDIA(in_dev)) { | 1338 | if (!IN_DEV_SHARED_MEDIA(in_dev)) { |
1221 | if (!inet_addr_onlink(in_dev, new_gw, old_gw)) | 1339 | if (!inet_addr_onlink(in_dev, new_gw, old_gw)) |
1222 | goto reject_redirect; | 1340 | goto reject_redirect; |
@@ -1267,7 +1385,6 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1267 | 1385 | ||
1268 | /* Copy all the information. */ | 1386 | /* Copy all the information. */ |
1269 | *rt = *rth; | 1387 | *rt = *rth; |
1270 | INIT_RCU_HEAD(&rt->u.dst.rcu_head); | ||
1271 | rt->u.dst.__use = 1; | 1388 | rt->u.dst.__use = 1; |
1272 | atomic_set(&rt->u.dst.__refcnt, 1); | 1389 | atomic_set(&rt->u.dst.__refcnt, 1); |
1273 | rt->u.dst.child = NULL; | 1390 | rt->u.dst.child = NULL; |
@@ -1280,7 +1397,9 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1280 | rt->u.dst.path = &rt->u.dst; | 1397 | rt->u.dst.path = &rt->u.dst; |
1281 | rt->u.dst.neighbour = NULL; | 1398 | rt->u.dst.neighbour = NULL; |
1282 | rt->u.dst.hh = NULL; | 1399 | rt->u.dst.hh = NULL; |
1400 | #ifdef CONFIG_XFRM | ||
1283 | rt->u.dst.xfrm = NULL; | 1401 | rt->u.dst.xfrm = NULL; |
1402 | #endif | ||
1284 | rt->rt_genid = rt_genid(net); | 1403 | rt->rt_genid = rt_genid(net); |
1285 | rt->rt_flags |= RTCF_REDIRECTED; | 1404 | rt->rt_flags |= RTCF_REDIRECTED; |
1286 | 1405 | ||
@@ -1324,11 +1443,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1324 | reject_redirect: | 1443 | reject_redirect: |
1325 | #ifdef CONFIG_IP_ROUTE_VERBOSE | 1444 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
1326 | if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) | 1445 | if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) |
1327 | printk(KERN_INFO "Redirect from " NIPQUAD_FMT " on %s about " | 1446 | printk(KERN_INFO "Redirect from %pI4 on %s about %pI4 ignored.\n" |
1328 | NIPQUAD_FMT " ignored.\n" | 1447 | " Advised path = %pI4 -> %pI4\n", |
1329 | " Advised path = " NIPQUAD_FMT " -> " NIPQUAD_FMT "\n", | 1448 | &old_gw, dev->name, &new_gw, |
1330 | NIPQUAD(old_gw), dev->name, NIPQUAD(new_gw), | 1449 | &saddr, &daddr); |
1331 | NIPQUAD(saddr), NIPQUAD(daddr)); | ||
1332 | #endif | 1450 | #endif |
1333 | in_dev_put(in_dev); | 1451 | in_dev_put(in_dev); |
1334 | } | 1452 | } |
@@ -1348,9 +1466,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | |||
1348 | rt->fl.oif, | 1466 | rt->fl.oif, |
1349 | rt_genid(dev_net(dst->dev))); | 1467 | rt_genid(dev_net(dst->dev))); |
1350 | #if RT_CACHE_DEBUG >= 1 | 1468 | #if RT_CACHE_DEBUG >= 1 |
1351 | printk(KERN_DEBUG "ipv4_negative_advice: redirect to " | 1469 | printk(KERN_DEBUG "ipv4_negative_advice: redirect to %pI4/%02x dropped\n", |
1352 | NIPQUAD_FMT "/%02x dropped\n", | 1470 | &rt->rt_dst, rt->fl.fl4_tos); |
1353 | NIPQUAD(rt->rt_dst), rt->fl.fl4_tos); | ||
1354 | #endif | 1471 | #endif |
1355 | rt_del(hash, rt); | 1472 | rt_del(hash, rt); |
1356 | ret = NULL; | 1473 | ret = NULL; |
@@ -1414,10 +1531,9 @@ void ip_rt_send_redirect(struct sk_buff *skb) | |||
1414 | if (IN_DEV_LOG_MARTIANS(in_dev) && | 1531 | if (IN_DEV_LOG_MARTIANS(in_dev) && |
1415 | rt->u.dst.rate_tokens == ip_rt_redirect_number && | 1532 | rt->u.dst.rate_tokens == ip_rt_redirect_number && |
1416 | net_ratelimit()) | 1533 | net_ratelimit()) |
1417 | printk(KERN_WARNING "host " NIPQUAD_FMT "/if%d ignores " | 1534 | printk(KERN_WARNING "host %pI4/if%d ignores redirects for %pI4 to %pI4.\n", |
1418 | "redirects for " NIPQUAD_FMT " to " NIPQUAD_FMT ".\n", | 1535 | &rt->rt_src, rt->rt_iif, |
1419 | NIPQUAD(rt->rt_src), rt->rt_iif, | 1536 | &rt->rt_dst, &rt->rt_gateway); |
1420 | NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_gateway)); | ||
1421 | #endif | 1537 | #endif |
1422 | } | 1538 | } |
1423 | out: | 1539 | out: |
@@ -1610,8 +1726,8 @@ static void ipv4_link_failure(struct sk_buff *skb) | |||
1610 | 1726 | ||
1611 | static int ip_rt_bug(struct sk_buff *skb) | 1727 | static int ip_rt_bug(struct sk_buff *skb) |
1612 | { | 1728 | { |
1613 | printk(KERN_DEBUG "ip_rt_bug: " NIPQUAD_FMT " -> " NIPQUAD_FMT ", %s\n", | 1729 | printk(KERN_DEBUG "ip_rt_bug: %pI4 -> %pI4, %s\n", |
1614 | NIPQUAD(ip_hdr(skb)->saddr), NIPQUAD(ip_hdr(skb)->daddr), | 1730 | &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, |
1615 | skb->dev ? skb->dev->name : "?"); | 1731 | skb->dev ? skb->dev->name : "?"); |
1616 | kfree_skb(skb); | 1732 | kfree_skb(skb); |
1617 | return 0; | 1733 | return 0; |
@@ -1788,9 +1904,8 @@ static void ip_handle_martian_source(struct net_device *dev, | |||
1788 | * RFC1812 recommendation, if source is martian, | 1904 | * RFC1812 recommendation, if source is martian, |
1789 | * the only hint is MAC header. | 1905 | * the only hint is MAC header. |
1790 | */ | 1906 | */ |
1791 | printk(KERN_WARNING "martian source " NIPQUAD_FMT " from " | 1907 | printk(KERN_WARNING "martian source %pI4 from %pI4, on dev %s\n", |
1792 | NIPQUAD_FMT", on dev %s\n", | 1908 | &daddr, &saddr, dev->name); |
1793 | NIPQUAD(daddr), NIPQUAD(saddr), dev->name); | ||
1794 | if (dev->hard_header_len && skb_mac_header_was_set(skb)) { | 1909 | if (dev->hard_header_len && skb_mac_header_was_set(skb)) { |
1795 | int i; | 1910 | int i; |
1796 | const unsigned char *p = skb_mac_header(skb); | 1911 | const unsigned char *p = skb_mac_header(skb); |
@@ -2099,9 +2214,8 @@ martian_destination: | |||
2099 | RT_CACHE_STAT_INC(in_martian_dst); | 2214 | RT_CACHE_STAT_INC(in_martian_dst); |
2100 | #ifdef CONFIG_IP_ROUTE_VERBOSE | 2215 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
2101 | if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) | 2216 | if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) |
2102 | printk(KERN_WARNING "martian destination " NIPQUAD_FMT " from " | 2217 | printk(KERN_WARNING "martian destination %pI4 from %pI4, dev %s\n", |
2103 | NIPQUAD_FMT ", dev %s\n", | 2218 | &daddr, &saddr, dev->name); |
2104 | NIPQUAD(daddr), NIPQUAD(saddr), dev->name); | ||
2105 | #endif | 2219 | #endif |
2106 | 2220 | ||
2107 | e_hostunreach: | 2221 | e_hostunreach: |
@@ -2130,6 +2244,10 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2130 | struct net *net; | 2244 | struct net *net; |
2131 | 2245 | ||
2132 | net = dev_net(dev); | 2246 | net = dev_net(dev); |
2247 | |||
2248 | if (!rt_caching(net)) | ||
2249 | goto skip_cache; | ||
2250 | |||
2133 | tos &= IPTOS_RT_MASK; | 2251 | tos &= IPTOS_RT_MASK; |
2134 | hash = rt_hash(daddr, saddr, iif, rt_genid(net)); | 2252 | hash = rt_hash(daddr, saddr, iif, rt_genid(net)); |
2135 | 2253 | ||
@@ -2154,6 +2272,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2154 | } | 2272 | } |
2155 | rcu_read_unlock(); | 2273 | rcu_read_unlock(); |
2156 | 2274 | ||
2275 | skip_cache: | ||
2157 | /* Multicast recognition logic is moved from route cache to here. | 2276 | /* Multicast recognition logic is moved from route cache to here. |
2158 | The problem was that too many Ethernet cards have broken/missing | 2277 | The problem was that too many Ethernet cards have broken/missing |
2159 | hardware multicast filters :-( As result the host on multicasting | 2278 | hardware multicast filters :-( As result the host on multicasting |
@@ -2539,6 +2658,9 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, | |||
2539 | unsigned hash; | 2658 | unsigned hash; |
2540 | struct rtable *rth; | 2659 | struct rtable *rth; |
2541 | 2660 | ||
2661 | if (!rt_caching(net)) | ||
2662 | goto slow_output; | ||
2663 | |||
2542 | hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net)); | 2664 | hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net)); |
2543 | 2665 | ||
2544 | rcu_read_lock_bh(); | 2666 | rcu_read_lock_bh(); |
@@ -2563,6 +2685,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, | |||
2563 | } | 2685 | } |
2564 | rcu_read_unlock_bh(); | 2686 | rcu_read_unlock_bh(); |
2565 | 2687 | ||
2688 | slow_output: | ||
2566 | return ip_route_output_slow(net, rp, flp); | 2689 | return ip_route_output_slow(net, rp, flp); |
2567 | } | 2690 | } |
2568 | 2691 | ||
@@ -2995,7 +3118,7 @@ static ctl_table ipv4_route_table[] = { | |||
2995 | .data = &ipv4_dst_ops.gc_thresh, | 3118 | .data = &ipv4_dst_ops.gc_thresh, |
2996 | .maxlen = sizeof(int), | 3119 | .maxlen = sizeof(int), |
2997 | .mode = 0644, | 3120 | .mode = 0644, |
2998 | .proc_handler = &proc_dointvec, | 3121 | .proc_handler = proc_dointvec, |
2999 | }, | 3122 | }, |
3000 | { | 3123 | { |
3001 | .ctl_name = NET_IPV4_ROUTE_MAX_SIZE, | 3124 | .ctl_name = NET_IPV4_ROUTE_MAX_SIZE, |
@@ -3003,7 +3126,7 @@ static ctl_table ipv4_route_table[] = { | |||
3003 | .data = &ip_rt_max_size, | 3126 | .data = &ip_rt_max_size, |
3004 | .maxlen = sizeof(int), | 3127 | .maxlen = sizeof(int), |
3005 | .mode = 0644, | 3128 | .mode = 0644, |
3006 | .proc_handler = &proc_dointvec, | 3129 | .proc_handler = proc_dointvec, |
3007 | }, | 3130 | }, |
3008 | { | 3131 | { |
3009 | /* Deprecated. Use gc_min_interval_ms */ | 3132 | /* Deprecated. Use gc_min_interval_ms */ |
@@ -3013,8 +3136,8 @@ static ctl_table ipv4_route_table[] = { | |||
3013 | .data = &ip_rt_gc_min_interval, | 3136 | .data = &ip_rt_gc_min_interval, |
3014 | .maxlen = sizeof(int), | 3137 | .maxlen = sizeof(int), |
3015 | .mode = 0644, | 3138 | .mode = 0644, |
3016 | .proc_handler = &proc_dointvec_jiffies, | 3139 | .proc_handler = proc_dointvec_jiffies, |
3017 | .strategy = &sysctl_jiffies, | 3140 | .strategy = sysctl_jiffies, |
3018 | }, | 3141 | }, |
3019 | { | 3142 | { |
3020 | .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, | 3143 | .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, |
@@ -3022,8 +3145,8 @@ static ctl_table ipv4_route_table[] = { | |||
3022 | .data = &ip_rt_gc_min_interval, | 3145 | .data = &ip_rt_gc_min_interval, |
3023 | .maxlen = sizeof(int), | 3146 | .maxlen = sizeof(int), |
3024 | .mode = 0644, | 3147 | .mode = 0644, |
3025 | .proc_handler = &proc_dointvec_ms_jiffies, | 3148 | .proc_handler = proc_dointvec_ms_jiffies, |
3026 | .strategy = &sysctl_ms_jiffies, | 3149 | .strategy = sysctl_ms_jiffies, |
3027 | }, | 3150 | }, |
3028 | { | 3151 | { |
3029 | .ctl_name = NET_IPV4_ROUTE_GC_TIMEOUT, | 3152 | .ctl_name = NET_IPV4_ROUTE_GC_TIMEOUT, |
@@ -3031,8 +3154,8 @@ static ctl_table ipv4_route_table[] = { | |||
3031 | .data = &ip_rt_gc_timeout, | 3154 | .data = &ip_rt_gc_timeout, |
3032 | .maxlen = sizeof(int), | 3155 | .maxlen = sizeof(int), |
3033 | .mode = 0644, | 3156 | .mode = 0644, |
3034 | .proc_handler = &proc_dointvec_jiffies, | 3157 | .proc_handler = proc_dointvec_jiffies, |
3035 | .strategy = &sysctl_jiffies, | 3158 | .strategy = sysctl_jiffies, |
3036 | }, | 3159 | }, |
3037 | { | 3160 | { |
3038 | .ctl_name = NET_IPV4_ROUTE_GC_INTERVAL, | 3161 | .ctl_name = NET_IPV4_ROUTE_GC_INTERVAL, |
@@ -3040,8 +3163,8 @@ static ctl_table ipv4_route_table[] = { | |||
3040 | .data = &ip_rt_gc_interval, | 3163 | .data = &ip_rt_gc_interval, |
3041 | .maxlen = sizeof(int), | 3164 | .maxlen = sizeof(int), |
3042 | .mode = 0644, | 3165 | .mode = 0644, |
3043 | .proc_handler = &proc_dointvec_jiffies, | 3166 | .proc_handler = proc_dointvec_jiffies, |
3044 | .strategy = &sysctl_jiffies, | 3167 | .strategy = sysctl_jiffies, |
3045 | }, | 3168 | }, |
3046 | { | 3169 | { |
3047 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_LOAD, | 3170 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_LOAD, |
@@ -3049,7 +3172,7 @@ static ctl_table ipv4_route_table[] = { | |||
3049 | .data = &ip_rt_redirect_load, | 3172 | .data = &ip_rt_redirect_load, |
3050 | .maxlen = sizeof(int), | 3173 | .maxlen = sizeof(int), |
3051 | .mode = 0644, | 3174 | .mode = 0644, |
3052 | .proc_handler = &proc_dointvec, | 3175 | .proc_handler = proc_dointvec, |
3053 | }, | 3176 | }, |
3054 | { | 3177 | { |
3055 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_NUMBER, | 3178 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_NUMBER, |
@@ -3057,7 +3180,7 @@ static ctl_table ipv4_route_table[] = { | |||
3057 | .data = &ip_rt_redirect_number, | 3180 | .data = &ip_rt_redirect_number, |
3058 | .maxlen = sizeof(int), | 3181 | .maxlen = sizeof(int), |
3059 | .mode = 0644, | 3182 | .mode = 0644, |
3060 | .proc_handler = &proc_dointvec, | 3183 | .proc_handler = proc_dointvec, |
3061 | }, | 3184 | }, |
3062 | { | 3185 | { |
3063 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_SILENCE, | 3186 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_SILENCE, |
@@ -3065,7 +3188,7 @@ static ctl_table ipv4_route_table[] = { | |||
3065 | .data = &ip_rt_redirect_silence, | 3188 | .data = &ip_rt_redirect_silence, |
3066 | .maxlen = sizeof(int), | 3189 | .maxlen = sizeof(int), |
3067 | .mode = 0644, | 3190 | .mode = 0644, |
3068 | .proc_handler = &proc_dointvec, | 3191 | .proc_handler = proc_dointvec, |
3069 | }, | 3192 | }, |
3070 | { | 3193 | { |
3071 | .ctl_name = NET_IPV4_ROUTE_ERROR_COST, | 3194 | .ctl_name = NET_IPV4_ROUTE_ERROR_COST, |
@@ -3073,7 +3196,7 @@ static ctl_table ipv4_route_table[] = { | |||
3073 | .data = &ip_rt_error_cost, | 3196 | .data = &ip_rt_error_cost, |
3074 | .maxlen = sizeof(int), | 3197 | .maxlen = sizeof(int), |
3075 | .mode = 0644, | 3198 | .mode = 0644, |
3076 | .proc_handler = &proc_dointvec, | 3199 | .proc_handler = proc_dointvec, |
3077 | }, | 3200 | }, |
3078 | { | 3201 | { |
3079 | .ctl_name = NET_IPV4_ROUTE_ERROR_BURST, | 3202 | .ctl_name = NET_IPV4_ROUTE_ERROR_BURST, |
@@ -3081,7 +3204,7 @@ static ctl_table ipv4_route_table[] = { | |||
3081 | .data = &ip_rt_error_burst, | 3204 | .data = &ip_rt_error_burst, |
3082 | .maxlen = sizeof(int), | 3205 | .maxlen = sizeof(int), |
3083 | .mode = 0644, | 3206 | .mode = 0644, |
3084 | .proc_handler = &proc_dointvec, | 3207 | .proc_handler = proc_dointvec, |
3085 | }, | 3208 | }, |
3086 | { | 3209 | { |
3087 | .ctl_name = NET_IPV4_ROUTE_GC_ELASTICITY, | 3210 | .ctl_name = NET_IPV4_ROUTE_GC_ELASTICITY, |
@@ -3089,7 +3212,7 @@ static ctl_table ipv4_route_table[] = { | |||
3089 | .data = &ip_rt_gc_elasticity, | 3212 | .data = &ip_rt_gc_elasticity, |
3090 | .maxlen = sizeof(int), | 3213 | .maxlen = sizeof(int), |
3091 | .mode = 0644, | 3214 | .mode = 0644, |
3092 | .proc_handler = &proc_dointvec, | 3215 | .proc_handler = proc_dointvec, |
3093 | }, | 3216 | }, |
3094 | { | 3217 | { |
3095 | .ctl_name = NET_IPV4_ROUTE_MTU_EXPIRES, | 3218 | .ctl_name = NET_IPV4_ROUTE_MTU_EXPIRES, |
@@ -3097,8 +3220,8 @@ static ctl_table ipv4_route_table[] = { | |||
3097 | .data = &ip_rt_mtu_expires, | 3220 | .data = &ip_rt_mtu_expires, |
3098 | .maxlen = sizeof(int), | 3221 | .maxlen = sizeof(int), |
3099 | .mode = 0644, | 3222 | .mode = 0644, |
3100 | .proc_handler = &proc_dointvec_jiffies, | 3223 | .proc_handler = proc_dointvec_jiffies, |
3101 | .strategy = &sysctl_jiffies, | 3224 | .strategy = sysctl_jiffies, |
3102 | }, | 3225 | }, |
3103 | { | 3226 | { |
3104 | .ctl_name = NET_IPV4_ROUTE_MIN_PMTU, | 3227 | .ctl_name = NET_IPV4_ROUTE_MIN_PMTU, |
@@ -3106,7 +3229,7 @@ static ctl_table ipv4_route_table[] = { | |||
3106 | .data = &ip_rt_min_pmtu, | 3229 | .data = &ip_rt_min_pmtu, |
3107 | .maxlen = sizeof(int), | 3230 | .maxlen = sizeof(int), |
3108 | .mode = 0644, | 3231 | .mode = 0644, |
3109 | .proc_handler = &proc_dointvec, | 3232 | .proc_handler = proc_dointvec, |
3110 | }, | 3233 | }, |
3111 | { | 3234 | { |
3112 | .ctl_name = NET_IPV4_ROUTE_MIN_ADVMSS, | 3235 | .ctl_name = NET_IPV4_ROUTE_MIN_ADVMSS, |
@@ -3114,7 +3237,7 @@ static ctl_table ipv4_route_table[] = { | |||
3114 | .data = &ip_rt_min_advmss, | 3237 | .data = &ip_rt_min_advmss, |
3115 | .maxlen = sizeof(int), | 3238 | .maxlen = sizeof(int), |
3116 | .mode = 0644, | 3239 | .mode = 0644, |
3117 | .proc_handler = &proc_dointvec, | 3240 | .proc_handler = proc_dointvec, |
3118 | }, | 3241 | }, |
3119 | { | 3242 | { |
3120 | .ctl_name = NET_IPV4_ROUTE_SECRET_INTERVAL, | 3243 | .ctl_name = NET_IPV4_ROUTE_SECRET_INTERVAL, |
@@ -3122,8 +3245,8 @@ static ctl_table ipv4_route_table[] = { | |||
3122 | .data = &ip_rt_secret_interval, | 3245 | .data = &ip_rt_secret_interval, |
3123 | .maxlen = sizeof(int), | 3246 | .maxlen = sizeof(int), |
3124 | .mode = 0644, | 3247 | .mode = 0644, |
3125 | .proc_handler = &ipv4_sysctl_rt_secret_interval, | 3248 | .proc_handler = ipv4_sysctl_rt_secret_interval, |
3126 | .strategy = &ipv4_sysctl_rt_secret_interval_strategy, | 3249 | .strategy = ipv4_sysctl_rt_secret_interval_strategy, |
3127 | }, | 3250 | }, |
3128 | { .ctl_name = 0 } | 3251 | { .ctl_name = 0 } |
3129 | }; | 3252 | }; |
@@ -3151,8 +3274,8 @@ static struct ctl_table ipv4_route_flush_table[] = { | |||
3151 | .procname = "flush", | 3274 | .procname = "flush", |
3152 | .maxlen = sizeof(int), | 3275 | .maxlen = sizeof(int), |
3153 | .mode = 0200, | 3276 | .mode = 0200, |
3154 | .proc_handler = &ipv4_sysctl_rtcache_flush, | 3277 | .proc_handler = ipv4_sysctl_rtcache_flush, |
3155 | .strategy = &ipv4_sysctl_rtcache_flush_strategy, | 3278 | .strategy = ipv4_sysctl_rtcache_flush_strategy, |
3156 | }, | 3279 | }, |
3157 | { .ctl_name = 0 }, | 3280 | { .ctl_name = 0 }, |
3158 | }; | 3281 | }; |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 1bb10df8ce7d..4710d219f06a 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -195,7 +195,7 @@ static struct ctl_table ipv4_table[] = { | |||
195 | .data = &sysctl_tcp_timestamps, | 195 | .data = &sysctl_tcp_timestamps, |
196 | .maxlen = sizeof(int), | 196 | .maxlen = sizeof(int), |
197 | .mode = 0644, | 197 | .mode = 0644, |
198 | .proc_handler = &proc_dointvec | 198 | .proc_handler = proc_dointvec |
199 | }, | 199 | }, |
200 | { | 200 | { |
201 | .ctl_name = NET_IPV4_TCP_WINDOW_SCALING, | 201 | .ctl_name = NET_IPV4_TCP_WINDOW_SCALING, |
@@ -203,7 +203,7 @@ static struct ctl_table ipv4_table[] = { | |||
203 | .data = &sysctl_tcp_window_scaling, | 203 | .data = &sysctl_tcp_window_scaling, |
204 | .maxlen = sizeof(int), | 204 | .maxlen = sizeof(int), |
205 | .mode = 0644, | 205 | .mode = 0644, |
206 | .proc_handler = &proc_dointvec | 206 | .proc_handler = proc_dointvec |
207 | }, | 207 | }, |
208 | { | 208 | { |
209 | .ctl_name = NET_IPV4_TCP_SACK, | 209 | .ctl_name = NET_IPV4_TCP_SACK, |
@@ -211,7 +211,7 @@ static struct ctl_table ipv4_table[] = { | |||
211 | .data = &sysctl_tcp_sack, | 211 | .data = &sysctl_tcp_sack, |
212 | .maxlen = sizeof(int), | 212 | .maxlen = sizeof(int), |
213 | .mode = 0644, | 213 | .mode = 0644, |
214 | .proc_handler = &proc_dointvec | 214 | .proc_handler = proc_dointvec |
215 | }, | 215 | }, |
216 | { | 216 | { |
217 | .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE, | 217 | .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE, |
@@ -219,7 +219,7 @@ static struct ctl_table ipv4_table[] = { | |||
219 | .data = &sysctl_tcp_retrans_collapse, | 219 | .data = &sysctl_tcp_retrans_collapse, |
220 | .maxlen = sizeof(int), | 220 | .maxlen = sizeof(int), |
221 | .mode = 0644, | 221 | .mode = 0644, |
222 | .proc_handler = &proc_dointvec | 222 | .proc_handler = proc_dointvec |
223 | }, | 223 | }, |
224 | { | 224 | { |
225 | .ctl_name = NET_IPV4_DEFAULT_TTL, | 225 | .ctl_name = NET_IPV4_DEFAULT_TTL, |
@@ -227,8 +227,8 @@ static struct ctl_table ipv4_table[] = { | |||
227 | .data = &sysctl_ip_default_ttl, | 227 | .data = &sysctl_ip_default_ttl, |
228 | .maxlen = sizeof(int), | 228 | .maxlen = sizeof(int), |
229 | .mode = 0644, | 229 | .mode = 0644, |
230 | .proc_handler = &ipv4_doint_and_flush, | 230 | .proc_handler = ipv4_doint_and_flush, |
231 | .strategy = &ipv4_doint_and_flush_strategy, | 231 | .strategy = ipv4_doint_and_flush_strategy, |
232 | .extra2 = &init_net, | 232 | .extra2 = &init_net, |
233 | }, | 233 | }, |
234 | { | 234 | { |
@@ -237,7 +237,7 @@ static struct ctl_table ipv4_table[] = { | |||
237 | .data = &ipv4_config.no_pmtu_disc, | 237 | .data = &ipv4_config.no_pmtu_disc, |
238 | .maxlen = sizeof(int), | 238 | .maxlen = sizeof(int), |
239 | .mode = 0644, | 239 | .mode = 0644, |
240 | .proc_handler = &proc_dointvec | 240 | .proc_handler = proc_dointvec |
241 | }, | 241 | }, |
242 | { | 242 | { |
243 | .ctl_name = NET_IPV4_NONLOCAL_BIND, | 243 | .ctl_name = NET_IPV4_NONLOCAL_BIND, |
@@ -245,7 +245,7 @@ static struct ctl_table ipv4_table[] = { | |||
245 | .data = &sysctl_ip_nonlocal_bind, | 245 | .data = &sysctl_ip_nonlocal_bind, |
246 | .maxlen = sizeof(int), | 246 | .maxlen = sizeof(int), |
247 | .mode = 0644, | 247 | .mode = 0644, |
248 | .proc_handler = &proc_dointvec | 248 | .proc_handler = proc_dointvec |
249 | }, | 249 | }, |
250 | { | 250 | { |
251 | .ctl_name = NET_IPV4_TCP_SYN_RETRIES, | 251 | .ctl_name = NET_IPV4_TCP_SYN_RETRIES, |
@@ -253,7 +253,7 @@ static struct ctl_table ipv4_table[] = { | |||
253 | .data = &sysctl_tcp_syn_retries, | 253 | .data = &sysctl_tcp_syn_retries, |
254 | .maxlen = sizeof(int), | 254 | .maxlen = sizeof(int), |
255 | .mode = 0644, | 255 | .mode = 0644, |
256 | .proc_handler = &proc_dointvec | 256 | .proc_handler = proc_dointvec |
257 | }, | 257 | }, |
258 | { | 258 | { |
259 | .ctl_name = NET_TCP_SYNACK_RETRIES, | 259 | .ctl_name = NET_TCP_SYNACK_RETRIES, |
@@ -261,7 +261,7 @@ static struct ctl_table ipv4_table[] = { | |||
261 | .data = &sysctl_tcp_synack_retries, | 261 | .data = &sysctl_tcp_synack_retries, |
262 | .maxlen = sizeof(int), | 262 | .maxlen = sizeof(int), |
263 | .mode = 0644, | 263 | .mode = 0644, |
264 | .proc_handler = &proc_dointvec | 264 | .proc_handler = proc_dointvec |
265 | }, | 265 | }, |
266 | { | 266 | { |
267 | .ctl_name = NET_TCP_MAX_ORPHANS, | 267 | .ctl_name = NET_TCP_MAX_ORPHANS, |
@@ -269,7 +269,7 @@ static struct ctl_table ipv4_table[] = { | |||
269 | .data = &sysctl_tcp_max_orphans, | 269 | .data = &sysctl_tcp_max_orphans, |
270 | .maxlen = sizeof(int), | 270 | .maxlen = sizeof(int), |
271 | .mode = 0644, | 271 | .mode = 0644, |
272 | .proc_handler = &proc_dointvec | 272 | .proc_handler = proc_dointvec |
273 | }, | 273 | }, |
274 | { | 274 | { |
275 | .ctl_name = NET_TCP_MAX_TW_BUCKETS, | 275 | .ctl_name = NET_TCP_MAX_TW_BUCKETS, |
@@ -277,7 +277,7 @@ static struct ctl_table ipv4_table[] = { | |||
277 | .data = &tcp_death_row.sysctl_max_tw_buckets, | 277 | .data = &tcp_death_row.sysctl_max_tw_buckets, |
278 | .maxlen = sizeof(int), | 278 | .maxlen = sizeof(int), |
279 | .mode = 0644, | 279 | .mode = 0644, |
280 | .proc_handler = &proc_dointvec | 280 | .proc_handler = proc_dointvec |
281 | }, | 281 | }, |
282 | { | 282 | { |
283 | .ctl_name = NET_IPV4_DYNADDR, | 283 | .ctl_name = NET_IPV4_DYNADDR, |
@@ -285,7 +285,7 @@ static struct ctl_table ipv4_table[] = { | |||
285 | .data = &sysctl_ip_dynaddr, | 285 | .data = &sysctl_ip_dynaddr, |
286 | .maxlen = sizeof(int), | 286 | .maxlen = sizeof(int), |
287 | .mode = 0644, | 287 | .mode = 0644, |
288 | .proc_handler = &proc_dointvec | 288 | .proc_handler = proc_dointvec |
289 | }, | 289 | }, |
290 | { | 290 | { |
291 | .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME, | 291 | .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME, |
@@ -293,8 +293,8 @@ static struct ctl_table ipv4_table[] = { | |||
293 | .data = &sysctl_tcp_keepalive_time, | 293 | .data = &sysctl_tcp_keepalive_time, |
294 | .maxlen = sizeof(int), | 294 | .maxlen = sizeof(int), |
295 | .mode = 0644, | 295 | .mode = 0644, |
296 | .proc_handler = &proc_dointvec_jiffies, | 296 | .proc_handler = proc_dointvec_jiffies, |
297 | .strategy = &sysctl_jiffies | 297 | .strategy = sysctl_jiffies |
298 | }, | 298 | }, |
299 | { | 299 | { |
300 | .ctl_name = NET_IPV4_TCP_KEEPALIVE_PROBES, | 300 | .ctl_name = NET_IPV4_TCP_KEEPALIVE_PROBES, |
@@ -302,7 +302,7 @@ static struct ctl_table ipv4_table[] = { | |||
302 | .data = &sysctl_tcp_keepalive_probes, | 302 | .data = &sysctl_tcp_keepalive_probes, |
303 | .maxlen = sizeof(int), | 303 | .maxlen = sizeof(int), |
304 | .mode = 0644, | 304 | .mode = 0644, |
305 | .proc_handler = &proc_dointvec | 305 | .proc_handler = proc_dointvec |
306 | }, | 306 | }, |
307 | { | 307 | { |
308 | .ctl_name = NET_IPV4_TCP_KEEPALIVE_INTVL, | 308 | .ctl_name = NET_IPV4_TCP_KEEPALIVE_INTVL, |
@@ -310,8 +310,8 @@ static struct ctl_table ipv4_table[] = { | |||
310 | .data = &sysctl_tcp_keepalive_intvl, | 310 | .data = &sysctl_tcp_keepalive_intvl, |
311 | .maxlen = sizeof(int), | 311 | .maxlen = sizeof(int), |
312 | .mode = 0644, | 312 | .mode = 0644, |
313 | .proc_handler = &proc_dointvec_jiffies, | 313 | .proc_handler = proc_dointvec_jiffies, |
314 | .strategy = &sysctl_jiffies | 314 | .strategy = sysctl_jiffies |
315 | }, | 315 | }, |
316 | { | 316 | { |
317 | .ctl_name = NET_IPV4_TCP_RETRIES1, | 317 | .ctl_name = NET_IPV4_TCP_RETRIES1, |
@@ -319,8 +319,8 @@ static struct ctl_table ipv4_table[] = { | |||
319 | .data = &sysctl_tcp_retries1, | 319 | .data = &sysctl_tcp_retries1, |
320 | .maxlen = sizeof(int), | 320 | .maxlen = sizeof(int), |
321 | .mode = 0644, | 321 | .mode = 0644, |
322 | .proc_handler = &proc_dointvec_minmax, | 322 | .proc_handler = proc_dointvec_minmax, |
323 | .strategy = &sysctl_intvec, | 323 | .strategy = sysctl_intvec, |
324 | .extra2 = &tcp_retr1_max | 324 | .extra2 = &tcp_retr1_max |
325 | }, | 325 | }, |
326 | { | 326 | { |
@@ -329,7 +329,7 @@ static struct ctl_table ipv4_table[] = { | |||
329 | .data = &sysctl_tcp_retries2, | 329 | .data = &sysctl_tcp_retries2, |
330 | .maxlen = sizeof(int), | 330 | .maxlen = sizeof(int), |
331 | .mode = 0644, | 331 | .mode = 0644, |
332 | .proc_handler = &proc_dointvec | 332 | .proc_handler = proc_dointvec |
333 | }, | 333 | }, |
334 | { | 334 | { |
335 | .ctl_name = NET_IPV4_TCP_FIN_TIMEOUT, | 335 | .ctl_name = NET_IPV4_TCP_FIN_TIMEOUT, |
@@ -337,8 +337,8 @@ static struct ctl_table ipv4_table[] = { | |||
337 | .data = &sysctl_tcp_fin_timeout, | 337 | .data = &sysctl_tcp_fin_timeout, |
338 | .maxlen = sizeof(int), | 338 | .maxlen = sizeof(int), |
339 | .mode = 0644, | 339 | .mode = 0644, |
340 | .proc_handler = &proc_dointvec_jiffies, | 340 | .proc_handler = proc_dointvec_jiffies, |
341 | .strategy = &sysctl_jiffies | 341 | .strategy = sysctl_jiffies |
342 | }, | 342 | }, |
343 | #ifdef CONFIG_SYN_COOKIES | 343 | #ifdef CONFIG_SYN_COOKIES |
344 | { | 344 | { |
@@ -347,7 +347,7 @@ static struct ctl_table ipv4_table[] = { | |||
347 | .data = &sysctl_tcp_syncookies, | 347 | .data = &sysctl_tcp_syncookies, |
348 | .maxlen = sizeof(int), | 348 | .maxlen = sizeof(int), |
349 | .mode = 0644, | 349 | .mode = 0644, |
350 | .proc_handler = &proc_dointvec | 350 | .proc_handler = proc_dointvec |
351 | }, | 351 | }, |
352 | #endif | 352 | #endif |
353 | { | 353 | { |
@@ -356,7 +356,7 @@ static struct ctl_table ipv4_table[] = { | |||
356 | .data = &tcp_death_row.sysctl_tw_recycle, | 356 | .data = &tcp_death_row.sysctl_tw_recycle, |
357 | .maxlen = sizeof(int), | 357 | .maxlen = sizeof(int), |
358 | .mode = 0644, | 358 | .mode = 0644, |
359 | .proc_handler = &proc_dointvec | 359 | .proc_handler = proc_dointvec |
360 | }, | 360 | }, |
361 | { | 361 | { |
362 | .ctl_name = NET_TCP_ABORT_ON_OVERFLOW, | 362 | .ctl_name = NET_TCP_ABORT_ON_OVERFLOW, |
@@ -364,7 +364,7 @@ static struct ctl_table ipv4_table[] = { | |||
364 | .data = &sysctl_tcp_abort_on_overflow, | 364 | .data = &sysctl_tcp_abort_on_overflow, |
365 | .maxlen = sizeof(int), | 365 | .maxlen = sizeof(int), |
366 | .mode = 0644, | 366 | .mode = 0644, |
367 | .proc_handler = &proc_dointvec | 367 | .proc_handler = proc_dointvec |
368 | }, | 368 | }, |
369 | { | 369 | { |
370 | .ctl_name = NET_TCP_STDURG, | 370 | .ctl_name = NET_TCP_STDURG, |
@@ -372,7 +372,7 @@ static struct ctl_table ipv4_table[] = { | |||
372 | .data = &sysctl_tcp_stdurg, | 372 | .data = &sysctl_tcp_stdurg, |
373 | .maxlen = sizeof(int), | 373 | .maxlen = sizeof(int), |
374 | .mode = 0644, | 374 | .mode = 0644, |
375 | .proc_handler = &proc_dointvec | 375 | .proc_handler = proc_dointvec |
376 | }, | 376 | }, |
377 | { | 377 | { |
378 | .ctl_name = NET_TCP_RFC1337, | 378 | .ctl_name = NET_TCP_RFC1337, |
@@ -380,7 +380,7 @@ static struct ctl_table ipv4_table[] = { | |||
380 | .data = &sysctl_tcp_rfc1337, | 380 | .data = &sysctl_tcp_rfc1337, |
381 | .maxlen = sizeof(int), | 381 | .maxlen = sizeof(int), |
382 | .mode = 0644, | 382 | .mode = 0644, |
383 | .proc_handler = &proc_dointvec | 383 | .proc_handler = proc_dointvec |
384 | }, | 384 | }, |
385 | { | 385 | { |
386 | .ctl_name = NET_TCP_MAX_SYN_BACKLOG, | 386 | .ctl_name = NET_TCP_MAX_SYN_BACKLOG, |
@@ -388,7 +388,7 @@ static struct ctl_table ipv4_table[] = { | |||
388 | .data = &sysctl_max_syn_backlog, | 388 | .data = &sysctl_max_syn_backlog, |
389 | .maxlen = sizeof(int), | 389 | .maxlen = sizeof(int), |
390 | .mode = 0644, | 390 | .mode = 0644, |
391 | .proc_handler = &proc_dointvec | 391 | .proc_handler = proc_dointvec |
392 | }, | 392 | }, |
393 | { | 393 | { |
394 | .ctl_name = NET_IPV4_LOCAL_PORT_RANGE, | 394 | .ctl_name = NET_IPV4_LOCAL_PORT_RANGE, |
@@ -396,8 +396,8 @@ static struct ctl_table ipv4_table[] = { | |||
396 | .data = &sysctl_local_ports.range, | 396 | .data = &sysctl_local_ports.range, |
397 | .maxlen = sizeof(sysctl_local_ports.range), | 397 | .maxlen = sizeof(sysctl_local_ports.range), |
398 | .mode = 0644, | 398 | .mode = 0644, |
399 | .proc_handler = &ipv4_local_port_range, | 399 | .proc_handler = ipv4_local_port_range, |
400 | .strategy = &ipv4_sysctl_local_port_range, | 400 | .strategy = ipv4_sysctl_local_port_range, |
401 | }, | 401 | }, |
402 | #ifdef CONFIG_IP_MULTICAST | 402 | #ifdef CONFIG_IP_MULTICAST |
403 | { | 403 | { |
@@ -406,7 +406,7 @@ static struct ctl_table ipv4_table[] = { | |||
406 | .data = &sysctl_igmp_max_memberships, | 406 | .data = &sysctl_igmp_max_memberships, |
407 | .maxlen = sizeof(int), | 407 | .maxlen = sizeof(int), |
408 | .mode = 0644, | 408 | .mode = 0644, |
409 | .proc_handler = &proc_dointvec | 409 | .proc_handler = proc_dointvec |
410 | }, | 410 | }, |
411 | 411 | ||
412 | #endif | 412 | #endif |
@@ -416,7 +416,7 @@ static struct ctl_table ipv4_table[] = { | |||
416 | .data = &sysctl_igmp_max_msf, | 416 | .data = &sysctl_igmp_max_msf, |
417 | .maxlen = sizeof(int), | 417 | .maxlen = sizeof(int), |
418 | .mode = 0644, | 418 | .mode = 0644, |
419 | .proc_handler = &proc_dointvec | 419 | .proc_handler = proc_dointvec |
420 | }, | 420 | }, |
421 | { | 421 | { |
422 | .ctl_name = NET_IPV4_INET_PEER_THRESHOLD, | 422 | .ctl_name = NET_IPV4_INET_PEER_THRESHOLD, |
@@ -424,7 +424,7 @@ static struct ctl_table ipv4_table[] = { | |||
424 | .data = &inet_peer_threshold, | 424 | .data = &inet_peer_threshold, |
425 | .maxlen = sizeof(int), | 425 | .maxlen = sizeof(int), |
426 | .mode = 0644, | 426 | .mode = 0644, |
427 | .proc_handler = &proc_dointvec | 427 | .proc_handler = proc_dointvec |
428 | }, | 428 | }, |
429 | { | 429 | { |
430 | .ctl_name = NET_IPV4_INET_PEER_MINTTL, | 430 | .ctl_name = NET_IPV4_INET_PEER_MINTTL, |
@@ -432,8 +432,8 @@ static struct ctl_table ipv4_table[] = { | |||
432 | .data = &inet_peer_minttl, | 432 | .data = &inet_peer_minttl, |
433 | .maxlen = sizeof(int), | 433 | .maxlen = sizeof(int), |
434 | .mode = 0644, | 434 | .mode = 0644, |
435 | .proc_handler = &proc_dointvec_jiffies, | 435 | .proc_handler = proc_dointvec_jiffies, |
436 | .strategy = &sysctl_jiffies | 436 | .strategy = sysctl_jiffies |
437 | }, | 437 | }, |
438 | { | 438 | { |
439 | .ctl_name = NET_IPV4_INET_PEER_MAXTTL, | 439 | .ctl_name = NET_IPV4_INET_PEER_MAXTTL, |
@@ -441,8 +441,8 @@ static struct ctl_table ipv4_table[] = { | |||
441 | .data = &inet_peer_maxttl, | 441 | .data = &inet_peer_maxttl, |
442 | .maxlen = sizeof(int), | 442 | .maxlen = sizeof(int), |
443 | .mode = 0644, | 443 | .mode = 0644, |
444 | .proc_handler = &proc_dointvec_jiffies, | 444 | .proc_handler = proc_dointvec_jiffies, |
445 | .strategy = &sysctl_jiffies | 445 | .strategy = sysctl_jiffies |
446 | }, | 446 | }, |
447 | { | 447 | { |
448 | .ctl_name = NET_IPV4_INET_PEER_GC_MINTIME, | 448 | .ctl_name = NET_IPV4_INET_PEER_GC_MINTIME, |
@@ -450,8 +450,8 @@ static struct ctl_table ipv4_table[] = { | |||
450 | .data = &inet_peer_gc_mintime, | 450 | .data = &inet_peer_gc_mintime, |
451 | .maxlen = sizeof(int), | 451 | .maxlen = sizeof(int), |
452 | .mode = 0644, | 452 | .mode = 0644, |
453 | .proc_handler = &proc_dointvec_jiffies, | 453 | .proc_handler = proc_dointvec_jiffies, |
454 | .strategy = &sysctl_jiffies | 454 | .strategy = sysctl_jiffies |
455 | }, | 455 | }, |
456 | { | 456 | { |
457 | .ctl_name = NET_IPV4_INET_PEER_GC_MAXTIME, | 457 | .ctl_name = NET_IPV4_INET_PEER_GC_MAXTIME, |
@@ -459,8 +459,8 @@ static struct ctl_table ipv4_table[] = { | |||
459 | .data = &inet_peer_gc_maxtime, | 459 | .data = &inet_peer_gc_maxtime, |
460 | .maxlen = sizeof(int), | 460 | .maxlen = sizeof(int), |
461 | .mode = 0644, | 461 | .mode = 0644, |
462 | .proc_handler = &proc_dointvec_jiffies, | 462 | .proc_handler = proc_dointvec_jiffies, |
463 | .strategy = &sysctl_jiffies | 463 | .strategy = sysctl_jiffies |
464 | }, | 464 | }, |
465 | { | 465 | { |
466 | .ctl_name = NET_TCP_ORPHAN_RETRIES, | 466 | .ctl_name = NET_TCP_ORPHAN_RETRIES, |
@@ -468,7 +468,7 @@ static struct ctl_table ipv4_table[] = { | |||
468 | .data = &sysctl_tcp_orphan_retries, | 468 | .data = &sysctl_tcp_orphan_retries, |
469 | .maxlen = sizeof(int), | 469 | .maxlen = sizeof(int), |
470 | .mode = 0644, | 470 | .mode = 0644, |
471 | .proc_handler = &proc_dointvec | 471 | .proc_handler = proc_dointvec |
472 | }, | 472 | }, |
473 | { | 473 | { |
474 | .ctl_name = NET_TCP_FACK, | 474 | .ctl_name = NET_TCP_FACK, |
@@ -476,7 +476,7 @@ static struct ctl_table ipv4_table[] = { | |||
476 | .data = &sysctl_tcp_fack, | 476 | .data = &sysctl_tcp_fack, |
477 | .maxlen = sizeof(int), | 477 | .maxlen = sizeof(int), |
478 | .mode = 0644, | 478 | .mode = 0644, |
479 | .proc_handler = &proc_dointvec | 479 | .proc_handler = proc_dointvec |
480 | }, | 480 | }, |
481 | { | 481 | { |
482 | .ctl_name = NET_TCP_REORDERING, | 482 | .ctl_name = NET_TCP_REORDERING, |
@@ -484,7 +484,7 @@ static struct ctl_table ipv4_table[] = { | |||
484 | .data = &sysctl_tcp_reordering, | 484 | .data = &sysctl_tcp_reordering, |
485 | .maxlen = sizeof(int), | 485 | .maxlen = sizeof(int), |
486 | .mode = 0644, | 486 | .mode = 0644, |
487 | .proc_handler = &proc_dointvec | 487 | .proc_handler = proc_dointvec |
488 | }, | 488 | }, |
489 | { | 489 | { |
490 | .ctl_name = NET_TCP_ECN, | 490 | .ctl_name = NET_TCP_ECN, |
@@ -492,7 +492,7 @@ static struct ctl_table ipv4_table[] = { | |||
492 | .data = &sysctl_tcp_ecn, | 492 | .data = &sysctl_tcp_ecn, |
493 | .maxlen = sizeof(int), | 493 | .maxlen = sizeof(int), |
494 | .mode = 0644, | 494 | .mode = 0644, |
495 | .proc_handler = &proc_dointvec | 495 | .proc_handler = proc_dointvec |
496 | }, | 496 | }, |
497 | { | 497 | { |
498 | .ctl_name = NET_TCP_DSACK, | 498 | .ctl_name = NET_TCP_DSACK, |
@@ -500,7 +500,7 @@ static struct ctl_table ipv4_table[] = { | |||
500 | .data = &sysctl_tcp_dsack, | 500 | .data = &sysctl_tcp_dsack, |
501 | .maxlen = sizeof(int), | 501 | .maxlen = sizeof(int), |
502 | .mode = 0644, | 502 | .mode = 0644, |
503 | .proc_handler = &proc_dointvec | 503 | .proc_handler = proc_dointvec |
504 | }, | 504 | }, |
505 | { | 505 | { |
506 | .ctl_name = NET_TCP_MEM, | 506 | .ctl_name = NET_TCP_MEM, |
@@ -508,7 +508,7 @@ static struct ctl_table ipv4_table[] = { | |||
508 | .data = &sysctl_tcp_mem, | 508 | .data = &sysctl_tcp_mem, |
509 | .maxlen = sizeof(sysctl_tcp_mem), | 509 | .maxlen = sizeof(sysctl_tcp_mem), |
510 | .mode = 0644, | 510 | .mode = 0644, |
511 | .proc_handler = &proc_dointvec | 511 | .proc_handler = proc_dointvec |
512 | }, | 512 | }, |
513 | { | 513 | { |
514 | .ctl_name = NET_TCP_WMEM, | 514 | .ctl_name = NET_TCP_WMEM, |
@@ -516,7 +516,7 @@ static struct ctl_table ipv4_table[] = { | |||
516 | .data = &sysctl_tcp_wmem, | 516 | .data = &sysctl_tcp_wmem, |
517 | .maxlen = sizeof(sysctl_tcp_wmem), | 517 | .maxlen = sizeof(sysctl_tcp_wmem), |
518 | .mode = 0644, | 518 | .mode = 0644, |
519 | .proc_handler = &proc_dointvec | 519 | .proc_handler = proc_dointvec |
520 | }, | 520 | }, |
521 | { | 521 | { |
522 | .ctl_name = NET_TCP_RMEM, | 522 | .ctl_name = NET_TCP_RMEM, |
@@ -524,7 +524,7 @@ static struct ctl_table ipv4_table[] = { | |||
524 | .data = &sysctl_tcp_rmem, | 524 | .data = &sysctl_tcp_rmem, |
525 | .maxlen = sizeof(sysctl_tcp_rmem), | 525 | .maxlen = sizeof(sysctl_tcp_rmem), |
526 | .mode = 0644, | 526 | .mode = 0644, |
527 | .proc_handler = &proc_dointvec | 527 | .proc_handler = proc_dointvec |
528 | }, | 528 | }, |
529 | { | 529 | { |
530 | .ctl_name = NET_TCP_APP_WIN, | 530 | .ctl_name = NET_TCP_APP_WIN, |
@@ -532,7 +532,7 @@ static struct ctl_table ipv4_table[] = { | |||
532 | .data = &sysctl_tcp_app_win, | 532 | .data = &sysctl_tcp_app_win, |
533 | .maxlen = sizeof(int), | 533 | .maxlen = sizeof(int), |
534 | .mode = 0644, | 534 | .mode = 0644, |
535 | .proc_handler = &proc_dointvec | 535 | .proc_handler = proc_dointvec |
536 | }, | 536 | }, |
537 | { | 537 | { |
538 | .ctl_name = NET_TCP_ADV_WIN_SCALE, | 538 | .ctl_name = NET_TCP_ADV_WIN_SCALE, |
@@ -540,7 +540,7 @@ static struct ctl_table ipv4_table[] = { | |||
540 | .data = &sysctl_tcp_adv_win_scale, | 540 | .data = &sysctl_tcp_adv_win_scale, |
541 | .maxlen = sizeof(int), | 541 | .maxlen = sizeof(int), |
542 | .mode = 0644, | 542 | .mode = 0644, |
543 | .proc_handler = &proc_dointvec | 543 | .proc_handler = proc_dointvec |
544 | }, | 544 | }, |
545 | { | 545 | { |
546 | .ctl_name = NET_TCP_TW_REUSE, | 546 | .ctl_name = NET_TCP_TW_REUSE, |
@@ -548,7 +548,7 @@ static struct ctl_table ipv4_table[] = { | |||
548 | .data = &sysctl_tcp_tw_reuse, | 548 | .data = &sysctl_tcp_tw_reuse, |
549 | .maxlen = sizeof(int), | 549 | .maxlen = sizeof(int), |
550 | .mode = 0644, | 550 | .mode = 0644, |
551 | .proc_handler = &proc_dointvec | 551 | .proc_handler = proc_dointvec |
552 | }, | 552 | }, |
553 | { | 553 | { |
554 | .ctl_name = NET_TCP_FRTO, | 554 | .ctl_name = NET_TCP_FRTO, |
@@ -556,7 +556,7 @@ static struct ctl_table ipv4_table[] = { | |||
556 | .data = &sysctl_tcp_frto, | 556 | .data = &sysctl_tcp_frto, |
557 | .maxlen = sizeof(int), | 557 | .maxlen = sizeof(int), |
558 | .mode = 0644, | 558 | .mode = 0644, |
559 | .proc_handler = &proc_dointvec | 559 | .proc_handler = proc_dointvec |
560 | }, | 560 | }, |
561 | { | 561 | { |
562 | .ctl_name = NET_TCP_FRTO_RESPONSE, | 562 | .ctl_name = NET_TCP_FRTO_RESPONSE, |
@@ -564,7 +564,7 @@ static struct ctl_table ipv4_table[] = { | |||
564 | .data = &sysctl_tcp_frto_response, | 564 | .data = &sysctl_tcp_frto_response, |
565 | .maxlen = sizeof(int), | 565 | .maxlen = sizeof(int), |
566 | .mode = 0644, | 566 | .mode = 0644, |
567 | .proc_handler = &proc_dointvec | 567 | .proc_handler = proc_dointvec |
568 | }, | 568 | }, |
569 | { | 569 | { |
570 | .ctl_name = NET_TCP_LOW_LATENCY, | 570 | .ctl_name = NET_TCP_LOW_LATENCY, |
@@ -572,7 +572,7 @@ static struct ctl_table ipv4_table[] = { | |||
572 | .data = &sysctl_tcp_low_latency, | 572 | .data = &sysctl_tcp_low_latency, |
573 | .maxlen = sizeof(int), | 573 | .maxlen = sizeof(int), |
574 | .mode = 0644, | 574 | .mode = 0644, |
575 | .proc_handler = &proc_dointvec | 575 | .proc_handler = proc_dointvec |
576 | }, | 576 | }, |
577 | { | 577 | { |
578 | .ctl_name = NET_TCP_NO_METRICS_SAVE, | 578 | .ctl_name = NET_TCP_NO_METRICS_SAVE, |
@@ -580,7 +580,7 @@ static struct ctl_table ipv4_table[] = { | |||
580 | .data = &sysctl_tcp_nometrics_save, | 580 | .data = &sysctl_tcp_nometrics_save, |
581 | .maxlen = sizeof(int), | 581 | .maxlen = sizeof(int), |
582 | .mode = 0644, | 582 | .mode = 0644, |
583 | .proc_handler = &proc_dointvec, | 583 | .proc_handler = proc_dointvec, |
584 | }, | 584 | }, |
585 | { | 585 | { |
586 | .ctl_name = NET_TCP_MODERATE_RCVBUF, | 586 | .ctl_name = NET_TCP_MODERATE_RCVBUF, |
@@ -588,7 +588,7 @@ static struct ctl_table ipv4_table[] = { | |||
588 | .data = &sysctl_tcp_moderate_rcvbuf, | 588 | .data = &sysctl_tcp_moderate_rcvbuf, |
589 | .maxlen = sizeof(int), | 589 | .maxlen = sizeof(int), |
590 | .mode = 0644, | 590 | .mode = 0644, |
591 | .proc_handler = &proc_dointvec, | 591 | .proc_handler = proc_dointvec, |
592 | }, | 592 | }, |
593 | { | 593 | { |
594 | .ctl_name = NET_TCP_TSO_WIN_DIVISOR, | 594 | .ctl_name = NET_TCP_TSO_WIN_DIVISOR, |
@@ -596,15 +596,15 @@ static struct ctl_table ipv4_table[] = { | |||
596 | .data = &sysctl_tcp_tso_win_divisor, | 596 | .data = &sysctl_tcp_tso_win_divisor, |
597 | .maxlen = sizeof(int), | 597 | .maxlen = sizeof(int), |
598 | .mode = 0644, | 598 | .mode = 0644, |
599 | .proc_handler = &proc_dointvec, | 599 | .proc_handler = proc_dointvec, |
600 | }, | 600 | }, |
601 | { | 601 | { |
602 | .ctl_name = NET_TCP_CONG_CONTROL, | 602 | .ctl_name = NET_TCP_CONG_CONTROL, |
603 | .procname = "tcp_congestion_control", | 603 | .procname = "tcp_congestion_control", |
604 | .mode = 0644, | 604 | .mode = 0644, |
605 | .maxlen = TCP_CA_NAME_MAX, | 605 | .maxlen = TCP_CA_NAME_MAX, |
606 | .proc_handler = &proc_tcp_congestion_control, | 606 | .proc_handler = proc_tcp_congestion_control, |
607 | .strategy = &sysctl_tcp_congestion_control, | 607 | .strategy = sysctl_tcp_congestion_control, |
608 | }, | 608 | }, |
609 | { | 609 | { |
610 | .ctl_name = NET_TCP_ABC, | 610 | .ctl_name = NET_TCP_ABC, |
@@ -612,7 +612,7 @@ static struct ctl_table ipv4_table[] = { | |||
612 | .data = &sysctl_tcp_abc, | 612 | .data = &sysctl_tcp_abc, |
613 | .maxlen = sizeof(int), | 613 | .maxlen = sizeof(int), |
614 | .mode = 0644, | 614 | .mode = 0644, |
615 | .proc_handler = &proc_dointvec, | 615 | .proc_handler = proc_dointvec, |
616 | }, | 616 | }, |
617 | { | 617 | { |
618 | .ctl_name = NET_TCP_MTU_PROBING, | 618 | .ctl_name = NET_TCP_MTU_PROBING, |
@@ -620,7 +620,7 @@ static struct ctl_table ipv4_table[] = { | |||
620 | .data = &sysctl_tcp_mtu_probing, | 620 | .data = &sysctl_tcp_mtu_probing, |
621 | .maxlen = sizeof(int), | 621 | .maxlen = sizeof(int), |
622 | .mode = 0644, | 622 | .mode = 0644, |
623 | .proc_handler = &proc_dointvec, | 623 | .proc_handler = proc_dointvec, |
624 | }, | 624 | }, |
625 | { | 625 | { |
626 | .ctl_name = NET_TCP_BASE_MSS, | 626 | .ctl_name = NET_TCP_BASE_MSS, |
@@ -628,7 +628,7 @@ static struct ctl_table ipv4_table[] = { | |||
628 | .data = &sysctl_tcp_base_mss, | 628 | .data = &sysctl_tcp_base_mss, |
629 | .maxlen = sizeof(int), | 629 | .maxlen = sizeof(int), |
630 | .mode = 0644, | 630 | .mode = 0644, |
631 | .proc_handler = &proc_dointvec, | 631 | .proc_handler = proc_dointvec, |
632 | }, | 632 | }, |
633 | { | 633 | { |
634 | .ctl_name = NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, | 634 | .ctl_name = NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, |
@@ -636,7 +636,7 @@ static struct ctl_table ipv4_table[] = { | |||
636 | .data = &sysctl_tcp_workaround_signed_windows, | 636 | .data = &sysctl_tcp_workaround_signed_windows, |
637 | .maxlen = sizeof(int), | 637 | .maxlen = sizeof(int), |
638 | .mode = 0644, | 638 | .mode = 0644, |
639 | .proc_handler = &proc_dointvec | 639 | .proc_handler = proc_dointvec |
640 | }, | 640 | }, |
641 | #ifdef CONFIG_NET_DMA | 641 | #ifdef CONFIG_NET_DMA |
642 | { | 642 | { |
@@ -645,7 +645,7 @@ static struct ctl_table ipv4_table[] = { | |||
645 | .data = &sysctl_tcp_dma_copybreak, | 645 | .data = &sysctl_tcp_dma_copybreak, |
646 | .maxlen = sizeof(int), | 646 | .maxlen = sizeof(int), |
647 | .mode = 0644, | 647 | .mode = 0644, |
648 | .proc_handler = &proc_dointvec | 648 | .proc_handler = proc_dointvec |
649 | }, | 649 | }, |
650 | #endif | 650 | #endif |
651 | { | 651 | { |
@@ -654,7 +654,7 @@ static struct ctl_table ipv4_table[] = { | |||
654 | .data = &sysctl_tcp_slow_start_after_idle, | 654 | .data = &sysctl_tcp_slow_start_after_idle, |
655 | .maxlen = sizeof(int), | 655 | .maxlen = sizeof(int), |
656 | .mode = 0644, | 656 | .mode = 0644, |
657 | .proc_handler = &proc_dointvec | 657 | .proc_handler = proc_dointvec |
658 | }, | 658 | }, |
659 | #ifdef CONFIG_NETLABEL | 659 | #ifdef CONFIG_NETLABEL |
660 | { | 660 | { |
@@ -663,7 +663,7 @@ static struct ctl_table ipv4_table[] = { | |||
663 | .data = &cipso_v4_cache_enabled, | 663 | .data = &cipso_v4_cache_enabled, |
664 | .maxlen = sizeof(int), | 664 | .maxlen = sizeof(int), |
665 | .mode = 0644, | 665 | .mode = 0644, |
666 | .proc_handler = &proc_dointvec, | 666 | .proc_handler = proc_dointvec, |
667 | }, | 667 | }, |
668 | { | 668 | { |
669 | .ctl_name = NET_CIPSOV4_CACHE_BUCKET_SIZE, | 669 | .ctl_name = NET_CIPSOV4_CACHE_BUCKET_SIZE, |
@@ -671,7 +671,7 @@ static struct ctl_table ipv4_table[] = { | |||
671 | .data = &cipso_v4_cache_bucketsize, | 671 | .data = &cipso_v4_cache_bucketsize, |
672 | .maxlen = sizeof(int), | 672 | .maxlen = sizeof(int), |
673 | .mode = 0644, | 673 | .mode = 0644, |
674 | .proc_handler = &proc_dointvec, | 674 | .proc_handler = proc_dointvec, |
675 | }, | 675 | }, |
676 | { | 676 | { |
677 | .ctl_name = NET_CIPSOV4_RBM_OPTFMT, | 677 | .ctl_name = NET_CIPSOV4_RBM_OPTFMT, |
@@ -679,7 +679,7 @@ static struct ctl_table ipv4_table[] = { | |||
679 | .data = &cipso_v4_rbm_optfmt, | 679 | .data = &cipso_v4_rbm_optfmt, |
680 | .maxlen = sizeof(int), | 680 | .maxlen = sizeof(int), |
681 | .mode = 0644, | 681 | .mode = 0644, |
682 | .proc_handler = &proc_dointvec, | 682 | .proc_handler = proc_dointvec, |
683 | }, | 683 | }, |
684 | { | 684 | { |
685 | .ctl_name = NET_CIPSOV4_RBM_STRICTVALID, | 685 | .ctl_name = NET_CIPSOV4_RBM_STRICTVALID, |
@@ -687,22 +687,22 @@ static struct ctl_table ipv4_table[] = { | |||
687 | .data = &cipso_v4_rbm_strictvalid, | 687 | .data = &cipso_v4_rbm_strictvalid, |
688 | .maxlen = sizeof(int), | 688 | .maxlen = sizeof(int), |
689 | .mode = 0644, | 689 | .mode = 0644, |
690 | .proc_handler = &proc_dointvec, | 690 | .proc_handler = proc_dointvec, |
691 | }, | 691 | }, |
692 | #endif /* CONFIG_NETLABEL */ | 692 | #endif /* CONFIG_NETLABEL */ |
693 | { | 693 | { |
694 | .procname = "tcp_available_congestion_control", | 694 | .procname = "tcp_available_congestion_control", |
695 | .maxlen = TCP_CA_BUF_MAX, | 695 | .maxlen = TCP_CA_BUF_MAX, |
696 | .mode = 0444, | 696 | .mode = 0444, |
697 | .proc_handler = &proc_tcp_available_congestion_control, | 697 | .proc_handler = proc_tcp_available_congestion_control, |
698 | }, | 698 | }, |
699 | { | 699 | { |
700 | .ctl_name = NET_TCP_ALLOWED_CONG_CONTROL, | 700 | .ctl_name = NET_TCP_ALLOWED_CONG_CONTROL, |
701 | .procname = "tcp_allowed_congestion_control", | 701 | .procname = "tcp_allowed_congestion_control", |
702 | .maxlen = TCP_CA_BUF_MAX, | 702 | .maxlen = TCP_CA_BUF_MAX, |
703 | .mode = 0644, | 703 | .mode = 0644, |
704 | .proc_handler = &proc_allowed_congestion_control, | 704 | .proc_handler = proc_allowed_congestion_control, |
705 | .strategy = &strategy_allowed_congestion_control, | 705 | .strategy = strategy_allowed_congestion_control, |
706 | }, | 706 | }, |
707 | { | 707 | { |
708 | .ctl_name = NET_TCP_MAX_SSTHRESH, | 708 | .ctl_name = NET_TCP_MAX_SSTHRESH, |
@@ -710,7 +710,7 @@ static struct ctl_table ipv4_table[] = { | |||
710 | .data = &sysctl_tcp_max_ssthresh, | 710 | .data = &sysctl_tcp_max_ssthresh, |
711 | .maxlen = sizeof(int), | 711 | .maxlen = sizeof(int), |
712 | .mode = 0644, | 712 | .mode = 0644, |
713 | .proc_handler = &proc_dointvec, | 713 | .proc_handler = proc_dointvec, |
714 | }, | 714 | }, |
715 | { | 715 | { |
716 | .ctl_name = CTL_UNNUMBERED, | 716 | .ctl_name = CTL_UNNUMBERED, |
@@ -718,8 +718,8 @@ static struct ctl_table ipv4_table[] = { | |||
718 | .data = &sysctl_udp_mem, | 718 | .data = &sysctl_udp_mem, |
719 | .maxlen = sizeof(sysctl_udp_mem), | 719 | .maxlen = sizeof(sysctl_udp_mem), |
720 | .mode = 0644, | 720 | .mode = 0644, |
721 | .proc_handler = &proc_dointvec_minmax, | 721 | .proc_handler = proc_dointvec_minmax, |
722 | .strategy = &sysctl_intvec, | 722 | .strategy = sysctl_intvec, |
723 | .extra1 = &zero | 723 | .extra1 = &zero |
724 | }, | 724 | }, |
725 | { | 725 | { |
@@ -728,8 +728,8 @@ static struct ctl_table ipv4_table[] = { | |||
728 | .data = &sysctl_udp_rmem_min, | 728 | .data = &sysctl_udp_rmem_min, |
729 | .maxlen = sizeof(sysctl_udp_rmem_min), | 729 | .maxlen = sizeof(sysctl_udp_rmem_min), |
730 | .mode = 0644, | 730 | .mode = 0644, |
731 | .proc_handler = &proc_dointvec_minmax, | 731 | .proc_handler = proc_dointvec_minmax, |
732 | .strategy = &sysctl_intvec, | 732 | .strategy = sysctl_intvec, |
733 | .extra1 = &zero | 733 | .extra1 = &zero |
734 | }, | 734 | }, |
735 | { | 735 | { |
@@ -738,8 +738,8 @@ static struct ctl_table ipv4_table[] = { | |||
738 | .data = &sysctl_udp_wmem_min, | 738 | .data = &sysctl_udp_wmem_min, |
739 | .maxlen = sizeof(sysctl_udp_wmem_min), | 739 | .maxlen = sizeof(sysctl_udp_wmem_min), |
740 | .mode = 0644, | 740 | .mode = 0644, |
741 | .proc_handler = &proc_dointvec_minmax, | 741 | .proc_handler = proc_dointvec_minmax, |
742 | .strategy = &sysctl_intvec, | 742 | .strategy = sysctl_intvec, |
743 | .extra1 = &zero | 743 | .extra1 = &zero |
744 | }, | 744 | }, |
745 | { .ctl_name = 0 } | 745 | { .ctl_name = 0 } |
@@ -752,7 +752,7 @@ static struct ctl_table ipv4_net_table[] = { | |||
752 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, | 752 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, |
753 | .maxlen = sizeof(int), | 753 | .maxlen = sizeof(int), |
754 | .mode = 0644, | 754 | .mode = 0644, |
755 | .proc_handler = &proc_dointvec | 755 | .proc_handler = proc_dointvec |
756 | }, | 756 | }, |
757 | { | 757 | { |
758 | .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, | 758 | .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, |
@@ -760,7 +760,7 @@ static struct ctl_table ipv4_net_table[] = { | |||
760 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, | 760 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, |
761 | .maxlen = sizeof(int), | 761 | .maxlen = sizeof(int), |
762 | .mode = 0644, | 762 | .mode = 0644, |
763 | .proc_handler = &proc_dointvec | 763 | .proc_handler = proc_dointvec |
764 | }, | 764 | }, |
765 | { | 765 | { |
766 | .ctl_name = NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, | 766 | .ctl_name = NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, |
@@ -768,7 +768,7 @@ static struct ctl_table ipv4_net_table[] = { | |||
768 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, | 768 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, |
769 | .maxlen = sizeof(int), | 769 | .maxlen = sizeof(int), |
770 | .mode = 0644, | 770 | .mode = 0644, |
771 | .proc_handler = &proc_dointvec | 771 | .proc_handler = proc_dointvec |
772 | }, | 772 | }, |
773 | { | 773 | { |
774 | .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, | 774 | .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, |
@@ -776,7 +776,7 @@ static struct ctl_table ipv4_net_table[] = { | |||
776 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, | 776 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, |
777 | .maxlen = sizeof(int), | 777 | .maxlen = sizeof(int), |
778 | .mode = 0644, | 778 | .mode = 0644, |
779 | .proc_handler = &proc_dointvec | 779 | .proc_handler = proc_dointvec |
780 | }, | 780 | }, |
781 | { | 781 | { |
782 | .ctl_name = NET_IPV4_ICMP_RATELIMIT, | 782 | .ctl_name = NET_IPV4_ICMP_RATELIMIT, |
@@ -784,8 +784,8 @@ static struct ctl_table ipv4_net_table[] = { | |||
784 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, | 784 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, |
785 | .maxlen = sizeof(int), | 785 | .maxlen = sizeof(int), |
786 | .mode = 0644, | 786 | .mode = 0644, |
787 | .proc_handler = &proc_dointvec_ms_jiffies, | 787 | .proc_handler = proc_dointvec_ms_jiffies, |
788 | .strategy = &sysctl_ms_jiffies | 788 | .strategy = sysctl_ms_jiffies |
789 | }, | 789 | }, |
790 | { | 790 | { |
791 | .ctl_name = NET_IPV4_ICMP_RATEMASK, | 791 | .ctl_name = NET_IPV4_ICMP_RATEMASK, |
@@ -793,7 +793,15 @@ static struct ctl_table ipv4_net_table[] = { | |||
793 | .data = &init_net.ipv4.sysctl_icmp_ratemask, | 793 | .data = &init_net.ipv4.sysctl_icmp_ratemask, |
794 | .maxlen = sizeof(int), | 794 | .maxlen = sizeof(int), |
795 | .mode = 0644, | 795 | .mode = 0644, |
796 | .proc_handler = &proc_dointvec | 796 | .proc_handler = proc_dointvec |
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 | ||
797 | }, | 805 | }, |
798 | { } | 806 | { } |
799 | }; | 807 | }; |
@@ -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.c b/net/ipv4/tcp.c index c5aca0bb116a..f60a5917e54d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1680,7 +1680,7 @@ void tcp_set_state(struct sock *sk, int state) | |||
1680 | inet_put_port(sk); | 1680 | inet_put_port(sk); |
1681 | /* fall through */ | 1681 | /* fall through */ |
1682 | default: | 1682 | default: |
1683 | if (oldstate==TCP_ESTABLISHED) | 1683 | if (oldstate == TCP_ESTABLISHED) |
1684 | TCP_DEC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); | 1684 | TCP_DEC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); |
1685 | } | 1685 | } |
1686 | 1686 | ||
@@ -1690,7 +1690,7 @@ void tcp_set_state(struct sock *sk, int state) | |||
1690 | sk->sk_state = state; | 1690 | sk->sk_state = state; |
1691 | 1691 | ||
1692 | #ifdef STATE_TRACE | 1692 | #ifdef STATE_TRACE |
1693 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); | 1693 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n", sk, statename[oldstate], statename[state]); |
1694 | #endif | 1694 | #endif |
1695 | } | 1695 | } |
1696 | EXPORT_SYMBOL_GPL(tcp_set_state); | 1696 | EXPORT_SYMBOL_GPL(tcp_set_state); |
@@ -2650,7 +2650,7 @@ EXPORT_SYMBOL(tcp_md5_hash_key); | |||
2650 | 2650 | ||
2651 | void tcp_done(struct sock *sk) | 2651 | void tcp_done(struct sock *sk) |
2652 | { | 2652 | { |
2653 | if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | 2653 | if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) |
2654 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_ATTEMPTFAILS); | 2654 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_ATTEMPTFAILS); |
2655 | 2655 | ||
2656 | tcp_set_state(sk, TCP_CLOSE); | 2656 | tcp_set_state(sk, TCP_CLOSE); |
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 4a1221e5e8ee..ee467ec40c4f 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c | |||
@@ -1,13 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | * TCP CUBIC: Binary Increase Congestion control for TCP v2.2 | 2 | * TCP CUBIC: Binary Increase Congestion control for TCP v2.3 |
3 | * Home page: | 3 | * Home page: |
4 | * http://netsrv.csc.ncsu.edu/twiki/bin/view/Main/BIC | 4 | * http://netsrv.csc.ncsu.edu/twiki/bin/view/Main/BIC |
5 | * This is from the implementation of CUBIC TCP in | 5 | * This is from the implementation of CUBIC TCP in |
6 | * Injong Rhee, Lisong Xu. | 6 | * Sangtae Ha, Injong Rhee and Lisong Xu, |
7 | * "CUBIC: A New TCP-Friendly High-Speed TCP Variant | 7 | * "CUBIC: A New TCP-Friendly High-Speed TCP Variant" |
8 | * in PFLDnet 2005 | 8 | * in ACM SIGOPS Operating System Review, July 2008. |
9 | * Available from: | 9 | * Available from: |
10 | * http://netsrv.csc.ncsu.edu/export/cubic-paper.pdf | 10 | * http://netsrv.csc.ncsu.edu/export/cubic_a_new_tcp_2008.pdf |
11 | * | ||
12 | * CUBIC integrates a new slow start algorithm, called HyStart. | ||
13 | * The details of HyStart are presented in | ||
14 | * Sangtae Ha and Injong Rhee, | ||
15 | * "Taming the Elephants: New TCP Slow Start", NCSU TechReport 2008. | ||
16 | * Available from: | ||
17 | * http://netsrv.csc.ncsu.edu/export/hystart_techreport_2008.pdf | ||
18 | * | ||
19 | * All testing results are available from: | ||
20 | * http://netsrv.csc.ncsu.edu/wiki/index.php/TCP_Testing | ||
11 | * | 21 | * |
12 | * Unless CUBIC is enabled and congestion window is large | 22 | * Unless CUBIC is enabled and congestion window is large |
13 | * this behaves the same as the original Reno. | 23 | * this behaves the same as the original Reno. |
@@ -23,12 +33,26 @@ | |||
23 | */ | 33 | */ |
24 | #define BICTCP_HZ 10 /* BIC HZ 2^10 = 1024 */ | 34 | #define BICTCP_HZ 10 /* BIC HZ 2^10 = 1024 */ |
25 | 35 | ||
36 | /* Two methods of hybrid slow start */ | ||
37 | #define HYSTART_ACK_TRAIN 0x1 | ||
38 | #define HYSTART_DELAY 0x2 | ||
39 | |||
40 | /* Number of delay samples for detecting the increase of delay */ | ||
41 | #define HYSTART_MIN_SAMPLES 8 | ||
42 | #define HYSTART_DELAY_MIN (2U<<3) | ||
43 | #define HYSTART_DELAY_MAX (16U<<3) | ||
44 | #define HYSTART_DELAY_THRESH(x) clamp(x, HYSTART_DELAY_MIN, HYSTART_DELAY_MAX) | ||
45 | |||
26 | static int fast_convergence __read_mostly = 1; | 46 | static int fast_convergence __read_mostly = 1; |
27 | static int beta __read_mostly = 717; /* = 717/1024 (BICTCP_BETA_SCALE) */ | 47 | static int beta __read_mostly = 717; /* = 717/1024 (BICTCP_BETA_SCALE) */ |
28 | static int initial_ssthresh __read_mostly; | 48 | static int initial_ssthresh __read_mostly; |
29 | static int bic_scale __read_mostly = 41; | 49 | static int bic_scale __read_mostly = 41; |
30 | static int tcp_friendliness __read_mostly = 1; | 50 | static int tcp_friendliness __read_mostly = 1; |
31 | 51 | ||
52 | static int hystart __read_mostly = 1; | ||
53 | static int hystart_detect __read_mostly = HYSTART_ACK_TRAIN | HYSTART_DELAY; | ||
54 | static int hystart_low_window __read_mostly = 16; | ||
55 | |||
32 | static u32 cube_rtt_scale __read_mostly; | 56 | static u32 cube_rtt_scale __read_mostly; |
33 | static u32 beta_scale __read_mostly; | 57 | static u32 beta_scale __read_mostly; |
34 | static u64 cube_factor __read_mostly; | 58 | static u64 cube_factor __read_mostly; |
@@ -44,6 +68,13 @@ module_param(bic_scale, int, 0444); | |||
44 | MODULE_PARM_DESC(bic_scale, "scale (scaled by 1024) value for bic function (bic_scale/1024)"); | 68 | MODULE_PARM_DESC(bic_scale, "scale (scaled by 1024) value for bic function (bic_scale/1024)"); |
45 | module_param(tcp_friendliness, int, 0644); | 69 | module_param(tcp_friendliness, int, 0644); |
46 | MODULE_PARM_DESC(tcp_friendliness, "turn on/off tcp friendliness"); | 70 | MODULE_PARM_DESC(tcp_friendliness, "turn on/off tcp friendliness"); |
71 | module_param(hystart, int, 0644); | ||
72 | MODULE_PARM_DESC(hystart, "turn on/off hybrid slow start algorithm"); | ||
73 | module_param(hystart_detect, int, 0644); | ||
74 | MODULE_PARM_DESC(hystart_detect, "hyrbrid slow start detection mechanisms" | ||
75 | " 1: packet-train 2: delay 3: both packet-train and delay"); | ||
76 | module_param(hystart_low_window, int, 0644); | ||
77 | MODULE_PARM_DESC(hystart_low_window, "lower bound cwnd for hybrid slow start"); | ||
47 | 78 | ||
48 | /* BIC TCP Parameters */ | 79 | /* BIC TCP Parameters */ |
49 | struct bictcp { | 80 | struct bictcp { |
@@ -59,7 +90,13 @@ struct bictcp { | |||
59 | u32 ack_cnt; /* number of acks */ | 90 | u32 ack_cnt; /* number of acks */ |
60 | u32 tcp_cwnd; /* estimated tcp cwnd */ | 91 | u32 tcp_cwnd; /* estimated tcp cwnd */ |
61 | #define ACK_RATIO_SHIFT 4 | 92 | #define ACK_RATIO_SHIFT 4 |
62 | u32 delayed_ack; /* estimate the ratio of Packets/ACKs << 4 */ | 93 | u16 delayed_ack; /* estimate the ratio of Packets/ACKs << 4 */ |
94 | u8 sample_cnt; /* number of samples to decide curr_rtt */ | ||
95 | u8 found; /* the exit point is found? */ | ||
96 | u32 round_start; /* beginning of each round */ | ||
97 | u32 end_seq; /* end_seq of the round */ | ||
98 | u32 last_jiffies; /* last time when the ACK spacing is close */ | ||
99 | u32 curr_rtt; /* the minimum rtt of current round */ | ||
63 | }; | 100 | }; |
64 | 101 | ||
65 | static inline void bictcp_reset(struct bictcp *ca) | 102 | static inline void bictcp_reset(struct bictcp *ca) |
@@ -76,12 +113,28 @@ static inline void bictcp_reset(struct bictcp *ca) | |||
76 | ca->delayed_ack = 2 << ACK_RATIO_SHIFT; | 113 | ca->delayed_ack = 2 << ACK_RATIO_SHIFT; |
77 | ca->ack_cnt = 0; | 114 | ca->ack_cnt = 0; |
78 | ca->tcp_cwnd = 0; | 115 | ca->tcp_cwnd = 0; |
116 | ca->found = 0; | ||
117 | } | ||
118 | |||
119 | static inline void bictcp_hystart_reset(struct sock *sk) | ||
120 | { | ||
121 | struct tcp_sock *tp = tcp_sk(sk); | ||
122 | struct bictcp *ca = inet_csk_ca(sk); | ||
123 | |||
124 | ca->round_start = ca->last_jiffies = jiffies; | ||
125 | ca->end_seq = tp->snd_nxt; | ||
126 | ca->curr_rtt = 0; | ||
127 | ca->sample_cnt = 0; | ||
79 | } | 128 | } |
80 | 129 | ||
81 | static void bictcp_init(struct sock *sk) | 130 | static void bictcp_init(struct sock *sk) |
82 | { | 131 | { |
83 | bictcp_reset(inet_csk_ca(sk)); | 132 | bictcp_reset(inet_csk_ca(sk)); |
84 | if (initial_ssthresh) | 133 | |
134 | if (hystart) | ||
135 | bictcp_hystart_reset(sk); | ||
136 | |||
137 | if (!hystart && initial_ssthresh) | ||
85 | tcp_sk(sk)->snd_ssthresh = initial_ssthresh; | 138 | tcp_sk(sk)->snd_ssthresh = initial_ssthresh; |
86 | } | 139 | } |
87 | 140 | ||
@@ -235,9 +288,11 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
235 | if (!tcp_is_cwnd_limited(sk, in_flight)) | 288 | if (!tcp_is_cwnd_limited(sk, in_flight)) |
236 | return; | 289 | return; |
237 | 290 | ||
238 | if (tp->snd_cwnd <= tp->snd_ssthresh) | 291 | if (tp->snd_cwnd <= tp->snd_ssthresh) { |
292 | if (hystart && after(ack, ca->end_seq)) | ||
293 | bictcp_hystart_reset(sk); | ||
239 | tcp_slow_start(tp); | 294 | tcp_slow_start(tp); |
240 | else { | 295 | } else { |
241 | bictcp_update(ca, tp->snd_cwnd); | 296 | bictcp_update(ca, tp->snd_cwnd); |
242 | 297 | ||
243 | /* In dangerous area, increase slowly. | 298 | /* In dangerous area, increase slowly. |
@@ -281,8 +336,45 @@ static u32 bictcp_undo_cwnd(struct sock *sk) | |||
281 | 336 | ||
282 | static void bictcp_state(struct sock *sk, u8 new_state) | 337 | static void bictcp_state(struct sock *sk, u8 new_state) |
283 | { | 338 | { |
284 | if (new_state == TCP_CA_Loss) | 339 | if (new_state == TCP_CA_Loss) { |
285 | bictcp_reset(inet_csk_ca(sk)); | 340 | bictcp_reset(inet_csk_ca(sk)); |
341 | bictcp_hystart_reset(sk); | ||
342 | } | ||
343 | } | ||
344 | |||
345 | static void hystart_update(struct sock *sk, u32 delay) | ||
346 | { | ||
347 | struct tcp_sock *tp = tcp_sk(sk); | ||
348 | struct bictcp *ca = inet_csk_ca(sk); | ||
349 | |||
350 | if (!(ca->found & hystart_detect)) { | ||
351 | u32 curr_jiffies = jiffies; | ||
352 | |||
353 | /* first detection parameter - ack-train detection */ | ||
354 | if (curr_jiffies - ca->last_jiffies <= msecs_to_jiffies(2)) { | ||
355 | ca->last_jiffies = curr_jiffies; | ||
356 | if (curr_jiffies - ca->round_start >= ca->delay_min>>4) | ||
357 | ca->found |= HYSTART_ACK_TRAIN; | ||
358 | } | ||
359 | |||
360 | /* obtain the minimum delay of more than sampling packets */ | ||
361 | if (ca->sample_cnt < HYSTART_MIN_SAMPLES) { | ||
362 | if (ca->curr_rtt == 0 || ca->curr_rtt > delay) | ||
363 | ca->curr_rtt = delay; | ||
364 | |||
365 | ca->sample_cnt++; | ||
366 | } else { | ||
367 | if (ca->curr_rtt > ca->delay_min + | ||
368 | HYSTART_DELAY_THRESH(ca->delay_min>>4)) | ||
369 | ca->found |= HYSTART_DELAY; | ||
370 | } | ||
371 | /* | ||
372 | * Either one of two conditions are met, | ||
373 | * we exit from slow start immediately. | ||
374 | */ | ||
375 | if (ca->found & hystart_detect) | ||
376 | tp->snd_ssthresh = tp->snd_cwnd; | ||
377 | } | ||
286 | } | 378 | } |
287 | 379 | ||
288 | /* Track delayed acknowledgment ratio using sliding window | 380 | /* Track delayed acknowledgment ratio using sliding window |
@@ -291,6 +383,7 @@ static void bictcp_state(struct sock *sk, u8 new_state) | |||
291 | static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) | 383 | static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) |
292 | { | 384 | { |
293 | const struct inet_connection_sock *icsk = inet_csk(sk); | 385 | const struct inet_connection_sock *icsk = inet_csk(sk); |
386 | const struct tcp_sock *tp = tcp_sk(sk); | ||
294 | struct bictcp *ca = inet_csk_ca(sk); | 387 | struct bictcp *ca = inet_csk_ca(sk); |
295 | u32 delay; | 388 | u32 delay; |
296 | 389 | ||
@@ -314,6 +407,11 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) | |||
314 | /* first time call or link delay decreases */ | 407 | /* first time call or link delay decreases */ |
315 | if (ca->delay_min == 0 || ca->delay_min > delay) | 408 | if (ca->delay_min == 0 || ca->delay_min > delay) |
316 | ca->delay_min = delay; | 409 | ca->delay_min = delay; |
410 | |||
411 | /* hystart triggers when cwnd is larger than some threshold */ | ||
412 | if (hystart && tp->snd_cwnd <= tp->snd_ssthresh && | ||
413 | tp->snd_cwnd >= hystart_low_window) | ||
414 | hystart_update(sk, delay); | ||
317 | } | 415 | } |
318 | 416 | ||
319 | static struct tcp_congestion_ops cubictcp = { | 417 | static struct tcp_congestion_ops cubictcp = { |
@@ -372,4 +470,4 @@ module_exit(cubictcp_unregister); | |||
372 | MODULE_AUTHOR("Sangtae Ha, Stephen Hemminger"); | 470 | MODULE_AUTHOR("Sangtae Ha, Stephen Hemminger"); |
373 | MODULE_LICENSE("GPL"); | 471 | MODULE_LICENSE("GPL"); |
374 | MODULE_DESCRIPTION("CUBIC TCP"); | 472 | MODULE_DESCRIPTION("CUBIC TCP"); |
375 | MODULE_VERSION("2.2"); | 473 | MODULE_VERSION("2.3"); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d77c0d29e239..097294b7da3e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2336,9 +2336,9 @@ static void DBGUNDO(struct sock *sk, const char *msg) | |||
2336 | struct inet_sock *inet = inet_sk(sk); | 2336 | struct inet_sock *inet = inet_sk(sk); |
2337 | 2337 | ||
2338 | if (sk->sk_family == AF_INET) { | 2338 | if (sk->sk_family == AF_INET) { |
2339 | printk(KERN_DEBUG "Undo %s " NIPQUAD_FMT "/%u c%u l%u ss%u/%u p%u\n", | 2339 | printk(KERN_DEBUG "Undo %s %pI4/%u c%u l%u ss%u/%u p%u\n", |
2340 | msg, | 2340 | msg, |
2341 | NIPQUAD(inet->daddr), ntohs(inet->dport), | 2341 | &inet->daddr, ntohs(inet->dport), |
2342 | tp->snd_cwnd, tcp_left_out(tp), | 2342 | tp->snd_cwnd, tcp_left_out(tp), |
2343 | tp->snd_ssthresh, tp->prior_ssthresh, | 2343 | tp->snd_ssthresh, tp->prior_ssthresh, |
2344 | tp->packets_out); | 2344 | tp->packets_out); |
@@ -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_ipv4.c b/net/ipv4/tcp_ipv4.c index 5c8fa7f1e327..d49233f409b5 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1139,10 +1139,9 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) | |||
1139 | 1139 | ||
1140 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { | 1140 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { |
1141 | if (net_ratelimit()) { | 1141 | if (net_ratelimit()) { |
1142 | printk(KERN_INFO "MD5 Hash failed for " | 1142 | printk(KERN_INFO "MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n", |
1143 | "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)%s\n", | 1143 | &iph->saddr, ntohs(th->source), |
1144 | NIPQUAD(iph->saddr), ntohs(th->source), | 1144 | &iph->daddr, ntohs(th->dest), |
1145 | NIPQUAD(iph->daddr), ntohs(th->dest), | ||
1146 | genhash ? " tcp_v4_calc_md5_hash failed" : ""); | 1145 | genhash ? " tcp_v4_calc_md5_hash failed" : ""); |
1147 | } | 1146 | } |
1148 | return 1; | 1147 | return 1; |
@@ -1297,10 +1296,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1297 | * to destinations, already remembered | 1296 | * to destinations, already remembered |
1298 | * to the moment of synflood. | 1297 | * to the moment of synflood. |
1299 | */ | 1298 | */ |
1300 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open " | 1299 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open request from %pI4/%u\n", |
1301 | "request from " NIPQUAD_FMT "/%u\n", | 1300 | &saddr, ntohs(tcp_hdr(skb)->source)); |
1302 | NIPQUAD(saddr), | ||
1303 | ntohs(tcp_hdr(skb)->source)); | ||
1304 | goto drop_and_release; | 1301 | goto drop_and_release; |
1305 | } | 1302 | } |
1306 | 1303 | ||
@@ -1877,7 +1874,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur) | |||
1877 | struct inet_connection_sock *icsk; | 1874 | struct inet_connection_sock *icsk; |
1878 | struct hlist_node *node; | 1875 | struct hlist_node *node; |
1879 | struct sock *sk = cur; | 1876 | struct sock *sk = cur; |
1880 | struct tcp_iter_state* st = seq->private; | 1877 | struct tcp_iter_state *st = seq->private; |
1881 | struct net *net = seq_file_net(seq); | 1878 | struct net *net = seq_file_net(seq); |
1882 | 1879 | ||
1883 | if (!sk) { | 1880 | if (!sk) { |
@@ -1963,7 +1960,7 @@ static inline int empty_bucket(struct tcp_iter_state *st) | |||
1963 | 1960 | ||
1964 | static void *established_get_first(struct seq_file *seq) | 1961 | static void *established_get_first(struct seq_file *seq) |
1965 | { | 1962 | { |
1966 | struct tcp_iter_state* st = seq->private; | 1963 | struct tcp_iter_state *st = seq->private; |
1967 | struct net *net = seq_file_net(seq); | 1964 | struct net *net = seq_file_net(seq); |
1968 | void *rc = NULL; | 1965 | void *rc = NULL; |
1969 | 1966 | ||
@@ -2008,7 +2005,7 @@ static void *established_get_next(struct seq_file *seq, void *cur) | |||
2008 | struct sock *sk = cur; | 2005 | struct sock *sk = cur; |
2009 | struct inet_timewait_sock *tw; | 2006 | struct inet_timewait_sock *tw; |
2010 | struct hlist_node *node; | 2007 | struct hlist_node *node; |
2011 | struct tcp_iter_state* st = seq->private; | 2008 | struct tcp_iter_state *st = seq->private; |
2012 | struct net *net = seq_file_net(seq); | 2009 | struct net *net = seq_file_net(seq); |
2013 | 2010 | ||
2014 | ++st->num; | 2011 | ++st->num; |
@@ -2067,7 +2064,7 @@ static void *established_get_idx(struct seq_file *seq, loff_t pos) | |||
2067 | static void *tcp_get_idx(struct seq_file *seq, loff_t pos) | 2064 | static void *tcp_get_idx(struct seq_file *seq, loff_t pos) |
2068 | { | 2065 | { |
2069 | void *rc; | 2066 | void *rc; |
2070 | struct tcp_iter_state* st = seq->private; | 2067 | struct tcp_iter_state *st = seq->private; |
2071 | 2068 | ||
2072 | inet_listen_lock(&tcp_hashinfo); | 2069 | inet_listen_lock(&tcp_hashinfo); |
2073 | st->state = TCP_SEQ_STATE_LISTENING; | 2070 | st->state = TCP_SEQ_STATE_LISTENING; |
@@ -2084,7 +2081,7 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos) | |||
2084 | 2081 | ||
2085 | static void *tcp_seq_start(struct seq_file *seq, loff_t *pos) | 2082 | static void *tcp_seq_start(struct seq_file *seq, loff_t *pos) |
2086 | { | 2083 | { |
2087 | struct tcp_iter_state* st = seq->private; | 2084 | struct tcp_iter_state *st = seq->private; |
2088 | st->state = TCP_SEQ_STATE_LISTENING; | 2085 | st->state = TCP_SEQ_STATE_LISTENING; |
2089 | st->num = 0; | 2086 | st->num = 0; |
2090 | return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 2087 | return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
@@ -2093,7 +2090,7 @@ static void *tcp_seq_start(struct seq_file *seq, loff_t *pos) | |||
2093 | static void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2090 | static void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2094 | { | 2091 | { |
2095 | void *rc = NULL; | 2092 | void *rc = NULL; |
2096 | struct tcp_iter_state* st; | 2093 | struct tcp_iter_state *st; |
2097 | 2094 | ||
2098 | if (v == SEQ_START_TOKEN) { | 2095 | if (v == SEQ_START_TOKEN) { |
2099 | rc = tcp_get_idx(seq, 0); | 2096 | rc = tcp_get_idx(seq, 0); |
@@ -2123,7 +2120,7 @@ out: | |||
2123 | 2120 | ||
2124 | static void tcp_seq_stop(struct seq_file *seq, void *v) | 2121 | static void tcp_seq_stop(struct seq_file *seq, void *v) |
2125 | { | 2122 | { |
2126 | struct tcp_iter_state* st = seq->private; | 2123 | struct tcp_iter_state *st = seq->private; |
2127 | 2124 | ||
2128 | switch (st->state) { | 2125 | switch (st->state) { |
2129 | case TCP_SEQ_STATE_OPENREQ: | 2126 | case TCP_SEQ_STATE_OPENREQ: |
@@ -2284,7 +2281,7 @@ static void get_timewait4_sock(struct inet_timewait_sock *tw, | |||
2284 | 2281 | ||
2285 | static int tcp4_seq_show(struct seq_file *seq, void *v) | 2282 | static int tcp4_seq_show(struct seq_file *seq, void *v) |
2286 | { | 2283 | { |
2287 | struct tcp_iter_state* st; | 2284 | struct tcp_iter_state *st; |
2288 | int len; | 2285 | int len; |
2289 | 2286 | ||
2290 | if (v == SEQ_START_TOKEN) { | 2287 | if (v == SEQ_START_TOKEN) { |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 779f2e9d0689..f67effbb102b 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -491,7 +491,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
491 | * as a request_sock. | 491 | * as a request_sock. |
492 | */ | 492 | */ |
493 | 493 | ||
494 | struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | 494 | struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, |
495 | struct request_sock *req, | 495 | struct request_sock *req, |
496 | struct request_sock **prev) | 496 | struct request_sock **prev) |
497 | { | 497 | { |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index ba85d8831893..a524627923ae 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -42,7 +42,7 @@ | |||
42 | /* People can turn this off for buggy TCP's found in printers etc. */ | 42 | /* People can turn this off for buggy TCP's found in printers etc. */ |
43 | int sysctl_tcp_retrans_collapse __read_mostly = 1; | 43 | int sysctl_tcp_retrans_collapse __read_mostly = 1; |
44 | 44 | ||
45 | /* People can turn this on to work with those rare, broken TCPs that | 45 | /* People can turn this on to work with those rare, broken TCPs that |
46 | * interpret the window field as a signed quantity. | 46 | * interpret the window field as a signed quantity. |
47 | */ | 47 | */ |
48 | int sysctl_tcp_workaround_signed_windows __read_mostly = 0; | 48 | int sysctl_tcp_workaround_signed_windows __read_mostly = 0; |
@@ -484,7 +484,7 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, | |||
484 | } | 484 | } |
485 | if (likely(sysctl_tcp_window_scaling)) { | 485 | if (likely(sysctl_tcp_window_scaling)) { |
486 | opts->ws = tp->rx_opt.rcv_wscale; | 486 | opts->ws = tp->rx_opt.rcv_wscale; |
487 | if(likely(opts->ws)) | 487 | if (likely(opts->ws)) |
488 | size += TCPOLEN_WSCALE_ALIGNED; | 488 | size += TCPOLEN_WSCALE_ALIGNED; |
489 | } | 489 | } |
490 | if (likely(sysctl_tcp_sack)) { | 490 | if (likely(sysctl_tcp_sack)) { |
@@ -526,7 +526,7 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
526 | 526 | ||
527 | if (likely(ireq->wscale_ok)) { | 527 | if (likely(ireq->wscale_ok)) { |
528 | opts->ws = ireq->rcv_wscale; | 528 | opts->ws = ireq->rcv_wscale; |
529 | if(likely(opts->ws)) | 529 | if (likely(opts->ws)) |
530 | size += TCPOLEN_WSCALE_ALIGNED; | 530 | size += TCPOLEN_WSCALE_ALIGNED; |
531 | } | 531 | } |
532 | if (likely(doing_ts)) { | 532 | if (likely(doing_ts)) { |
@@ -1172,7 +1172,7 @@ static int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, | |||
1172 | 1172 | ||
1173 | static inline int tcp_minshall_check(const struct tcp_sock *tp) | 1173 | static inline int tcp_minshall_check(const struct tcp_sock *tp) |
1174 | { | 1174 | { |
1175 | return after(tp->snd_sml,tp->snd_una) && | 1175 | return after(tp->snd_sml, tp->snd_una) && |
1176 | !after(tp->snd_sml, tp->snd_nxt); | 1176 | !after(tp->snd_sml, tp->snd_nxt); |
1177 | } | 1177 | } |
1178 | 1178 | ||
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index 7ddc30f0744f..25524d4e372a 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -153,12 +153,11 @@ static int tcpprobe_sprint(char *tbuf, int n) | |||
153 | = ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start)); | 153 | = ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start)); |
154 | 154 | ||
155 | return snprintf(tbuf, n, | 155 | return snprintf(tbuf, n, |
156 | "%lu.%09lu " NIPQUAD_FMT ":%u " NIPQUAD_FMT ":%u" | 156 | "%lu.%09lu %pI4:%u %pI4:%u %d %#x %#x %u %u %u %u\n", |
157 | " %d %#x %#x %u %u %u %u\n", | ||
158 | (unsigned long) tv.tv_sec, | 157 | (unsigned long) tv.tv_sec, |
159 | (unsigned long) tv.tv_nsec, | 158 | (unsigned long) tv.tv_nsec, |
160 | NIPQUAD(p->saddr), ntohs(p->sport), | 159 | &p->saddr, ntohs(p->sport), |
161 | NIPQUAD(p->daddr), ntohs(p->dport), | 160 | &p->daddr, ntohs(p->dport), |
162 | p->length, p->snd_nxt, p->snd_una, | 161 | p->length, p->snd_nxt, p->snd_una, |
163 | p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt); | 162 | p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt); |
164 | } | 163 | } |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 6b6dff1164b9..3df339e3e363 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -171,7 +171,7 @@ static int tcp_write_timeout(struct sock *sk) | |||
171 | 171 | ||
172 | static void tcp_delack_timer(unsigned long data) | 172 | static void tcp_delack_timer(unsigned long data) |
173 | { | 173 | { |
174 | struct sock *sk = (struct sock*)data; | 174 | struct sock *sk = (struct sock *)data; |
175 | struct tcp_sock *tp = tcp_sk(sk); | 175 | struct tcp_sock *tp = tcp_sk(sk); |
176 | struct inet_connection_sock *icsk = inet_csk(sk); | 176 | struct inet_connection_sock *icsk = inet_csk(sk); |
177 | 177 | ||
@@ -299,15 +299,15 @@ static void tcp_retransmit_timer(struct sock *sk) | |||
299 | #ifdef TCP_DEBUG | 299 | #ifdef TCP_DEBUG |
300 | struct inet_sock *inet = inet_sk(sk); | 300 | struct inet_sock *inet = inet_sk(sk); |
301 | if (sk->sk_family == AF_INET) { | 301 | if (sk->sk_family == AF_INET) { |
302 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer " NIPQUAD_FMT ":%u/%u shrinks window %u:%u. Repaired.\n", | 302 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer %pI4:%u/%u shrinks window %u:%u. Repaired.\n", |
303 | NIPQUAD(inet->daddr), ntohs(inet->dport), | 303 | &inet->daddr, ntohs(inet->dport), |
304 | inet->num, tp->snd_una, tp->snd_nxt); | 304 | inet->num, tp->snd_una, tp->snd_nxt); |
305 | } | 305 | } |
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 |
@@ -396,7 +396,7 @@ out:; | |||
396 | 396 | ||
397 | static void tcp_write_timer(unsigned long data) | 397 | static void tcp_write_timer(unsigned long data) |
398 | { | 398 | { |
399 | struct sock *sk = (struct sock*)data; | 399 | struct sock *sk = (struct sock *)data; |
400 | struct inet_connection_sock *icsk = inet_csk(sk); | 400 | struct inet_connection_sock *icsk = inet_csk(sk); |
401 | int event; | 401 | int event; |
402 | 402 | ||
diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c index e03b10183a8b..9ec843a9bbb2 100644 --- a/net/ipv4/tcp_yeah.c +++ b/net/ipv4/tcp_yeah.c | |||
@@ -83,7 +83,7 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) | |||
83 | else if (!yeah->doing_reno_now) { | 83 | else if (!yeah->doing_reno_now) { |
84 | /* Scalable */ | 84 | /* Scalable */ |
85 | 85 | ||
86 | tp->snd_cwnd_cnt+=yeah->pkts_acked; | 86 | tp->snd_cwnd_cnt += yeah->pkts_acked; |
87 | if (tp->snd_cwnd_cnt > min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT)){ | 87 | if (tp->snd_cwnd_cnt > min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT)){ |
88 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) | 88 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) |
89 | tp->snd_cwnd++; | 89 | tp->snd_cwnd++; |
@@ -224,7 +224,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk) { | |||
224 | 224 | ||
225 | reduction = max( reduction, tp->snd_cwnd >> TCP_YEAH_DELTA); | 225 | reduction = max( reduction, tp->snd_cwnd >> TCP_YEAH_DELTA); |
226 | } else | 226 | } else |
227 | reduction = max(tp->snd_cwnd>>1,2U); | 227 | reduction = max(tp->snd_cwnd>>1, 2U); |
228 | 228 | ||
229 | yeah->fast_count = 0; | 229 | yeah->fast_count = 0; |
230 | yeah->reno_count = max(yeah->reno_count>>1, 2U); | 230 | yeah->reno_count = max(yeah->reno_count>>1, 2U); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index cf02701ced48..54badc9a019d 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 | /* | 109 | struct udp_table udp_table; |
108 | * Snmp MIB for the UDP layer | 110 | EXPORT_SYMBOL(udp_table); |
109 | */ | ||
110 | |||
111 | struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | ||
112 | DEFINE_RWLOCK(udp_hash_lock); | ||
113 | 111 | ||
114 | int sysctl_udp_mem[3] __read_mostly; | 112 | int sysctl_udp_mem[3] __read_mostly; |
115 | int sysctl_udp_rmem_min __read_mostly; | 113 | int sysctl_udp_rmem_min __read_mostly; |
@@ -123,7 +121,7 @@ atomic_t udp_memory_allocated; | |||
123 | EXPORT_SYMBOL(udp_memory_allocated); | 121 | EXPORT_SYMBOL(udp_memory_allocated); |
124 | 122 | ||
125 | static int udp_lib_lport_inuse(struct net *net, __u16 num, | 123 | static 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,39 @@ 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 | /* |
193 | * We need that previous write to sk->sk_hash committed | ||
194 | * before write to sk->next done in following add_node() variant | ||
195 | */ | ||
196 | smp_wmb(); | ||
197 | sk_add_node_rcu(sk, &hslot->head); | ||
189 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | 198 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
190 | } | 199 | } |
191 | error = 0; | 200 | error = 0; |
201 | fail_unlock: | ||
202 | spin_unlock_bh(&hslot->lock); | ||
192 | fail: | 203 | fail: |
193 | write_unlock_bh(&udp_hash_lock); | ||
194 | return error; | 204 | return error; |
195 | } | 205 | } |
196 | 206 | ||
@@ -208,63 +218,89 @@ int udp_v4_get_port(struct sock *sk, unsigned short snum) | |||
208 | return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal); | 218 | return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal); |
209 | } | 219 | } |
210 | 220 | ||
221 | static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr, | ||
222 | unsigned short hnum, | ||
223 | __be16 sport, __be32 daddr, __be16 dport, int dif) | ||
224 | { | ||
225 | int score = -1; | ||
226 | |||
227 | if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && | ||
228 | !ipv6_only_sock(sk)) { | ||
229 | struct inet_sock *inet = inet_sk(sk); | ||
230 | |||
231 | score = (sk->sk_family == PF_INET ? 1 : 0); | ||
232 | if (inet->rcv_saddr) { | ||
233 | if (inet->rcv_saddr != daddr) | ||
234 | return -1; | ||
235 | score += 2; | ||
236 | } | ||
237 | if (inet->daddr) { | ||
238 | if (inet->daddr != saddr) | ||
239 | return -1; | ||
240 | score += 2; | ||
241 | } | ||
242 | if (inet->dport) { | ||
243 | if (inet->dport != sport) | ||
244 | return -1; | ||
245 | score += 2; | ||
246 | } | ||
247 | if (sk->sk_bound_dev_if) { | ||
248 | if (sk->sk_bound_dev_if != dif) | ||
249 | return -1; | ||
250 | score += 2; | ||
251 | } | ||
252 | } | ||
253 | return score; | ||
254 | } | ||
255 | |||
211 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try | 256 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try |
212 | * harder than this. -DaveM | 257 | * harder than this. -DaveM |
213 | */ | 258 | */ |
214 | static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, | 259 | static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, |
215 | __be16 sport, __be32 daddr, __be16 dport, | 260 | __be16 sport, __be32 daddr, __be16 dport, |
216 | int dif, struct hlist_head udptable[]) | 261 | int dif, struct udp_table *udptable) |
217 | { | 262 | { |
218 | struct sock *sk, *result = NULL; | 263 | struct sock *sk, *result; |
219 | struct hlist_node *node; | 264 | struct hlist_node *node, *next; |
220 | unsigned short hnum = ntohs(dport); | 265 | unsigned short hnum = ntohs(dport); |
221 | int badness = -1; | 266 | unsigned int hash = udp_hashfn(net, hnum); |
222 | 267 | struct udp_hslot *hslot = &udptable->hash[hash]; | |
223 | read_lock(&udp_hash_lock); | 268 | int score, badness; |
224 | sk_for_each(sk, node, &udptable[udp_hashfn(net, hnum)]) { | 269 | |
225 | struct inet_sock *inet = inet_sk(sk); | 270 | rcu_read_lock(); |
226 | 271 | begin: | |
227 | if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && | 272 | result = NULL; |
228 | !ipv6_only_sock(sk)) { | 273 | badness = -1; |
229 | int score = (sk->sk_family == PF_INET ? 1 : 0); | 274 | sk_for_each_rcu_safenext(sk, node, &hslot->head, next) { |
230 | if (inet->rcv_saddr) { | 275 | /* |
231 | if (inet->rcv_saddr != daddr) | 276 | * lockless reader, and SLAB_DESTROY_BY_RCU items: |
232 | continue; | 277 | * We must check this item was not moved to another chain |
233 | score+=2; | 278 | */ |
234 | } | 279 | if (udp_hashfn(net, sk->sk_hash) != hash) |
235 | if (inet->daddr) { | 280 | goto begin; |
236 | if (inet->daddr != saddr) | 281 | score = compute_score(sk, net, saddr, hnum, sport, |
237 | continue; | 282 | daddr, dport, dif); |
238 | score+=2; | 283 | if (score > badness) { |
239 | } | 284 | result = sk; |
240 | if (inet->dport) { | 285 | 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 | } | 286 | } |
258 | } | 287 | } |
259 | if (result) | 288 | if (result) { |
260 | sock_hold(result); | 289 | if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt))) |
261 | read_unlock(&udp_hash_lock); | 290 | result = NULL; |
291 | else if (unlikely(compute_score(result, net, saddr, hnum, sport, | ||
292 | daddr, dport, dif) < badness)) { | ||
293 | sock_put(result); | ||
294 | goto begin; | ||
295 | } | ||
296 | } | ||
297 | rcu_read_unlock(); | ||
262 | return result; | 298 | return result; |
263 | } | 299 | } |
264 | 300 | ||
265 | static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, | 301 | static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, |
266 | __be16 sport, __be16 dport, | 302 | __be16 sport, __be16 dport, |
267 | struct hlist_head udptable[]) | 303 | struct udp_table *udptable) |
268 | { | 304 | { |
269 | struct sock *sk; | 305 | struct sock *sk; |
270 | const struct iphdr *iph = ip_hdr(skb); | 306 | const struct iphdr *iph = ip_hdr(skb); |
@@ -280,7 +316,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, | |||
280 | struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | 316 | struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, |
281 | __be32 daddr, __be16 dport, int dif) | 317 | __be32 daddr, __be16 dport, int dif) |
282 | { | 318 | { |
283 | return __udp4_lib_lookup(net, saddr, sport, daddr, dport, dif, udp_hash); | 319 | return __udp4_lib_lookup(net, saddr, sport, daddr, dport, dif, &udp_table); |
284 | } | 320 | } |
285 | EXPORT_SYMBOL_GPL(udp4_lib_lookup); | 321 | EXPORT_SYMBOL_GPL(udp4_lib_lookup); |
286 | 322 | ||
@@ -324,7 +360,7 @@ found: | |||
324 | * to find the appropriate port. | 360 | * to find the appropriate port. |
325 | */ | 361 | */ |
326 | 362 | ||
327 | void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[]) | 363 | void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) |
328 | { | 364 | { |
329 | struct inet_sock *inet; | 365 | struct inet_sock *inet; |
330 | struct iphdr *iph = (struct iphdr*)skb->data; | 366 | struct iphdr *iph = (struct iphdr*)skb->data; |
@@ -393,7 +429,7 @@ out: | |||
393 | 429 | ||
394 | void udp_err(struct sk_buff *skb, u32 info) | 430 | void udp_err(struct sk_buff *skb, u32 info) |
395 | { | 431 | { |
396 | __udp4_lib_err(skb, info, udp_hash); | 432 | __udp4_lib_err(skb, info, &udp_table); |
397 | } | 433 | } |
398 | 434 | ||
399 | /* | 435 | /* |
@@ -934,6 +970,21 @@ int udp_disconnect(struct sock *sk, int flags) | |||
934 | return 0; | 970 | return 0; |
935 | } | 971 | } |
936 | 972 | ||
973 | void udp_lib_unhash(struct sock *sk) | ||
974 | { | ||
975 | struct udp_table *udptable = sk->sk_prot->h.udp_table; | ||
976 | unsigned int hash = udp_hashfn(sock_net(sk), sk->sk_hash); | ||
977 | struct udp_hslot *hslot = &udptable->hash[hash]; | ||
978 | |||
979 | spin_lock_bh(&hslot->lock); | ||
980 | if (sk_del_node_init_rcu(sk)) { | ||
981 | inet_sk(sk)->num = 0; | ||
982 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | ||
983 | } | ||
984 | spin_unlock_bh(&hslot->lock); | ||
985 | } | ||
986 | EXPORT_SYMBOL(udp_lib_unhash); | ||
987 | |||
937 | static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 988 | static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
938 | { | 989 | { |
939 | int is_udplite = IS_UDPLITE(sk); | 990 | int is_udplite = IS_UDPLITE(sk); |
@@ -1072,13 +1123,14 @@ drop: | |||
1072 | static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | 1123 | static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, |
1073 | struct udphdr *uh, | 1124 | struct udphdr *uh, |
1074 | __be32 saddr, __be32 daddr, | 1125 | __be32 saddr, __be32 daddr, |
1075 | struct hlist_head udptable[]) | 1126 | struct udp_table *udptable) |
1076 | { | 1127 | { |
1077 | struct sock *sk; | 1128 | struct sock *sk; |
1129 | struct udp_hslot *hslot = &udptable->hash[udp_hashfn(net, ntohs(uh->dest))]; | ||
1078 | int dif; | 1130 | int dif; |
1079 | 1131 | ||
1080 | read_lock(&udp_hash_lock); | 1132 | spin_lock(&hslot->lock); |
1081 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); | 1133 | sk = sk_head(&hslot->head); |
1082 | dif = skb->dev->ifindex; | 1134 | dif = skb->dev->ifindex; |
1083 | sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); | 1135 | sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); |
1084 | if (sk) { | 1136 | if (sk) { |
@@ -1104,7 +1156,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | |||
1104 | } while (sknext); | 1156 | } while (sknext); |
1105 | } else | 1157 | } else |
1106 | kfree_skb(skb); | 1158 | kfree_skb(skb); |
1107 | read_unlock(&udp_hash_lock); | 1159 | spin_unlock(&hslot->lock); |
1108 | return 0; | 1160 | return 0; |
1109 | } | 1161 | } |
1110 | 1162 | ||
@@ -1150,7 +1202,7 @@ static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh, | |||
1150 | * All we need to do is get the socket, and then do a checksum. | 1202 | * All we need to do is get the socket, and then do a checksum. |
1151 | */ | 1203 | */ |
1152 | 1204 | ||
1153 | int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | 1205 | int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, |
1154 | int proto) | 1206 | int proto) |
1155 | { | 1207 | { |
1156 | struct sock *sk; | 1208 | struct sock *sk; |
@@ -1218,13 +1270,13 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1218 | return 0; | 1270 | return 0; |
1219 | 1271 | ||
1220 | short_packet: | 1272 | short_packet: |
1221 | LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From " NIPQUAD_FMT ":%u %d/%d to " NIPQUAD_FMT ":%u\n", | 1273 | LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %pI4:%u %d/%d to %pI4:%u\n", |
1222 | proto == IPPROTO_UDPLITE ? "-Lite" : "", | 1274 | proto == IPPROTO_UDPLITE ? "-Lite" : "", |
1223 | NIPQUAD(saddr), | 1275 | &saddr, |
1224 | ntohs(uh->source), | 1276 | ntohs(uh->source), |
1225 | ulen, | 1277 | ulen, |
1226 | skb->len, | 1278 | skb->len, |
1227 | NIPQUAD(daddr), | 1279 | &daddr, |
1228 | ntohs(uh->dest)); | 1280 | ntohs(uh->dest)); |
1229 | goto drop; | 1281 | goto drop; |
1230 | 1282 | ||
@@ -1233,11 +1285,11 @@ csum_error: | |||
1233 | * RFC1122: OK. Discards the bad packet silently (as far as | 1285 | * RFC1122: OK. Discards the bad packet silently (as far as |
1234 | * the network is concerned, anyway) as per 4.1.3.4 (MUST). | 1286 | * the network is concerned, anyway) as per 4.1.3.4 (MUST). |
1235 | */ | 1287 | */ |
1236 | LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From " NIPQUAD_FMT ":%u to " NIPQUAD_FMT ":%u ulen %d\n", | 1288 | LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n", |
1237 | proto == IPPROTO_UDPLITE ? "-Lite" : "", | 1289 | proto == IPPROTO_UDPLITE ? "-Lite" : "", |
1238 | NIPQUAD(saddr), | 1290 | &saddr, |
1239 | ntohs(uh->source), | 1291 | ntohs(uh->source), |
1240 | NIPQUAD(daddr), | 1292 | &daddr, |
1241 | ntohs(uh->dest), | 1293 | ntohs(uh->dest), |
1242 | ulen); | 1294 | ulen); |
1243 | drop: | 1295 | drop: |
@@ -1248,7 +1300,7 @@ drop: | |||
1248 | 1300 | ||
1249 | int udp_rcv(struct sk_buff *skb) | 1301 | int udp_rcv(struct sk_buff *skb) |
1250 | { | 1302 | { |
1251 | return __udp4_lib_rcv(skb, udp_hash, IPPROTO_UDP); | 1303 | return __udp4_lib_rcv(skb, &udp_table, IPPROTO_UDP); |
1252 | } | 1304 | } |
1253 | 1305 | ||
1254 | void udp_destroy_sock(struct sock *sk) | 1306 | void udp_destroy_sock(struct sock *sk) |
@@ -1490,7 +1542,8 @@ struct proto udp_prot = { | |||
1490 | .sysctl_wmem = &sysctl_udp_wmem_min, | 1542 | .sysctl_wmem = &sysctl_udp_wmem_min, |
1491 | .sysctl_rmem = &sysctl_udp_rmem_min, | 1543 | .sysctl_rmem = &sysctl_udp_rmem_min, |
1492 | .obj_size = sizeof(struct udp_sock), | 1544 | .obj_size = sizeof(struct udp_sock), |
1493 | .h.udp_hash = udp_hash, | 1545 | .slab_flags = SLAB_DESTROY_BY_RCU, |
1546 | .h.udp_table = &udp_table, | ||
1494 | #ifdef CONFIG_COMPAT | 1547 | #ifdef CONFIG_COMPAT |
1495 | .compat_setsockopt = compat_udp_setsockopt, | 1548 | .compat_setsockopt = compat_udp_setsockopt, |
1496 | .compat_getsockopt = compat_udp_getsockopt, | 1549 | .compat_getsockopt = compat_udp_getsockopt, |
@@ -1500,20 +1553,23 @@ struct proto udp_prot = { | |||
1500 | /* ------------------------------------------------------------------------ */ | 1553 | /* ------------------------------------------------------------------------ */ |
1501 | #ifdef CONFIG_PROC_FS | 1554 | #ifdef CONFIG_PROC_FS |
1502 | 1555 | ||
1503 | static struct sock *udp_get_first(struct seq_file *seq) | 1556 | static struct sock *udp_get_first(struct seq_file *seq, int start) |
1504 | { | 1557 | { |
1505 | struct sock *sk; | 1558 | struct sock *sk; |
1506 | struct udp_iter_state *state = seq->private; | 1559 | struct udp_iter_state *state = seq->private; |
1507 | struct net *net = seq_file_net(seq); | 1560 | struct net *net = seq_file_net(seq); |
1508 | 1561 | ||
1509 | for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { | 1562 | for (state->bucket = start; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { |
1510 | struct hlist_node *node; | 1563 | struct hlist_node *node; |
1511 | sk_for_each(sk, node, state->hashtable + state->bucket) { | 1564 | struct udp_hslot *hslot = &state->udp_table->hash[state->bucket]; |
1565 | spin_lock_bh(&hslot->lock); | ||
1566 | sk_for_each(sk, node, &hslot->head) { | ||
1512 | if (!net_eq(sock_net(sk), net)) | 1567 | if (!net_eq(sock_net(sk), net)) |
1513 | continue; | 1568 | continue; |
1514 | if (sk->sk_family == state->family) | 1569 | if (sk->sk_family == state->family) |
1515 | goto found; | 1570 | goto found; |
1516 | } | 1571 | } |
1572 | spin_unlock_bh(&hslot->lock); | ||
1517 | } | 1573 | } |
1518 | sk = NULL; | 1574 | sk = NULL; |
1519 | found: | 1575 | found: |
@@ -1527,20 +1583,18 @@ static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) | |||
1527 | 1583 | ||
1528 | do { | 1584 | do { |
1529 | sk = sk_next(sk); | 1585 | sk = sk_next(sk); |
1530 | try_again: | ||
1531 | ; | ||
1532 | } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family)); | 1586 | } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family)); |
1533 | 1587 | ||
1534 | if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { | 1588 | if (!sk) { |
1535 | sk = sk_head(state->hashtable + state->bucket); | 1589 | spin_unlock_bh(&state->udp_table->hash[state->bucket].lock); |
1536 | goto try_again; | 1590 | return udp_get_first(seq, state->bucket + 1); |
1537 | } | 1591 | } |
1538 | return sk; | 1592 | return sk; |
1539 | } | 1593 | } |
1540 | 1594 | ||
1541 | static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) | 1595 | static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) |
1542 | { | 1596 | { |
1543 | struct sock *sk = udp_get_first(seq); | 1597 | struct sock *sk = udp_get_first(seq, 0); |
1544 | 1598 | ||
1545 | if (sk) | 1599 | if (sk) |
1546 | while (pos && (sk = udp_get_next(seq, sk)) != NULL) | 1600 | while (pos && (sk = udp_get_next(seq, sk)) != NULL) |
@@ -1549,9 +1603,7 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) | |||
1549 | } | 1603 | } |
1550 | 1604 | ||
1551 | static void *udp_seq_start(struct seq_file *seq, loff_t *pos) | 1605 | static void *udp_seq_start(struct seq_file *seq, loff_t *pos) |
1552 | __acquires(udp_hash_lock) | ||
1553 | { | 1606 | { |
1554 | read_lock(&udp_hash_lock); | ||
1555 | return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN; | 1607 | return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN; |
1556 | } | 1608 | } |
1557 | 1609 | ||
@@ -1569,9 +1621,11 @@ static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1569 | } | 1621 | } |
1570 | 1622 | ||
1571 | static void udp_seq_stop(struct seq_file *seq, void *v) | 1623 | static void udp_seq_stop(struct seq_file *seq, void *v) |
1572 | __releases(udp_hash_lock) | ||
1573 | { | 1624 | { |
1574 | read_unlock(&udp_hash_lock); | 1625 | struct udp_iter_state *state = seq->private; |
1626 | |||
1627 | if (state->bucket < UDP_HTABLE_SIZE) | ||
1628 | spin_unlock_bh(&state->udp_table->hash[state->bucket].lock); | ||
1575 | } | 1629 | } |
1576 | 1630 | ||
1577 | static int udp_seq_open(struct inode *inode, struct file *file) | 1631 | static int udp_seq_open(struct inode *inode, struct file *file) |
@@ -1587,7 +1641,7 @@ static int udp_seq_open(struct inode *inode, struct file *file) | |||
1587 | 1641 | ||
1588 | s = ((struct seq_file *)file->private_data)->private; | 1642 | s = ((struct seq_file *)file->private_data)->private; |
1589 | s->family = afinfo->family; | 1643 | s->family = afinfo->family; |
1590 | s->hashtable = afinfo->hashtable; | 1644 | s->udp_table = afinfo->udp_table; |
1591 | return err; | 1645 | return err; |
1592 | } | 1646 | } |
1593 | 1647 | ||
@@ -1659,7 +1713,7 @@ int udp4_seq_show(struct seq_file *seq, void *v) | |||
1659 | static struct udp_seq_afinfo udp4_seq_afinfo = { | 1713 | static struct udp_seq_afinfo udp4_seq_afinfo = { |
1660 | .name = "udp", | 1714 | .name = "udp", |
1661 | .family = AF_INET, | 1715 | .family = AF_INET, |
1662 | .hashtable = udp_hash, | 1716 | .udp_table = &udp_table, |
1663 | .seq_fops = { | 1717 | .seq_fops = { |
1664 | .owner = THIS_MODULE, | 1718 | .owner = THIS_MODULE, |
1665 | }, | 1719 | }, |
@@ -1694,16 +1748,28 @@ void udp4_proc_exit(void) | |||
1694 | } | 1748 | } |
1695 | #endif /* CONFIG_PROC_FS */ | 1749 | #endif /* CONFIG_PROC_FS */ |
1696 | 1750 | ||
1751 | void __init udp_table_init(struct udp_table *table) | ||
1752 | { | ||
1753 | int i; | ||
1754 | |||
1755 | for (i = 0; i < UDP_HTABLE_SIZE; i++) { | ||
1756 | INIT_HLIST_HEAD(&table->hash[i].head); | ||
1757 | spin_lock_init(&table->hash[i].lock); | ||
1758 | } | ||
1759 | } | ||
1760 | |||
1697 | void __init udp_init(void) | 1761 | void __init udp_init(void) |
1698 | { | 1762 | { |
1699 | unsigned long limit; | 1763 | unsigned long nr_pages, limit; |
1700 | 1764 | ||
1765 | udp_table_init(&udp_table); | ||
1701 | /* Set the pressure threshold up by the same strategy of TCP. It is a | 1766 | /* Set the pressure threshold up by the same strategy of TCP. It is a |
1702 | * fraction of global memory that is up to 1/2 at 256 MB, decreasing | 1767 | * fraction of global memory that is up to 1/2 at 256 MB, decreasing |
1703 | * toward zero with the amount of memory, with a floor of 128 pages. | 1768 | * toward zero with the amount of memory, with a floor of 128 pages. |
1704 | */ | 1769 | */ |
1705 | limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); | 1770 | nr_pages = totalram_pages - totalhigh_pages; |
1706 | limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | 1771 | limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); |
1772 | limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | ||
1707 | limit = max(limit, 128UL); | 1773 | limit = max(limit, 128UL); |
1708 | sysctl_udp_mem[0] = limit / 4 * 3; | 1774 | sysctl_udp_mem[0] = limit / 4 * 3; |
1709 | sysctl_udp_mem[1] = limit; | 1775 | sysctl_udp_mem[1] = limit; |
@@ -1714,8 +1780,6 @@ void __init udp_init(void) | |||
1714 | } | 1780 | } |
1715 | 1781 | ||
1716 | EXPORT_SYMBOL(udp_disconnect); | 1782 | EXPORT_SYMBOL(udp_disconnect); |
1717 | EXPORT_SYMBOL(udp_hash); | ||
1718 | EXPORT_SYMBOL(udp_hash_lock); | ||
1719 | EXPORT_SYMBOL(udp_ioctl); | 1783 | EXPORT_SYMBOL(udp_ioctl); |
1720 | EXPORT_SYMBOL(udp_prot); | 1784 | EXPORT_SYMBOL(udp_prot); |
1721 | EXPORT_SYMBOL(udp_sendmsg); | 1785 | EXPORT_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 | ||
8 | extern int __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int ); | 8 | extern int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int ); |
9 | extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []); | 9 | extern void __udp4_lib_err(struct sk_buff *, u32, struct udp_table *); |
10 | 10 | ||
11 | extern int udp_v4_get_port(struct sock *sk, unsigned short snum); | 11 | extern 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 | ||
15 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 15 | struct udp_table udplite_table; |
16 | EXPORT_SYMBOL(udplite_table); | ||
16 | 17 | ||
17 | static int udplite_rcv(struct sk_buff *skb) | 18 | static 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 | ||
22 | static void udplite_err(struct sk_buff *skb, u32 info) | 23 | static 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 | ||
27 | static struct net_protocol udplite_protocol = { | 28 | static 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 = { | |||
71 | static struct udp_seq_afinfo udplite4_seq_afinfo = { | 73 | static 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 | ||
109 | void __init udplite4_register(void) | 111 | void __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 | ||
129 | EXPORT_SYMBOL(udplite_hash); | ||
130 | EXPORT_SYMBOL(udplite_prot); | 132 | EXPORT_SYMBOL(udplite_prot); |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index c63de0a72aba..f9a775b7e796 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -65,7 +65,7 @@ __xfrm4_find_bundle(struct flowi *fl, struct xfrm_policy *policy) | |||
65 | 65 | ||
66 | read_lock_bh(&policy->lock); | 66 | read_lock_bh(&policy->lock); |
67 | for (dst = policy->bundles; dst; dst = dst->next) { | 67 | for (dst = policy->bundles; dst; dst = dst->next) { |
68 | struct xfrm_dst *xdst = (struct xfrm_dst*)dst; | 68 | struct xfrm_dst *xdst = (struct xfrm_dst *)dst; |
69 | if (xdst->u.rt.fl.oif == fl->oif && /*XXX*/ | 69 | if (xdst->u.rt.fl.oif == fl->oif && /*XXX*/ |
70 | xdst->u.rt.fl.fl4_dst == fl->fl4_dst && | 70 | xdst->u.rt.fl.fl4_dst == fl->fl4_dst && |
71 | xdst->u.rt.fl.fl4_src == fl->fl4_src && | 71 | xdst->u.rt.fl.fl4_src == fl->fl4_src && |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d9da5eb9dcb2..0e41f1be6dc9 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2988,9 +2988,8 @@ static void if6_seq_stop(struct seq_file *seq, void *v) | |||
2988 | static int if6_seq_show(struct seq_file *seq, void *v) | 2988 | static int if6_seq_show(struct seq_file *seq, void *v) |
2989 | { | 2989 | { |
2990 | struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; | 2990 | struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; |
2991 | seq_printf(seq, | 2991 | seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n", |
2992 | NIP6_SEQFMT " %02x %02x %02x %02x %8s\n", | 2992 | &ifp->addr, |
2993 | NIP6(ifp->addr), | ||
2994 | ifp->idev->dev->ifindex, | 2993 | ifp->idev->dev->ifindex, |
2995 | ifp->prefix_len, | 2994 | ifp->prefix_len, |
2996 | ifp->scope, | 2995 | ifp->scope, |
@@ -4033,8 +4032,8 @@ static struct addrconf_sysctl_table | |||
4033 | .data = &ipv6_devconf.forwarding, | 4032 | .data = &ipv6_devconf.forwarding, |
4034 | .maxlen = sizeof(int), | 4033 | .maxlen = sizeof(int), |
4035 | .mode = 0644, | 4034 | .mode = 0644, |
4036 | .proc_handler = &addrconf_sysctl_forward, | 4035 | .proc_handler = addrconf_sysctl_forward, |
4037 | .strategy = &addrconf_sysctl_forward_strategy, | 4036 | .strategy = addrconf_sysctl_forward_strategy, |
4038 | }, | 4037 | }, |
4039 | { | 4038 | { |
4040 | .ctl_name = NET_IPV6_HOP_LIMIT, | 4039 | .ctl_name = NET_IPV6_HOP_LIMIT, |
@@ -4050,7 +4049,7 @@ static struct addrconf_sysctl_table | |||
4050 | .data = &ipv6_devconf.mtu6, | 4049 | .data = &ipv6_devconf.mtu6, |
4051 | .maxlen = sizeof(int), | 4050 | .maxlen = sizeof(int), |
4052 | .mode = 0644, | 4051 | .mode = 0644, |
4053 | .proc_handler = &proc_dointvec, | 4052 | .proc_handler = proc_dointvec, |
4054 | }, | 4053 | }, |
4055 | { | 4054 | { |
4056 | .ctl_name = NET_IPV6_ACCEPT_RA, | 4055 | .ctl_name = NET_IPV6_ACCEPT_RA, |
@@ -4058,7 +4057,7 @@ static struct addrconf_sysctl_table | |||
4058 | .data = &ipv6_devconf.accept_ra, | 4057 | .data = &ipv6_devconf.accept_ra, |
4059 | .maxlen = sizeof(int), | 4058 | .maxlen = sizeof(int), |
4060 | .mode = 0644, | 4059 | .mode = 0644, |
4061 | .proc_handler = &proc_dointvec, | 4060 | .proc_handler = proc_dointvec, |
4062 | }, | 4061 | }, |
4063 | { | 4062 | { |
4064 | .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, | 4063 | .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, |
@@ -4066,7 +4065,7 @@ static struct addrconf_sysctl_table | |||
4066 | .data = &ipv6_devconf.accept_redirects, | 4065 | .data = &ipv6_devconf.accept_redirects, |
4067 | .maxlen = sizeof(int), | 4066 | .maxlen = sizeof(int), |
4068 | .mode = 0644, | 4067 | .mode = 0644, |
4069 | .proc_handler = &proc_dointvec, | 4068 | .proc_handler = proc_dointvec, |
4070 | }, | 4069 | }, |
4071 | { | 4070 | { |
4072 | .ctl_name = NET_IPV6_AUTOCONF, | 4071 | .ctl_name = NET_IPV6_AUTOCONF, |
@@ -4074,7 +4073,7 @@ static struct addrconf_sysctl_table | |||
4074 | .data = &ipv6_devconf.autoconf, | 4073 | .data = &ipv6_devconf.autoconf, |
4075 | .maxlen = sizeof(int), | 4074 | .maxlen = sizeof(int), |
4076 | .mode = 0644, | 4075 | .mode = 0644, |
4077 | .proc_handler = &proc_dointvec, | 4076 | .proc_handler = proc_dointvec, |
4078 | }, | 4077 | }, |
4079 | { | 4078 | { |
4080 | .ctl_name = NET_IPV6_DAD_TRANSMITS, | 4079 | .ctl_name = NET_IPV6_DAD_TRANSMITS, |
@@ -4082,7 +4081,7 @@ static struct addrconf_sysctl_table | |||
4082 | .data = &ipv6_devconf.dad_transmits, | 4081 | .data = &ipv6_devconf.dad_transmits, |
4083 | .maxlen = sizeof(int), | 4082 | .maxlen = sizeof(int), |
4084 | .mode = 0644, | 4083 | .mode = 0644, |
4085 | .proc_handler = &proc_dointvec, | 4084 | .proc_handler = proc_dointvec, |
4086 | }, | 4085 | }, |
4087 | { | 4086 | { |
4088 | .ctl_name = NET_IPV6_RTR_SOLICITS, | 4087 | .ctl_name = NET_IPV6_RTR_SOLICITS, |
@@ -4090,7 +4089,7 @@ static struct addrconf_sysctl_table | |||
4090 | .data = &ipv6_devconf.rtr_solicits, | 4089 | .data = &ipv6_devconf.rtr_solicits, |
4091 | .maxlen = sizeof(int), | 4090 | .maxlen = sizeof(int), |
4092 | .mode = 0644, | 4091 | .mode = 0644, |
4093 | .proc_handler = &proc_dointvec, | 4092 | .proc_handler = proc_dointvec, |
4094 | }, | 4093 | }, |
4095 | { | 4094 | { |
4096 | .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, | 4095 | .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, |
@@ -4098,8 +4097,8 @@ static struct addrconf_sysctl_table | |||
4098 | .data = &ipv6_devconf.rtr_solicit_interval, | 4097 | .data = &ipv6_devconf.rtr_solicit_interval, |
4099 | .maxlen = sizeof(int), | 4098 | .maxlen = sizeof(int), |
4100 | .mode = 0644, | 4099 | .mode = 0644, |
4101 | .proc_handler = &proc_dointvec_jiffies, | 4100 | .proc_handler = proc_dointvec_jiffies, |
4102 | .strategy = &sysctl_jiffies, | 4101 | .strategy = sysctl_jiffies, |
4103 | }, | 4102 | }, |
4104 | { | 4103 | { |
4105 | .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, | 4104 | .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, |
@@ -4107,8 +4106,8 @@ static struct addrconf_sysctl_table | |||
4107 | .data = &ipv6_devconf.rtr_solicit_delay, | 4106 | .data = &ipv6_devconf.rtr_solicit_delay, |
4108 | .maxlen = sizeof(int), | 4107 | .maxlen = sizeof(int), |
4109 | .mode = 0644, | 4108 | .mode = 0644, |
4110 | .proc_handler = &proc_dointvec_jiffies, | 4109 | .proc_handler = proc_dointvec_jiffies, |
4111 | .strategy = &sysctl_jiffies, | 4110 | .strategy = sysctl_jiffies, |
4112 | }, | 4111 | }, |
4113 | { | 4112 | { |
4114 | .ctl_name = NET_IPV6_FORCE_MLD_VERSION, | 4113 | .ctl_name = NET_IPV6_FORCE_MLD_VERSION, |
@@ -4116,7 +4115,7 @@ static struct addrconf_sysctl_table | |||
4116 | .data = &ipv6_devconf.force_mld_version, | 4115 | .data = &ipv6_devconf.force_mld_version, |
4117 | .maxlen = sizeof(int), | 4116 | .maxlen = sizeof(int), |
4118 | .mode = 0644, | 4117 | .mode = 0644, |
4119 | .proc_handler = &proc_dointvec, | 4118 | .proc_handler = proc_dointvec, |
4120 | }, | 4119 | }, |
4121 | #ifdef CONFIG_IPV6_PRIVACY | 4120 | #ifdef CONFIG_IPV6_PRIVACY |
4122 | { | 4121 | { |
@@ -4125,7 +4124,7 @@ static struct addrconf_sysctl_table | |||
4125 | .data = &ipv6_devconf.use_tempaddr, | 4124 | .data = &ipv6_devconf.use_tempaddr, |
4126 | .maxlen = sizeof(int), | 4125 | .maxlen = sizeof(int), |
4127 | .mode = 0644, | 4126 | .mode = 0644, |
4128 | .proc_handler = &proc_dointvec, | 4127 | .proc_handler = proc_dointvec, |
4129 | }, | 4128 | }, |
4130 | { | 4129 | { |
4131 | .ctl_name = NET_IPV6_TEMP_VALID_LFT, | 4130 | .ctl_name = NET_IPV6_TEMP_VALID_LFT, |
@@ -4133,7 +4132,7 @@ static struct addrconf_sysctl_table | |||
4133 | .data = &ipv6_devconf.temp_valid_lft, | 4132 | .data = &ipv6_devconf.temp_valid_lft, |
4134 | .maxlen = sizeof(int), | 4133 | .maxlen = sizeof(int), |
4135 | .mode = 0644, | 4134 | .mode = 0644, |
4136 | .proc_handler = &proc_dointvec, | 4135 | .proc_handler = proc_dointvec, |
4137 | }, | 4136 | }, |
4138 | { | 4137 | { |
4139 | .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, | 4138 | .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, |
@@ -4141,7 +4140,7 @@ static struct addrconf_sysctl_table | |||
4141 | .data = &ipv6_devconf.temp_prefered_lft, | 4140 | .data = &ipv6_devconf.temp_prefered_lft, |
4142 | .maxlen = sizeof(int), | 4141 | .maxlen = sizeof(int), |
4143 | .mode = 0644, | 4142 | .mode = 0644, |
4144 | .proc_handler = &proc_dointvec, | 4143 | .proc_handler = proc_dointvec, |
4145 | }, | 4144 | }, |
4146 | { | 4145 | { |
4147 | .ctl_name = NET_IPV6_REGEN_MAX_RETRY, | 4146 | .ctl_name = NET_IPV6_REGEN_MAX_RETRY, |
@@ -4149,7 +4148,7 @@ static struct addrconf_sysctl_table | |||
4149 | .data = &ipv6_devconf.regen_max_retry, | 4148 | .data = &ipv6_devconf.regen_max_retry, |
4150 | .maxlen = sizeof(int), | 4149 | .maxlen = sizeof(int), |
4151 | .mode = 0644, | 4150 | .mode = 0644, |
4152 | .proc_handler = &proc_dointvec, | 4151 | .proc_handler = proc_dointvec, |
4153 | }, | 4152 | }, |
4154 | { | 4153 | { |
4155 | .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, | 4154 | .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, |
@@ -4157,7 +4156,7 @@ static struct addrconf_sysctl_table | |||
4157 | .data = &ipv6_devconf.max_desync_factor, | 4156 | .data = &ipv6_devconf.max_desync_factor, |
4158 | .maxlen = sizeof(int), | 4157 | .maxlen = sizeof(int), |
4159 | .mode = 0644, | 4158 | .mode = 0644, |
4160 | .proc_handler = &proc_dointvec, | 4159 | .proc_handler = proc_dointvec, |
4161 | }, | 4160 | }, |
4162 | #endif | 4161 | #endif |
4163 | { | 4162 | { |
@@ -4166,7 +4165,7 @@ static struct addrconf_sysctl_table | |||
4166 | .data = &ipv6_devconf.max_addresses, | 4165 | .data = &ipv6_devconf.max_addresses, |
4167 | .maxlen = sizeof(int), | 4166 | .maxlen = sizeof(int), |
4168 | .mode = 0644, | 4167 | .mode = 0644, |
4169 | .proc_handler = &proc_dointvec, | 4168 | .proc_handler = proc_dointvec, |
4170 | }, | 4169 | }, |
4171 | { | 4170 | { |
4172 | .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, | 4171 | .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, |
@@ -4174,7 +4173,7 @@ static struct addrconf_sysctl_table | |||
4174 | .data = &ipv6_devconf.accept_ra_defrtr, | 4173 | .data = &ipv6_devconf.accept_ra_defrtr, |
4175 | .maxlen = sizeof(int), | 4174 | .maxlen = sizeof(int), |
4176 | .mode = 0644, | 4175 | .mode = 0644, |
4177 | .proc_handler = &proc_dointvec, | 4176 | .proc_handler = proc_dointvec, |
4178 | }, | 4177 | }, |
4179 | { | 4178 | { |
4180 | .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, | 4179 | .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, |
@@ -4182,7 +4181,7 @@ static struct addrconf_sysctl_table | |||
4182 | .data = &ipv6_devconf.accept_ra_pinfo, | 4181 | .data = &ipv6_devconf.accept_ra_pinfo, |
4183 | .maxlen = sizeof(int), | 4182 | .maxlen = sizeof(int), |
4184 | .mode = 0644, | 4183 | .mode = 0644, |
4185 | .proc_handler = &proc_dointvec, | 4184 | .proc_handler = proc_dointvec, |
4186 | }, | 4185 | }, |
4187 | #ifdef CONFIG_IPV6_ROUTER_PREF | 4186 | #ifdef CONFIG_IPV6_ROUTER_PREF |
4188 | { | 4187 | { |
@@ -4191,7 +4190,7 @@ static struct addrconf_sysctl_table | |||
4191 | .data = &ipv6_devconf.accept_ra_rtr_pref, | 4190 | .data = &ipv6_devconf.accept_ra_rtr_pref, |
4192 | .maxlen = sizeof(int), | 4191 | .maxlen = sizeof(int), |
4193 | .mode = 0644, | 4192 | .mode = 0644, |
4194 | .proc_handler = &proc_dointvec, | 4193 | .proc_handler = proc_dointvec, |
4195 | }, | 4194 | }, |
4196 | { | 4195 | { |
4197 | .ctl_name = NET_IPV6_RTR_PROBE_INTERVAL, | 4196 | .ctl_name = NET_IPV6_RTR_PROBE_INTERVAL, |
@@ -4199,8 +4198,8 @@ static struct addrconf_sysctl_table | |||
4199 | .data = &ipv6_devconf.rtr_probe_interval, | 4198 | .data = &ipv6_devconf.rtr_probe_interval, |
4200 | .maxlen = sizeof(int), | 4199 | .maxlen = sizeof(int), |
4201 | .mode = 0644, | 4200 | .mode = 0644, |
4202 | .proc_handler = &proc_dointvec_jiffies, | 4201 | .proc_handler = proc_dointvec_jiffies, |
4203 | .strategy = &sysctl_jiffies, | 4202 | .strategy = sysctl_jiffies, |
4204 | }, | 4203 | }, |
4205 | #ifdef CONFIG_IPV6_ROUTE_INFO | 4204 | #ifdef CONFIG_IPV6_ROUTE_INFO |
4206 | { | 4205 | { |
@@ -4209,7 +4208,7 @@ static struct addrconf_sysctl_table | |||
4209 | .data = &ipv6_devconf.accept_ra_rt_info_max_plen, | 4208 | .data = &ipv6_devconf.accept_ra_rt_info_max_plen, |
4210 | .maxlen = sizeof(int), | 4209 | .maxlen = sizeof(int), |
4211 | .mode = 0644, | 4210 | .mode = 0644, |
4212 | .proc_handler = &proc_dointvec, | 4211 | .proc_handler = proc_dointvec, |
4213 | }, | 4212 | }, |
4214 | #endif | 4213 | #endif |
4215 | #endif | 4214 | #endif |
@@ -4219,7 +4218,7 @@ static struct addrconf_sysctl_table | |||
4219 | .data = &ipv6_devconf.proxy_ndp, | 4218 | .data = &ipv6_devconf.proxy_ndp, |
4220 | .maxlen = sizeof(int), | 4219 | .maxlen = sizeof(int), |
4221 | .mode = 0644, | 4220 | .mode = 0644, |
4222 | .proc_handler = &proc_dointvec, | 4221 | .proc_handler = proc_dointvec, |
4223 | }, | 4222 | }, |
4224 | { | 4223 | { |
4225 | .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE, | 4224 | .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE, |
@@ -4227,7 +4226,7 @@ static struct addrconf_sysctl_table | |||
4227 | .data = &ipv6_devconf.accept_source_route, | 4226 | .data = &ipv6_devconf.accept_source_route, |
4228 | .maxlen = sizeof(int), | 4227 | .maxlen = sizeof(int), |
4229 | .mode = 0644, | 4228 | .mode = 0644, |
4230 | .proc_handler = &proc_dointvec, | 4229 | .proc_handler = proc_dointvec, |
4231 | }, | 4230 | }, |
4232 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD | 4231 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD |
4233 | { | 4232 | { |
@@ -4236,7 +4235,7 @@ static struct addrconf_sysctl_table | |||
4236 | .data = &ipv6_devconf.optimistic_dad, | 4235 | .data = &ipv6_devconf.optimistic_dad, |
4237 | .maxlen = sizeof(int), | 4236 | .maxlen = sizeof(int), |
4238 | .mode = 0644, | 4237 | .mode = 0644, |
4239 | .proc_handler = &proc_dointvec, | 4238 | .proc_handler = proc_dointvec, |
4240 | 4239 | ||
4241 | }, | 4240 | }, |
4242 | #endif | 4241 | #endif |
@@ -4247,7 +4246,7 @@ static struct addrconf_sysctl_table | |||
4247 | .data = &ipv6_devconf.mc_forwarding, | 4246 | .data = &ipv6_devconf.mc_forwarding, |
4248 | .maxlen = sizeof(int), | 4247 | .maxlen = sizeof(int), |
4249 | .mode = 0644, | 4248 | .mode = 0644, |
4250 | .proc_handler = &proc_dointvec, | 4249 | .proc_handler = proc_dointvec, |
4251 | }, | 4250 | }, |
4252 | #endif | 4251 | #endif |
4253 | { | 4252 | { |
@@ -4256,7 +4255,7 @@ static struct addrconf_sysctl_table | |||
4256 | .data = &ipv6_devconf.disable_ipv6, | 4255 | .data = &ipv6_devconf.disable_ipv6, |
4257 | .maxlen = sizeof(int), | 4256 | .maxlen = sizeof(int), |
4258 | .mode = 0644, | 4257 | .mode = 0644, |
4259 | .proc_handler = &proc_dointvec, | 4258 | .proc_handler = proc_dointvec, |
4260 | }, | 4259 | }, |
4261 | { | 4260 | { |
4262 | .ctl_name = CTL_UNNUMBERED, | 4261 | .ctl_name = CTL_UNNUMBERED, |
@@ -4264,7 +4263,7 @@ static struct addrconf_sysctl_table | |||
4264 | .data = &ipv6_devconf.accept_dad, | 4263 | .data = &ipv6_devconf.accept_dad, |
4265 | .maxlen = sizeof(int), | 4264 | .maxlen = sizeof(int), |
4266 | .mode = 0644, | 4265 | .mode = 0644, |
4267 | .proc_handler = &proc_dointvec, | 4266 | .proc_handler = proc_dointvec, |
4268 | }, | 4267 | }, |
4269 | { | 4268 | { |
4270 | .ctl_name = 0, /* sentinel */ | 4269 | .ctl_name = 0, /* sentinel */ |
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..be351009fd03 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 | } |
@@ -955,8 +956,8 @@ ctl_table ipv6_icmp_table_template[] = { | |||
955 | .data = &init_net.ipv6.sysctl.icmpv6_time, | 956 | .data = &init_net.ipv6.sysctl.icmpv6_time, |
956 | .maxlen = sizeof(int), | 957 | .maxlen = sizeof(int), |
957 | .mode = 0644, | 958 | .mode = 0644, |
958 | .proc_handler = &proc_dointvec_ms_jiffies, | 959 | .proc_handler = proc_dointvec_ms_jiffies, |
959 | .strategy = &sysctl_ms_jiffies | 960 | .strategy = sysctl_ms_jiffies |
960 | }, | 961 | }, |
961 | { .ctl_name = 0 }, | 962 | { .ctl_name = 0 }, |
962 | }; | 963 | }; |
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 52a7eb0e2c2c..b17377d6f260 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..fbf451c0d77a 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -437,38 +437,20 @@ static void pndisc_destructor(struct pneigh_entry *n) | |||
437 | ipv6_dev_mc_dec(dev, &maddr); | 437 | ipv6_dev_mc_dec(dev, &maddr); |
438 | } | 438 | } |
439 | 439 | ||
440 | /* | 440 | struct sk_buff *ndisc_build_skb(struct net_device *dev, |
441 | * Send a Neighbour Advertisement | 441 | const struct in6_addr *daddr, |
442 | */ | 442 | const struct in6_addr *saddr, |
443 | static void __ndisc_send(struct net_device *dev, | 443 | struct icmp6hdr *icmp6h, |
444 | struct neighbour *neigh, | 444 | const struct in6_addr *target, |
445 | const struct in6_addr *daddr, | 445 | int llinfo) |
446 | const struct in6_addr *saddr, | ||
447 | struct icmp6hdr *icmp6h, const struct in6_addr *target, | ||
448 | int llinfo) | ||
449 | { | 446 | { |
450 | struct flowi fl; | ||
451 | struct dst_entry *dst; | ||
452 | struct net *net = dev_net(dev); | 447 | struct net *net = dev_net(dev); |
453 | struct sock *sk = net->ipv6.ndisc_sk; | 448 | struct sock *sk = net->ipv6.ndisc_sk; |
454 | struct sk_buff *skb; | 449 | struct sk_buff *skb; |
455 | struct icmp6hdr *hdr; | 450 | struct icmp6hdr *hdr; |
456 | struct inet6_dev *idev; | ||
457 | int len; | 451 | int len; |
458 | int err; | 452 | int err; |
459 | u8 *opt, type; | 453 | u8 *opt; |
460 | |||
461 | type = icmp6h->icmp6_type; | ||
462 | |||
463 | icmpv6_flow_init(sk, &fl, type, saddr, daddr, dev->ifindex); | ||
464 | |||
465 | dst = icmp6_dst_alloc(dev, neigh, daddr); | ||
466 | if (!dst) | ||
467 | return; | ||
468 | |||
469 | err = xfrm_lookup(&dst, &fl, NULL, 0); | ||
470 | if (err < 0) | ||
471 | return; | ||
472 | 454 | ||
473 | if (!dev->addr_len) | 455 | if (!dev->addr_len) |
474 | llinfo = 0; | 456 | llinfo = 0; |
@@ -485,8 +467,7 @@ static void __ndisc_send(struct net_device *dev, | |||
485 | ND_PRINTK0(KERN_ERR | 467 | ND_PRINTK0(KERN_ERR |
486 | "ICMPv6 ND: %s() failed to allocate an skb.\n", | 468 | "ICMPv6 ND: %s() failed to allocate an skb.\n", |
487 | __func__); | 469 | __func__); |
488 | dst_release(dst); | 470 | return NULL; |
489 | return; | ||
490 | } | 471 | } |
491 | 472 | ||
492 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 473 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
@@ -513,6 +494,42 @@ static void __ndisc_send(struct net_device *dev, | |||
513 | csum_partial((__u8 *) hdr, | 494 | csum_partial((__u8 *) hdr, |
514 | len, 0)); | 495 | len, 0)); |
515 | 496 | ||
497 | return skb; | ||
498 | } | ||
499 | |||
500 | EXPORT_SYMBOL(ndisc_build_skb); | ||
501 | |||
502 | void ndisc_send_skb(struct sk_buff *skb, | ||
503 | struct net_device *dev, | ||
504 | struct neighbour *neigh, | ||
505 | const struct in6_addr *daddr, | ||
506 | const struct in6_addr *saddr, | ||
507 | struct icmp6hdr *icmp6h) | ||
508 | { | ||
509 | struct flowi fl; | ||
510 | struct dst_entry *dst; | ||
511 | struct net *net = dev_net(dev); | ||
512 | struct sock *sk = net->ipv6.ndisc_sk; | ||
513 | struct inet6_dev *idev; | ||
514 | int err; | ||
515 | u8 type; | ||
516 | |||
517 | type = icmp6h->icmp6_type; | ||
518 | |||
519 | icmpv6_flow_init(sk, &fl, type, saddr, daddr, dev->ifindex); | ||
520 | |||
521 | dst = icmp6_dst_alloc(dev, neigh, daddr); | ||
522 | if (!dst) { | ||
523 | kfree_skb(skb); | ||
524 | return; | ||
525 | } | ||
526 | |||
527 | err = xfrm_lookup(&dst, &fl, NULL, 0); | ||
528 | if (err < 0) { | ||
529 | kfree_skb(skb); | ||
530 | return; | ||
531 | } | ||
532 | |||
516 | skb->dst = dst; | 533 | skb->dst = dst; |
517 | 534 | ||
518 | idev = in6_dev_get(dst->dev); | 535 | idev = in6_dev_get(dst->dev); |
@@ -529,6 +546,27 @@ static void __ndisc_send(struct net_device *dev, | |||
529 | in6_dev_put(idev); | 546 | in6_dev_put(idev); |
530 | } | 547 | } |
531 | 548 | ||
549 | EXPORT_SYMBOL(ndisc_send_skb); | ||
550 | |||
551 | /* | ||
552 | * Send a Neighbour Discover packet | ||
553 | */ | ||
554 | static void __ndisc_send(struct net_device *dev, | ||
555 | struct neighbour *neigh, | ||
556 | const struct in6_addr *daddr, | ||
557 | const struct in6_addr *saddr, | ||
558 | struct icmp6hdr *icmp6h, const struct in6_addr *target, | ||
559 | int llinfo) | ||
560 | { | ||
561 | struct sk_buff *skb; | ||
562 | |||
563 | skb = ndisc_build_skb(dev, daddr, saddr, icmp6h, target, llinfo); | ||
564 | if (!skb) | ||
565 | return; | ||
566 | |||
567 | ndisc_send_skb(skb, dev, neigh, daddr, saddr, icmp6h); | ||
568 | } | ||
569 | |||
532 | static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | 570 | static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, |
533 | const struct in6_addr *daddr, | 571 | const struct in6_addr *daddr, |
534 | const struct in6_addr *solicited_addr, | 572 | const struct in6_addr *solicited_addr, |
@@ -647,11 +685,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
647 | 685 | ||
648 | if ((probes -= neigh->parms->ucast_probes) < 0) { | 686 | if ((probes -= neigh->parms->ucast_probes) < 0) { |
649 | if (!(neigh->nud_state & NUD_VALID)) { | 687 | if (!(neigh->nud_state & NUD_VALID)) { |
650 | ND_PRINTK1(KERN_DEBUG | 688 | ND_PRINTK1(KERN_DEBUG "%s(): trying to ucast probe in NUD_INVALID: %pI6\n", |
651 | "%s(): trying to ucast probe in NUD_INVALID: " | 689 | __func__, target); |
652 | NIP6_FMT "\n", | ||
653 | __func__, | ||
654 | NIP6(*target)); | ||
655 | } | 690 | } |
656 | ndisc_send_ns(dev, neigh, target, target, saddr); | 691 | ndisc_send_ns(dev, neigh, target, target, saddr); |
657 | } else if ((probes -= neigh->parms->app_probes) < 0) { | 692 | } 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..7c668c63f708 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 ", |
@@ -424,9 +424,8 @@ ip6t_log_packet(u_int8_t pf, | |||
424 | if (skb->dev->type == ARPHRD_SIT) { | 424 | if (skb->dev->type == ARPHRD_SIT) { |
425 | const struct iphdr *iph = | 425 | const struct iphdr *iph = |
426 | (struct iphdr *)skb_mac_header(skb); | 426 | (struct iphdr *)skb_mac_header(skb); |
427 | printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ", | 427 | printk("TUNNEL=%pI4->%pI4 ", |
428 | NIPQUAD(iph->saddr), | 428 | &iph->saddr, &iph->daddr); |
429 | NIPQUAD(iph->daddr)); | ||
430 | } | 429 | } |
431 | } else | 430 | } else |
432 | printk(" "); | 431 | printk(" "); |
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, | |||
56 | static int ipv6_print_tuple(struct seq_file *s, | 56 | static 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/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 05726177903f..bd52151d31e9 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -253,7 +253,7 @@ static struct ctl_table icmpv6_sysctl_table[] = { | |||
253 | .data = &nf_ct_icmpv6_timeout, | 253 | .data = &nf_ct_icmpv6_timeout, |
254 | .maxlen = sizeof(unsigned int), | 254 | .maxlen = sizeof(unsigned int), |
255 | .mode = 0644, | 255 | .mode = 0644, |
256 | .proc_handler = &proc_dointvec_jiffies, | 256 | .proc_handler = proc_dointvec_jiffies, |
257 | }, | 257 | }, |
258 | { | 258 | { |
259 | .ctl_name = 0 | 259 | .ctl_name = 0 |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 9967ac7a01a8..ed4d79a9e4a6 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -80,7 +80,7 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = { | |||
80 | .data = &nf_init_frags.timeout, | 80 | .data = &nf_init_frags.timeout, |
81 | .maxlen = sizeof(unsigned int), | 81 | .maxlen = sizeof(unsigned int), |
82 | .mode = 0644, | 82 | .mode = 0644, |
83 | .proc_handler = &proc_dointvec_jiffies, | 83 | .proc_handler = proc_dointvec_jiffies, |
84 | }, | 84 | }, |
85 | { | 85 | { |
86 | .ctl_name = NET_NF_CONNTRACK_FRAG6_LOW_THRESH, | 86 | .ctl_name = NET_NF_CONNTRACK_FRAG6_LOW_THRESH, |
@@ -88,7 +88,7 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = { | |||
88 | .data = &nf_init_frags.low_thresh, | 88 | .data = &nf_init_frags.low_thresh, |
89 | .maxlen = sizeof(unsigned int), | 89 | .maxlen = sizeof(unsigned int), |
90 | .mode = 0644, | 90 | .mode = 0644, |
91 | .proc_handler = &proc_dointvec, | 91 | .proc_handler = proc_dointvec, |
92 | }, | 92 | }, |
93 | { | 93 | { |
94 | .ctl_name = NET_NF_CONNTRACK_FRAG6_HIGH_THRESH, | 94 | .ctl_name = NET_NF_CONNTRACK_FRAG6_HIGH_THRESH, |
@@ -96,7 +96,7 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = { | |||
96 | .data = &nf_init_frags.high_thresh, | 96 | .data = &nf_init_frags.high_thresh, |
97 | .maxlen = sizeof(unsigned int), | 97 | .maxlen = sizeof(unsigned int), |
98 | .mode = 0644, | 98 | .mode = 0644, |
99 | .proc_handler = &proc_dointvec, | 99 | .proc_handler = proc_dointvec, |
100 | }, | 100 | }, |
101 | { .ctl_name = 0 } | 101 | { .ctl_name = 0 } |
102 | }; | 102 | }; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index af12de071f4c..3c575118fca5 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -642,7 +642,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = { | |||
642 | .data = &init_net.ipv6.frags.high_thresh, | 642 | .data = &init_net.ipv6.frags.high_thresh, |
643 | .maxlen = sizeof(int), | 643 | .maxlen = sizeof(int), |
644 | .mode = 0644, | 644 | .mode = 0644, |
645 | .proc_handler = &proc_dointvec | 645 | .proc_handler = proc_dointvec |
646 | }, | 646 | }, |
647 | { | 647 | { |
648 | .ctl_name = NET_IPV6_IP6FRAG_LOW_THRESH, | 648 | .ctl_name = NET_IPV6_IP6FRAG_LOW_THRESH, |
@@ -650,7 +650,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = { | |||
650 | .data = &init_net.ipv6.frags.low_thresh, | 650 | .data = &init_net.ipv6.frags.low_thresh, |
651 | .maxlen = sizeof(int), | 651 | .maxlen = sizeof(int), |
652 | .mode = 0644, | 652 | .mode = 0644, |
653 | .proc_handler = &proc_dointvec | 653 | .proc_handler = proc_dointvec |
654 | }, | 654 | }, |
655 | { | 655 | { |
656 | .ctl_name = NET_IPV6_IP6FRAG_TIME, | 656 | .ctl_name = NET_IPV6_IP6FRAG_TIME, |
@@ -658,8 +658,8 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = { | |||
658 | .data = &init_net.ipv6.frags.timeout, | 658 | .data = &init_net.ipv6.frags.timeout, |
659 | .maxlen = sizeof(int), | 659 | .maxlen = sizeof(int), |
660 | .mode = 0644, | 660 | .mode = 0644, |
661 | .proc_handler = &proc_dointvec_jiffies, | 661 | .proc_handler = proc_dointvec_jiffies, |
662 | .strategy = &sysctl_jiffies, | 662 | .strategy = sysctl_jiffies, |
663 | }, | 663 | }, |
664 | { } | 664 | { } |
665 | }; | 665 | }; |
@@ -671,8 +671,8 @@ static struct ctl_table ip6_frags_ctl_table[] = { | |||
671 | .data = &ip6_frags.secret_interval, | 671 | .data = &ip6_frags.secret_interval, |
672 | .maxlen = sizeof(int), | 672 | .maxlen = sizeof(int), |
673 | .mode = 0644, | 673 | .mode = 0644, |
674 | .proc_handler = &proc_dointvec_jiffies, | 674 | .proc_handler = proc_dointvec_jiffies, |
675 | .strategy = &sysctl_jiffies | 675 | .strategy = sysctl_jiffies |
676 | }, | 676 | }, |
677 | { } | 677 | { } |
678 | }; | 678 | }; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 89dc69924340..4d40dc214b2d 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 | } |
@@ -2502,7 +2499,7 @@ ctl_table ipv6_route_table_template[] = { | |||
2502 | .data = &init_net.ipv6.sysctl.flush_delay, | 2499 | .data = &init_net.ipv6.sysctl.flush_delay, |
2503 | .maxlen = sizeof(int), | 2500 | .maxlen = sizeof(int), |
2504 | .mode = 0200, | 2501 | .mode = 0200, |
2505 | .proc_handler = &ipv6_sysctl_rtcache_flush | 2502 | .proc_handler = ipv6_sysctl_rtcache_flush |
2506 | }, | 2503 | }, |
2507 | { | 2504 | { |
2508 | .ctl_name = NET_IPV6_ROUTE_GC_THRESH, | 2505 | .ctl_name = NET_IPV6_ROUTE_GC_THRESH, |
@@ -2510,7 +2507,7 @@ ctl_table ipv6_route_table_template[] = { | |||
2510 | .data = &ip6_dst_ops_template.gc_thresh, | 2507 | .data = &ip6_dst_ops_template.gc_thresh, |
2511 | .maxlen = sizeof(int), | 2508 | .maxlen = sizeof(int), |
2512 | .mode = 0644, | 2509 | .mode = 0644, |
2513 | .proc_handler = &proc_dointvec, | 2510 | .proc_handler = proc_dointvec, |
2514 | }, | 2511 | }, |
2515 | { | 2512 | { |
2516 | .ctl_name = NET_IPV6_ROUTE_MAX_SIZE, | 2513 | .ctl_name = NET_IPV6_ROUTE_MAX_SIZE, |
@@ -2518,7 +2515,7 @@ ctl_table ipv6_route_table_template[] = { | |||
2518 | .data = &init_net.ipv6.sysctl.ip6_rt_max_size, | 2515 | .data = &init_net.ipv6.sysctl.ip6_rt_max_size, |
2519 | .maxlen = sizeof(int), | 2516 | .maxlen = sizeof(int), |
2520 | .mode = 0644, | 2517 | .mode = 0644, |
2521 | .proc_handler = &proc_dointvec, | 2518 | .proc_handler = proc_dointvec, |
2522 | }, | 2519 | }, |
2523 | { | 2520 | { |
2524 | .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL, | 2521 | .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL, |
@@ -2526,8 +2523,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2526 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval, | 2523 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval, |
2527 | .maxlen = sizeof(int), | 2524 | .maxlen = sizeof(int), |
2528 | .mode = 0644, | 2525 | .mode = 0644, |
2529 | .proc_handler = &proc_dointvec_jiffies, | 2526 | .proc_handler = proc_dointvec_jiffies, |
2530 | .strategy = &sysctl_jiffies, | 2527 | .strategy = sysctl_jiffies, |
2531 | }, | 2528 | }, |
2532 | { | 2529 | { |
2533 | .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT, | 2530 | .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT, |
@@ -2535,8 +2532,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2535 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_timeout, | 2532 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_timeout, |
2536 | .maxlen = sizeof(int), | 2533 | .maxlen = sizeof(int), |
2537 | .mode = 0644, | 2534 | .mode = 0644, |
2538 | .proc_handler = &proc_dointvec_jiffies, | 2535 | .proc_handler = proc_dointvec_jiffies, |
2539 | .strategy = &sysctl_jiffies, | 2536 | .strategy = sysctl_jiffies, |
2540 | }, | 2537 | }, |
2541 | { | 2538 | { |
2542 | .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL, | 2539 | .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL, |
@@ -2544,8 +2541,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2544 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_interval, | 2541 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_interval, |
2545 | .maxlen = sizeof(int), | 2542 | .maxlen = sizeof(int), |
2546 | .mode = 0644, | 2543 | .mode = 0644, |
2547 | .proc_handler = &proc_dointvec_jiffies, | 2544 | .proc_handler = proc_dointvec_jiffies, |
2548 | .strategy = &sysctl_jiffies, | 2545 | .strategy = sysctl_jiffies, |
2549 | }, | 2546 | }, |
2550 | { | 2547 | { |
2551 | .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY, | 2548 | .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY, |
@@ -2553,8 +2550,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2553 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity, | 2550 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity, |
2554 | .maxlen = sizeof(int), | 2551 | .maxlen = sizeof(int), |
2555 | .mode = 0644, | 2552 | .mode = 0644, |
2556 | .proc_handler = &proc_dointvec_jiffies, | 2553 | .proc_handler = proc_dointvec_jiffies, |
2557 | .strategy = &sysctl_jiffies, | 2554 | .strategy = sysctl_jiffies, |
2558 | }, | 2555 | }, |
2559 | { | 2556 | { |
2560 | .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES, | 2557 | .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES, |
@@ -2562,8 +2559,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2562 | .data = &init_net.ipv6.sysctl.ip6_rt_mtu_expires, | 2559 | .data = &init_net.ipv6.sysctl.ip6_rt_mtu_expires, |
2563 | .maxlen = sizeof(int), | 2560 | .maxlen = sizeof(int), |
2564 | .mode = 0644, | 2561 | .mode = 0644, |
2565 | .proc_handler = &proc_dointvec_jiffies, | 2562 | .proc_handler = proc_dointvec_jiffies, |
2566 | .strategy = &sysctl_jiffies, | 2563 | .strategy = sysctl_jiffies, |
2567 | }, | 2564 | }, |
2568 | { | 2565 | { |
2569 | .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS, | 2566 | .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS, |
@@ -2571,8 +2568,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2571 | .data = &init_net.ipv6.sysctl.ip6_rt_min_advmss, | 2568 | .data = &init_net.ipv6.sysctl.ip6_rt_min_advmss, |
2572 | .maxlen = sizeof(int), | 2569 | .maxlen = sizeof(int), |
2573 | .mode = 0644, | 2570 | .mode = 0644, |
2574 | .proc_handler = &proc_dointvec_jiffies, | 2571 | .proc_handler = proc_dointvec_jiffies, |
2575 | .strategy = &sysctl_jiffies, | 2572 | .strategy = sysctl_jiffies, |
2576 | }, | 2573 | }, |
2577 | { | 2574 | { |
2578 | .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, | 2575 | .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, |
@@ -2580,8 +2577,8 @@ ctl_table ipv6_route_table_template[] = { | |||
2580 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval, | 2577 | .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval, |
2581 | .maxlen = sizeof(int), | 2578 | .maxlen = sizeof(int), |
2582 | .mode = 0644, | 2579 | .mode = 0644, |
2583 | .proc_handler = &proc_dointvec_ms_jiffies, | 2580 | .proc_handler = proc_dointvec_ms_jiffies, |
2584 | .strategy = &sysctl_ms_jiffies, | 2581 | .strategy = sysctl_ms_jiffies, |
2585 | }, | 2582 | }, |
2586 | { .ctl_name = 0 } | 2583 | { .ctl_name = 0 } |
2587 | }; | 2584 | }; |
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index 587f8f60c489..9048fe7e7ea7 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c | |||
@@ -35,7 +35,7 @@ static ctl_table ipv6_table_template[] = { | |||
35 | .data = &init_net.ipv6.sysctl.bindv6only, | 35 | .data = &init_net.ipv6.sysctl.bindv6only, |
36 | .maxlen = sizeof(int), | 36 | .maxlen = sizeof(int), |
37 | .mode = 0644, | 37 | .mode = 0644, |
38 | .proc_handler = &proc_dointvec | 38 | .proc_handler = proc_dointvec |
39 | }, | 39 | }, |
40 | { .ctl_name = 0 } | 40 | { .ctl_name = 0 } |
41 | }; | 41 | }; |
@@ -47,7 +47,7 @@ static ctl_table ipv6_table[] = { | |||
47 | .data = &sysctl_mld_max_msf, | 47 | .data = &sysctl_mld_max_msf, |
48 | .maxlen = sizeof(int), | 48 | .maxlen = sizeof(int), |
49 | .mode = 0644, | 49 | .mode = 0644, |
50 | .proc_handler = &proc_dointvec | 50 | .proc_handler = proc_dointvec |
51 | }, | 51 | }, |
52 | { .ctl_name = 0 } | 52 | { .ctl_name = 0 } |
53 | }; | 53 | }; |
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 8b48512ebf6a..8dafa36b1ba5 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 | ||
57 | static 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 | |||
57 | static struct sock *__udp6_lib_lookup(struct net *net, | 95 | static 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 | 108 | begin: | |
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 | ||
110 | static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb, | 137 | static 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); |
@@ -253,7 +280,7 @@ csum_copy_err: | |||
253 | 280 | ||
254 | void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 281 | void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
255 | int type, int code, int offset, __be32 info, | 282 | int type, int code, int offset, __be32 info, |
256 | struct hlist_head udptable[] ) | 283 | struct udp_table *udptable) |
257 | { | 284 | { |
258 | struct ipv6_pinfo *np; | 285 | struct ipv6_pinfo *np; |
259 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; | 286 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; |
@@ -289,7 +316,7 @@ static __inline__ void udpv6_err(struct sk_buff *skb, | |||
289 | struct inet6_skb_parm *opt, int type, | 316 | struct inet6_skb_parm *opt, int type, |
290 | int code, int offset, __be32 info ) | 317 | int code, int offset, __be32 info ) |
291 | { | 318 | { |
292 | __udp6_lib_err(skb, opt, type, code, offset, info, udp_hash); | 319 | __udp6_lib_err(skb, opt, type, code, offset, info, &udp_table); |
293 | } | 320 | } |
294 | 321 | ||
295 | int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | 322 | int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) |
@@ -388,14 +415,15 @@ static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk, | |||
388 | */ | 415 | */ |
389 | static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | 416 | static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, |
390 | struct in6_addr *saddr, struct in6_addr *daddr, | 417 | struct in6_addr *saddr, struct in6_addr *daddr, |
391 | struct hlist_head udptable[]) | 418 | struct udp_table *udptable) |
392 | { | 419 | { |
393 | struct sock *sk, *sk2; | 420 | struct sock *sk, *sk2; |
394 | const struct udphdr *uh = udp_hdr(skb); | 421 | const struct udphdr *uh = udp_hdr(skb); |
422 | struct udp_hslot *hslot = &udptable->hash[udp_hashfn(net, ntohs(uh->dest))]; | ||
395 | int dif; | 423 | int dif; |
396 | 424 | ||
397 | read_lock(&udp_hash_lock); | 425 | spin_lock(&hslot->lock); |
398 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); | 426 | sk = sk_head(&hslot->head); |
399 | dif = inet6_iif(skb); | 427 | dif = inet6_iif(skb); |
400 | sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); | 428 | sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); |
401 | if (!sk) { | 429 | if (!sk) { |
@@ -423,7 +451,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | |||
423 | sk_add_backlog(sk, skb); | 451 | sk_add_backlog(sk, skb); |
424 | bh_unlock_sock(sk); | 452 | bh_unlock_sock(sk); |
425 | out: | 453 | out: |
426 | read_unlock(&udp_hash_lock); | 454 | spin_unlock(&hslot->lock); |
427 | return 0; | 455 | return 0; |
428 | } | 456 | } |
429 | 457 | ||
@@ -461,7 +489,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, | |||
461 | return 0; | 489 | return 0; |
462 | } | 490 | } |
463 | 491 | ||
464 | int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | 492 | int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, |
465 | int proto) | 493 | int proto) |
466 | { | 494 | { |
467 | struct sock *sk; | 495 | struct sock *sk; |
@@ -558,7 +586,7 @@ discard: | |||
558 | 586 | ||
559 | static __inline__ int udpv6_rcv(struct sk_buff *skb) | 587 | static __inline__ int udpv6_rcv(struct sk_buff *skb) |
560 | { | 588 | { |
561 | return __udp6_lib_rcv(skb, udp_hash, IPPROTO_UDP); | 589 | return __udp6_lib_rcv(skb, &udp_table, IPPROTO_UDP); |
562 | } | 590 | } |
563 | 591 | ||
564 | /* | 592 | /* |
@@ -1022,7 +1050,7 @@ int udp6_seq_show(struct seq_file *seq, void *v) | |||
1022 | static struct udp_seq_afinfo udp6_seq_afinfo = { | 1050 | static struct udp_seq_afinfo udp6_seq_afinfo = { |
1023 | .name = "udp6", | 1051 | .name = "udp6", |
1024 | .family = AF_INET6, | 1052 | .family = AF_INET6, |
1025 | .hashtable = udp_hash, | 1053 | .udp_table = &udp_table, |
1026 | .seq_fops = { | 1054 | .seq_fops = { |
1027 | .owner = THIS_MODULE, | 1055 | .owner = THIS_MODULE, |
1028 | }, | 1056 | }, |
@@ -1064,7 +1092,8 @@ struct proto udpv6_prot = { | |||
1064 | .sysctl_wmem = &sysctl_udp_wmem_min, | 1092 | .sysctl_wmem = &sysctl_udp_wmem_min, |
1065 | .sysctl_rmem = &sysctl_udp_rmem_min, | 1093 | .sysctl_rmem = &sysctl_udp_rmem_min, |
1066 | .obj_size = sizeof(struct udp6_sock), | 1094 | .obj_size = sizeof(struct udp6_sock), |
1067 | .h.udp_hash = udp_hash, | 1095 | .slab_flags = SLAB_DESTROY_BY_RCU, |
1096 | .h.udp_table = &udp_table, | ||
1068 | #ifdef CONFIG_COMPAT | 1097 | #ifdef CONFIG_COMPAT |
1069 | .compat_setsockopt = compat_udpv6_setsockopt, | 1098 | .compat_setsockopt = compat_udpv6_setsockopt, |
1070 | .compat_getsockopt = compat_udpv6_getsockopt, | 1099 | .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 | ||
10 | extern int __udp6_lib_rcv(struct sk_buff *, struct hlist_head [], int ); | 10 | extern int __udp6_lib_rcv(struct sk_buff *, struct udp_table *, int ); |
11 | extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, | 11 | extern 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 | ||
14 | extern int udp_v6_get_port(struct sock *sk, unsigned short snum); | 14 | extern 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 | ||
16 | static int udplitev6_rcv(struct sk_buff *skb) | 16 | static 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 | ||
21 | static void udplitev6_err(struct sk_buff *skb, | 21 | static 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 | ||
28 | static struct inet6_protocol udplitev6_protocol = { | 28 | static 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) | |||
95 | static struct udp_seq_afinfo udplite6_seq_afinfo = { | 96 | static 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/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 08e4cbbe3f04..604bc0a96c05 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -144,6 +144,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) | |||
144 | static inline void | 144 | static inline void |
145 | _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | 145 | _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) |
146 | { | 146 | { |
147 | int onlyproto = 0; | ||
147 | u16 offset = skb_network_header_len(skb); | 148 | u16 offset = skb_network_header_len(skb); |
148 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 149 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
149 | struct ipv6_opt_hdr *exthdr; | 150 | struct ipv6_opt_hdr *exthdr; |
@@ -159,6 +160,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
159 | exthdr = (struct ipv6_opt_hdr *)(nh + offset); | 160 | exthdr = (struct ipv6_opt_hdr *)(nh + offset); |
160 | 161 | ||
161 | switch (nexthdr) { | 162 | switch (nexthdr) { |
163 | case NEXTHDR_FRAGMENT: | ||
164 | onlyproto = 1; | ||
162 | case NEXTHDR_ROUTING: | 165 | case NEXTHDR_ROUTING: |
163 | case NEXTHDR_HOP: | 166 | case NEXTHDR_HOP: |
164 | case NEXTHDR_DEST: | 167 | case NEXTHDR_DEST: |
@@ -172,7 +175,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
172 | case IPPROTO_TCP: | 175 | case IPPROTO_TCP: |
173 | case IPPROTO_SCTP: | 176 | case IPPROTO_SCTP: |
174 | case IPPROTO_DCCP: | 177 | case IPPROTO_DCCP: |
175 | if (pskb_may_pull(skb, nh + offset + 4 - skb->data)) { | 178 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 4 - skb->data)) { |
176 | __be16 *ports = (__be16 *)exthdr; | 179 | __be16 *ports = (__be16 *)exthdr; |
177 | 180 | ||
178 | fl->fl_ip_sport = ports[!!reverse]; | 181 | fl->fl_ip_sport = ports[!!reverse]; |
@@ -182,7 +185,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
182 | return; | 185 | return; |
183 | 186 | ||
184 | case IPPROTO_ICMPV6: | 187 | case IPPROTO_ICMPV6: |
185 | if (pskb_may_pull(skb, nh + offset + 2 - skb->data)) { | 188 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { |
186 | u8 *icmp = (u8 *)exthdr; | 189 | u8 *icmp = (u8 *)exthdr; |
187 | 190 | ||
188 | fl->fl_icmp_type = icmp[0]; | 191 | fl->fl_icmp_type = icmp[0]; |
@@ -193,7 +196,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
193 | 196 | ||
194 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 197 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
195 | case IPPROTO_MH: | 198 | case IPPROTO_MH: |
196 | if (pskb_may_pull(skb, nh + offset + 3 - skb->data)) { | 199 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { |
197 | struct ip6_mh *mh; | 200 | struct ip6_mh *mh; |
198 | mh = (struct ip6_mh *)exthdr; | 201 | mh = (struct ip6_mh *)exthdr; |
199 | 202 | ||
diff --git a/net/ipx/sysctl_net_ipx.c b/net/ipx/sysctl_net_ipx.c index 92fef864e852..633fcab35580 100644 --- a/net/ipx/sysctl_net_ipx.c +++ b/net/ipx/sysctl_net_ipx.c | |||
@@ -23,7 +23,7 @@ static struct ctl_table ipx_table[] = { | |||
23 | .data = &sysctl_ipx_pprop_broadcasting, | 23 | .data = &sysctl_ipx_pprop_broadcasting, |
24 | .maxlen = sizeof(int), | 24 | .maxlen = sizeof(int), |
25 | .mode = 0644, | 25 | .mode = 0644, |
26 | .proc_handler = &proc_dointvec, | 26 | .proc_handler = proc_dointvec, |
27 | }, | 27 | }, |
28 | { 0 }, | 28 | { 0 }, |
29 | }; | 29 | }; |
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/irda/irsysctl.c b/net/irda/irsysctl.c index 9ab3df15425d..57f8817c3979 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c | |||
@@ -118,8 +118,8 @@ static ctl_table irda_table[] = { | |||
118 | .data = &sysctl_discovery, | 118 | .data = &sysctl_discovery, |
119 | .maxlen = sizeof(int), | 119 | .maxlen = sizeof(int), |
120 | .mode = 0644, | 120 | .mode = 0644, |
121 | .proc_handler = &do_discovery, | 121 | .proc_handler = do_discovery, |
122 | .strategy = &sysctl_intvec | 122 | .strategy = sysctl_intvec |
123 | }, | 123 | }, |
124 | { | 124 | { |
125 | .ctl_name = NET_IRDA_DEVNAME, | 125 | .ctl_name = NET_IRDA_DEVNAME, |
@@ -127,8 +127,8 @@ static ctl_table irda_table[] = { | |||
127 | .data = sysctl_devname, | 127 | .data = sysctl_devname, |
128 | .maxlen = 65, | 128 | .maxlen = 65, |
129 | .mode = 0644, | 129 | .mode = 0644, |
130 | .proc_handler = &do_devname, | 130 | .proc_handler = do_devname, |
131 | .strategy = &sysctl_string | 131 | .strategy = sysctl_string |
132 | }, | 132 | }, |
133 | #ifdef CONFIG_IRDA_DEBUG | 133 | #ifdef CONFIG_IRDA_DEBUG |
134 | { | 134 | { |
@@ -137,7 +137,7 @@ static ctl_table irda_table[] = { | |||
137 | .data = &irda_debug, | 137 | .data = &irda_debug, |
138 | .maxlen = sizeof(int), | 138 | .maxlen = sizeof(int), |
139 | .mode = 0644, | 139 | .mode = 0644, |
140 | .proc_handler = &proc_dointvec | 140 | .proc_handler = proc_dointvec |
141 | }, | 141 | }, |
142 | #endif | 142 | #endif |
143 | #ifdef CONFIG_IRDA_FAST_RR | 143 | #ifdef CONFIG_IRDA_FAST_RR |
@@ -147,7 +147,7 @@ static ctl_table irda_table[] = { | |||
147 | .data = &sysctl_fast_poll_increase, | 147 | .data = &sysctl_fast_poll_increase, |
148 | .maxlen = sizeof(int), | 148 | .maxlen = sizeof(int), |
149 | .mode = 0644, | 149 | .mode = 0644, |
150 | .proc_handler = &proc_dointvec | 150 | .proc_handler = proc_dointvec |
151 | }, | 151 | }, |
152 | #endif | 152 | #endif |
153 | { | 153 | { |
@@ -156,8 +156,8 @@ static ctl_table irda_table[] = { | |||
156 | .data = &sysctl_discovery_slots, | 156 | .data = &sysctl_discovery_slots, |
157 | .maxlen = sizeof(int), | 157 | .maxlen = sizeof(int), |
158 | .mode = 0644, | 158 | .mode = 0644, |
159 | .proc_handler = &proc_dointvec_minmax, | 159 | .proc_handler = proc_dointvec_minmax, |
160 | .strategy = &sysctl_intvec, | 160 | .strategy = sysctl_intvec, |
161 | .extra1 = &min_discovery_slots, | 161 | .extra1 = &min_discovery_slots, |
162 | .extra2 = &max_discovery_slots | 162 | .extra2 = &max_discovery_slots |
163 | }, | 163 | }, |
@@ -167,7 +167,7 @@ static ctl_table irda_table[] = { | |||
167 | .data = &sysctl_discovery_timeout, | 167 | .data = &sysctl_discovery_timeout, |
168 | .maxlen = sizeof(int), | 168 | .maxlen = sizeof(int), |
169 | .mode = 0644, | 169 | .mode = 0644, |
170 | .proc_handler = &proc_dointvec | 170 | .proc_handler = proc_dointvec |
171 | }, | 171 | }, |
172 | { | 172 | { |
173 | .ctl_name = NET_IRDA_SLOT_TIMEOUT, | 173 | .ctl_name = NET_IRDA_SLOT_TIMEOUT, |
@@ -175,8 +175,8 @@ static ctl_table irda_table[] = { | |||
175 | .data = &sysctl_slot_timeout, | 175 | .data = &sysctl_slot_timeout, |
176 | .maxlen = sizeof(int), | 176 | .maxlen = sizeof(int), |
177 | .mode = 0644, | 177 | .mode = 0644, |
178 | .proc_handler = &proc_dointvec_minmax, | 178 | .proc_handler = proc_dointvec_minmax, |
179 | .strategy = &sysctl_intvec, | 179 | .strategy = sysctl_intvec, |
180 | .extra1 = &min_slot_timeout, | 180 | .extra1 = &min_slot_timeout, |
181 | .extra2 = &max_slot_timeout | 181 | .extra2 = &max_slot_timeout |
182 | }, | 182 | }, |
@@ -186,8 +186,8 @@ static ctl_table irda_table[] = { | |||
186 | .data = &sysctl_max_baud_rate, | 186 | .data = &sysctl_max_baud_rate, |
187 | .maxlen = sizeof(int), | 187 | .maxlen = sizeof(int), |
188 | .mode = 0644, | 188 | .mode = 0644, |
189 | .proc_handler = &proc_dointvec_minmax, | 189 | .proc_handler = proc_dointvec_minmax, |
190 | .strategy = &sysctl_intvec, | 190 | .strategy = sysctl_intvec, |
191 | .extra1 = &min_max_baud_rate, | 191 | .extra1 = &min_max_baud_rate, |
192 | .extra2 = &max_max_baud_rate | 192 | .extra2 = &max_max_baud_rate |
193 | }, | 193 | }, |
@@ -197,8 +197,8 @@ static ctl_table irda_table[] = { | |||
197 | .data = &sysctl_min_tx_turn_time, | 197 | .data = &sysctl_min_tx_turn_time, |
198 | .maxlen = sizeof(int), | 198 | .maxlen = sizeof(int), |
199 | .mode = 0644, | 199 | .mode = 0644, |
200 | .proc_handler = &proc_dointvec_minmax, | 200 | .proc_handler = proc_dointvec_minmax, |
201 | .strategy = &sysctl_intvec, | 201 | .strategy = sysctl_intvec, |
202 | .extra1 = &min_min_tx_turn_time, | 202 | .extra1 = &min_min_tx_turn_time, |
203 | .extra2 = &max_min_tx_turn_time | 203 | .extra2 = &max_min_tx_turn_time |
204 | }, | 204 | }, |
@@ -208,8 +208,8 @@ static ctl_table irda_table[] = { | |||
208 | .data = &sysctl_max_tx_data_size, | 208 | .data = &sysctl_max_tx_data_size, |
209 | .maxlen = sizeof(int), | 209 | .maxlen = sizeof(int), |
210 | .mode = 0644, | 210 | .mode = 0644, |
211 | .proc_handler = &proc_dointvec_minmax, | 211 | .proc_handler = proc_dointvec_minmax, |
212 | .strategy = &sysctl_intvec, | 212 | .strategy = sysctl_intvec, |
213 | .extra1 = &min_max_tx_data_size, | 213 | .extra1 = &min_max_tx_data_size, |
214 | .extra2 = &max_max_tx_data_size | 214 | .extra2 = &max_max_tx_data_size |
215 | }, | 215 | }, |
@@ -219,8 +219,8 @@ static ctl_table irda_table[] = { | |||
219 | .data = &sysctl_max_tx_window, | 219 | .data = &sysctl_max_tx_window, |
220 | .maxlen = sizeof(int), | 220 | .maxlen = sizeof(int), |
221 | .mode = 0644, | 221 | .mode = 0644, |
222 | .proc_handler = &proc_dointvec_minmax, | 222 | .proc_handler = proc_dointvec_minmax, |
223 | .strategy = &sysctl_intvec, | 223 | .strategy = sysctl_intvec, |
224 | .extra1 = &min_max_tx_window, | 224 | .extra1 = &min_max_tx_window, |
225 | .extra2 = &max_max_tx_window | 225 | .extra2 = &max_max_tx_window |
226 | }, | 226 | }, |
@@ -230,8 +230,8 @@ static ctl_table irda_table[] = { | |||
230 | .data = &sysctl_max_noreply_time, | 230 | .data = &sysctl_max_noreply_time, |
231 | .maxlen = sizeof(int), | 231 | .maxlen = sizeof(int), |
232 | .mode = 0644, | 232 | .mode = 0644, |
233 | .proc_handler = &proc_dointvec_minmax, | 233 | .proc_handler = proc_dointvec_minmax, |
234 | .strategy = &sysctl_intvec, | 234 | .strategy = sysctl_intvec, |
235 | .extra1 = &min_max_noreply_time, | 235 | .extra1 = &min_max_noreply_time, |
236 | .extra2 = &max_max_noreply_time | 236 | .extra2 = &max_max_noreply_time |
237 | }, | 237 | }, |
@@ -241,8 +241,8 @@ static ctl_table irda_table[] = { | |||
241 | .data = &sysctl_warn_noreply_time, | 241 | .data = &sysctl_warn_noreply_time, |
242 | .maxlen = sizeof(int), | 242 | .maxlen = sizeof(int), |
243 | .mode = 0644, | 243 | .mode = 0644, |
244 | .proc_handler = &proc_dointvec_minmax, | 244 | .proc_handler = proc_dointvec_minmax, |
245 | .strategy = &sysctl_intvec, | 245 | .strategy = sysctl_intvec, |
246 | .extra1 = &min_warn_noreply_time, | 246 | .extra1 = &min_warn_noreply_time, |
247 | .extra2 = &max_warn_noreply_time | 247 | .extra2 = &max_warn_noreply_time |
248 | }, | 248 | }, |
@@ -252,8 +252,8 @@ static ctl_table irda_table[] = { | |||
252 | .data = &sysctl_lap_keepalive_time, | 252 | .data = &sysctl_lap_keepalive_time, |
253 | .maxlen = sizeof(int), | 253 | .maxlen = sizeof(int), |
254 | .mode = 0644, | 254 | .mode = 0644, |
255 | .proc_handler = &proc_dointvec_minmax, | 255 | .proc_handler = proc_dointvec_minmax, |
256 | .strategy = &sysctl_intvec, | 256 | .strategy = sysctl_intvec, |
257 | .extra1 = &min_lap_keepalive_time, | 257 | .extra1 = &min_lap_keepalive_time, |
258 | .extra2 = &max_lap_keepalive_time | 258 | .extra2 = &max_lap_keepalive_time |
259 | }, | 259 | }, |
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 | ||
28 | static void llc_ui_format_mac(struct seq_file *seq, u8 *addr) | 28 | static 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 | ||
34 | static struct sock *llc_get_sk_idx(loff_t pos) | 33 | static struct sock *llc_get_sk_idx(loff_t pos) |
diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c index 5bef1dcf18e3..57b9304d444c 100644 --- a/net/llc/sysctl_net_llc.c +++ b/net/llc/sysctl_net_llc.c | |||
@@ -20,8 +20,8 @@ static struct ctl_table llc2_timeout_table[] = { | |||
20 | .data = &sysctl_llc2_ack_timeout, | 20 | .data = &sysctl_llc2_ack_timeout, |
21 | .maxlen = sizeof(long), | 21 | .maxlen = sizeof(long), |
22 | .mode = 0644, | 22 | .mode = 0644, |
23 | .proc_handler = &proc_dointvec_jiffies, | 23 | .proc_handler = proc_dointvec_jiffies, |
24 | .strategy = &sysctl_jiffies, | 24 | .strategy = sysctl_jiffies, |
25 | }, | 25 | }, |
26 | { | 26 | { |
27 | .ctl_name = NET_LLC2_BUSY_TIMEOUT, | 27 | .ctl_name = NET_LLC2_BUSY_TIMEOUT, |
@@ -29,8 +29,8 @@ static struct ctl_table llc2_timeout_table[] = { | |||
29 | .data = &sysctl_llc2_busy_timeout, | 29 | .data = &sysctl_llc2_busy_timeout, |
30 | .maxlen = sizeof(long), | 30 | .maxlen = sizeof(long), |
31 | .mode = 0644, | 31 | .mode = 0644, |
32 | .proc_handler = &proc_dointvec_jiffies, | 32 | .proc_handler = proc_dointvec_jiffies, |
33 | .strategy = &sysctl_jiffies, | 33 | .strategy = sysctl_jiffies, |
34 | }, | 34 | }, |
35 | { | 35 | { |
36 | .ctl_name = NET_LLC2_P_TIMEOUT, | 36 | .ctl_name = NET_LLC2_P_TIMEOUT, |
@@ -38,8 +38,8 @@ static struct ctl_table llc2_timeout_table[] = { | |||
38 | .data = &sysctl_llc2_p_timeout, | 38 | .data = &sysctl_llc2_p_timeout, |
39 | .maxlen = sizeof(long), | 39 | .maxlen = sizeof(long), |
40 | .mode = 0644, | 40 | .mode = 0644, |
41 | .proc_handler = &proc_dointvec_jiffies, | 41 | .proc_handler = proc_dointvec_jiffies, |
42 | .strategy = &sysctl_jiffies, | 42 | .strategy = sysctl_jiffies, |
43 | }, | 43 | }, |
44 | { | 44 | { |
45 | .ctl_name = NET_LLC2_REJ_TIMEOUT, | 45 | .ctl_name = NET_LLC2_REJ_TIMEOUT, |
@@ -47,8 +47,8 @@ static struct ctl_table llc2_timeout_table[] = { | |||
47 | .data = &sysctl_llc2_rej_timeout, | 47 | .data = &sysctl_llc2_rej_timeout, |
48 | .maxlen = sizeof(long), | 48 | .maxlen = sizeof(long), |
49 | .mode = 0644, | 49 | .mode = 0644, |
50 | .proc_handler = &proc_dointvec_jiffies, | 50 | .proc_handler = proc_dointvec_jiffies, |
51 | .strategy = &sysctl_jiffies, | 51 | .strategy = sysctl_jiffies, |
52 | }, | 52 | }, |
53 | { 0 }, | 53 | { 0 }, |
54 | }; | 54 | }; |
@@ -60,8 +60,8 @@ static struct ctl_table llc_station_table[] = { | |||
60 | .data = &sysctl_llc_station_ack_timeout, | 60 | .data = &sysctl_llc_station_ack_timeout, |
61 | .maxlen = sizeof(long), | 61 | .maxlen = sizeof(long), |
62 | .mode = 0644, | 62 | .mode = 0644, |
63 | .proc_handler = &proc_dointvec_jiffies, | 63 | .proc_handler = proc_dointvec_jiffies, |
64 | .strategy = &sysctl_jiffies, | 64 | .strategy = sysctl_jiffies, |
65 | }, | 65 | }, |
66 | { 0 }, | 66 | { 0 }, |
67 | }; | 67 | }; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 855126a3039d..16423f94801b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -17,13 +17,6 @@ | |||
17 | #include "rate.h" | 17 | #include "rate.h" |
18 | #include "mesh.h" | 18 | #include "mesh.h" |
19 | 19 | ||
20 | struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy) | ||
21 | { | ||
22 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
23 | return &local->hw; | ||
24 | } | ||
25 | EXPORT_SYMBOL(wiphy_to_hw); | ||
26 | |||
27 | static bool nl80211_type_check(enum nl80211_iftype type) | 20 | static bool nl80211_type_check(enum nl80211_iftype type) |
28 | { | 21 | { |
29 | switch (type) { | 22 | switch (type) { |
@@ -33,6 +26,8 @@ static bool nl80211_type_check(enum nl80211_iftype type) | |||
33 | #ifdef CONFIG_MAC80211_MESH | 26 | #ifdef CONFIG_MAC80211_MESH |
34 | case NL80211_IFTYPE_MESH_POINT: | 27 | case NL80211_IFTYPE_MESH_POINT: |
35 | #endif | 28 | #endif |
29 | case NL80211_IFTYPE_AP: | ||
30 | case NL80211_IFTYPE_AP_VLAN: | ||
36 | case NL80211_IFTYPE_WDS: | 31 | case NL80211_IFTYPE_WDS: |
37 | return true; | 32 | return true; |
38 | default: | 33 | default: |
@@ -401,8 +396,8 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata, | |||
401 | */ | 396 | */ |
402 | if (params->interval) { | 397 | if (params->interval) { |
403 | sdata->local->hw.conf.beacon_int = params->interval; | 398 | sdata->local->hw.conf.beacon_int = params->interval; |
404 | if (ieee80211_hw_config(sdata->local)) | 399 | ieee80211_hw_config(sdata->local, |
405 | return -EINVAL; | 400 | IEEE80211_CONF_CHANGE_BEACON_INTERVAL); |
406 | /* | 401 | /* |
407 | * We updated some parameter so if below bails out | 402 | * We updated some parameter so if below bails out |
408 | * it's not an error. | 403 | * it's not an error. |
@@ -589,6 +584,8 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
589 | struct ieee80211_supported_band *sband; | 584 | struct ieee80211_supported_band *sband; |
590 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 585 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
591 | 586 | ||
587 | sband = local->hw.wiphy->bands[local->oper_channel->band]; | ||
588 | |||
592 | /* | 589 | /* |
593 | * FIXME: updating the flags is racy when this function is | 590 | * FIXME: updating the flags is racy when this function is |
594 | * called from ieee80211_change_station(), this will | 591 | * called from ieee80211_change_station(), this will |
@@ -629,7 +626,6 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
629 | 626 | ||
630 | if (params->supported_rates) { | 627 | if (params->supported_rates) { |
631 | rates = 0; | 628 | rates = 0; |
632 | sband = local->hw.wiphy->bands[local->oper_channel->band]; | ||
633 | 629 | ||
634 | for (i = 0; i < params->supported_rates_len; i++) { | 630 | for (i = 0; i < params->supported_rates_len; i++) { |
635 | int rate = (params->supported_rates[i] & 0x7f) * 5; | 631 | int rate = (params->supported_rates[i] & 0x7f) * 5; |
@@ -641,10 +637,10 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
641 | sta->sta.supp_rates[local->oper_channel->band] = rates; | 637 | sta->sta.supp_rates[local->oper_channel->band] = rates; |
642 | } | 638 | } |
643 | 639 | ||
644 | if (params->ht_capa) { | 640 | if (params->ht_capa) |
645 | ieee80211_ht_cap_ie_to_ht_info(params->ht_capa, | 641 | ieee80211_ht_cap_ie_to_sta_ht_cap(sband, |
646 | &sta->sta.ht_info); | 642 | params->ht_capa, |
647 | } | 643 | &sta->sta.ht_cap); |
648 | 644 | ||
649 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { | 645 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { |
650 | switch (params->plink_action) { | 646 | switch (params->plink_action) { |
@@ -957,6 +953,72 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
957 | rcu_read_unlock(); | 953 | rcu_read_unlock(); |
958 | return 0; | 954 | return 0; |
959 | } | 955 | } |
956 | |||
957 | static int ieee80211_get_mesh_params(struct wiphy *wiphy, | ||
958 | struct net_device *dev, | ||
959 | struct mesh_config *conf) | ||
960 | { | ||
961 | struct ieee80211_sub_if_data *sdata; | ||
962 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
963 | |||
964 | if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) | ||
965 | return -ENOTSUPP; | ||
966 | memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config)); | ||
967 | return 0; | ||
968 | } | ||
969 | |||
970 | static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask) | ||
971 | { | ||
972 | return (mask >> (parm-1)) & 0x1; | ||
973 | } | ||
974 | |||
975 | static int ieee80211_set_mesh_params(struct wiphy *wiphy, | ||
976 | struct net_device *dev, | ||
977 | const struct mesh_config *nconf, u32 mask) | ||
978 | { | ||
979 | struct mesh_config *conf; | ||
980 | struct ieee80211_sub_if_data *sdata; | ||
981 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
982 | |||
983 | if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) | ||
984 | return -ENOTSUPP; | ||
985 | |||
986 | /* Set the config options which we are interested in setting */ | ||
987 | conf = &(sdata->u.mesh.mshcfg); | ||
988 | if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask)) | ||
989 | conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout; | ||
990 | if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask)) | ||
991 | conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout; | ||
992 | if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask)) | ||
993 | conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout; | ||
994 | if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask)) | ||
995 | conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks; | ||
996 | if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask)) | ||
997 | conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; | ||
998 | if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) | ||
999 | conf->dot11MeshTTL = nconf->dot11MeshTTL; | ||
1000 | if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) | ||
1001 | conf->auto_open_plinks = nconf->auto_open_plinks; | ||
1002 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) | ||
1003 | conf->dot11MeshHWMPmaxPREQretries = | ||
1004 | nconf->dot11MeshHWMPmaxPREQretries; | ||
1005 | if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask)) | ||
1006 | conf->path_refresh_time = nconf->path_refresh_time; | ||
1007 | if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask)) | ||
1008 | conf->min_discovery_timeout = nconf->min_discovery_timeout; | ||
1009 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask)) | ||
1010 | conf->dot11MeshHWMPactivePathTimeout = | ||
1011 | nconf->dot11MeshHWMPactivePathTimeout; | ||
1012 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask)) | ||
1013 | conf->dot11MeshHWMPpreqMinInterval = | ||
1014 | nconf->dot11MeshHWMPpreqMinInterval; | ||
1015 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | ||
1016 | mask)) | ||
1017 | conf->dot11MeshHWMPnetDiameterTraversalTime = | ||
1018 | nconf->dot11MeshHWMPnetDiameterTraversalTime; | ||
1019 | return 0; | ||
1020 | } | ||
1021 | |||
960 | #endif | 1022 | #endif |
961 | 1023 | ||
962 | static int ieee80211_change_bss(struct wiphy *wiphy, | 1024 | static int ieee80211_change_bss(struct wiphy *wiphy, |
@@ -972,25 +1034,67 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
972 | return -EINVAL; | 1034 | return -EINVAL; |
973 | 1035 | ||
974 | if (params->use_cts_prot >= 0) { | 1036 | if (params->use_cts_prot >= 0) { |
975 | sdata->bss_conf.use_cts_prot = params->use_cts_prot; | 1037 | sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; |
976 | changed |= BSS_CHANGED_ERP_CTS_PROT; | 1038 | changed |= BSS_CHANGED_ERP_CTS_PROT; |
977 | } | 1039 | } |
978 | if (params->use_short_preamble >= 0) { | 1040 | if (params->use_short_preamble >= 0) { |
979 | sdata->bss_conf.use_short_preamble = | 1041 | sdata->vif.bss_conf.use_short_preamble = |
980 | params->use_short_preamble; | 1042 | params->use_short_preamble; |
981 | changed |= BSS_CHANGED_ERP_PREAMBLE; | 1043 | changed |= BSS_CHANGED_ERP_PREAMBLE; |
982 | } | 1044 | } |
983 | if (params->use_short_slot_time >= 0) { | 1045 | if (params->use_short_slot_time >= 0) { |
984 | sdata->bss_conf.use_short_slot = | 1046 | sdata->vif.bss_conf.use_short_slot = |
985 | params->use_short_slot_time; | 1047 | params->use_short_slot_time; |
986 | changed |= BSS_CHANGED_ERP_SLOT; | 1048 | changed |= BSS_CHANGED_ERP_SLOT; |
987 | } | 1049 | } |
988 | 1050 | ||
1051 | if (params->basic_rates) { | ||
1052 | int i, j; | ||
1053 | u32 rates = 0; | ||
1054 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1055 | struct ieee80211_supported_band *sband = | ||
1056 | wiphy->bands[local->oper_channel->band]; | ||
1057 | |||
1058 | for (i = 0; i < params->basic_rates_len; i++) { | ||
1059 | int rate = (params->basic_rates[i] & 0x7f) * 5; | ||
1060 | for (j = 0; j < sband->n_bitrates; j++) { | ||
1061 | if (sband->bitrates[j].bitrate == rate) | ||
1062 | rates |= BIT(j); | ||
1063 | } | ||
1064 | } | ||
1065 | sdata->vif.bss_conf.basic_rates = rates; | ||
1066 | changed |= BSS_CHANGED_BASIC_RATES; | ||
1067 | } | ||
1068 | |||
989 | ieee80211_bss_info_change_notify(sdata, changed); | 1069 | ieee80211_bss_info_change_notify(sdata, changed); |
990 | 1070 | ||
991 | return 0; | 1071 | return 0; |
992 | } | 1072 | } |
993 | 1073 | ||
1074 | static int ieee80211_set_txq_params(struct wiphy *wiphy, | ||
1075 | struct ieee80211_txq_params *params) | ||
1076 | { | ||
1077 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1078 | struct ieee80211_tx_queue_params p; | ||
1079 | |||
1080 | if (!local->ops->conf_tx) | ||
1081 | return -EOPNOTSUPP; | ||
1082 | |||
1083 | memset(&p, 0, sizeof(p)); | ||
1084 | p.aifs = params->aifs; | ||
1085 | p.cw_max = params->cwmax; | ||
1086 | p.cw_min = params->cwmin; | ||
1087 | p.txop = params->txop; | ||
1088 | if (local->ops->conf_tx(local_to_hw(local), params->queue, &p)) { | ||
1089 | printk(KERN_DEBUG "%s: failed to set TX queue " | ||
1090 | "parameters for queue %d\n", local->mdev->name, | ||
1091 | params->queue); | ||
1092 | return -EINVAL; | ||
1093 | } | ||
1094 | |||
1095 | return 0; | ||
1096 | } | ||
1097 | |||
994 | struct cfg80211_ops mac80211_config_ops = { | 1098 | struct cfg80211_ops mac80211_config_ops = { |
995 | .add_virtual_intf = ieee80211_add_iface, | 1099 | .add_virtual_intf = ieee80211_add_iface, |
996 | .del_virtual_intf = ieee80211_del_iface, | 1100 | .del_virtual_intf = ieee80211_del_iface, |
@@ -1013,6 +1117,9 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1013 | .change_mpath = ieee80211_change_mpath, | 1117 | .change_mpath = ieee80211_change_mpath, |
1014 | .get_mpath = ieee80211_get_mpath, | 1118 | .get_mpath = ieee80211_get_mpath, |
1015 | .dump_mpath = ieee80211_dump_mpath, | 1119 | .dump_mpath = ieee80211_dump_mpath, |
1120 | .set_mesh_params = ieee80211_set_mesh_params, | ||
1121 | .get_mesh_params = ieee80211_get_mesh_params, | ||
1016 | #endif | 1122 | #endif |
1017 | .change_bss = ieee80211_change_bss, | 1123 | .change_bss = ieee80211_change_bss, |
1124 | .set_txq_params = ieee80211_set_txq_params, | ||
1018 | }; | 1125 | }; |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index 24ce54463310..2697a2fe608f 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -47,18 +47,14 @@ static const struct file_operations name## _ops = { \ | |||
47 | 47 | ||
48 | DEBUGFS_READONLY_FILE(frequency, 20, "%d", | 48 | DEBUGFS_READONLY_FILE(frequency, 20, "%d", |
49 | local->hw.conf.channel->center_freq); | 49 | local->hw.conf.channel->center_freq); |
50 | DEBUGFS_READONLY_FILE(antenna_sel_tx, 20, "%d", | ||
51 | local->hw.conf.antenna_sel_tx); | ||
52 | DEBUGFS_READONLY_FILE(antenna_sel_rx, 20, "%d", | ||
53 | local->hw.conf.antenna_sel_rx); | ||
54 | DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", | 50 | DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", |
55 | local->rts_threshold); | 51 | local->rts_threshold); |
56 | DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", | 52 | DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", |
57 | local->fragmentation_threshold); | 53 | local->fragmentation_threshold); |
58 | DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d", | 54 | DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d", |
59 | local->short_retry_limit); | 55 | local->hw.conf.short_frame_max_tx_count); |
60 | DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", | 56 | DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", |
61 | local->long_retry_limit); | 57 | local->hw.conf.long_frame_max_tx_count); |
62 | DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", | 58 | DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", |
63 | local->total_ps_buffered); | 59 | local->total_ps_buffered); |
64 | DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x", | 60 | DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x", |
@@ -202,8 +198,6 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
202 | local->debugfs.keys = debugfs_create_dir("keys", phyd); | 198 | local->debugfs.keys = debugfs_create_dir("keys", phyd); |
203 | 199 | ||
204 | DEBUGFS_ADD(frequency); | 200 | DEBUGFS_ADD(frequency); |
205 | DEBUGFS_ADD(antenna_sel_tx); | ||
206 | DEBUGFS_ADD(antenna_sel_rx); | ||
207 | DEBUGFS_ADD(rts_threshold); | 201 | DEBUGFS_ADD(rts_threshold); |
208 | DEBUGFS_ADD(fragmentation_threshold); | 202 | DEBUGFS_ADD(fragmentation_threshold); |
209 | DEBUGFS_ADD(short_retry_limit); | 203 | DEBUGFS_ADD(short_retry_limit); |
@@ -258,8 +252,6 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
258 | void debugfs_hw_del(struct ieee80211_local *local) | 252 | void debugfs_hw_del(struct ieee80211_local *local) |
259 | { | 253 | { |
260 | DEBUGFS_DEL(frequency); | 254 | DEBUGFS_DEL(frequency); |
261 | DEBUGFS_DEL(antenna_sel_tx); | ||
262 | DEBUGFS_DEL(antenna_sel_rx); | ||
263 | DEBUGFS_DEL(rts_threshold); | 255 | DEBUGFS_DEL(rts_threshold); |
264 | DEBUGFS_DEL(fragmentation_threshold); | 256 | DEBUGFS_DEL(fragmentation_threshold); |
265 | DEBUGFS_DEL(short_retry_limit); | 257 | DEBUGFS_DEL(short_retry_limit); |
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..c54219301724 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -41,29 +41,6 @@ static ssize_t ieee80211_if_read( | |||
41 | return ret; | 41 | return ret; |
42 | } | 42 | } |
43 | 43 | ||
44 | #ifdef CONFIG_MAC80211_MESH | ||
45 | static ssize_t ieee80211_if_write( | ||
46 | struct ieee80211_sub_if_data *sdata, | ||
47 | char const __user *userbuf, | ||
48 | size_t count, loff_t *ppos, | ||
49 | int (*format)(struct ieee80211_sub_if_data *, char *)) | ||
50 | { | ||
51 | char buf[10]; | ||
52 | int buf_size; | ||
53 | |||
54 | memset(buf, 0x00, sizeof(buf)); | ||
55 | buf_size = min(count, (sizeof(buf)-1)); | ||
56 | if (copy_from_user(buf, userbuf, buf_size)) | ||
57 | return count; | ||
58 | read_lock(&dev_base_lock); | ||
59 | if (sdata->dev->reg_state == NETREG_REGISTERED) | ||
60 | (*format)(sdata, buf); | ||
61 | read_unlock(&dev_base_lock); | ||
62 | |||
63 | return count; | ||
64 | } | ||
65 | #endif | ||
66 | |||
67 | #define IEEE80211_IF_FMT(name, field, format_string) \ | 44 | #define IEEE80211_IF_FMT(name, field, format_string) \ |
68 | static ssize_t ieee80211_if_fmt_##name( \ | 45 | static ssize_t ieee80211_if_fmt_##name( \ |
69 | const struct ieee80211_sub_if_data *sdata, char *buf, \ | 46 | const struct ieee80211_sub_if_data *sdata, char *buf, \ |
@@ -71,19 +48,6 @@ static ssize_t ieee80211_if_fmt_##name( \ | |||
71 | { \ | 48 | { \ |
72 | return scnprintf(buf, buflen, format_string, sdata->field); \ | 49 | return scnprintf(buf, buflen, format_string, sdata->field); \ |
73 | } | 50 | } |
74 | #define IEEE80211_IF_WFMT(name, field, type) \ | ||
75 | static int ieee80211_if_wfmt_##name( \ | ||
76 | struct ieee80211_sub_if_data *sdata, char *buf) \ | ||
77 | { \ | ||
78 | unsigned long tmp; \ | ||
79 | char *endp; \ | ||
80 | \ | ||
81 | tmp = simple_strtoul(buf, &endp, 0); \ | ||
82 | if ((endp == buf) || ((type)tmp != tmp)) \ | ||
83 | return -EINVAL; \ | ||
84 | sdata->field = tmp; \ | ||
85 | return 0; \ | ||
86 | } | ||
87 | #define IEEE80211_IF_FMT_DEC(name, field) \ | 51 | #define IEEE80211_IF_FMT_DEC(name, field) \ |
88 | IEEE80211_IF_FMT(name, field, "%d\n") | 52 | IEEE80211_IF_FMT(name, field, "%d\n") |
89 | #define IEEE80211_IF_FMT_HEX(name, field) \ | 53 | #define IEEE80211_IF_FMT_HEX(name, field) \ |
@@ -104,8 +68,7 @@ static ssize_t ieee80211_if_fmt_##name( \ | |||
104 | const struct ieee80211_sub_if_data *sdata, char *buf, \ | 68 | const struct ieee80211_sub_if_data *sdata, char *buf, \ |
105 | int buflen) \ | 69 | int buflen) \ |
106 | { \ | 70 | { \ |
107 | DECLARE_MAC_BUF(mac); \ | 71 | return scnprintf(buf, buflen, "%pM\n", sdata->field); \ |
108 | return scnprintf(buf, buflen, "%s\n", print_mac(mac, sdata->field));\ | ||
109 | } | 72 | } |
110 | 73 | ||
111 | #define __IEEE80211_IF_FILE(name) \ | 74 | #define __IEEE80211_IF_FILE(name) \ |
@@ -126,34 +89,6 @@ static const struct file_operations name##_ops = { \ | |||
126 | IEEE80211_IF_FMT_##format(name, field) \ | 89 | IEEE80211_IF_FMT_##format(name, field) \ |
127 | __IEEE80211_IF_FILE(name) | 90 | __IEEE80211_IF_FILE(name) |
128 | 91 | ||
129 | #define __IEEE80211_IF_WFILE(name) \ | ||
130 | static ssize_t ieee80211_if_read_##name(struct file *file, \ | ||
131 | char __user *userbuf, \ | ||
132 | size_t count, loff_t *ppos) \ | ||
133 | { \ | ||
134 | return ieee80211_if_read(file->private_data, \ | ||
135 | userbuf, count, ppos, \ | ||
136 | ieee80211_if_fmt_##name); \ | ||
137 | } \ | ||
138 | static ssize_t ieee80211_if_write_##name(struct file *file, \ | ||
139 | const char __user *userbuf, \ | ||
140 | size_t count, loff_t *ppos) \ | ||
141 | { \ | ||
142 | return ieee80211_if_write(file->private_data, \ | ||
143 | userbuf, count, ppos, \ | ||
144 | ieee80211_if_wfmt_##name); \ | ||
145 | } \ | ||
146 | static const struct file_operations name##_ops = { \ | ||
147 | .read = ieee80211_if_read_##name, \ | ||
148 | .write = ieee80211_if_write_##name, \ | ||
149 | .open = mac80211_open_file_generic, \ | ||
150 | } | ||
151 | |||
152 | #define IEEE80211_IF_WFILE(name, field, format, type) \ | ||
153 | IEEE80211_IF_FMT_##format(name, field) \ | ||
154 | IEEE80211_IF_WFMT(name, field, type) \ | ||
155 | __IEEE80211_IF_WFILE(name) | ||
156 | |||
157 | /* common attributes */ | 92 | /* common attributes */ |
158 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); | 93 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); |
159 | IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC); | 94 | IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC); |
@@ -184,7 +119,7 @@ static ssize_t ieee80211_if_fmt_flags( | |||
184 | sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", | 119 | sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", |
185 | sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", | 120 | sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", |
186 | sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", | 121 | sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", |
187 | sdata->bss_conf.use_cts_prot ? "CTS prot\n" : ""); | 122 | sdata->vif.bss_conf.use_cts_prot ? "CTS prot\n" : ""); |
188 | } | 123 | } |
189 | __IEEE80211_IF_FILE(flags); | 124 | __IEEE80211_IF_FILE(flags); |
190 | 125 | ||
@@ -212,30 +147,30 @@ IEEE80211_IF_FILE(dropped_frames_no_route, | |||
212 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); | 147 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); |
213 | 148 | ||
214 | /* Mesh parameters */ | 149 | /* Mesh parameters */ |
215 | IEEE80211_IF_WFILE(dot11MeshMaxRetries, | 150 | IEEE80211_IF_FILE(dot11MeshMaxRetries, |
216 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC, u8); | 151 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC); |
217 | IEEE80211_IF_WFILE(dot11MeshRetryTimeout, | 152 | IEEE80211_IF_FILE(dot11MeshRetryTimeout, |
218 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC, u16); | 153 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC); |
219 | IEEE80211_IF_WFILE(dot11MeshConfirmTimeout, | 154 | IEEE80211_IF_FILE(dot11MeshConfirmTimeout, |
220 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC, u16); | 155 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC); |
221 | IEEE80211_IF_WFILE(dot11MeshHoldingTimeout, | 156 | IEEE80211_IF_FILE(dot11MeshHoldingTimeout, |
222 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC, u16); | 157 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); |
223 | IEEE80211_IF_WFILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC, u8); | 158 | IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); |
224 | IEEE80211_IF_WFILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC, u8); | 159 | IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); |
225 | IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks, | 160 | IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, |
226 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC, u16); | 161 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); |
227 | IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout, | 162 | IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout, |
228 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32); | 163 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC); |
229 | IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval, | 164 | IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval, |
230 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16); | 165 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC); |
231 | IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime, | 166 | IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime, |
232 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16); | 167 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC); |
233 | IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries, | 168 | IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries, |
234 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8); | 169 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC); |
235 | IEEE80211_IF_WFILE(path_refresh_time, | 170 | IEEE80211_IF_FILE(path_refresh_time, |
236 | u.mesh.mshcfg.path_refresh_time, DEC, u32); | 171 | u.mesh.mshcfg.path_refresh_time, DEC); |
237 | IEEE80211_IF_WFILE(min_discovery_timeout, | 172 | IEEE80211_IF_FILE(min_discovery_timeout, |
238 | u.mesh.mshcfg.min_discovery_timeout, DEC, u16); | 173 | u.mesh.mshcfg.min_discovery_timeout, DEC); |
239 | #endif | 174 | #endif |
240 | 175 | ||
241 | 176 | ||
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index b85c4f27b361..a2fbe0131312 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -39,13 +39,6 @@ static const struct file_operations sta_ ##name## _ops = { \ | |||
39 | .open = mac80211_open_file_generic, \ | 39 | .open = mac80211_open_file_generic, \ |
40 | } | 40 | } |
41 | 41 | ||
42 | #define STA_OPS_WR(name) \ | ||
43 | static const struct file_operations sta_ ##name## _ops = { \ | ||
44 | .read = sta_##name##_read, \ | ||
45 | .write = sta_##name##_write, \ | ||
46 | .open = mac80211_open_file_generic, \ | ||
47 | } | ||
48 | |||
49 | #define STA_FILE(name, field, format) \ | 42 | #define STA_FILE(name, field, format) \ |
50 | STA_READ_##format(name, field) \ | 43 | STA_READ_##format(name, field) \ |
51 | STA_OPS(name) | 44 | STA_OPS(name) |
@@ -144,7 +137,7 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | |||
144 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); | 137 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); |
145 | for (i = 0; i < STA_TID_NUM; i++) | 138 | for (i = 0; i < STA_TID_NUM; i++) |
146 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", | 139 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", |
147 | sta->ampdu_mlme.tid_state_rx[i]? | 140 | sta->ampdu_mlme.tid_state_rx[i] ? |
148 | sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); | 141 | sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); |
149 | 142 | ||
150 | p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :"); | 143 | p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :"); |
@@ -155,84 +148,20 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | |||
155 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); | 148 | p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:"); |
156 | for (i = 0; i < STA_TID_NUM; i++) | 149 | for (i = 0; i < STA_TID_NUM; i++) |
157 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", | 150 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", |
158 | sta->ampdu_mlme.tid_state_tx[i]? | 151 | sta->ampdu_mlme.tid_state_tx[i] ? |
159 | sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); | 152 | sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); |
160 | 153 | ||
161 | p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :"); | 154 | p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :"); |
162 | for (i = 0; i < STA_TID_NUM; i++) | 155 | for (i = 0; i < STA_TID_NUM; i++) |
163 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", | 156 | p += scnprintf(p, sizeof(buf)+buf-p, "%5d", |
164 | sta->ampdu_mlme.tid_state_tx[i]? | 157 | sta->ampdu_mlme.tid_state_tx[i] ? |
165 | sta->ampdu_mlme.tid_tx[i]->ssn : 0); | 158 | sta->ampdu_mlme.tid_tx[i]->ssn : 0); |
166 | 159 | ||
167 | p += scnprintf(p, sizeof(buf)+buf-p, "\n"); | 160 | p += scnprintf(p, sizeof(buf)+buf-p, "\n"); |
168 | 161 | ||
169 | return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); | 162 | return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); |
170 | } | 163 | } |
171 | 164 | STA_OPS(agg_status); | |
172 | static ssize_t sta_agg_status_write(struct file *file, | ||
173 | const char __user *user_buf, size_t count, loff_t *ppos) | ||
174 | { | ||
175 | struct sta_info *sta = file->private_data; | ||
176 | struct ieee80211_local *local = sta->sdata->local; | ||
177 | struct ieee80211_hw *hw = &local->hw; | ||
178 | u8 *da = sta->sta.addr; | ||
179 | static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0, | ||
180 | 0, 0, 0, 0, 0, 0, 0, 0}; | ||
181 | static int tid_static_rx[16] = {1, 1, 1, 1, 1, 1, 1, 1, | ||
182 | 1, 1, 1, 1, 1, 1, 1, 1}; | ||
183 | char *endp; | ||
184 | char buf[32]; | ||
185 | int buf_size, rs; | ||
186 | unsigned int tid_num; | ||
187 | char state[4]; | ||
188 | |||
189 | memset(buf, 0x00, sizeof(buf)); | ||
190 | buf_size = min(count, (sizeof(buf)-1)); | ||
191 | if (copy_from_user(buf, user_buf, buf_size)) | ||
192 | return -EFAULT; | ||
193 | |||
194 | tid_num = simple_strtoul(buf, &endp, 0); | ||
195 | if (endp == buf) | ||
196 | return -EINVAL; | ||
197 | |||
198 | if ((tid_num >= 100) && (tid_num <= 115)) { | ||
199 | /* toggle Rx aggregation command */ | ||
200 | tid_num = tid_num - 100; | ||
201 | if (tid_static_rx[tid_num] == 1) { | ||
202 | strcpy(state, "off"); | ||
203 | ieee80211_sta_stop_rx_ba_session(sta->sdata, da, tid_num, 0, | ||
204 | WLAN_REASON_QSTA_REQUIRE_SETUP); | ||
205 | sta->ampdu_mlme.tid_state_rx[tid_num] |= | ||
206 | HT_AGG_STATE_DEBUGFS_CTL; | ||
207 | tid_static_rx[tid_num] = 0; | ||
208 | } else { | ||
209 | strcpy(state, "on "); | ||
210 | sta->ampdu_mlme.tid_state_rx[tid_num] &= | ||
211 | ~HT_AGG_STATE_DEBUGFS_CTL; | ||
212 | tid_static_rx[tid_num] = 1; | ||
213 | } | ||
214 | printk(KERN_DEBUG "debugfs - try switching tid %u %s\n", | ||
215 | tid_num, state); | ||
216 | } else if ((tid_num >= 0) && (tid_num <= 15)) { | ||
217 | /* toggle Tx aggregation command */ | ||
218 | if (tid_static_tx[tid_num] == 0) { | ||
219 | strcpy(state, "on "); | ||
220 | rs = ieee80211_start_tx_ba_session(hw, da, tid_num); | ||
221 | if (rs == 0) | ||
222 | tid_static_tx[tid_num] = 1; | ||
223 | } else { | ||
224 | strcpy(state, "off"); | ||
225 | rs = ieee80211_stop_tx_ba_session(hw, da, tid_num, 1); | ||
226 | if (rs == 0) | ||
227 | tid_static_tx[tid_num] = 0; | ||
228 | } | ||
229 | printk(KERN_DEBUG "debugfs - switching tid %u %s, return=%d\n", | ||
230 | tid_num, state, rs); | ||
231 | } | ||
232 | |||
233 | return count; | ||
234 | } | ||
235 | STA_OPS_WR(agg_status); | ||
236 | 165 | ||
237 | #define DEBUGFS_ADD(name) \ | 166 | #define DEBUGFS_ADD(name) \ |
238 | sta->debugfs.name = debugfs_create_file(#name, 0400, \ | 167 | sta->debugfs.name = debugfs_create_file(#name, 0400, \ |
@@ -246,15 +175,14 @@ STA_OPS_WR(agg_status); | |||
246 | void ieee80211_sta_debugfs_add(struct sta_info *sta) | 175 | void ieee80211_sta_debugfs_add(struct sta_info *sta) |
247 | { | 176 | { |
248 | struct dentry *stations_dir = sta->local->debugfs.stations; | 177 | struct dentry *stations_dir = sta->local->debugfs.stations; |
249 | DECLARE_MAC_BUF(mbuf); | 178 | u8 mac[3*ETH_ALEN]; |
250 | u8 *mac; | ||
251 | 179 | ||
252 | sta->debugfs.add_has_run = true; | 180 | sta->debugfs.add_has_run = true; |
253 | 181 | ||
254 | if (!stations_dir) | 182 | if (!stations_dir) |
255 | return; | 183 | return; |
256 | 184 | ||
257 | mac = print_mac(mbuf, sta->sta.addr); | 185 | snprintf(mac, sizeof(mac), "%pM", sta->sta.addr); |
258 | 186 | ||
259 | /* | 187 | /* |
260 | * This might fail due to a race condition: | 188 | * 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..3e231d756776 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -20,50 +20,125 @@ | |||
20 | #include "sta_info.h" | 20 | #include "sta_info.h" |
21 | #include "wme.h" | 21 | #include "wme.h" |
22 | 22 | ||
23 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, | 23 | void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, |
24 | struct ieee80211_ht_info *ht_info) | 24 | struct ieee80211_ht_cap *ht_cap_ie, |
25 | struct ieee80211_sta_ht_cap *ht_cap) | ||
25 | { | 26 | { |
27 | u8 ampdu_info, tx_mcs_set_cap; | ||
28 | int i, max_tx_streams; | ||
26 | 29 | ||
27 | if (ht_info == NULL) | 30 | BUG_ON(!ht_cap); |
28 | return -EINVAL; | 31 | |
32 | memset(ht_cap, 0, sizeof(*ht_cap)); | ||
33 | |||
34 | if (!ht_cap_ie) | ||
35 | return; | ||
29 | 36 | ||
30 | memset(ht_info, 0, sizeof(*ht_info)); | 37 | ht_cap->ht_supported = true; |
31 | 38 | ||
32 | if (ht_cap_ie) { | 39 | ht_cap->cap = ht_cap->cap & sband->ht_cap.cap; |
33 | u8 ampdu_info = ht_cap_ie->ampdu_params_info; | 40 | ht_cap->cap &= ~IEEE80211_HT_CAP_SM_PS; |
41 | ht_cap->cap |= sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS; | ||
34 | 42 | ||
35 | ht_info->ht_supported = 1; | 43 | ampdu_info = ht_cap_ie->ampdu_params_info; |
36 | ht_info->cap = le16_to_cpu(ht_cap_ie->cap_info); | 44 | ht_cap->ampdu_factor = |
37 | ht_info->ampdu_factor = | 45 | ampdu_info & IEEE80211_HT_AMPDU_PARM_FACTOR; |
38 | ampdu_info & IEEE80211_HT_CAP_AMPDU_FACTOR; | 46 | ht_cap->ampdu_density = |
39 | ht_info->ampdu_density = | 47 | (ampdu_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> 2; |
40 | (ampdu_info & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2; | ||
41 | memcpy(ht_info->supp_mcs_set, ht_cap_ie->supp_mcs_set, 16); | ||
42 | } else | ||
43 | ht_info->ht_supported = 0; | ||
44 | 48 | ||
45 | return 0; | 49 | /* own MCS TX capabilities */ |
50 | tx_mcs_set_cap = sband->ht_cap.mcs.tx_params; | ||
51 | |||
52 | /* can we TX with MCS rates? */ | ||
53 | if (!(tx_mcs_set_cap & IEEE80211_HT_MCS_TX_DEFINED)) | ||
54 | return; | ||
55 | |||
56 | /* Counting from 0, therefore +1 */ | ||
57 | if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_RX_DIFF) | ||
58 | max_tx_streams = | ||
59 | ((tx_mcs_set_cap & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK) | ||
60 | >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1; | ||
61 | else | ||
62 | max_tx_streams = IEEE80211_HT_MCS_TX_MAX_STREAMS; | ||
63 | |||
64 | /* | ||
65 | * 802.11n D5.0 20.3.5 / 20.6 says: | ||
66 | * - indices 0 to 7 and 32 are single spatial stream | ||
67 | * - 8 to 31 are multiple spatial streams using equal modulation | ||
68 | * [8..15 for two streams, 16..23 for three and 24..31 for four] | ||
69 | * - remainder are multiple spatial streams using unequal modulation | ||
70 | */ | ||
71 | for (i = 0; i < max_tx_streams; i++) | ||
72 | ht_cap->mcs.rx_mask[i] = | ||
73 | sband->ht_cap.mcs.rx_mask[i] & ht_cap_ie->mcs.rx_mask[i]; | ||
74 | |||
75 | if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION) | ||
76 | for (i = IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE; | ||
77 | i < IEEE80211_HT_MCS_MASK_LEN; i++) | ||
78 | ht_cap->mcs.rx_mask[i] = | ||
79 | sband->ht_cap.mcs.rx_mask[i] & | ||
80 | ht_cap_ie->mcs.rx_mask[i]; | ||
81 | |||
82 | /* handle MCS rate 32 too */ | ||
83 | if (sband->ht_cap.mcs.rx_mask[32/8] & ht_cap_ie->mcs.rx_mask[32/8] & 1) | ||
84 | ht_cap->mcs.rx_mask[32/8] |= 1; | ||
46 | } | 85 | } |
47 | 86 | ||
48 | int ieee80211_ht_addt_info_ie_to_ht_bss_info( | 87 | /* |
49 | struct ieee80211_ht_addt_info *ht_add_info_ie, | 88 | * ieee80211_enable_ht should be called only after the operating band |
50 | struct ieee80211_ht_bss_info *bss_info) | 89 | * has been determined as ht configuration depends on the hw's |
90 | * HT abilities for a specific band. | ||
91 | */ | ||
92 | u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | ||
93 | struct ieee80211_ht_info *hti, | ||
94 | u16 ap_ht_cap_flags) | ||
51 | { | 95 | { |
52 | if (bss_info == NULL) | 96 | struct ieee80211_local *local = sdata->local; |
53 | return -EINVAL; | 97 | struct ieee80211_supported_band *sband; |
98 | struct ieee80211_bss_ht_conf ht; | ||
99 | u32 changed = 0; | ||
100 | bool enable_ht = true, ht_changed; | ||
101 | |||
102 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
54 | 103 | ||
55 | memset(bss_info, 0, sizeof(*bss_info)); | 104 | memset(&ht, 0, sizeof(ht)); |
56 | 105 | ||
57 | if (ht_add_info_ie) { | 106 | /* HT is not supported */ |
58 | u16 op_mode; | 107 | if (!sband->ht_cap.ht_supported) |
59 | op_mode = le16_to_cpu(ht_add_info_ie->operation_mode); | 108 | enable_ht = false; |
60 | 109 | ||
61 | bss_info->primary_channel = ht_add_info_ie->control_chan; | 110 | /* check that channel matches the right operating channel */ |
62 | bss_info->bss_cap = ht_add_info_ie->ht_param; | 111 | if (local->hw.conf.channel->center_freq != |
63 | bss_info->bss_op_mode = (u8)(op_mode & 0xff); | 112 | ieee80211_channel_to_frequency(hti->control_chan)) |
113 | enable_ht = false; | ||
114 | |||
115 | /* | ||
116 | * XXX: This is totally incorrect when there are multiple virtual | ||
117 | * interfaces, needs to be fixed later. | ||
118 | */ | ||
119 | ht_changed = local->hw.conf.ht.enabled != enable_ht; | ||
120 | local->hw.conf.ht.enabled = enable_ht; | ||
121 | if (ht_changed) | ||
122 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_HT); | ||
123 | |||
124 | /* disable HT */ | ||
125 | if (!enable_ht) | ||
126 | return 0; | ||
127 | ht.secondary_channel_offset = | ||
128 | hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET; | ||
129 | ht.width_40_ok = | ||
130 | !(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) && | ||
131 | (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && | ||
132 | (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY); | ||
133 | ht.operation_mode = le16_to_cpu(hti->operation_mode); | ||
134 | |||
135 | /* if bss configuration changed store the new one */ | ||
136 | if (memcmp(&sdata->vif.bss_conf.ht, &ht, sizeof(ht))) { | ||
137 | changed |= BSS_CHANGED_HT; | ||
138 | sdata->vif.bss_conf.ht = ht; | ||
64 | } | 139 | } |
65 | 140 | ||
66 | return 0; | 141 | return changed; |
67 | } | 142 | } |
68 | 143 | ||
69 | static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, | 144 | static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, |
@@ -241,7 +316,6 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r | |||
241 | struct ieee80211_hw *hw = &local->hw; | 316 | struct ieee80211_hw *hw = &local->hw; |
242 | struct sta_info *sta; | 317 | struct sta_info *sta; |
243 | int ret, i; | 318 | int ret, i; |
244 | DECLARE_MAC_BUF(mac); | ||
245 | 319 | ||
246 | rcu_read_lock(); | 320 | rcu_read_lock(); |
247 | 321 | ||
@@ -269,8 +343,8 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r | |||
269 | BUG_ON(!local->ops->ampdu_action); | 343 | BUG_ON(!local->ops->ampdu_action); |
270 | 344 | ||
271 | #ifdef CONFIG_MAC80211_HT_DEBUG | 345 | #ifdef CONFIG_MAC80211_HT_DEBUG |
272 | printk(KERN_DEBUG "Rx BA session stop requested for %s tid %u\n", | 346 | printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n", |
273 | print_mac(mac, ra), tid); | 347 | ra, tid); |
274 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 348 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
275 | 349 | ||
276 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, | 350 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, |
@@ -383,14 +457,13 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
383 | u16 start_seq_num; | 457 | u16 start_seq_num; |
384 | u8 *state; | 458 | u8 *state; |
385 | int ret; | 459 | int ret; |
386 | DECLARE_MAC_BUF(mac); | ||
387 | 460 | ||
388 | if (tid >= STA_TID_NUM) | 461 | if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) |
389 | return -EINVAL; | 462 | return -EINVAL; |
390 | 463 | ||
391 | #ifdef CONFIG_MAC80211_HT_DEBUG | 464 | #ifdef CONFIG_MAC80211_HT_DEBUG |
392 | printk(KERN_DEBUG "Open BA session requested for %s tid %u\n", | 465 | printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n", |
393 | print_mac(mac, ra), tid); | 466 | ra, tid); |
394 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 467 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
395 | 468 | ||
396 | rcu_read_lock(); | 469 | rcu_read_lock(); |
@@ -442,17 +515,19 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
442 | (unsigned long)&sta->timer_to_tid[tid]; | 515 | (unsigned long)&sta->timer_to_tid[tid]; |
443 | init_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | 516 | init_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); |
444 | 517 | ||
445 | /* create a new queue for this aggregation */ | 518 | if (hw->ampdu_queues) { |
446 | ret = ieee80211_ht_agg_queue_add(local, sta, tid); | 519 | /* create a new queue for this aggregation */ |
520 | ret = ieee80211_ht_agg_queue_add(local, sta, tid); | ||
447 | 521 | ||
448 | /* case no queue is available to aggregation | 522 | /* case no queue is available to aggregation |
449 | * don't switch to aggregation */ | 523 | * don't switch to aggregation */ |
450 | if (ret) { | 524 | if (ret) { |
451 | #ifdef CONFIG_MAC80211_HT_DEBUG | 525 | #ifdef CONFIG_MAC80211_HT_DEBUG |
452 | printk(KERN_DEBUG "BA request denied - queue unavailable for" | 526 | printk(KERN_DEBUG "BA request denied - " |
453 | " tid %d\n", tid); | 527 | "queue unavailable for tid %d\n", tid); |
454 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 528 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
455 | goto err_unlock_queue; | 529 | goto err_unlock_queue; |
530 | } | ||
456 | } | 531 | } |
457 | sdata = sta->sdata; | 532 | sdata = sta->sdata; |
458 | 533 | ||
@@ -471,7 +546,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
471 | /* No need to requeue the packets in the agg queue, since we | 546 | /* No need to requeue the packets in the agg queue, since we |
472 | * held the tx lock: no packet could be enqueued to the newly | 547 | * held the tx lock: no packet could be enqueued to the newly |
473 | * allocated queue */ | 548 | * allocated queue */ |
474 | ieee80211_ht_agg_queue_remove(local, sta, tid, 0); | 549 | if (hw->ampdu_queues) |
550 | ieee80211_ht_agg_queue_remove(local, sta, tid, 0); | ||
475 | #ifdef CONFIG_MAC80211_HT_DEBUG | 551 | #ifdef CONFIG_MAC80211_HT_DEBUG |
476 | printk(KERN_DEBUG "BA request denied - HW unavailable for" | 552 | printk(KERN_DEBUG "BA request denied - HW unavailable for" |
477 | " tid %d\n", tid); | 553 | " tid %d\n", tid); |
@@ -481,7 +557,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
481 | } | 557 | } |
482 | 558 | ||
483 | /* Will put all the packets in the new SW queue */ | 559 | /* Will put all the packets in the new SW queue */ |
484 | ieee80211_requeue(local, ieee802_1d_to_ac[tid]); | 560 | if (hw->ampdu_queues) |
561 | ieee80211_requeue(local, ieee802_1d_to_ac[tid]); | ||
485 | spin_unlock_bh(&sta->lock); | 562 | spin_unlock_bh(&sta->lock); |
486 | 563 | ||
487 | /* send an addBA request */ | 564 | /* send an addBA request */ |
@@ -524,7 +601,6 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | |||
524 | struct sta_info *sta; | 601 | struct sta_info *sta; |
525 | u8 *state; | 602 | u8 *state; |
526 | int ret = 0; | 603 | int ret = 0; |
527 | DECLARE_MAC_BUF(mac); | ||
528 | 604 | ||
529 | if (tid >= STA_TID_NUM) | 605 | if (tid >= STA_TID_NUM) |
530 | return -EINVAL; | 606 | return -EINVAL; |
@@ -546,11 +622,12 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | |||
546 | } | 622 | } |
547 | 623 | ||
548 | #ifdef CONFIG_MAC80211_HT_DEBUG | 624 | #ifdef CONFIG_MAC80211_HT_DEBUG |
549 | printk(KERN_DEBUG "Tx BA session stop requested for %s tid %u\n", | 625 | printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n", |
550 | print_mac(mac, ra), tid); | 626 | ra, tid); |
551 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 627 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
552 | 628 | ||
553 | ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]); | 629 | if (hw->ampdu_queues) |
630 | ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]); | ||
554 | 631 | ||
555 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | | 632 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | |
556 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | 633 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); |
@@ -563,7 +640,8 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | |||
563 | if (ret) { | 640 | if (ret) { |
564 | WARN_ON(ret != -EBUSY); | 641 | WARN_ON(ret != -EBUSY); |
565 | *state = HT_AGG_STATE_OPERATIONAL; | 642 | *state = HT_AGG_STATE_OPERATIONAL; |
566 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | 643 | if (hw->ampdu_queues) |
644 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
567 | goto stop_BA_exit; | 645 | goto stop_BA_exit; |
568 | } | 646 | } |
569 | 647 | ||
@@ -579,7 +657,6 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
579 | struct ieee80211_local *local = hw_to_local(hw); | 657 | struct ieee80211_local *local = hw_to_local(hw); |
580 | struct sta_info *sta; | 658 | struct sta_info *sta; |
581 | u8 *state; | 659 | u8 *state; |
582 | DECLARE_MAC_BUF(mac); | ||
583 | 660 | ||
584 | if (tid >= STA_TID_NUM) { | 661 | if (tid >= STA_TID_NUM) { |
585 | #ifdef CONFIG_MAC80211_HT_DEBUG | 662 | #ifdef CONFIG_MAC80211_HT_DEBUG |
@@ -594,8 +671,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
594 | if (!sta) { | 671 | if (!sta) { |
595 | rcu_read_unlock(); | 672 | rcu_read_unlock(); |
596 | #ifdef CONFIG_MAC80211_HT_DEBUG | 673 | #ifdef CONFIG_MAC80211_HT_DEBUG |
597 | printk(KERN_DEBUG "Could not find station: %s\n", | 674 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); |
598 | print_mac(mac, ra)); | ||
599 | #endif | 675 | #endif |
600 | return; | 676 | return; |
601 | } | 677 | } |
@@ -621,7 +697,8 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
621 | #ifdef CONFIG_MAC80211_HT_DEBUG | 697 | #ifdef CONFIG_MAC80211_HT_DEBUG |
622 | printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); | 698 | printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); |
623 | #endif | 699 | #endif |
624 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | 700 | if (hw->ampdu_queues) |
701 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
625 | } | 702 | } |
626 | spin_unlock_bh(&sta->lock); | 703 | spin_unlock_bh(&sta->lock); |
627 | rcu_read_unlock(); | 704 | rcu_read_unlock(); |
@@ -634,7 +711,6 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | |||
634 | struct sta_info *sta; | 711 | struct sta_info *sta; |
635 | u8 *state; | 712 | u8 *state; |
636 | int agg_queue; | 713 | int agg_queue; |
637 | DECLARE_MAC_BUF(mac); | ||
638 | 714 | ||
639 | if (tid >= STA_TID_NUM) { | 715 | if (tid >= STA_TID_NUM) { |
640 | #ifdef CONFIG_MAC80211_HT_DEBUG | 716 | #ifdef CONFIG_MAC80211_HT_DEBUG |
@@ -645,16 +721,15 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | |||
645 | } | 721 | } |
646 | 722 | ||
647 | #ifdef CONFIG_MAC80211_HT_DEBUG | 723 | #ifdef CONFIG_MAC80211_HT_DEBUG |
648 | printk(KERN_DEBUG "Stopping Tx BA session for %s tid %d\n", | 724 | printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n", |
649 | print_mac(mac, ra), tid); | 725 | ra, tid); |
650 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 726 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
651 | 727 | ||
652 | rcu_read_lock(); | 728 | rcu_read_lock(); |
653 | sta = sta_info_get(local, ra); | 729 | sta = sta_info_get(local, ra); |
654 | if (!sta) { | 730 | if (!sta) { |
655 | #ifdef CONFIG_MAC80211_HT_DEBUG | 731 | #ifdef CONFIG_MAC80211_HT_DEBUG |
656 | printk(KERN_DEBUG "Could not find station: %s\n", | 732 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); |
657 | print_mac(mac, ra)); | ||
658 | #endif | 733 | #endif |
659 | rcu_read_unlock(); | 734 | rcu_read_unlock(); |
660 | return; | 735 | return; |
@@ -677,16 +752,18 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | |||
677 | ieee80211_send_delba(sta->sdata, ra, tid, | 752 | ieee80211_send_delba(sta->sdata, ra, tid, |
678 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); | 753 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); |
679 | 754 | ||
680 | agg_queue = sta->tid_to_tx_q[tid]; | 755 | if (hw->ampdu_queues) { |
681 | 756 | agg_queue = sta->tid_to_tx_q[tid]; | |
682 | ieee80211_ht_agg_queue_remove(local, sta, tid, 1); | 757 | ieee80211_ht_agg_queue_remove(local, sta, tid, 1); |
683 | 758 | ||
684 | /* We just requeued the all the frames that were in the | 759 | /* We just requeued the all the frames that were in the |
685 | * removed queue, and since we might miss a softirq we do | 760 | * removed queue, and since we might miss a softirq we do |
686 | * netif_schedule_queue. ieee80211_wake_queue is not used | 761 | * netif_schedule_queue. ieee80211_wake_queue is not used |
687 | * here as this queue is not necessarily stopped | 762 | * here as this queue is not necessarily stopped |
688 | */ | 763 | */ |
689 | netif_schedule_queue(netdev_get_tx_queue(local->mdev, agg_queue)); | 764 | netif_schedule_queue(netdev_get_tx_queue(local->mdev, |
765 | agg_queue)); | ||
766 | } | ||
690 | spin_lock_bh(&sta->lock); | 767 | spin_lock_bh(&sta->lock); |
691 | *state = HT_AGG_STATE_IDLE; | 768 | *state = HT_AGG_STATE_IDLE; |
692 | sta->ampdu_mlme.addba_req_num[tid] = 0; | 769 | sta->ampdu_mlme.addba_req_num[tid] = 0; |
@@ -783,7 +860,6 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
783 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; | 860 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; |
784 | u8 dialog_token; | 861 | u8 dialog_token; |
785 | int ret = -EOPNOTSUPP; | 862 | int ret = -EOPNOTSUPP; |
786 | DECLARE_MAC_BUF(mac); | ||
787 | 863 | ||
788 | /* extract session parameters from addba request frame */ | 864 | /* extract session parameters from addba request frame */ |
789 | dialog_token = mgmt->u.action.u.addba_req.dialog_token; | 865 | dialog_token = mgmt->u.action.u.addba_req.dialog_token; |
@@ -801,15 +877,16 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
801 | /* sanity check for incoming parameters: | 877 | /* sanity check for incoming parameters: |
802 | * check if configuration can support the BA policy | 878 | * check if configuration can support the BA policy |
803 | * and if buffer size does not exceeds max value */ | 879 | * and if buffer size does not exceeds max value */ |
880 | /* XXX: check own ht delayed BA capability?? */ | ||
804 | if (((ba_policy != 1) | 881 | if (((ba_policy != 1) |
805 | && (!(conf->ht_conf.cap & IEEE80211_HT_CAP_DELAY_BA))) | 882 | && (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) |
806 | || (buf_size > IEEE80211_MAX_AMPDU_BUF)) { | 883 | || (buf_size > IEEE80211_MAX_AMPDU_BUF)) { |
807 | status = WLAN_STATUS_INVALID_QOS_PARAM; | 884 | status = WLAN_STATUS_INVALID_QOS_PARAM; |
808 | #ifdef CONFIG_MAC80211_HT_DEBUG | 885 | #ifdef CONFIG_MAC80211_HT_DEBUG |
809 | if (net_ratelimit()) | 886 | if (net_ratelimit()) |
810 | printk(KERN_DEBUG "AddBA Req with bad params from " | 887 | printk(KERN_DEBUG "AddBA Req with bad params from " |
811 | "%s on tid %u. policy %d, buffer size %d\n", | 888 | "%pM on tid %u. policy %d, buffer size %d\n", |
812 | print_mac(mac, mgmt->sa), tid, ba_policy, | 889 | mgmt->sa, tid, ba_policy, |
813 | buf_size); | 890 | buf_size); |
814 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 891 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
815 | goto end_no_lock; | 892 | goto end_no_lock; |
@@ -820,7 +897,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
820 | 897 | ||
821 | sband = local->hw.wiphy->bands[conf->channel->band]; | 898 | sband = local->hw.wiphy->bands[conf->channel->band]; |
822 | buf_size = IEEE80211_MIN_AMPDU_BUF; | 899 | buf_size = IEEE80211_MIN_AMPDU_BUF; |
823 | buf_size = buf_size << sband->ht_info.ampdu_factor; | 900 | buf_size = buf_size << sband->ht_cap.ampdu_factor; |
824 | } | 901 | } |
825 | 902 | ||
826 | 903 | ||
@@ -831,8 +908,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
831 | #ifdef CONFIG_MAC80211_HT_DEBUG | 908 | #ifdef CONFIG_MAC80211_HT_DEBUG |
832 | if (net_ratelimit()) | 909 | if (net_ratelimit()) |
833 | printk(KERN_DEBUG "unexpected AddBA Req from " | 910 | printk(KERN_DEBUG "unexpected AddBA Req from " |
834 | "%s on tid %u\n", | 911 | "%pM on tid %u\n", |
835 | print_mac(mac, mgmt->sa), tid); | 912 | mgmt->sa, tid); |
836 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 913 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
837 | goto end; | 914 | goto end; |
838 | } | 915 | } |
@@ -910,7 +987,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
910 | { | 987 | { |
911 | struct ieee80211_hw *hw = &local->hw; | 988 | struct ieee80211_hw *hw = &local->hw; |
912 | u16 capab; | 989 | u16 capab; |
913 | u16 tid; | 990 | u16 tid, start_seq_num; |
914 | u8 *state; | 991 | u8 *state; |
915 | 992 | ||
916 | capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab); | 993 | capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab); |
@@ -943,9 +1020,18 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
943 | *state |= HT_ADDBA_RECEIVED_MSK; | 1020 | *state |= HT_ADDBA_RECEIVED_MSK; |
944 | sta->ampdu_mlme.addba_req_num[tid] = 0; | 1021 | sta->ampdu_mlme.addba_req_num[tid] = 0; |
945 | 1022 | ||
946 | if (*state == HT_AGG_STATE_OPERATIONAL) | 1023 | if (*state == HT_AGG_STATE_OPERATIONAL && |
1024 | local->hw.ampdu_queues) | ||
947 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | 1025 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); |
948 | 1026 | ||
1027 | if (local->ops->ampdu_action) { | ||
1028 | (void)local->ops->ampdu_action(hw, | ||
1029 | IEEE80211_AMPDU_TX_RESUME, | ||
1030 | &sta->sta, tid, &start_seq_num); | ||
1031 | } | ||
1032 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
1033 | printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid); | ||
1034 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
949 | spin_unlock_bh(&sta->lock); | 1035 | spin_unlock_bh(&sta->lock); |
950 | } else { | 1036 | } else { |
951 | sta->ampdu_mlme.addba_req_num[tid]++; | 1037 | sta->ampdu_mlme.addba_req_num[tid]++; |
@@ -964,7 +1050,6 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, | |||
964 | struct ieee80211_local *local = sdata->local; | 1050 | struct ieee80211_local *local = sdata->local; |
965 | u16 tid, params; | 1051 | u16 tid, params; |
966 | u16 initiator; | 1052 | u16 initiator; |
967 | DECLARE_MAC_BUF(mac); | ||
968 | 1053 | ||
969 | params = le16_to_cpu(mgmt->u.action.u.delba.params); | 1054 | params = le16_to_cpu(mgmt->u.action.u.delba.params); |
970 | tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; | 1055 | tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; |
@@ -972,9 +1057,8 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, | |||
972 | 1057 | ||
973 | #ifdef CONFIG_MAC80211_HT_DEBUG | 1058 | #ifdef CONFIG_MAC80211_HT_DEBUG |
974 | if (net_ratelimit()) | 1059 | if (net_ratelimit()) |
975 | printk(KERN_DEBUG "delba from %s (%s) tid %d reason code %d\n", | 1060 | printk(KERN_DEBUG "delba from %pM (%s) tid %d reason code %d\n", |
976 | print_mac(mac, mgmt->sa), | 1061 | mgmt->sa, initiator ? "initiator" : "recipient", tid, |
977 | initiator ? "initiator" : "recipient", tid, | ||
978 | mgmt->u.action.u.delba.reason_code); | 1062 | mgmt->u.action.u.delba.reason_code); |
979 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 1063 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
980 | 1064 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 156e42a003ae..155a20410017 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/etherdevice.h> | 25 | #include <linux/etherdevice.h> |
26 | #include <net/cfg80211.h> | ||
26 | #include <net/wireless.h> | 27 | #include <net/wireless.h> |
27 | #include <net/iw_handler.h> | 28 | #include <net/iw_handler.h> |
28 | #include <net/mac80211.h> | 29 | #include <net/mac80211.h> |
@@ -142,7 +143,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result; | |||
142 | #define IEEE80211_TX_FRAGMENTED BIT(0) | 143 | #define IEEE80211_TX_FRAGMENTED BIT(0) |
143 | #define IEEE80211_TX_UNICAST BIT(1) | 144 | #define IEEE80211_TX_UNICAST BIT(1) |
144 | #define IEEE80211_TX_PS_BUFFERED BIT(2) | 145 | #define IEEE80211_TX_PS_BUFFERED BIT(2) |
145 | #define IEEE80211_TX_PROBE_LAST_FRAG BIT(3) | ||
146 | 146 | ||
147 | struct ieee80211_tx_data { | 147 | struct ieee80211_tx_data { |
148 | struct sk_buff *skb; | 148 | struct sk_buff *skb; |
@@ -153,11 +153,6 @@ struct ieee80211_tx_data { | |||
153 | struct ieee80211_key *key; | 153 | struct ieee80211_key *key; |
154 | 154 | ||
155 | struct ieee80211_channel *channel; | 155 | struct ieee80211_channel *channel; |
156 | s8 rate_idx; | ||
157 | /* use this rate (if set) for last fragment; rate can | ||
158 | * be set to lower rate for the first fragments, e.g., | ||
159 | * when using CTS protection with IEEE 802.11g. */ | ||
160 | s8 last_frag_rate_idx; | ||
161 | 156 | ||
162 | /* Extra fragments (in addition to the first fragment | 157 | /* Extra fragments (in addition to the first fragment |
163 | * in skb) */ | 158 | * in skb) */ |
@@ -203,9 +198,7 @@ struct ieee80211_rx_data { | |||
203 | struct ieee80211_tx_stored_packet { | 198 | struct ieee80211_tx_stored_packet { |
204 | struct sk_buff *skb; | 199 | struct sk_buff *skb; |
205 | struct sk_buff **extra_frag; | 200 | struct sk_buff **extra_frag; |
206 | s8 last_frag_rate_idx; | ||
207 | int num_extra_frag; | 201 | int num_extra_frag; |
208 | bool last_frag_rate_ctrl_probe; | ||
209 | }; | 202 | }; |
210 | 203 | ||
211 | struct beacon_data { | 204 | struct beacon_data { |
@@ -219,9 +212,6 @@ struct ieee80211_if_ap { | |||
219 | 212 | ||
220 | struct list_head vlans; | 213 | struct list_head vlans; |
221 | 214 | ||
222 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | ||
223 | size_t ssid_len; | ||
224 | |||
225 | /* yes, this looks ugly, but guarantees that we can later use | 215 | /* yes, this looks ugly, but guarantees that we can later use |
226 | * bitmap_empty :) | 216 | * bitmap_empty :) |
227 | * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ | 217 | * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ |
@@ -255,26 +245,6 @@ struct mesh_preq_queue { | |||
255 | u8 flags; | 245 | u8 flags; |
256 | }; | 246 | }; |
257 | 247 | ||
258 | struct mesh_config { | ||
259 | /* Timeouts in ms */ | ||
260 | /* Mesh plink management parameters */ | ||
261 | u16 dot11MeshRetryTimeout; | ||
262 | u16 dot11MeshConfirmTimeout; | ||
263 | u16 dot11MeshHoldingTimeout; | ||
264 | u16 dot11MeshMaxPeerLinks; | ||
265 | u8 dot11MeshMaxRetries; | ||
266 | u8 dot11MeshTTL; | ||
267 | bool auto_open_plinks; | ||
268 | /* HWMP parameters */ | ||
269 | u8 dot11MeshHWMPmaxPREQretries; | ||
270 | u32 path_refresh_time; | ||
271 | u16 min_discovery_timeout; | ||
272 | u32 dot11MeshHWMPactivePathTimeout; | ||
273 | u16 dot11MeshHWMPpreqMinInterval; | ||
274 | u16 dot11MeshHWMPnetDiameterTraversalTime; | ||
275 | }; | ||
276 | |||
277 | |||
278 | /* flags used in struct ieee80211_if_sta.flags */ | 248 | /* flags used in struct ieee80211_if_sta.flags */ |
279 | #define IEEE80211_STA_SSID_SET BIT(0) | 249 | #define IEEE80211_STA_SSID_SET BIT(0) |
280 | #define IEEE80211_STA_BSSID_SET BIT(1) | 250 | #define IEEE80211_STA_BSSID_SET BIT(1) |
@@ -438,8 +408,7 @@ struct ieee80211_sub_if_data { | |||
438 | struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; | 408 | struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; |
439 | struct ieee80211_key *default_key; | 409 | struct ieee80211_key *default_key; |
440 | 410 | ||
441 | /* BSS configuration for this interface. */ | 411 | u16 sequence_number; |
442 | struct ieee80211_bss_conf bss_conf; | ||
443 | 412 | ||
444 | /* | 413 | /* |
445 | * AP this belongs to: self in AP mode and | 414 | * AP this belongs to: self in AP mode and |
@@ -633,8 +602,6 @@ struct ieee80211_local { | |||
633 | 602 | ||
634 | int rts_threshold; | 603 | int rts_threshold; |
635 | int fragmentation_threshold; | 604 | int fragmentation_threshold; |
636 | int short_retry_limit; /* dot11ShortRetryLimit */ | ||
637 | int long_retry_limit; /* dot11LongRetryLimit */ | ||
638 | 605 | ||
639 | struct crypto_blkcipher *wep_tx_tfm; | 606 | struct crypto_blkcipher *wep_tx_tfm; |
640 | struct crypto_blkcipher *wep_rx_tfm; | 607 | struct crypto_blkcipher *wep_rx_tfm; |
@@ -727,8 +694,6 @@ struct ieee80211_local { | |||
727 | struct dentry *rcdir; | 694 | struct dentry *rcdir; |
728 | struct dentry *rcname; | 695 | struct dentry *rcname; |
729 | struct dentry *frequency; | 696 | struct dentry *frequency; |
730 | struct dentry *antenna_sel_tx; | ||
731 | struct dentry *antenna_sel_rx; | ||
732 | struct dentry *rts_threshold; | 697 | struct dentry *rts_threshold; |
733 | struct dentry *fragmentation_threshold; | 698 | struct dentry *fragmentation_threshold; |
734 | struct dentry *short_retry_limit; | 699 | struct dentry *short_retry_limit; |
@@ -817,7 +782,7 @@ struct ieee802_11_elems { | |||
817 | u8 *wmm_info; | 782 | u8 *wmm_info; |
818 | u8 *wmm_param; | 783 | u8 *wmm_param; |
819 | struct ieee80211_ht_cap *ht_cap_elem; | 784 | struct ieee80211_ht_cap *ht_cap_elem; |
820 | struct ieee80211_ht_addt_info *ht_info_elem; | 785 | struct ieee80211_ht_info *ht_info_elem; |
821 | u8 *mesh_config; | 786 | u8 *mesh_config; |
822 | u8 *mesh_id; | 787 | u8 *mesh_id; |
823 | u8 *peer_link; | 788 | u8 *peer_link; |
@@ -869,11 +834,6 @@ static inline struct ieee80211_hw *local_to_hw( | |||
869 | return &local->hw; | 834 | return &local->hw; |
870 | } | 835 | } |
871 | 836 | ||
872 | struct sta_attribute { | ||
873 | struct attribute attr; | ||
874 | ssize_t (*show)(const struct sta_info *, char *buf); | ||
875 | ssize_t (*store)(struct sta_info *, const char *buf, size_t count); | ||
876 | }; | ||
877 | 837 | ||
878 | static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) | 838 | static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) |
879 | { | 839 | { |
@@ -882,12 +842,9 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) | |||
882 | } | 842 | } |
883 | 843 | ||
884 | 844 | ||
885 | int ieee80211_hw_config(struct ieee80211_local *local); | 845 | int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); |
886 | int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); | 846 | int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); |
887 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); | 847 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); |
888 | u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, | ||
889 | struct ieee80211_ht_info *req_ht_cap, | ||
890 | struct ieee80211_ht_bss_info *req_bss_cap); | ||
891 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | 848 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
892 | u32 changed); | 849 | u32 changed); |
893 | void ieee80211_configure_filter(struct ieee80211_local *local); | 850 | void ieee80211_configure_filter(struct ieee80211_local *local); |
@@ -968,11 +925,12 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); | |||
968 | int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); | 925 | int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); |
969 | 926 | ||
970 | /* HT */ | 927 | /* HT */ |
971 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, | 928 | void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, |
972 | struct ieee80211_ht_info *ht_info); | 929 | struct ieee80211_ht_cap *ht_cap_ie, |
973 | int ieee80211_ht_addt_info_ie_to_ht_bss_info( | 930 | struct ieee80211_sta_ht_cap *ht_cap); |
974 | struct ieee80211_ht_addt_info *ht_add_info_ie, | 931 | u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, |
975 | struct ieee80211_ht_bss_info *bss_info); | 932 | struct ieee80211_ht_info *hti, |
933 | u16 ap_ht_cap_flags); | ||
976 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); | 934 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); |
977 | 935 | ||
978 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, | 936 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 8336fee68d3e..cde145221b61 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -65,7 +65,7 @@ static int ieee80211_open(struct net_device *dev) | |||
65 | struct ieee80211_if_init_conf conf; | 65 | struct ieee80211_if_init_conf conf; |
66 | u32 changed = 0; | 66 | u32 changed = 0; |
67 | int res; | 67 | int res; |
68 | bool need_hw_reconfig = 0; | 68 | u32 hw_reconf_flags = 0; |
69 | u8 null_addr[ETH_ALEN] = {0}; | 69 | u8 null_addr[ETH_ALEN] = {0}; |
70 | 70 | ||
71 | /* fail early if user set an invalid address */ | 71 | /* fail early if user set an invalid address */ |
@@ -152,7 +152,8 @@ static int ieee80211_open(struct net_device *dev) | |||
152 | res = local->ops->start(local_to_hw(local)); | 152 | res = local->ops->start(local_to_hw(local)); |
153 | if (res) | 153 | if (res) |
154 | goto err_del_bss; | 154 | goto err_del_bss; |
155 | need_hw_reconfig = 1; | 155 | /* we're brought up, everything changes */ |
156 | hw_reconf_flags = ~0; | ||
156 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); | 157 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); |
157 | } | 158 | } |
158 | 159 | ||
@@ -198,8 +199,10 @@ static int ieee80211_open(struct net_device *dev) | |||
198 | 199 | ||
199 | /* must be before the call to ieee80211_configure_filter */ | 200 | /* must be before the call to ieee80211_configure_filter */ |
200 | local->monitors++; | 201 | local->monitors++; |
201 | if (local->monitors == 1) | 202 | if (local->monitors == 1) { |
202 | local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; | 203 | local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; |
204 | hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP; | ||
205 | } | ||
203 | 206 | ||
204 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | 207 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) |
205 | local->fif_fcsfail++; | 208 | local->fif_fcsfail++; |
@@ -279,8 +282,8 @@ static int ieee80211_open(struct net_device *dev) | |||
279 | atomic_inc(&local->iff_promiscs); | 282 | atomic_inc(&local->iff_promiscs); |
280 | 283 | ||
281 | local->open_count++; | 284 | local->open_count++; |
282 | if (need_hw_reconfig) { | 285 | if (hw_reconf_flags) { |
283 | ieee80211_hw_config(local); | 286 | ieee80211_hw_config(local, hw_reconf_flags); |
284 | /* | 287 | /* |
285 | * set default queue parameters so drivers don't | 288 | * set default queue parameters so drivers don't |
286 | * need to initialise the hardware if the hardware | 289 | * need to initialise the hardware if the hardware |
@@ -322,6 +325,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
322 | struct ieee80211_local *local = sdata->local; | 325 | struct ieee80211_local *local = sdata->local; |
323 | struct ieee80211_if_init_conf conf; | 326 | struct ieee80211_if_init_conf conf; |
324 | struct sta_info *sta; | 327 | struct sta_info *sta; |
328 | u32 hw_reconf_flags = 0; | ||
325 | 329 | ||
326 | /* | 330 | /* |
327 | * Stop TX on this interface first. | 331 | * Stop TX on this interface first. |
@@ -405,8 +409,10 @@ static int ieee80211_stop(struct net_device *dev) | |||
405 | } | 409 | } |
406 | 410 | ||
407 | local->monitors--; | 411 | local->monitors--; |
408 | if (local->monitors == 0) | 412 | if (local->monitors == 0) { |
409 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; | 413 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; |
414 | hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP; | ||
415 | } | ||
410 | 416 | ||
411 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | 417 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) |
412 | local->fif_fcsfail--; | 418 | local->fif_fcsfail--; |
@@ -504,8 +510,15 @@ static int ieee80211_stop(struct net_device *dev) | |||
504 | 510 | ||
505 | tasklet_disable(&local->tx_pending_tasklet); | 511 | tasklet_disable(&local->tx_pending_tasklet); |
506 | tasklet_disable(&local->tasklet); | 512 | tasklet_disable(&local->tasklet); |
513 | |||
514 | /* no reconfiguring after stop! */ | ||
515 | hw_reconf_flags = 0; | ||
507 | } | 516 | } |
508 | 517 | ||
518 | /* do after stop to avoid reconfiguring when we stop anyway */ | ||
519 | if (hw_reconf_flags) | ||
520 | ieee80211_hw_config(local, hw_reconf_flags); | ||
521 | |||
509 | return 0; | 522 | return 0; |
510 | } | 523 | } |
511 | 524 | ||
@@ -682,7 +695,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
682 | ieee80211_setup_sdata(sdata, type); | 695 | ieee80211_setup_sdata(sdata, type); |
683 | 696 | ||
684 | /* reset some values that shouldn't be kept across type changes */ | 697 | /* reset some values that shouldn't be kept across type changes */ |
685 | sdata->bss_conf.basic_rates = | 698 | sdata->vif.bss_conf.basic_rates = |
686 | ieee80211_mandatory_rates(sdata->local, | 699 | ieee80211_mandatory_rates(sdata->local, |
687 | sdata->local->hw.conf.channel->band); | 700 | sdata->local->hw.conf.channel->band); |
688 | sdata->drop_unencrypted = 0; | 701 | sdata->drop_unencrypted = 0; |
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 | ||
162 | static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | 161 | static 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/main.c b/net/mac80211/main.c index ae62ad40ad63..d631dc96c323 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -41,6 +41,8 @@ | |||
41 | */ | 41 | */ |
42 | struct ieee80211_tx_status_rtap_hdr { | 42 | struct ieee80211_tx_status_rtap_hdr { |
43 | struct ieee80211_radiotap_header hdr; | 43 | struct ieee80211_radiotap_header hdr; |
44 | u8 rate; | ||
45 | u8 padding_for_rate; | ||
44 | __le16 tx_flags; | 46 | __le16 tx_flags; |
45 | u8 data_retries; | 47 | u8 data_retries; |
46 | } __attribute__ ((packed)); | 48 | } __attribute__ ((packed)); |
@@ -169,19 +171,13 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) | |||
169 | conf.changed = changed; | 171 | conf.changed = changed; |
170 | 172 | ||
171 | if (sdata->vif.type == NL80211_IFTYPE_STATION || | 173 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
172 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { | 174 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
173 | conf.bssid = sdata->u.sta.bssid; | 175 | conf.bssid = sdata->u.sta.bssid; |
174 | conf.ssid = sdata->u.sta.ssid; | 176 | else if (sdata->vif.type == NL80211_IFTYPE_AP) |
175 | conf.ssid_len = sdata->u.sta.ssid_len; | ||
176 | } else if (sdata->vif.type == NL80211_IFTYPE_AP) { | ||
177 | conf.bssid = sdata->dev->dev_addr; | 177 | conf.bssid = sdata->dev->dev_addr; |
178 | conf.ssid = sdata->u.ap.ssid; | 178 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
179 | conf.ssid_len = sdata->u.ap.ssid_len; | ||
180 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { | ||
181 | u8 zero[ETH_ALEN] = { 0 }; | 179 | u8 zero[ETH_ALEN] = { 0 }; |
182 | conf.bssid = zero; | 180 | conf.bssid = zero; |
183 | conf.ssid = zero; | ||
184 | conf.ssid_len = 0; | ||
185 | } else { | 181 | } else { |
186 | WARN_ON(1); | 182 | WARN_ON(1); |
187 | return -EINVAL; | 183 | return -EINVAL; |
@@ -190,136 +186,48 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) | |||
190 | if (WARN_ON(!conf.bssid && (changed & IEEE80211_IFCC_BSSID))) | 186 | if (WARN_ON(!conf.bssid && (changed & IEEE80211_IFCC_BSSID))) |
191 | return -EINVAL; | 187 | return -EINVAL; |
192 | 188 | ||
193 | if (WARN_ON(!conf.ssid && (changed & IEEE80211_IFCC_SSID))) | ||
194 | return -EINVAL; | ||
195 | |||
196 | return local->ops->config_interface(local_to_hw(local), | 189 | return local->ops->config_interface(local_to_hw(local), |
197 | &sdata->vif, &conf); | 190 | &sdata->vif, &conf); |
198 | } | 191 | } |
199 | 192 | ||
200 | int ieee80211_hw_config(struct ieee80211_local *local) | 193 | int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) |
201 | { | 194 | { |
202 | struct ieee80211_channel *chan; | 195 | struct ieee80211_channel *chan; |
203 | int ret = 0; | 196 | int ret = 0; |
197 | int power; | ||
198 | |||
199 | might_sleep(); | ||
204 | 200 | ||
205 | if (local->sw_scanning) | 201 | if (local->sw_scanning) |
206 | chan = local->scan_channel; | 202 | chan = local->scan_channel; |
207 | else | 203 | else |
208 | chan = local->oper_channel; | 204 | chan = local->oper_channel; |
209 | 205 | ||
210 | local->hw.conf.channel = chan; | 206 | if (chan != local->hw.conf.channel) { |
207 | local->hw.conf.channel = chan; | ||
208 | changed |= IEEE80211_CONF_CHANGE_CHANNEL; | ||
209 | } | ||
210 | |||
211 | 211 | ||
212 | if (!local->hw.conf.power_level) | 212 | if (!local->hw.conf.power_level) |
213 | local->hw.conf.power_level = chan->max_power; | 213 | power = chan->max_power; |
214 | else | 214 | else |
215 | local->hw.conf.power_level = min(chan->max_power, | 215 | power = min(chan->max_power, local->hw.conf.power_level); |
216 | local->hw.conf.power_level); | 216 | if (local->hw.conf.power_level != power) { |
217 | 217 | changed |= IEEE80211_CONF_CHANGE_POWER; | |
218 | local->hw.conf.max_antenna_gain = chan->max_antenna_gain; | 218 | local->hw.conf.power_level = power; |
219 | |||
220 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
221 | printk(KERN_DEBUG "%s: HW CONFIG: freq=%d\n", | ||
222 | wiphy_name(local->hw.wiphy), chan->center_freq); | ||
223 | #endif | ||
224 | |||
225 | if (local->open_count) | ||
226 | ret = local->ops->config(local_to_hw(local), &local->hw.conf); | ||
227 | |||
228 | return ret; | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * ieee80211_handle_ht should be used only after legacy configuration | ||
233 | * has been determined namely band, as ht configuration depends upon | ||
234 | * the hardware's HT abilities for a _specific_ band. | ||
235 | */ | ||
236 | u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, | ||
237 | struct ieee80211_ht_info *req_ht_cap, | ||
238 | struct ieee80211_ht_bss_info *req_bss_cap) | ||
239 | { | ||
240 | struct ieee80211_conf *conf = &local->hw.conf; | ||
241 | struct ieee80211_supported_band *sband; | ||
242 | struct ieee80211_ht_info ht_conf; | ||
243 | struct ieee80211_ht_bss_info ht_bss_conf; | ||
244 | u32 changed = 0; | ||
245 | int i; | ||
246 | u8 max_tx_streams = IEEE80211_HT_CAP_MAX_STREAMS; | ||
247 | u8 tx_mcs_set_cap; | ||
248 | |||
249 | sband = local->hw.wiphy->bands[conf->channel->band]; | ||
250 | |||
251 | memset(&ht_conf, 0, sizeof(struct ieee80211_ht_info)); | ||
252 | memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info)); | ||
253 | |||
254 | /* HT is not supported */ | ||
255 | if (!sband->ht_info.ht_supported) { | ||
256 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; | ||
257 | goto out; | ||
258 | } | 219 | } |
259 | 220 | ||
260 | /* disable HT */ | 221 | if (changed && local->open_count) { |
261 | if (!enable_ht) { | 222 | ret = local->ops->config(local_to_hw(local), changed); |
262 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) | 223 | /* |
263 | changed |= BSS_CHANGED_HT; | 224 | * HW reconfiguration should never fail, the driver has told |
264 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; | 225 | * us what it can support so it should live up to that promise. |
265 | conf->ht_conf.ht_supported = 0; | 226 | */ |
266 | goto out; | 227 | WARN_ON(ret); |
267 | } | 228 | } |
268 | 229 | ||
269 | 230 | return ret; | |
270 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) | ||
271 | changed |= BSS_CHANGED_HT; | ||
272 | |||
273 | conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE; | ||
274 | ht_conf.ht_supported = 1; | ||
275 | |||
276 | ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap; | ||
277 | ht_conf.cap &= ~(IEEE80211_HT_CAP_SM_PS); | ||
278 | ht_conf.cap |= sband->ht_info.cap & IEEE80211_HT_CAP_SM_PS; | ||
279 | ht_bss_conf.primary_channel = req_bss_cap->primary_channel; | ||
280 | ht_bss_conf.bss_cap = req_bss_cap->bss_cap; | ||
281 | ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode; | ||
282 | |||
283 | ht_conf.ampdu_factor = req_ht_cap->ampdu_factor; | ||
284 | ht_conf.ampdu_density = req_ht_cap->ampdu_density; | ||
285 | |||
286 | /* Bits 96-100 */ | ||
287 | tx_mcs_set_cap = sband->ht_info.supp_mcs_set[12]; | ||
288 | |||
289 | /* configure suppoerted Tx MCS according to requested MCS | ||
290 | * (based in most cases on Rx capabilities of peer) and self | ||
291 | * Tx MCS capabilities (as defined by low level driver HW | ||
292 | * Tx capabilities) */ | ||
293 | if (!(tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_DEFINED)) | ||
294 | goto check_changed; | ||
295 | |||
296 | /* Counting from 0 therfore + 1 */ | ||
297 | if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_RX_DIFF) | ||
298 | max_tx_streams = ((tx_mcs_set_cap & | ||
299 | IEEE80211_HT_CAP_MCS_TX_STREAMS) >> 2) + 1; | ||
300 | |||
301 | for (i = 0; i < max_tx_streams; i++) | ||
302 | ht_conf.supp_mcs_set[i] = | ||
303 | sband->ht_info.supp_mcs_set[i] & | ||
304 | req_ht_cap->supp_mcs_set[i]; | ||
305 | |||
306 | if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_UEQM) | ||
307 | for (i = IEEE80211_SUPP_MCS_SET_UEQM; | ||
308 | i < IEEE80211_SUPP_MCS_SET_LEN; i++) | ||
309 | ht_conf.supp_mcs_set[i] = | ||
310 | sband->ht_info.supp_mcs_set[i] & | ||
311 | req_ht_cap->supp_mcs_set[i]; | ||
312 | |||
313 | check_changed: | ||
314 | /* if bss configuration changed store the new one */ | ||
315 | if (memcmp(&conf->ht_conf, &ht_conf, sizeof(ht_conf)) || | ||
316 | memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) { | ||
317 | changed |= BSS_CHANGED_HT; | ||
318 | memcpy(&conf->ht_conf, &ht_conf, sizeof(ht_conf)); | ||
319 | memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf)); | ||
320 | } | ||
321 | out: | ||
322 | return changed; | ||
323 | } | 231 | } |
324 | 232 | ||
325 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | 233 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
@@ -336,15 +244,18 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
336 | if (local->ops->bss_info_changed) | 244 | if (local->ops->bss_info_changed) |
337 | local->ops->bss_info_changed(local_to_hw(local), | 245 | local->ops->bss_info_changed(local_to_hw(local), |
338 | &sdata->vif, | 246 | &sdata->vif, |
339 | &sdata->bss_conf, | 247 | &sdata->vif.bss_conf, |
340 | changed); | 248 | changed); |
341 | } | 249 | } |
342 | 250 | ||
343 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) | 251 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) |
344 | { | 252 | { |
345 | sdata->bss_conf.use_cts_prot = 0; | 253 | sdata->vif.bss_conf.use_cts_prot = false; |
346 | sdata->bss_conf.use_short_preamble = 0; | 254 | sdata->vif.bss_conf.use_short_preamble = false; |
347 | return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE; | 255 | sdata->vif.bss_conf.use_short_slot = false; |
256 | return BSS_CHANGED_ERP_CTS_PROT | | ||
257 | BSS_CHANGED_ERP_PREAMBLE | | ||
258 | BSS_CHANGED_ERP_SLOT; | ||
348 | } | 259 | } |
349 | 260 | ||
350 | void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | 261 | void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, |
@@ -466,8 +377,6 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
466 | struct sta_info *sta, | 377 | struct sta_info *sta, |
467 | struct sk_buff *skb) | 378 | struct sk_buff *skb) |
468 | { | 379 | { |
469 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
470 | |||
471 | sta->tx_filtered_count++; | 380 | sta->tx_filtered_count++; |
472 | 381 | ||
473 | /* | 382 | /* |
@@ -514,10 +423,9 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
514 | return; | 423 | return; |
515 | } | 424 | } |
516 | 425 | ||
517 | if (!test_sta_flags(sta, WLAN_STA_PS) && | 426 | if (!test_sta_flags(sta, WLAN_STA_PS) && !skb->requeue) { |
518 | !(info->flags & IEEE80211_TX_CTL_REQUEUE)) { | ||
519 | /* Software retry the packet once */ | 427 | /* Software retry the packet once */ |
520 | info->flags |= IEEE80211_TX_CTL_REQUEUE; | 428 | skb->requeue = 1; |
521 | ieee80211_remove_tx_extra(local, sta->key, skb); | 429 | ieee80211_remove_tx_extra(local, sta->key, skb); |
522 | dev_queue_xmit(skb); | 430 | dev_queue_xmit(skb); |
523 | return; | 431 | return; |
@@ -547,13 +455,28 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
547 | struct ieee80211_sub_if_data *sdata; | 455 | struct ieee80211_sub_if_data *sdata; |
548 | struct net_device *prev_dev = NULL; | 456 | struct net_device *prev_dev = NULL; |
549 | struct sta_info *sta; | 457 | struct sta_info *sta; |
458 | int retry_count = -1, i; | ||
459 | |||
460 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { | ||
461 | /* the HW cannot have attempted that rate */ | ||
462 | if (i >= hw->max_rates) { | ||
463 | info->status.rates[i].idx = -1; | ||
464 | info->status.rates[i].count = 0; | ||
465 | } | ||
466 | |||
467 | retry_count += info->status.rates[i].count; | ||
468 | } | ||
469 | if (retry_count < 0) | ||
470 | retry_count = 0; | ||
550 | 471 | ||
551 | rcu_read_lock(); | 472 | rcu_read_lock(); |
552 | 473 | ||
474 | sband = local->hw.wiphy->bands[info->band]; | ||
475 | |||
553 | sta = sta_info_get(local, hdr->addr1); | 476 | sta = sta_info_get(local, hdr->addr1); |
554 | 477 | ||
555 | if (sta) { | 478 | if (sta) { |
556 | if (info->status.excessive_retries && | 479 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
557 | test_sta_flags(sta, WLAN_STA_PS)) { | 480 | test_sta_flags(sta, WLAN_STA_PS)) { |
558 | /* | 481 | /* |
559 | * The STA is in power save mode, so assume | 482 | * The STA is in power save mode, so assume |
@@ -584,12 +507,11 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
584 | rcu_read_unlock(); | 507 | rcu_read_unlock(); |
585 | return; | 508 | return; |
586 | } else { | 509 | } else { |
587 | if (info->status.excessive_retries) | 510 | if (!(info->flags & IEEE80211_TX_STAT_ACK)) |
588 | sta->tx_retry_failed++; | 511 | sta->tx_retry_failed++; |
589 | sta->tx_retry_count += info->status.retry_count; | 512 | sta->tx_retry_count += retry_count; |
590 | } | 513 | } |
591 | 514 | ||
592 | sband = local->hw.wiphy->bands[info->band]; | ||
593 | rate_control_tx_status(local, sband, sta, skb); | 515 | rate_control_tx_status(local, sband, sta, skb); |
594 | } | 516 | } |
595 | 517 | ||
@@ -610,9 +532,9 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
610 | local->dot11TransmittedFrameCount++; | 532 | local->dot11TransmittedFrameCount++; |
611 | if (is_multicast_ether_addr(hdr->addr1)) | 533 | if (is_multicast_ether_addr(hdr->addr1)) |
612 | local->dot11MulticastTransmittedFrameCount++; | 534 | local->dot11MulticastTransmittedFrameCount++; |
613 | if (info->status.retry_count > 0) | 535 | if (retry_count > 0) |
614 | local->dot11RetryCount++; | 536 | local->dot11RetryCount++; |
615 | if (info->status.retry_count > 1) | 537 | if (retry_count > 1) |
616 | local->dot11MultipleRetryCount++; | 538 | local->dot11MultipleRetryCount++; |
617 | } | 539 | } |
618 | 540 | ||
@@ -656,19 +578,30 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
656 | rthdr->hdr.it_len = cpu_to_le16(sizeof(*rthdr)); | 578 | rthdr->hdr.it_len = cpu_to_le16(sizeof(*rthdr)); |
657 | rthdr->hdr.it_present = | 579 | rthdr->hdr.it_present = |
658 | cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | | 580 | cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | |
659 | (1 << IEEE80211_RADIOTAP_DATA_RETRIES)); | 581 | (1 << IEEE80211_RADIOTAP_DATA_RETRIES) | |
582 | (1 << IEEE80211_RADIOTAP_RATE)); | ||
660 | 583 | ||
661 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && | 584 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
662 | !is_multicast_ether_addr(hdr->addr1)) | 585 | !is_multicast_ether_addr(hdr->addr1)) |
663 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); | 586 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); |
664 | 587 | ||
665 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) && | 588 | /* |
666 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) | 589 | * XXX: Once radiotap gets the bitmap reset thing the vendor |
590 | * extensions proposal contains, we can actually report | ||
591 | * the whole set of tries we did. | ||
592 | */ | ||
593 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || | ||
594 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) | ||
667 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); | 595 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); |
668 | else if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) | 596 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
669 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); | 597 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); |
598 | if (info->status.rates[0].idx >= 0 && | ||
599 | !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) | ||
600 | rthdr->rate = sband->bitrates[ | ||
601 | info->status.rates[0].idx].bitrate / 5; | ||
670 | 602 | ||
671 | rthdr->data_retries = info->status.retry_count; | 603 | /* for now report the total retry_count */ |
604 | rthdr->data_retries = retry_count; | ||
672 | 605 | ||
673 | /* XXX: is this sufficient for BPF? */ | 606 | /* XXX: is this sufficient for BPF? */ |
674 | skb_set_mac_header(skb, 0); | 607 | skb_set_mac_header(skb, 0); |
@@ -753,13 +686,14 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
753 | BUG_ON(!ops->configure_filter); | 686 | BUG_ON(!ops->configure_filter); |
754 | local->ops = ops; | 687 | local->ops = ops; |
755 | 688 | ||
756 | local->hw.queues = 1; /* default */ | 689 | /* set up some defaults */ |
757 | 690 | local->hw.queues = 1; | |
691 | local->hw.max_rates = 1; | ||
758 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; | 692 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; |
759 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; | 693 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; |
760 | local->short_retry_limit = 7; | 694 | local->hw.conf.long_frame_max_tx_count = 4; |
761 | local->long_retry_limit = 4; | 695 | local->hw.conf.short_frame_max_tx_count = 7; |
762 | local->hw.conf.radio_enabled = 1; | 696 | local->hw.conf.radio_enabled = true; |
763 | 697 | ||
764 | INIT_LIST_HEAD(&local->interfaces); | 698 | INIT_LIST_HEAD(&local->interfaces); |
765 | 699 | ||
@@ -1013,7 +947,7 @@ static int __init ieee80211_init(void) | |||
1013 | 947 | ||
1014 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); | 948 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); |
1015 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) + | 949 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) + |
1016 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); | 950 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); |
1017 | 951 | ||
1018 | ret = rc80211_minstrel_init(); | 952 | ret = rc80211_minstrel_init(); |
1019 | if (ret) | 953 | if (ret) |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 8013277924f2..82f568e94365 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -238,7 +238,7 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
238 | 238 | ||
239 | pos = skb_put(skb, 21); | 239 | pos = skb_put(skb, 21); |
240 | *pos++ = WLAN_EID_MESH_CONFIG; | 240 | *pos++ = WLAN_EID_MESH_CONFIG; |
241 | *pos++ = MESH_CFG_LEN; | 241 | *pos++ = IEEE80211_MESH_CONFIG_LEN; |
242 | /* Version */ | 242 | /* Version */ |
243 | *pos++ = 1; | 243 | *pos++ = 1; |
244 | 244 | ||
@@ -473,7 +473,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
473 | size_t len, | 473 | size_t len, |
474 | struct ieee80211_rx_status *rx_status) | 474 | struct ieee80211_rx_status *rx_status) |
475 | { | 475 | { |
476 | struct ieee80211_local *local= sdata->local; | 476 | struct ieee80211_local *local = sdata->local; |
477 | struct ieee802_11_elems elems; | 477 | struct ieee802_11_elems elems; |
478 | struct ieee80211_channel *channel; | 478 | struct ieee80211_channel *channel; |
479 | u64 supp_rates = 0; | 479 | u64 supp_rates = 0; |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index e10471c6ba42..c197ab545e54 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -145,9 +145,6 @@ struct mesh_rmc { | |||
145 | }; | 145 | }; |
146 | 146 | ||
147 | 147 | ||
148 | /* Mesh IEs constants */ | ||
149 | #define MESH_CFG_LEN 19 | ||
150 | |||
151 | /* | 148 | /* |
152 | * MESH_CFG_COMP_LEN Includes: | 149 | * MESH_CFG_COMP_LEN Includes: |
153 | * - Active path selection protocol ID. | 150 | * - Active path selection protocol ID. |
@@ -157,7 +154,7 @@ struct mesh_rmc { | |||
157 | * Does not include mesh capabilities, which may vary across nodes in the same | 154 | * Does not include mesh capabilities, which may vary across nodes in the same |
158 | * mesh | 155 | * mesh |
159 | */ | 156 | */ |
160 | #define MESH_CFG_CMP_LEN 17 | 157 | #define MESH_CFG_CMP_LEN (IEEE80211_MESH_CONFIG_LEN - 2) |
161 | 158 | ||
162 | /* Default values, timeouts in ms */ | 159 | /* Default values, timeouts in ms */ |
163 | #define MESH_TTL 5 | 160 | #define MESH_TTL 5 |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 501c7831adb4..e8d573d592e7 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -218,12 +218,16 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local, | |||
218 | 218 | ||
219 | if (sta->fail_avg >= 100) | 219 | if (sta->fail_avg >= 100) |
220 | return MAX_METRIC; | 220 | return MAX_METRIC; |
221 | |||
222 | if (sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS) | ||
223 | return MAX_METRIC; | ||
224 | |||
221 | err = (sta->fail_avg << ARITH_SHIFT) / 100; | 225 | err = (sta->fail_avg << ARITH_SHIFT) / 100; |
222 | 226 | ||
223 | /* bitrate is in units of 100 Kbps, while we need rate in units of | 227 | /* bitrate is in units of 100 Kbps, while we need rate in units of |
224 | * 1Mbps. This will be corrected on tx_time computation. | 228 | * 1Mbps. This will be corrected on tx_time computation. |
225 | */ | 229 | */ |
226 | rate = sband->bitrates[sta->last_txrate_idx].bitrate; | 230 | rate = sband->bitrates[sta->last_tx_rate.idx].bitrate; |
227 | tx_time = (device_constant + 10 * test_frame_len / rate); | 231 | tx_time = (device_constant + 10 * test_frame_len / rate); |
228 | estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); | 232 | estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); |
229 | result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ; | 233 | result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ; |
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 | ||
361 | void mesh_plink_block(struct sta_info *sta) | 355 | void 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..dee6448c4eb0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -236,7 +236,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
236 | struct ieee80211_local *local = sdata->local; | 236 | struct ieee80211_local *local = sdata->local; |
237 | struct sk_buff *skb; | 237 | struct sk_buff *skb; |
238 | struct ieee80211_mgmt *mgmt; | 238 | struct ieee80211_mgmt *mgmt; |
239 | u8 *pos, *ies, *ht_add_ie; | 239 | u8 *pos, *ies, *ht_ie; |
240 | int i, len, count, rates_len, supp_rates_len; | 240 | int i, len, count, rates_len, supp_rates_len; |
241 | u16 capab; | 241 | u16 capab; |
242 | struct ieee80211_bss *bss; | 242 | struct ieee80211_bss *bss; |
@@ -393,24 +393,25 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
393 | 393 | ||
394 | /* wmm support is a must to HT */ | 394 | /* wmm support is a must to HT */ |
395 | if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) && | 395 | if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) && |
396 | sband->ht_info.ht_supported && | 396 | sband->ht_cap.ht_supported && |
397 | (ht_add_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_EXTRA_INFO))) { | 397 | (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) && |
398 | struct ieee80211_ht_addt_info *ht_add_info = | 398 | ht_ie[1] >= sizeof(struct ieee80211_ht_info)) { |
399 | (struct ieee80211_ht_addt_info *)ht_add_ie; | 399 | struct ieee80211_ht_info *ht_info = |
400 | u16 cap = sband->ht_info.cap; | 400 | (struct ieee80211_ht_info *)(ht_ie + 2); |
401 | u16 cap = sband->ht_cap.cap; | ||
401 | __le16 tmp; | 402 | __le16 tmp; |
402 | u32 flags = local->hw.conf.channel->flags; | 403 | u32 flags = local->hw.conf.channel->flags; |
403 | 404 | ||
404 | switch (ht_add_info->ht_param & IEEE80211_HT_IE_CHA_SEC_OFFSET) { | 405 | switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { |
405 | case IEEE80211_HT_IE_CHA_SEC_ABOVE: | 406 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
406 | if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) { | 407 | if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) { |
407 | cap &= ~IEEE80211_HT_CAP_SUP_WIDTH; | 408 | cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
408 | cap &= ~IEEE80211_HT_CAP_SGI_40; | 409 | cap &= ~IEEE80211_HT_CAP_SGI_40; |
409 | } | 410 | } |
410 | break; | 411 | break; |
411 | case IEEE80211_HT_IE_CHA_SEC_BELOW: | 412 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: |
412 | if (flags & IEEE80211_CHAN_NO_FAT_BELOW) { | 413 | if (flags & IEEE80211_CHAN_NO_FAT_BELOW) { |
413 | cap &= ~IEEE80211_HT_CAP_SUP_WIDTH; | 414 | cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
414 | cap &= ~IEEE80211_HT_CAP_SGI_40; | 415 | cap &= ~IEEE80211_HT_CAP_SGI_40; |
415 | } | 416 | } |
416 | break; | 417 | break; |
@@ -424,9 +425,9 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
424 | memcpy(pos, &tmp, sizeof(u16)); | 425 | memcpy(pos, &tmp, sizeof(u16)); |
425 | pos += sizeof(u16); | 426 | pos += sizeof(u16); |
426 | /* TODO: needs a define here for << 2 */ | 427 | /* TODO: needs a define here for << 2 */ |
427 | *pos++ = sband->ht_info.ampdu_factor | | 428 | *pos++ = sband->ht_cap.ampdu_factor | |
428 | (sband->ht_info.ampdu_density << 2); | 429 | (sband->ht_cap.ampdu_density << 2); |
429 | memcpy(pos, sband->ht_info.supp_mcs_set, 16); | 430 | memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs)); |
430 | } | 431 | } |
431 | 432 | ||
432 | kfree(ifsta->assocreq_ies); | 433 | kfree(ifsta->assocreq_ies); |
@@ -568,25 +569,35 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
568 | } | 569 | } |
569 | } | 570 | } |
570 | 571 | ||
571 | static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata, | 572 | static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, |
572 | bool use_protection, | 573 | u16 capab, bool erp_valid, u8 erp) |
573 | bool use_short_preamble) | ||
574 | { | 574 | { |
575 | struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; | 575 | struct ieee80211_bss_conf *bss_conf = &sdata->vif.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; |
580 | bool use_protection; | ||
581 | bool use_short_preamble; | ||
582 | bool use_short_slot; | ||
583 | |||
584 | if (erp_valid) { | ||
585 | use_protection = (erp & WLAN_ERP_USE_PROTECTION) != 0; | ||
586 | use_short_preamble = (erp & WLAN_ERP_BARKER_PREAMBLE) == 0; | ||
587 | } else { | ||
588 | use_protection = false; | ||
589 | use_short_preamble = !!(capab & WLAN_CAPABILITY_SHORT_PREAMBLE); | ||
590 | } | ||
591 | |||
592 | use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); | ||
581 | 593 | ||
582 | if (use_protection != bss_conf->use_cts_prot) { | 594 | if (use_protection != bss_conf->use_cts_prot) { |
583 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 595 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
584 | if (net_ratelimit()) { | 596 | if (net_ratelimit()) { |
585 | printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" | 597 | printk(KERN_DEBUG "%s: CTS protection %s (BSSID=%pM)\n", |
586 | "%s)\n", | ||
587 | sdata->dev->name, | 598 | sdata->dev->name, |
588 | use_protection ? "enabled" : "disabled", | 599 | use_protection ? "enabled" : "disabled", |
589 | print_mac(mac, ifsta->bssid)); | 600 | ifsta->bssid); |
590 | } | 601 | } |
591 | #endif | 602 | #endif |
592 | bss_conf->use_cts_prot = use_protection; | 603 | bss_conf->use_cts_prot = use_protection; |
@@ -597,40 +608,28 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata, | |||
597 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 608 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
598 | if (net_ratelimit()) { | 609 | if (net_ratelimit()) { |
599 | printk(KERN_DEBUG "%s: switched to %s barker preamble" | 610 | printk(KERN_DEBUG "%s: switched to %s barker preamble" |
600 | " (BSSID=%s)\n", | 611 | " (BSSID=%pM)\n", |
601 | sdata->dev->name, | 612 | sdata->dev->name, |
602 | use_short_preamble ? "short" : "long", | 613 | use_short_preamble ? "short" : "long", |
603 | print_mac(mac, ifsta->bssid)); | 614 | ifsta->bssid); |
604 | } | 615 | } |
605 | #endif | 616 | #endif |
606 | bss_conf->use_short_preamble = use_short_preamble; | 617 | bss_conf->use_short_preamble = use_short_preamble; |
607 | changed |= BSS_CHANGED_ERP_PREAMBLE; | 618 | changed |= BSS_CHANGED_ERP_PREAMBLE; |
608 | } | 619 | } |
609 | 620 | ||
610 | return changed; | 621 | if (use_short_slot != bss_conf->use_short_slot) { |
611 | } | 622 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
612 | 623 | if (net_ratelimit()) { | |
613 | static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, | 624 | printk(KERN_DEBUG "%s: switched to %s slot" |
614 | u8 erp_value) | 625 | " (BSSID=%s)\n", |
615 | { | 626 | sdata->dev->name, |
616 | bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; | 627 | use_short_slot ? "short" : "long", |
617 | bool use_short_preamble = (erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0; | 628 | ifsta->bssid); |
618 | 629 | } | |
619 | return ieee80211_handle_protect_preamb(sdata, | 630 | #endif |
620 | use_protection, use_short_preamble); | 631 | bss_conf->use_short_slot = use_short_slot; |
621 | } | 632 | changed |= BSS_CHANGED_ERP_SLOT; |
622 | |||
623 | static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, | ||
624 | struct ieee80211_bss *bss) | ||
625 | { | ||
626 | u32 changed = 0; | ||
627 | |||
628 | if (bss->has_erp_value) | ||
629 | changed |= ieee80211_handle_erp_ie(sdata, bss->erp_value); | ||
630 | else { | ||
631 | u16 capab = bss->capability; | ||
632 | changed |= ieee80211_handle_protect_preamb(sdata, false, | ||
633 | (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0); | ||
634 | } | 633 | } |
635 | 634 | ||
636 | return changed; | 635 | return changed; |
@@ -701,14 +700,15 @@ static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata, | |||
701 | 700 | ||
702 | 701 | ||
703 | static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | 702 | static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, |
704 | struct ieee80211_if_sta *ifsta) | 703 | struct ieee80211_if_sta *ifsta, |
704 | u32 bss_info_changed) | ||
705 | { | 705 | { |
706 | struct ieee80211_local *local = sdata->local; | 706 | struct ieee80211_local *local = sdata->local; |
707 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; | 707 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; |
708 | u32 changed = BSS_CHANGED_ASSOC; | ||
709 | 708 | ||
710 | struct ieee80211_bss *bss; | 709 | struct ieee80211_bss *bss; |
711 | 710 | ||
711 | bss_info_changed |= BSS_CHANGED_ASSOC; | ||
712 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; | 712 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; |
713 | 713 | ||
714 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 714 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
@@ -719,22 +719,16 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
719 | ifsta->ssid, ifsta->ssid_len); | 719 | ifsta->ssid, ifsta->ssid_len); |
720 | if (bss) { | 720 | if (bss) { |
721 | /* set timing information */ | 721 | /* set timing information */ |
722 | sdata->bss_conf.beacon_int = bss->beacon_int; | 722 | sdata->vif.bss_conf.beacon_int = bss->beacon_int; |
723 | sdata->bss_conf.timestamp = bss->timestamp; | 723 | sdata->vif.bss_conf.timestamp = bss->timestamp; |
724 | sdata->bss_conf.dtim_period = bss->dtim_period; | 724 | sdata->vif.bss_conf.dtim_period = bss->dtim_period; |
725 | 725 | ||
726 | changed |= ieee80211_handle_bss_capability(sdata, bss); | 726 | bss_info_changed |= ieee80211_handle_bss_capability(sdata, |
727 | bss->capability, bss->has_erp_value, bss->erp_value); | ||
727 | 728 | ||
728 | ieee80211_rx_bss_put(local, bss); | 729 | ieee80211_rx_bss_put(local, bss); |
729 | } | 730 | } |
730 | 731 | ||
731 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { | ||
732 | changed |= BSS_CHANGED_HT; | ||
733 | sdata->bss_conf.assoc_ht = 1; | ||
734 | sdata->bss_conf.ht_conf = &conf->ht_conf; | ||
735 | sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf; | ||
736 | } | ||
737 | |||
738 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; | 732 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; |
739 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); | 733 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); |
740 | ieee80211_sta_send_associnfo(sdata, ifsta); | 734 | ieee80211_sta_send_associnfo(sdata, ifsta); |
@@ -742,14 +736,14 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
742 | ifsta->last_probe = jiffies; | 736 | ifsta->last_probe = jiffies; |
743 | ieee80211_led_assoc(local, 1); | 737 | ieee80211_led_assoc(local, 1); |
744 | 738 | ||
745 | sdata->bss_conf.assoc = 1; | 739 | sdata->vif.bss_conf.assoc = 1; |
746 | /* | 740 | /* |
747 | * For now just always ask the driver to update the basic rateset | 741 | * For now just always ask the driver to update the basic rateset |
748 | * when we have associated, we aren't checking whether it actually | 742 | * when we have associated, we aren't checking whether it actually |
749 | * changed or not. | 743 | * changed or not. |
750 | */ | 744 | */ |
751 | changed |= BSS_CHANGED_BASIC_RATES; | 745 | bss_info_changed |= BSS_CHANGED_BASIC_RATES; |
752 | ieee80211_bss_info_change_notify(sdata, changed); | 746 | ieee80211_bss_info_change_notify(sdata, bss_info_changed); |
753 | 747 | ||
754 | netif_tx_start_all_queues(sdata->dev); | 748 | netif_tx_start_all_queues(sdata->dev); |
755 | netif_carrier_on(sdata->dev); | 749 | netif_carrier_on(sdata->dev); |
@@ -760,18 +754,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
760 | static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, | 754 | static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, |
761 | struct ieee80211_if_sta *ifsta) | 755 | struct ieee80211_if_sta *ifsta) |
762 | { | 756 | { |
763 | DECLARE_MAC_BUF(mac); | ||
764 | |||
765 | ifsta->direct_probe_tries++; | 757 | ifsta->direct_probe_tries++; |
766 | if (ifsta->direct_probe_tries > IEEE80211_AUTH_MAX_TRIES) { | 758 | if (ifsta->direct_probe_tries > IEEE80211_AUTH_MAX_TRIES) { |
767 | printk(KERN_DEBUG "%s: direct probe to AP %s timed out\n", | 759 | printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n", |
768 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 760 | sdata->dev->name, ifsta->bssid); |
769 | ifsta->state = IEEE80211_STA_MLME_DISABLED; | 761 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
762 | ieee80211_sta_send_apinfo(sdata, ifsta); | ||
770 | return; | 763 | return; |
771 | } | 764 | } |
772 | 765 | ||
773 | printk(KERN_DEBUG "%s: direct probe to AP %s try %d\n", | 766 | printk(KERN_DEBUG "%s: direct probe to AP %pM try %d\n", |
774 | sdata->dev->name, print_mac(mac, ifsta->bssid), | 767 | sdata->dev->name, ifsta->bssid, |
775 | ifsta->direct_probe_tries); | 768 | ifsta->direct_probe_tries); |
776 | 769 | ||
777 | ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE; | 770 | ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE; |
@@ -791,20 +784,19 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, | |||
791 | static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, | 784 | static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, |
792 | struct ieee80211_if_sta *ifsta) | 785 | struct ieee80211_if_sta *ifsta) |
793 | { | 786 | { |
794 | DECLARE_MAC_BUF(mac); | ||
795 | |||
796 | ifsta->auth_tries++; | 787 | ifsta->auth_tries++; |
797 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { | 788 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { |
798 | printk(KERN_DEBUG "%s: authentication with AP %s" | 789 | printk(KERN_DEBUG "%s: authentication with AP %pM" |
799 | " timed out\n", | 790 | " timed out\n", |
800 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 791 | sdata->dev->name, ifsta->bssid); |
801 | ifsta->state = IEEE80211_STA_MLME_DISABLED; | 792 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
793 | ieee80211_sta_send_apinfo(sdata, ifsta); | ||
802 | return; | 794 | return; |
803 | } | 795 | } |
804 | 796 | ||
805 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; | 797 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; |
806 | printk(KERN_DEBUG "%s: authenticate with AP %s\n", | 798 | printk(KERN_DEBUG "%s: authenticate with AP %pM\n", |
807 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 799 | sdata->dev->name, ifsta->bssid); |
808 | 800 | ||
809 | ieee80211_send_auth(sdata, ifsta, 1, NULL, 0, 0); | 801 | ieee80211_send_auth(sdata, ifsta, 1, NULL, 0, 0); |
810 | 802 | ||
@@ -817,7 +809,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
817 | { | 809 | { |
818 | struct ieee80211_local *local = sdata->local; | 810 | struct ieee80211_local *local = sdata->local; |
819 | struct sta_info *sta; | 811 | struct sta_info *sta; |
820 | u32 changed = BSS_CHANGED_ASSOC; | 812 | u32 changed = 0; |
821 | 813 | ||
822 | rcu_read_lock(); | 814 | rcu_read_lock(); |
823 | 815 | ||
@@ -851,15 +843,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
851 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; | 843 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; |
852 | changed |= ieee80211_reset_erp_info(sdata); | 844 | changed |= ieee80211_reset_erp_info(sdata); |
853 | 845 | ||
854 | if (sdata->bss_conf.assoc_ht) | ||
855 | changed |= BSS_CHANGED_HT; | ||
856 | |||
857 | sdata->bss_conf.assoc_ht = 0; | ||
858 | sdata->bss_conf.ht_conf = NULL; | ||
859 | sdata->bss_conf.ht_bss_conf = NULL; | ||
860 | |||
861 | ieee80211_led_assoc(local, 0); | 846 | ieee80211_led_assoc(local, 0); |
862 | sdata->bss_conf.assoc = 0; | 847 | changed |= BSS_CHANGED_ASSOC; |
848 | sdata->vif.bss_conf.assoc = false; | ||
863 | 849 | ||
864 | ieee80211_sta_send_apinfo(sdata, ifsta); | 850 | ieee80211_sta_send_apinfo(sdata, ifsta); |
865 | 851 | ||
@@ -871,6 +857,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
871 | rcu_read_unlock(); | 857 | rcu_read_unlock(); |
872 | 858 | ||
873 | sta_info_destroy(sta); | 859 | sta_info_destroy(sta); |
860 | |||
861 | local->hw.conf.ht.enabled = false; | ||
862 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_HT); | ||
863 | |||
864 | ieee80211_bss_info_change_notify(sdata, changed); | ||
874 | } | 865 | } |
875 | 866 | ||
876 | static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata) | 867 | static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata) |
@@ -914,20 +905,19 @@ static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata, | |||
914 | static void ieee80211_associate(struct ieee80211_sub_if_data *sdata, | 905 | static void ieee80211_associate(struct ieee80211_sub_if_data *sdata, |
915 | struct ieee80211_if_sta *ifsta) | 906 | struct ieee80211_if_sta *ifsta) |
916 | { | 907 | { |
917 | DECLARE_MAC_BUF(mac); | ||
918 | |||
919 | ifsta->assoc_tries++; | 908 | ifsta->assoc_tries++; |
920 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { | 909 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { |
921 | printk(KERN_DEBUG "%s: association with AP %s" | 910 | printk(KERN_DEBUG "%s: association with AP %pM" |
922 | " timed out\n", | 911 | " timed out\n", |
923 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 912 | sdata->dev->name, ifsta->bssid); |
924 | ifsta->state = IEEE80211_STA_MLME_DISABLED; | 913 | ifsta->state = IEEE80211_STA_MLME_DISABLED; |
914 | ieee80211_sta_send_apinfo(sdata, ifsta); | ||
925 | return; | 915 | return; |
926 | } | 916 | } |
927 | 917 | ||
928 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; | 918 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; |
929 | printk(KERN_DEBUG "%s: associate with AP %s\n", | 919 | printk(KERN_DEBUG "%s: associate with AP %pM\n", |
930 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 920 | sdata->dev->name, ifsta->bssid); |
931 | if (ieee80211_privacy_mismatch(sdata, ifsta)) { | 921 | if (ieee80211_privacy_mismatch(sdata, ifsta)) { |
932 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " | 922 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " |
933 | "mixed-cell disabled - abort association\n", sdata->dev->name); | 923 | "mixed-cell disabled - abort association\n", sdata->dev->name); |
@@ -947,7 +937,6 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata, | |||
947 | struct ieee80211_local *local = sdata->local; | 937 | struct ieee80211_local *local = sdata->local; |
948 | struct sta_info *sta; | 938 | struct sta_info *sta; |
949 | int disassoc; | 939 | int disassoc; |
950 | DECLARE_MAC_BUF(mac); | ||
951 | 940 | ||
952 | /* TODO: start monitoring current AP signal quality and number of | 941 | /* TODO: start monitoring current AP signal quality and number of |
953 | * missed beacons. Scan other channels every now and then and search | 942 | * missed beacons. Scan other channels every now and then and search |
@@ -960,8 +949,8 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata, | |||
960 | 949 | ||
961 | sta = sta_info_get(local, ifsta->bssid); | 950 | sta = sta_info_get(local, ifsta->bssid); |
962 | if (!sta) { | 951 | if (!sta) { |
963 | printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", | 952 | printk(KERN_DEBUG "%s: No STA entry for own AP %pM\n", |
964 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 953 | sdata->dev->name, ifsta->bssid); |
965 | disassoc = 1; | 954 | disassoc = 1; |
966 | } else { | 955 | } else { |
967 | disassoc = 0; | 956 | disassoc = 0; |
@@ -969,9 +958,9 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata, | |||
969 | sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { | 958 | sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { |
970 | if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) { | 959 | if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) { |
971 | printk(KERN_DEBUG "%s: No ProbeResp from " | 960 | printk(KERN_DEBUG "%s: No ProbeResp from " |
972 | "current AP %s - assume out of " | 961 | "current AP %pM - assume out of " |
973 | "range\n", | 962 | "range\n", |
974 | sdata->dev->name, print_mac(mac, ifsta->bssid)); | 963 | sdata->dev->name, ifsta->bssid); |
975 | disassoc = 1; | 964 | disassoc = 1; |
976 | } else | 965 | } else |
977 | ieee80211_send_probe_req(sdata, ifsta->bssid, | 966 | ieee80211_send_probe_req(sdata, ifsta->bssid, |
@@ -1032,7 +1021,6 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
1032 | size_t len) | 1021 | size_t len) |
1033 | { | 1022 | { |
1034 | u16 auth_alg, auth_transaction, status_code; | 1023 | u16 auth_alg, auth_transaction, status_code; |
1035 | DECLARE_MAC_BUF(mac); | ||
1036 | 1024 | ||
1037 | if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && | 1025 | if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && |
1038 | sdata->vif.type != NL80211_IFTYPE_ADHOC) | 1026 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
@@ -1125,7 +1113,6 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | |||
1125 | size_t len) | 1113 | size_t len) |
1126 | { | 1114 | { |
1127 | u16 reason_code; | 1115 | u16 reason_code; |
1128 | DECLARE_MAC_BUF(mac); | ||
1129 | 1116 | ||
1130 | if (len < 24 + 2) | 1117 | if (len < 24 + 2) |
1131 | return; | 1118 | return; |
@@ -1136,7 +1123,8 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | |||
1136 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 1123 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
1137 | 1124 | ||
1138 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) | 1125 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) |
1139 | printk(KERN_DEBUG "%s: deauthenticated\n", sdata->dev->name); | 1126 | printk(KERN_DEBUG "%s: deauthenticated (Reason: %u)\n", |
1127 | sdata->dev->name, reason_code); | ||
1140 | 1128 | ||
1141 | if (ifsta->state == IEEE80211_STA_MLME_AUTHENTICATE || | 1129 | if (ifsta->state == IEEE80211_STA_MLME_AUTHENTICATE || |
1142 | ifsta->state == IEEE80211_STA_MLME_ASSOCIATE || | 1130 | ifsta->state == IEEE80211_STA_MLME_ASSOCIATE || |
@@ -1157,7 +1145,6 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1157 | size_t len) | 1145 | size_t len) |
1158 | { | 1146 | { |
1159 | u16 reason_code; | 1147 | u16 reason_code; |
1160 | DECLARE_MAC_BUF(mac); | ||
1161 | 1148 | ||
1162 | if (len < 24 + 2) | 1149 | if (len < 24 + 2) |
1163 | return; | 1150 | return; |
@@ -1168,7 +1155,8 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1168 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1155 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1169 | 1156 | ||
1170 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) | 1157 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) |
1171 | printk(KERN_DEBUG "%s: disassociated\n", sdata->dev->name); | 1158 | printk(KERN_DEBUG "%s: disassociated (Reason: %u)\n", |
1159 | sdata->dev->name, reason_code); | ||
1172 | 1160 | ||
1173 | if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) { | 1161 | if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) { |
1174 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; | 1162 | ifsta->state = IEEE80211_STA_MLME_ASSOCIATE; |
@@ -1192,11 +1180,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1192 | u64 rates, basic_rates; | 1180 | u64 rates, basic_rates; |
1193 | u16 capab_info, status_code, aid; | 1181 | u16 capab_info, status_code, aid; |
1194 | struct ieee802_11_elems elems; | 1182 | struct ieee802_11_elems elems; |
1195 | struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; | 1183 | struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; |
1196 | u8 *pos; | 1184 | u8 *pos; |
1185 | u32 changed = 0; | ||
1197 | int i, j; | 1186 | int i, j; |
1198 | DECLARE_MAC_BUF(mac); | 1187 | bool have_higher_than_11mbit = false, newsta = false; |
1199 | bool have_higher_than_11mbit = false; | 1188 | u16 ap_ht_cap_flags; |
1200 | 1189 | ||
1201 | /* AssocResp and ReassocResp have identical structure, so process both | 1190 | /* AssocResp and ReassocResp have identical structure, so process both |
1202 | * of them in this function. */ | 1191 | * of them in this function. */ |
@@ -1214,9 +1203,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); | 1203 | status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); |
1215 | aid = le16_to_cpu(mgmt->u.assoc_resp.aid); | 1204 | aid = le16_to_cpu(mgmt->u.assoc_resp.aid); |
1216 | 1205 | ||
1217 | printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " | 1206 | printk(KERN_DEBUG "%s: RX %sssocResp from %pM (capab=0x%x " |
1218 | "status=%d aid=%d)\n", | 1207 | "status=%d aid=%d)\n", |
1219 | sdata->dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), | 1208 | sdata->dev->name, reassoc ? "Rea" : "A", mgmt->sa, |
1220 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); | 1209 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); |
1221 | 1210 | ||
1222 | if (status_code != WLAN_STATUS_SUCCESS) { | 1211 | if (status_code != WLAN_STATUS_SUCCESS) { |
@@ -1259,7 +1248,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1259 | sta = sta_info_get(local, ifsta->bssid); | 1248 | sta = sta_info_get(local, ifsta->bssid); |
1260 | if (!sta) { | 1249 | if (!sta) { |
1261 | struct ieee80211_bss *bss; | 1250 | struct ieee80211_bss *bss; |
1262 | int err; | 1251 | |
1252 | newsta = true; | ||
1263 | 1253 | ||
1264 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); | 1254 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); |
1265 | if (!sta) { | 1255 | if (!sta) { |
@@ -1278,13 +1268,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1278 | ieee80211_rx_bss_put(local, bss); | 1268 | ieee80211_rx_bss_put(local, bss); |
1279 | } | 1269 | } |
1280 | 1270 | ||
1281 | err = sta_info_insert(sta); | ||
1282 | if (err) { | ||
1283 | printk(KERN_DEBUG "%s: failed to insert STA entry for" | ||
1284 | " the AP (error %d)\n", sdata->dev->name, err); | ||
1285 | rcu_read_unlock(); | ||
1286 | return; | ||
1287 | } | ||
1288 | /* update new sta with its last rx activity */ | 1271 | /* update new sta with its last rx activity */ |
1289 | sta->last_rx = jiffies; | 1272 | sta->last_rx = jiffies; |
1290 | } | 1273 | } |
@@ -1308,34 +1291,40 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1308 | 1291 | ||
1309 | for (i = 0; i < elems.supp_rates_len; i++) { | 1292 | for (i = 0; i < elems.supp_rates_len; i++) { |
1310 | int rate = (elems.supp_rates[i] & 0x7f) * 5; | 1293 | int rate = (elems.supp_rates[i] & 0x7f) * 5; |
1294 | bool is_basic = !!(elems.supp_rates[i] & 0x80); | ||
1311 | 1295 | ||
1312 | if (rate > 110) | 1296 | if (rate > 110) |
1313 | have_higher_than_11mbit = true; | 1297 | have_higher_than_11mbit = true; |
1314 | 1298 | ||
1315 | for (j = 0; j < sband->n_bitrates; j++) { | 1299 | for (j = 0; j < sband->n_bitrates; j++) { |
1316 | if (sband->bitrates[j].bitrate == rate) | 1300 | if (sband->bitrates[j].bitrate == rate) { |
1317 | rates |= BIT(j); | 1301 | rates |= BIT(j); |
1318 | if (elems.supp_rates[i] & 0x80) | 1302 | if (is_basic) |
1319 | basic_rates |= BIT(j); | 1303 | basic_rates |= BIT(j); |
1304 | break; | ||
1305 | } | ||
1320 | } | 1306 | } |
1321 | } | 1307 | } |
1322 | 1308 | ||
1323 | for (i = 0; i < elems.ext_supp_rates_len; i++) { | 1309 | for (i = 0; i < elems.ext_supp_rates_len; i++) { |
1324 | int rate = (elems.ext_supp_rates[i] & 0x7f) * 5; | 1310 | int rate = (elems.ext_supp_rates[i] & 0x7f) * 5; |
1311 | bool is_basic = !!(elems.supp_rates[i] & 0x80); | ||
1325 | 1312 | ||
1326 | if (rate > 110) | 1313 | if (rate > 110) |
1327 | have_higher_than_11mbit = true; | 1314 | have_higher_than_11mbit = true; |
1328 | 1315 | ||
1329 | for (j = 0; j < sband->n_bitrates; j++) { | 1316 | for (j = 0; j < sband->n_bitrates; j++) { |
1330 | if (sband->bitrates[j].bitrate == rate) | 1317 | if (sband->bitrates[j].bitrate == rate) { |
1331 | rates |= BIT(j); | 1318 | rates |= BIT(j); |
1332 | if (elems.ext_supp_rates[i] & 0x80) | 1319 | if (is_basic) |
1333 | basic_rates |= BIT(j); | 1320 | basic_rates |= BIT(j); |
1321 | break; | ||
1322 | } | ||
1334 | } | 1323 | } |
1335 | } | 1324 | } |
1336 | 1325 | ||
1337 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; | 1326 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
1338 | sdata->bss_conf.basic_rates = basic_rates; | 1327 | sdata->vif.bss_conf.basic_rates = basic_rates; |
1339 | 1328 | ||
1340 | /* cf. IEEE 802.11 9.2.12 */ | 1329 | /* cf. IEEE 802.11 9.2.12 */ |
1341 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | 1330 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && |
@@ -1344,31 +1333,43 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1344 | else | 1333 | else |
1345 | sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; | 1334 | sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; |
1346 | 1335 | ||
1347 | if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param && | 1336 | if (elems.ht_cap_elem) |
1348 | (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { | 1337 | ieee80211_ht_cap_ie_to_sta_ht_cap(sband, |
1349 | struct ieee80211_ht_bss_info bss_info; | 1338 | elems.ht_cap_elem, &sta->sta.ht_cap); |
1350 | ieee80211_ht_cap_ie_to_ht_info( | 1339 | |
1351 | elems.ht_cap_elem, &sta->sta.ht_info); | 1340 | ap_ht_cap_flags = sta->sta.ht_cap.cap; |
1352 | ieee80211_ht_addt_info_ie_to_ht_bss_info( | ||
1353 | elems.ht_info_elem, &bss_info); | ||
1354 | ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info); | ||
1355 | } | ||
1356 | 1341 | ||
1357 | rate_control_rate_init(sta); | 1342 | rate_control_rate_init(sta); |
1358 | 1343 | ||
1359 | if (elems.wmm_param) { | 1344 | if (elems.wmm_param) |
1360 | set_sta_flags(sta, WLAN_STA_WME); | 1345 | set_sta_flags(sta, WLAN_STA_WME); |
1361 | rcu_read_unlock(); | 1346 | |
1347 | if (newsta) { | ||
1348 | int err = sta_info_insert(sta); | ||
1349 | if (err) { | ||
1350 | printk(KERN_DEBUG "%s: failed to insert STA entry for" | ||
1351 | " the AP (error %d)\n", sdata->dev->name, err); | ||
1352 | rcu_read_unlock(); | ||
1353 | return; | ||
1354 | } | ||
1355 | } | ||
1356 | |||
1357 | rcu_read_unlock(); | ||
1358 | |||
1359 | if (elems.wmm_param) | ||
1362 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, | 1360 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
1363 | elems.wmm_param_len); | 1361 | elems.wmm_param_len); |
1364 | } else | 1362 | |
1365 | rcu_read_unlock(); | 1363 | if (elems.ht_info_elem && elems.wmm_param && |
1364 | (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) | ||
1365 | changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, | ||
1366 | ap_ht_cap_flags); | ||
1366 | 1367 | ||
1367 | /* set AID and assoc capability, | 1368 | /* set AID and assoc capability, |
1368 | * ieee80211_set_associated() will tell the driver */ | 1369 | * ieee80211_set_associated() will tell the driver */ |
1369 | bss_conf->aid = aid; | 1370 | bss_conf->aid = aid; |
1370 | bss_conf->assoc_capability = capab_info; | 1371 | bss_conf->assoc_capability = capab_info; |
1371 | ieee80211_set_associated(sdata, ifsta); | 1372 | ieee80211_set_associated(sdata, ifsta, changed); |
1372 | 1373 | ||
1373 | ieee80211_associated(sdata, ifsta); | 1374 | ieee80211_associated(sdata, ifsta); |
1374 | } | 1375 | } |
@@ -1386,6 +1387,13 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
1386 | struct ieee80211_supported_band *sband; | 1387 | struct ieee80211_supported_band *sband; |
1387 | union iwreq_data wrqu; | 1388 | union iwreq_data wrqu; |
1388 | 1389 | ||
1390 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | ||
1391 | if (!skb) { | ||
1392 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " | ||
1393 | "response\n", sdata->dev->name); | ||
1394 | return -ENOMEM; | ||
1395 | } | ||
1396 | |||
1389 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1397 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
1390 | 1398 | ||
1391 | /* Remove possible STA entries from other IBSS networks. */ | 1399 | /* Remove possible STA entries from other IBSS networks. */ |
@@ -1411,63 +1419,62 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
1411 | return res; | 1419 | return res; |
1412 | 1420 | ||
1413 | /* Build IBSS probe response */ | 1421 | /* Build IBSS probe response */ |
1414 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | ||
1415 | if (skb) { | ||
1416 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
1417 | 1422 | ||
1418 | mgmt = (struct ieee80211_mgmt *) | 1423 | skb_reserve(skb, local->hw.extra_tx_headroom); |
1419 | skb_put(skb, 24 + sizeof(mgmt->u.beacon)); | ||
1420 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); | ||
1421 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
1422 | IEEE80211_STYPE_PROBE_RESP); | ||
1423 | memset(mgmt->da, 0xff, ETH_ALEN); | ||
1424 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
1425 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
1426 | mgmt->u.beacon.beacon_int = | ||
1427 | cpu_to_le16(local->hw.conf.beacon_int); | ||
1428 | mgmt->u.beacon.timestamp = cpu_to_le64(bss->timestamp); | ||
1429 | mgmt->u.beacon.capab_info = cpu_to_le16(bss->capability); | ||
1430 | |||
1431 | pos = skb_put(skb, 2 + ifsta->ssid_len); | ||
1432 | *pos++ = WLAN_EID_SSID; | ||
1433 | *pos++ = ifsta->ssid_len; | ||
1434 | memcpy(pos, ifsta->ssid, ifsta->ssid_len); | ||
1435 | |||
1436 | rates = bss->supp_rates_len; | ||
1437 | if (rates > 8) | ||
1438 | rates = 8; | ||
1439 | pos = skb_put(skb, 2 + rates); | ||
1440 | *pos++ = WLAN_EID_SUPP_RATES; | ||
1441 | *pos++ = rates; | ||
1442 | memcpy(pos, bss->supp_rates, rates); | ||
1443 | 1424 | ||
1444 | if (bss->band == IEEE80211_BAND_2GHZ) { | 1425 | mgmt = (struct ieee80211_mgmt *) |
1445 | pos = skb_put(skb, 2 + 1); | 1426 | skb_put(skb, 24 + sizeof(mgmt->u.beacon)); |
1446 | *pos++ = WLAN_EID_DS_PARAMS; | 1427 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); |
1447 | *pos++ = 1; | 1428 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1448 | *pos++ = ieee80211_frequency_to_channel(bss->freq); | 1429 | IEEE80211_STYPE_PROBE_RESP); |
1449 | } | 1430 | memset(mgmt->da, 0xff, ETH_ALEN); |
1431 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
1432 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
1433 | mgmt->u.beacon.beacon_int = | ||
1434 | cpu_to_le16(local->hw.conf.beacon_int); | ||
1435 | mgmt->u.beacon.timestamp = cpu_to_le64(bss->timestamp); | ||
1436 | mgmt->u.beacon.capab_info = cpu_to_le16(bss->capability); | ||
1450 | 1437 | ||
1451 | pos = skb_put(skb, 2 + 2); | 1438 | pos = skb_put(skb, 2 + ifsta->ssid_len); |
1452 | *pos++ = WLAN_EID_IBSS_PARAMS; | 1439 | *pos++ = WLAN_EID_SSID; |
1453 | *pos++ = 2; | 1440 | *pos++ = ifsta->ssid_len; |
1454 | /* FIX: set ATIM window based on scan results */ | 1441 | memcpy(pos, ifsta->ssid, ifsta->ssid_len); |
1455 | *pos++ = 0; | ||
1456 | *pos++ = 0; | ||
1457 | 1442 | ||
1458 | if (bss->supp_rates_len > 8) { | 1443 | rates = bss->supp_rates_len; |
1459 | rates = bss->supp_rates_len - 8; | 1444 | if (rates > 8) |
1460 | pos = skb_put(skb, 2 + rates); | 1445 | rates = 8; |
1461 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 1446 | pos = skb_put(skb, 2 + rates); |
1462 | *pos++ = rates; | 1447 | *pos++ = WLAN_EID_SUPP_RATES; |
1463 | memcpy(pos, &bss->supp_rates[8], rates); | 1448 | *pos++ = rates; |
1464 | } | 1449 | memcpy(pos, bss->supp_rates, rates); |
1450 | |||
1451 | if (bss->band == IEEE80211_BAND_2GHZ) { | ||
1452 | pos = skb_put(skb, 2 + 1); | ||
1453 | *pos++ = WLAN_EID_DS_PARAMS; | ||
1454 | *pos++ = 1; | ||
1455 | *pos++ = ieee80211_frequency_to_channel(bss->freq); | ||
1456 | } | ||
1465 | 1457 | ||
1466 | ifsta->probe_resp = skb; | 1458 | pos = skb_put(skb, 2 + 2); |
1459 | *pos++ = WLAN_EID_IBSS_PARAMS; | ||
1460 | *pos++ = 2; | ||
1461 | /* FIX: set ATIM window based on scan results */ | ||
1462 | *pos++ = 0; | ||
1463 | *pos++ = 0; | ||
1467 | 1464 | ||
1468 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | 1465 | if (bss->supp_rates_len > 8) { |
1466 | rates = bss->supp_rates_len - 8; | ||
1467 | pos = skb_put(skb, 2 + rates); | ||
1468 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
1469 | *pos++ = rates; | ||
1470 | memcpy(pos, &bss->supp_rates[8], rates); | ||
1469 | } | 1471 | } |
1470 | 1472 | ||
1473 | ifsta->probe_resp = skb; | ||
1474 | |||
1475 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | ||
1476 | |||
1477 | |||
1471 | rates = 0; | 1478 | rates = 0; |
1472 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1479 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
1473 | for (i = 0; i < bss->supp_rates_len; i++) { | 1480 | for (i = 0; i < bss->supp_rates_len; i++) { |
@@ -1507,8 +1514,6 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1507 | u64 beacon_timestamp, rx_timestamp; | 1514 | u64 beacon_timestamp, rx_timestamp; |
1508 | u64 supp_rates = 0; | 1515 | u64 supp_rates = 0; |
1509 | enum ieee80211_band band = rx_status->band; | 1516 | enum ieee80211_band band = rx_status->band; |
1510 | DECLARE_MAC_BUF(mac); | ||
1511 | DECLARE_MAC_BUF(mac2); | ||
1512 | 1517 | ||
1513 | if (elems->ds_params && elems->ds_params_len == 1) | 1518 | if (elems->ds_params && elems->ds_params_len == 1) |
1514 | freq = ieee80211_channel_to_frequency(elems->ds_params[0]); | 1519 | freq = ieee80211_channel_to_frequency(elems->ds_params[0]); |
@@ -1538,10 +1543,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1538 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1543 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1539 | if (sta->sta.supp_rates[band] != prev_rates) | 1544 | if (sta->sta.supp_rates[band] != prev_rates) |
1540 | printk(KERN_DEBUG "%s: updated supp_rates set " | 1545 | printk(KERN_DEBUG "%s: updated supp_rates set " |
1541 | "for %s based on beacon info (0x%llx | " | 1546 | "for %pM based on beacon info (0x%llx | " |
1542 | "0x%llx -> 0x%llx)\n", | 1547 | "0x%llx -> 0x%llx)\n", |
1543 | sdata->dev->name, | 1548 | sdata->dev->name, |
1544 | print_mac(mac, sta->sta.addr), | 1549 | sta->sta.addr, |
1545 | (unsigned long long) prev_rates, | 1550 | (unsigned long long) prev_rates, |
1546 | (unsigned long long) supp_rates, | 1551 | (unsigned long long) supp_rates, |
1547 | (unsigned long long) sta->sta.supp_rates[band]); | 1552 | (unsigned long long) sta->sta.supp_rates[band]); |
@@ -1605,10 +1610,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1605 | /* can't merge without knowing the TSF */ | 1610 | /* can't merge without knowing the TSF */ |
1606 | rx_timestamp = -1LLU; | 1611 | rx_timestamp = -1LLU; |
1607 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1612 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1608 | printk(KERN_DEBUG "RX beacon SA=%s BSSID=" | 1613 | printk(KERN_DEBUG "RX beacon SA=%pM BSSID=" |
1609 | "%s TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", | 1614 | "%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", |
1610 | print_mac(mac, mgmt->sa), | 1615 | mgmt->sa, mgmt->bssid, |
1611 | print_mac(mac2, mgmt->bssid), | ||
1612 | (unsigned long long)rx_timestamp, | 1616 | (unsigned long long)rx_timestamp, |
1613 | (unsigned long long)beacon_timestamp, | 1617 | (unsigned long long)beacon_timestamp, |
1614 | (unsigned long long)(rx_timestamp - beacon_timestamp), | 1618 | (unsigned long long)(rx_timestamp - beacon_timestamp), |
@@ -1617,8 +1621,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1617 | if (beacon_timestamp > rx_timestamp) { | 1621 | if (beacon_timestamp > rx_timestamp) { |
1618 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1622 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1619 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 1623 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
1620 | "local TSF - IBSS merge with BSSID %s\n", | 1624 | "local TSF - IBSS merge with BSSID %pM\n", |
1621 | sdata->dev->name, print_mac(mac, mgmt->bssid)); | 1625 | sdata->dev->name, mgmt->bssid); |
1622 | #endif | 1626 | #endif |
1623 | ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss); | 1627 | ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss); |
1624 | ieee80211_ibss_add_sta(sdata, NULL, | 1628 | ieee80211_ibss_add_sta(sdata, NULL, |
@@ -1671,8 +1675,9 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1671 | size_t baselen; | 1675 | size_t baselen; |
1672 | struct ieee802_11_elems elems; | 1676 | struct ieee802_11_elems elems; |
1673 | struct ieee80211_local *local = sdata->local; | 1677 | struct ieee80211_local *local = sdata->local; |
1674 | struct ieee80211_conf *conf = &local->hw.conf; | ||
1675 | u32 changed = 0; | 1678 | u32 changed = 0; |
1679 | bool erp_valid; | ||
1680 | u8 erp_value = 0; | ||
1676 | 1681 | ||
1677 | /* Process beacon from the current BSS */ | 1682 | /* Process beacon from the current BSS */ |
1678 | baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; | 1683 | baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; |
@@ -1694,22 +1699,42 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1694 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, | 1699 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
1695 | elems.wmm_param_len); | 1700 | elems.wmm_param_len); |
1696 | 1701 | ||
1697 | if (elems.erp_info && elems.erp_info_len >= 1) | 1702 | |
1698 | changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]); | 1703 | if (elems.erp_info && elems.erp_info_len >= 1) { |
1699 | else { | 1704 | erp_valid = true; |
1700 | u16 capab = le16_to_cpu(mgmt->u.beacon.capab_info); | 1705 | erp_value = elems.erp_info[0]; |
1701 | changed |= ieee80211_handle_protect_preamb(sdata, false, | 1706 | } else { |
1702 | (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0); | 1707 | erp_valid = false; |
1703 | } | 1708 | } |
1709 | changed |= ieee80211_handle_bss_capability(sdata, | ||
1710 | le16_to_cpu(mgmt->u.beacon.capab_info), | ||
1711 | erp_valid, erp_value); | ||
1712 | |||
1713 | |||
1714 | if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param) { | ||
1715 | struct sta_info *sta; | ||
1716 | struct ieee80211_supported_band *sband; | ||
1717 | u16 ap_ht_cap_flags; | ||
1718 | |||
1719 | rcu_read_lock(); | ||
1720 | |||
1721 | sta = sta_info_get(local, ifsta->bssid); | ||
1722 | if (!sta) { | ||
1723 | rcu_read_unlock(); | ||
1724 | return; | ||
1725 | } | ||
1726 | |||
1727 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1704 | 1728 | ||
1705 | if (elems.ht_cap_elem && elems.ht_info_elem && | 1729 | ieee80211_ht_cap_ie_to_sta_ht_cap(sband, |
1706 | elems.wmm_param && conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { | 1730 | elems.ht_cap_elem, &sta->sta.ht_cap); |
1707 | struct ieee80211_ht_bss_info bss_info; | ||
1708 | 1731 | ||
1709 | ieee80211_ht_addt_info_ie_to_ht_bss_info( | 1732 | ap_ht_cap_flags = sta->sta.ht_cap.cap; |
1710 | elems.ht_info_elem, &bss_info); | 1733 | |
1711 | changed |= ieee80211_handle_ht(local, 1, &conf->ht_conf, | 1734 | rcu_read_unlock(); |
1712 | &bss_info); | 1735 | |
1736 | changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, | ||
1737 | ap_ht_cap_flags); | ||
1713 | } | 1738 | } |
1714 | 1739 | ||
1715 | ieee80211_bss_info_change_notify(sdata, changed); | 1740 | ieee80211_bss_info_change_notify(sdata, changed); |
@@ -1727,11 +1752,6 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1727 | struct sk_buff *skb; | 1752 | struct sk_buff *skb; |
1728 | struct ieee80211_mgmt *resp; | 1753 | struct ieee80211_mgmt *resp; |
1729 | u8 *pos, *end; | 1754 | 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 | 1755 | ||
1736 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC || | 1756 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC || |
1737 | ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED || | 1757 | ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED || |
@@ -1744,10 +1764,10 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1744 | tx_last_beacon = 1; | 1764 | tx_last_beacon = 1; |
1745 | 1765 | ||
1746 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1766 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1747 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" | 1767 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" |
1748 | "%s (tx_last_beacon=%d)\n", | 1768 | " (tx_last_beacon=%d)\n", |
1749 | sdata->dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), | 1769 | sdata->dev->name, mgmt->sa, mgmt->da, |
1750 | print_mac(mac3, mgmt->bssid), tx_last_beacon); | 1770 | mgmt->bssid, tx_last_beacon); |
1751 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 1771 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
1752 | 1772 | ||
1753 | if (!tx_last_beacon) | 1773 | if (!tx_last_beacon) |
@@ -1763,8 +1783,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1763 | pos + 2 + pos[1] > end) { | 1783 | pos + 2 + pos[1] > end) { |
1764 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1784 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1765 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 1785 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
1766 | "from %s\n", | 1786 | "from %pM\n", |
1767 | sdata->dev->name, print_mac(mac, mgmt->sa)); | 1787 | sdata->dev->name, mgmt->sa); |
1768 | #endif | 1788 | #endif |
1769 | return; | 1789 | return; |
1770 | } | 1790 | } |
@@ -1783,8 +1803,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1783 | resp = (struct ieee80211_mgmt *) skb->data; | 1803 | resp = (struct ieee80211_mgmt *) skb->data; |
1784 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 1804 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
1785 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1805 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1786 | printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", | 1806 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", |
1787 | sdata->dev->name, print_mac(mac, resp->da)); | 1807 | sdata->dev->name, resp->da); |
1788 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 1808 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
1789 | ieee80211_tx_skb(sdata, skb, 0); | 1809 | ieee80211_tx_skb(sdata, skb, 0); |
1790 | } | 1810 | } |
@@ -1990,7 +2010,6 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata, | |||
1990 | u8 bssid[ETH_ALEN], *pos; | 2010 | u8 bssid[ETH_ALEN], *pos; |
1991 | int i; | 2011 | int i; |
1992 | int ret; | 2012 | int ret; |
1993 | DECLARE_MAC_BUF(mac); | ||
1994 | 2013 | ||
1995 | #if 0 | 2014 | #if 0 |
1996 | /* Easier testing, use fixed BSSID. */ | 2015 | /* Easier testing, use fixed BSSID. */ |
@@ -2006,8 +2025,8 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata, | |||
2006 | bssid[0] |= 0x02; | 2025 | bssid[0] |= 0x02; |
2007 | #endif | 2026 | #endif |
2008 | 2027 | ||
2009 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", | 2028 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", |
2010 | sdata->dev->name, print_mac(mac, bssid)); | 2029 | sdata->dev->name, bssid); |
2011 | 2030 | ||
2012 | bss = ieee80211_rx_bss_add(local, bssid, | 2031 | bss = ieee80211_rx_bss_add(local, bssid, |
2013 | local->hw.conf.channel->center_freq, | 2032 | local->hw.conf.channel->center_freq, |
@@ -2050,8 +2069,6 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2050 | int found = 0; | 2069 | int found = 0; |
2051 | u8 bssid[ETH_ALEN]; | 2070 | u8 bssid[ETH_ALEN]; |
2052 | int active_ibss; | 2071 | int active_ibss; |
2053 | DECLARE_MAC_BUF(mac); | ||
2054 | DECLARE_MAC_BUF(mac2); | ||
2055 | 2072 | ||
2056 | if (ifsta->ssid_len == 0) | 2073 | if (ifsta->ssid_len == 0) |
2057 | return -EINVAL; | 2074 | return -EINVAL; |
@@ -2068,8 +2085,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2068 | || !(bss->capability & WLAN_CAPABILITY_IBSS)) | 2085 | || !(bss->capability & WLAN_CAPABILITY_IBSS)) |
2069 | continue; | 2086 | continue; |
2070 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2087 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2071 | printk(KERN_DEBUG " bssid=%s found\n", | 2088 | printk(KERN_DEBUG " bssid=%pM found\n", bss->bssid); |
2072 | print_mac(mac, bss->bssid)); | ||
2073 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2089 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
2074 | memcpy(bssid, bss->bssid, ETH_ALEN); | 2090 | memcpy(bssid, bss->bssid, ETH_ALEN); |
2075 | found = 1; | 2091 | found = 1; |
@@ -2080,9 +2096,8 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2080 | 2096 | ||
2081 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2097 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2082 | if (found) | 2098 | if (found) |
2083 | printk(KERN_DEBUG " sta_find_ibss: selected %s current " | 2099 | printk(KERN_DEBUG " sta_find_ibss: selected %pM current " |
2084 | "%s\n", print_mac(mac, bssid), | 2100 | "%pM\n", bssid, ifsta->bssid); |
2085 | print_mac(mac2, ifsta->bssid)); | ||
2086 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2101 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
2087 | 2102 | ||
2088 | if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { | 2103 | if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { |
@@ -2099,9 +2114,9 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2099 | if (!bss) | 2114 | if (!bss) |
2100 | goto dont_join; | 2115 | goto dont_join; |
2101 | 2116 | ||
2102 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" | 2117 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" |
2103 | " based on configured SSID\n", | 2118 | " based on configured SSID\n", |
2104 | sdata->dev->name, print_mac(mac, bssid)); | 2119 | sdata->dev->name, bssid); |
2105 | ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); | 2120 | ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); |
2106 | ieee80211_rx_bss_put(local, bss); | 2121 | ieee80211_rx_bss_put(local, bss); |
2107 | return ret; | 2122 | return ret; |
@@ -2343,7 +2358,6 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
2343 | { | 2358 | { |
2344 | struct ieee80211_local *local = sdata->local; | 2359 | struct ieee80211_local *local = sdata->local; |
2345 | struct sta_info *sta; | 2360 | struct sta_info *sta; |
2346 | DECLARE_MAC_BUF(mac); | ||
2347 | int band = local->hw.conf.channel->band; | 2361 | int band = local->hw.conf.channel->band; |
2348 | 2362 | ||
2349 | /* TODO: Could consider removing the least recently used entry and | 2363 | /* TODO: Could consider removing the least recently used entry and |
@@ -2351,7 +2365,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
2351 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 2365 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
2352 | if (net_ratelimit()) { | 2366 | if (net_ratelimit()) { |
2353 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " | 2367 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " |
2354 | "entry %s\n", sdata->dev->name, print_mac(mac, addr)); | 2368 | "entry %pM\n", sdata->dev->name, addr); |
2355 | } | 2369 | } |
2356 | return NULL; | 2370 | return NULL; |
2357 | } | 2371 | } |
@@ -2360,8 +2374,8 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
2360 | return NULL; | 2374 | return NULL; |
2361 | 2375 | ||
2362 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 2376 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
2363 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", | 2377 | 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); | 2378 | wiphy_name(local->hw.wiphy), addr, sdata->dev->name); |
2365 | #endif | 2379 | #endif |
2366 | 2380 | ||
2367 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | 2381 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); |
@@ -2408,7 +2422,6 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, | |||
2408 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) | 2422 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) |
2409 | { | 2423 | { |
2410 | struct ieee80211_if_sta *ifsta; | 2424 | struct ieee80211_if_sta *ifsta; |
2411 | int res; | ||
2412 | 2425 | ||
2413 | if (len > IEEE80211_MAX_SSID_LEN) | 2426 | if (len > IEEE80211_MAX_SSID_LEN) |
2414 | return -EINVAL; | 2427 | return -EINVAL; |
@@ -2420,19 +2433,6 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size | |||
2420 | memcpy(ifsta->ssid, ssid, len); | 2433 | memcpy(ifsta->ssid, ssid, len); |
2421 | ifsta->ssid_len = len; | 2434 | ifsta->ssid_len = len; |
2422 | ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET; | 2435 | ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET; |
2423 | |||
2424 | res = 0; | ||
2425 | /* | ||
2426 | * Hack! MLME code needs to be cleaned up to have different | ||
2427 | * entry points for configuration and internal selection change | ||
2428 | */ | ||
2429 | if (netif_running(sdata->dev)) | ||
2430 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); | ||
2431 | if (res) { | ||
2432 | printk(KERN_DEBUG "%s: Failed to config new SSID to " | ||
2433 | "the low-level driver\n", sdata->dev->name); | ||
2434 | return res; | ||
2435 | } | ||
2436 | } | 2436 | } |
2437 | 2437 | ||
2438 | if (len) | 2438 | if (len) |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 5d786720d935..3fa7ab285066 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -199,48 +199,44 @@ static void rate_control_release(struct kref *kref) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | 201 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, |
202 | struct ieee80211_supported_band *sband, | 202 | struct sta_info *sta, |
203 | struct sta_info *sta, struct sk_buff *skb, | 203 | struct ieee80211_tx_rate_control *txrc) |
204 | struct rate_selection *sel) | ||
205 | { | 204 | { |
206 | struct rate_control_ref *ref = sdata->local->rate_ctrl; | 205 | struct rate_control_ref *ref = sdata->local->rate_ctrl; |
207 | void *priv_sta = NULL; | 206 | void *priv_sta = NULL; |
208 | struct ieee80211_sta *ista = NULL; | 207 | struct ieee80211_sta *ista = NULL; |
208 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); | ||
209 | int i; | 209 | int i; |
210 | 210 | ||
211 | sel->rate_idx = -1; | ||
212 | sel->nonerp_idx = -1; | ||
213 | sel->probe_idx = -1; | ||
214 | sel->max_rate_idx = sdata->max_ratectrl_rateidx; | ||
215 | |||
216 | if (sta) { | 211 | if (sta) { |
217 | ista = &sta->sta; | 212 | ista = &sta->sta; |
218 | priv_sta = sta->rate_ctrl_priv; | 213 | priv_sta = sta->rate_ctrl_priv; |
219 | } | 214 | } |
220 | 215 | ||
216 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { | ||
217 | info->control.rates[i].idx = -1; | ||
218 | info->control.rates[i].flags = 0; | ||
219 | info->control.rates[i].count = 1; | ||
220 | } | ||
221 | |||
221 | if (sta && sdata->force_unicast_rateidx > -1) | 222 | if (sta && sdata->force_unicast_rateidx > -1) |
222 | sel->rate_idx = sdata->force_unicast_rateidx; | 223 | info->control.rates[0].idx = sdata->force_unicast_rateidx; |
223 | else | 224 | else |
224 | ref->ops->get_rate(ref->priv, sband, ista, priv_sta, skb, sel); | 225 | ref->ops->get_rate(ref->priv, ista, priv_sta, txrc); |
225 | 226 | ||
226 | if (sdata->max_ratectrl_rateidx > -1 && | 227 | /* |
227 | sel->rate_idx > sdata->max_ratectrl_rateidx) | 228 | * try to enforce the maximum rate the user wanted |
228 | sel->rate_idx = sdata->max_ratectrl_rateidx; | 229 | */ |
229 | 230 | if (sdata->max_ratectrl_rateidx > -1) | |
230 | BUG_ON(sel->rate_idx < 0); | 231 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { |
231 | 232 | if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) | |
232 | /* Select a non-ERP backup rate. */ | 233 | continue; |
233 | if (sel->nonerp_idx < 0) { | 234 | info->control.rates[i].idx = |
234 | for (i = 0; i < sband->n_bitrates; i++) { | 235 | min_t(s8, info->control.rates[i].idx, |
235 | struct ieee80211_rate *rate = &sband->bitrates[i]; | 236 | sdata->max_ratectrl_rateidx); |
236 | if (sband->bitrates[sel->rate_idx].bitrate < rate->bitrate) | ||
237 | break; | ||
238 | |||
239 | if (rate_supported(ista, sband->band, i) && | ||
240 | !(rate->flags & IEEE80211_RATE_ERP_G)) | ||
241 | sel->nonerp_idx = i; | ||
242 | } | ||
243 | } | 237 | } |
238 | |||
239 | BUG_ON(info->control.rates[0].idx < 0); | ||
244 | } | 240 | } |
245 | 241 | ||
246 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref) | 242 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref) |
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index d0092f847f82..928da625e281 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h | |||
@@ -31,9 +31,8 @@ struct rate_control_ref { | |||
31 | struct rate_control_ref *rate_control_alloc(const char *name, | 31 | struct rate_control_ref *rate_control_alloc(const char *name, |
32 | struct ieee80211_local *local); | 32 | struct ieee80211_local *local); |
33 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | 33 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, |
34 | struct ieee80211_supported_band *sband, | 34 | struct sta_info *sta, |
35 | struct sta_info *sta, struct sk_buff *skb, | 35 | struct ieee80211_tx_rate_control *txrc); |
36 | struct rate_selection *sel); | ||
37 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref); | 36 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref); |
38 | void rate_control_put(struct rate_control_ref *ref); | 37 | void rate_control_put(struct rate_control_ref *ref); |
39 | 38 | ||
@@ -64,12 +63,6 @@ static inline void rate_control_rate_init(struct sta_info *sta) | |||
64 | } | 63 | } |
65 | 64 | ||
66 | 65 | ||
67 | static inline void rate_control_clear(struct ieee80211_local *local) | ||
68 | { | ||
69 | struct rate_control_ref *ref = local->rate_ctrl; | ||
70 | ref->ops->clear(ref->priv); | ||
71 | } | ||
72 | |||
73 | static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, | 66 | static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, |
74 | struct ieee80211_sta *sta, | 67 | struct ieee80211_sta *sta, |
75 | gfp_t gfp) | 68 | gfp_t gfp) |
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index f6d69dab07a3..2b3b490a6073 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -126,7 +126,9 @@ minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi) | |||
126 | mr->adjusted_retry_count = mr->retry_count >> 1; | 126 | mr->adjusted_retry_count = mr->retry_count >> 1; |
127 | if (mr->adjusted_retry_count > 2) | 127 | if (mr->adjusted_retry_count > 2) |
128 | mr->adjusted_retry_count = 2; | 128 | mr->adjusted_retry_count = 2; |
129 | mr->sample_limit = 4; | ||
129 | } else { | 130 | } else { |
131 | mr->sample_limit = -1; | ||
130 | mr->adjusted_retry_count = mr->retry_count; | 132 | mr->adjusted_retry_count = mr->retry_count; |
131 | } | 133 | } |
132 | if (!mr->adjusted_retry_count) | 134 | if (!mr->adjusted_retry_count) |
@@ -169,30 +171,20 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
169 | { | 171 | { |
170 | struct minstrel_sta_info *mi = priv_sta; | 172 | struct minstrel_sta_info *mi = priv_sta; |
171 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 173 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
172 | struct ieee80211_tx_altrate *ar = info->status.retries; | 174 | struct ieee80211_tx_rate *ar = info->status.rates; |
173 | struct minstrel_priv *mp = priv; | 175 | int i, ndx; |
174 | int i, ndx, tries; | 176 | int success; |
175 | int success = 0; | ||
176 | |||
177 | if (!info->status.excessive_retries) | ||
178 | success = 1; | ||
179 | 177 | ||
180 | if (!mp->has_mrr || (ar[0].rate_idx < 0)) { | 178 | success = !!(info->flags & IEEE80211_TX_STAT_ACK); |
181 | ndx = rix_to_ndx(mi, info->tx_rate_idx); | ||
182 | tries = info->status.retry_count + 1; | ||
183 | mi->r[ndx].success += success; | ||
184 | mi->r[ndx].attempts += tries; | ||
185 | return; | ||
186 | } | ||
187 | 179 | ||
188 | for (i = 0; i < 4; i++) { | 180 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { |
189 | if (ar[i].rate_idx < 0) | 181 | if (ar[i].idx < 0) |
190 | break; | 182 | break; |
191 | 183 | ||
192 | ndx = rix_to_ndx(mi, ar[i].rate_idx); | 184 | ndx = rix_to_ndx(mi, ar[i].idx); |
193 | mi->r[ndx].attempts += ar[i].limit + 1; | 185 | mi->r[ndx].attempts += ar[i].count; |
194 | 186 | ||
195 | if ((i != 3) && (ar[i + 1].rate_idx < 0)) | 187 | if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) |
196 | mi->r[ndx].success += success; | 188 | mi->r[ndx].success += success; |
197 | } | 189 | } |
198 | 190 | ||
@@ -210,9 +202,9 @@ minstrel_get_retry_count(struct minstrel_rate *mr, | |||
210 | { | 202 | { |
211 | unsigned int retry = mr->adjusted_retry_count; | 203 | unsigned int retry = mr->adjusted_retry_count; |
212 | 204 | ||
213 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) | 205 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
214 | retry = max(2U, min(mr->retry_count_rtscts, retry)); | 206 | retry = max(2U, min(mr->retry_count_rtscts, retry)); |
215 | else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) | 207 | else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) |
216 | retry = max(2U, min(mr->retry_count_cts, retry)); | 208 | retry = max(2U, min(mr->retry_count_cts, retry)); |
217 | return retry; | 209 | return retry; |
218 | } | 210 | } |
@@ -233,15 +225,16 @@ minstrel_get_next_sample(struct minstrel_sta_info *mi) | |||
233 | return sample_ndx; | 225 | return sample_ndx; |
234 | } | 226 | } |
235 | 227 | ||
236 | void | 228 | static void |
237 | minstrel_get_rate(void *priv, struct ieee80211_supported_band *sband, | 229 | minstrel_get_rate(void *priv, struct ieee80211_sta *sta, |
238 | struct ieee80211_sta *sta, void *priv_sta, | 230 | void *priv_sta, struct ieee80211_tx_rate_control *txrc) |
239 | struct sk_buff *skb, struct rate_selection *sel) | ||
240 | { | 231 | { |
232 | struct sk_buff *skb = txrc->skb; | ||
233 | struct ieee80211_supported_band *sband = txrc->sband; | ||
241 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 234 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
242 | struct minstrel_sta_info *mi = priv_sta; | 235 | struct minstrel_sta_info *mi = priv_sta; |
243 | struct minstrel_priv *mp = priv; | 236 | struct minstrel_priv *mp = priv; |
244 | struct ieee80211_tx_altrate *ar = info->control.retries; | 237 | struct ieee80211_tx_rate *ar = info->control.rates; |
245 | unsigned int ndx, sample_ndx = 0; | 238 | unsigned int ndx, sample_ndx = 0; |
246 | bool mrr; | 239 | bool mrr; |
247 | bool sample_slower = false; | 240 | bool sample_slower = false; |
@@ -251,16 +244,12 @@ minstrel_get_rate(void *priv, struct ieee80211_supported_band *sband, | |||
251 | int sample_rate; | 244 | int sample_rate; |
252 | 245 | ||
253 | if (!sta || !mi || use_low_rate(skb)) { | 246 | if (!sta || !mi || use_low_rate(skb)) { |
254 | sel->rate_idx = rate_lowest_index(sband, sta); | 247 | ar[0].idx = rate_lowest_index(sband, sta); |
248 | ar[0].count = mp->max_retry; | ||
255 | return; | 249 | return; |
256 | } | 250 | } |
257 | 251 | ||
258 | mrr = mp->has_mrr; | 252 | mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot; |
259 | |||
260 | /* mac80211 does not allow mrr for RTS/CTS */ | ||
261 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || | ||
262 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) | ||
263 | mrr = false; | ||
264 | 253 | ||
265 | if (time_after(jiffies, mi->stats_update + (mp->update_interval * | 254 | if (time_after(jiffies, mi->stats_update + (mp->update_interval * |
266 | HZ) / 1000)) | 255 | HZ) / 1000)) |
@@ -278,7 +267,8 @@ minstrel_get_rate(void *priv, struct ieee80211_supported_band *sband, | |||
278 | (mi->sample_count + mi->sample_deferred / 2); | 267 | (mi->sample_count + mi->sample_deferred / 2); |
279 | 268 | ||
280 | /* delta > 0: sampling required */ | 269 | /* delta > 0: sampling required */ |
281 | if (delta > 0) { | 270 | if ((delta > 0) && (mrr || !mi->prev_sample)) { |
271 | struct minstrel_rate *msr; | ||
282 | if (mi->packet_count >= 10000) { | 272 | if (mi->packet_count >= 10000) { |
283 | mi->sample_deferred = 0; | 273 | mi->sample_deferred = 0; |
284 | mi->sample_count = 0; | 274 | mi->sample_count = 0; |
@@ -297,13 +287,20 @@ minstrel_get_rate(void *priv, struct ieee80211_supported_band *sband, | |||
297 | } | 287 | } |
298 | 288 | ||
299 | sample_ndx = minstrel_get_next_sample(mi); | 289 | sample_ndx = minstrel_get_next_sample(mi); |
290 | msr = &mi->r[sample_ndx]; | ||
300 | sample = true; | 291 | sample = true; |
301 | sample_slower = mrr && (mi->r[sample_ndx].perfect_tx_time > | 292 | sample_slower = mrr && (msr->perfect_tx_time > |
302 | mi->r[ndx].perfect_tx_time); | 293 | mi->r[ndx].perfect_tx_time); |
303 | 294 | ||
304 | if (!sample_slower) { | 295 | if (!sample_slower) { |
305 | ndx = sample_ndx; | 296 | if (msr->sample_limit != 0) { |
306 | mi->sample_count++; | 297 | ndx = sample_ndx; |
298 | mi->sample_count++; | ||
299 | if (msr->sample_limit > 0) | ||
300 | msr->sample_limit--; | ||
301 | } else { | ||
302 | sample = false; | ||
303 | } | ||
307 | } else { | 304 | } else { |
308 | /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark | 305 | /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark |
309 | * packets that have the sampling rate deferred to the | 306 | * packets that have the sampling rate deferred to the |
@@ -315,13 +312,22 @@ minstrel_get_rate(void *priv, struct ieee80211_supported_band *sband, | |||
315 | mi->sample_deferred++; | 312 | mi->sample_deferred++; |
316 | } | 313 | } |
317 | } | 314 | } |
318 | sel->rate_idx = mi->r[ndx].rix; | 315 | mi->prev_sample = sample; |
319 | info->control.retry_limit = minstrel_get_retry_count(&mi->r[ndx], info); | 316 | |
317 | /* If we're not using MRR and the sampling rate already | ||
318 | * has a probability of >95%, we shouldn't be attempting | ||
319 | * to use it, as this only wastes precious airtime */ | ||
320 | if (!mrr && sample && (mi->r[ndx].probability > 17100)) | ||
321 | ndx = mi->max_tp_rate; | ||
322 | |||
323 | ar[0].idx = mi->r[ndx].rix; | ||
324 | ar[0].count = minstrel_get_retry_count(&mi->r[ndx], info); | ||
320 | 325 | ||
321 | if (!mrr) { | 326 | if (!mrr) { |
322 | ar[0].rate_idx = mi->lowest_rix; | 327 | if (!sample) |
323 | ar[0].limit = mp->max_retry; | 328 | ar[0].count = mp->max_retry; |
324 | ar[1].rate_idx = -1; | 329 | ar[1].idx = mi->lowest_rix; |
330 | ar[1].count = mp->max_retry; | ||
325 | return; | 331 | return; |
326 | } | 332 | } |
327 | 333 | ||
@@ -336,9 +342,9 @@ minstrel_get_rate(void *priv, struct ieee80211_supported_band *sband, | |||
336 | } | 342 | } |
337 | mrr_ndx[1] = mi->max_prob_rate; | 343 | mrr_ndx[1] = mi->max_prob_rate; |
338 | mrr_ndx[2] = 0; | 344 | mrr_ndx[2] = 0; |
339 | for (i = 0; i < 3; i++) { | 345 | for (i = 1; i < 4; i++) { |
340 | ar[i].rate_idx = mi->r[mrr_ndx[i]].rix; | 346 | ar[i].idx = mi->r[mrr_ndx[i - 1]].rix; |
341 | ar[i].limit = mi->r[mrr_ndx[i]].adjusted_retry_count; | 347 | ar[i].count = mi->r[mrr_ndx[i - 1]].adjusted_retry_count; |
342 | } | 348 | } |
343 | } | 349 | } |
344 | 350 | ||
@@ -415,6 +421,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
415 | 421 | ||
416 | /* calculate maximum number of retransmissions before | 422 | /* calculate maximum number of retransmissions before |
417 | * fallback (based on maximum segment size) */ | 423 | * fallback (based on maximum segment size) */ |
424 | mr->sample_limit = -1; | ||
418 | mr->retry_count = 1; | 425 | mr->retry_count = 1; |
419 | mr->retry_count_cts = 1; | 426 | mr->retry_count_cts = 1; |
420 | mr->retry_count_rtscts = 1; | 427 | mr->retry_count_rtscts = 1; |
@@ -500,11 +507,6 @@ minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) | |||
500 | kfree(mi); | 507 | kfree(mi); |
501 | } | 508 | } |
502 | 509 | ||
503 | static void | ||
504 | minstrel_clear(void *priv) | ||
505 | { | ||
506 | } | ||
507 | |||
508 | static void * | 510 | static void * |
509 | minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 511 | minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
510 | { | 512 | { |
@@ -532,13 +534,13 @@ minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | |||
532 | /* maximum time that the hw is allowed to stay in one MRR segment */ | 534 | /* maximum time that the hw is allowed to stay in one MRR segment */ |
533 | mp->segment_size = 6000; | 535 | mp->segment_size = 6000; |
534 | 536 | ||
535 | if (hw->max_altrate_tries > 0) | 537 | if (hw->max_rate_tries > 0) |
536 | mp->max_retry = hw->max_altrate_tries; | 538 | mp->max_retry = hw->max_rate_tries; |
537 | else | 539 | else |
538 | /* safe default, does not necessarily have to match hw properties */ | 540 | /* safe default, does not necessarily have to match hw properties */ |
539 | mp->max_retry = 7; | 541 | mp->max_retry = 7; |
540 | 542 | ||
541 | if (hw->max_altrates >= 3) | 543 | if (hw->max_rates >= 4) |
542 | mp->has_mrr = true; | 544 | mp->has_mrr = true; |
543 | 545 | ||
544 | mp->hw = hw; | 546 | mp->hw = hw; |
@@ -558,7 +560,6 @@ static struct rate_control_ops mac80211_minstrel = { | |||
558 | .tx_status = minstrel_tx_status, | 560 | .tx_status = minstrel_tx_status, |
559 | .get_rate = minstrel_get_rate, | 561 | .get_rate = minstrel_get_rate, |
560 | .rate_init = minstrel_rate_init, | 562 | .rate_init = minstrel_rate_init, |
561 | .clear = minstrel_clear, | ||
562 | .alloc = minstrel_alloc, | 563 | .alloc = minstrel_alloc, |
563 | .free = minstrel_free, | 564 | .free = minstrel_free, |
564 | .alloc_sta = minstrel_alloc_sta, | 565 | .alloc_sta = minstrel_alloc_sta, |
diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h index 9a90a6aee043..869fe0ef951d 100644 --- a/net/mac80211/rc80211_minstrel.h +++ b/net/mac80211/rc80211_minstrel.h | |||
@@ -16,6 +16,7 @@ struct minstrel_rate { | |||
16 | unsigned int perfect_tx_time; | 16 | unsigned int perfect_tx_time; |
17 | unsigned int ack_time; | 17 | unsigned int ack_time; |
18 | 18 | ||
19 | int sample_limit; | ||
19 | unsigned int retry_count; | 20 | unsigned int retry_count; |
20 | unsigned int retry_count_cts; | 21 | unsigned int retry_count_cts; |
21 | unsigned int retry_count_rtscts; | 22 | unsigned int retry_count_rtscts; |
@@ -57,6 +58,7 @@ struct minstrel_sta_info { | |||
57 | 58 | ||
58 | int n_rates; | 59 | int n_rates; |
59 | struct minstrel_rate *r; | 60 | struct minstrel_rate *r; |
61 | bool prev_sample; | ||
60 | 62 | ||
61 | /* sampling table */ | 63 | /* sampling table */ |
62 | u8 *sample_table; | 64 | u8 *sample_table; |
diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h index 01d64d53f3b9..1a873f00691a 100644 --- a/net/mac80211/rc80211_pid.h +++ b/net/mac80211/rc80211_pid.h | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | /* Arithmetic right shift for positive and negative values for ISO C. */ | 50 | /* Arithmetic right shift for positive and negative values for ISO C. */ |
51 | #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \ | 51 | #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \ |
52 | (x) < 0 ? -((-(x)) >> (y)) : (x) >> (y) | 52 | ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y)) |
53 | 53 | ||
54 | enum rc_pid_event_type { | 54 | enum rc_pid_event_type { |
55 | RC_PID_EVENT_TYPE_TX_STATUS, | 55 | RC_PID_EVENT_TYPE_TX_STATUS, |
@@ -61,6 +61,7 @@ enum rc_pid_event_type { | |||
61 | union rc_pid_event_data { | 61 | union rc_pid_event_data { |
62 | /* RC_PID_EVENT_TX_STATUS */ | 62 | /* RC_PID_EVENT_TX_STATUS */ |
63 | struct { | 63 | struct { |
64 | u32 flags; | ||
64 | struct ieee80211_tx_info tx_status; | 65 | struct ieee80211_tx_info tx_status; |
65 | }; | 66 | }; |
66 | /* RC_PID_EVENT_TYPE_RATE_CHANGE */ | 67 | /* RC_PID_EVENT_TYPE_RATE_CHANGE */ |
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index 86eb374e3b87..2328ba568039 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c | |||
@@ -241,7 +241,7 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba | |||
241 | 241 | ||
242 | /* Ignore all frames that were sent with a different rate than the rate | 242 | /* Ignore all frames that were sent with a different rate than the rate |
243 | * we currently advise mac80211 to use. */ | 243 | * we currently advise mac80211 to use. */ |
244 | if (info->tx_rate_idx != spinfo->txrate_idx) | 244 | if (info->status.rates[0].idx != spinfo->txrate_idx) |
245 | return; | 245 | return; |
246 | 246 | ||
247 | spinfo->tx_num_xmit++; | 247 | spinfo->tx_num_xmit++; |
@@ -253,10 +253,10 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba | |||
253 | /* We count frames that totally failed to be transmitted as two bad | 253 | /* We count frames that totally failed to be transmitted as two bad |
254 | * frames, those that made it out but had some retries as one good and | 254 | * frames, those that made it out but had some retries as one good and |
255 | * one bad frame. */ | 255 | * one bad frame. */ |
256 | if (info->status.excessive_retries) { | 256 | if (!(info->flags & IEEE80211_TX_STAT_ACK)) { |
257 | spinfo->tx_num_failed += 2; | 257 | spinfo->tx_num_failed += 2; |
258 | spinfo->tx_num_xmit++; | 258 | spinfo->tx_num_xmit++; |
259 | } else if (info->status.retry_count) { | 259 | } else if (info->status.rates[0].count) { |
260 | spinfo->tx_num_failed++; | 260 | spinfo->tx_num_failed++; |
261 | spinfo->tx_num_xmit++; | 261 | spinfo->tx_num_xmit++; |
262 | } | 262 | } |
@@ -270,23 +270,32 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba | |||
270 | } | 270 | } |
271 | 271 | ||
272 | static void | 272 | static void |
273 | rate_control_pid_get_rate(void *priv, struct ieee80211_supported_band *sband, | 273 | rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta, |
274 | struct ieee80211_sta *sta, void *priv_sta, | 274 | void *priv_sta, |
275 | struct sk_buff *skb, | 275 | struct ieee80211_tx_rate_control *txrc) |
276 | struct rate_selection *sel) | ||
277 | { | 276 | { |
277 | struct sk_buff *skb = txrc->skb; | ||
278 | struct ieee80211_supported_band *sband = txrc->sband; | ||
278 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 279 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
280 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
279 | struct rc_pid_sta_info *spinfo = priv_sta; | 281 | struct rc_pid_sta_info *spinfo = priv_sta; |
280 | int rateidx; | 282 | int rateidx; |
281 | u16 fc; | 283 | u16 fc; |
282 | 284 | ||
285 | if (txrc->rts) | ||
286 | info->control.rates[0].count = | ||
287 | txrc->hw->conf.long_frame_max_tx_count; | ||
288 | else | ||
289 | info->control.rates[0].count = | ||
290 | txrc->hw->conf.short_frame_max_tx_count; | ||
291 | |||
283 | /* Send management frames and broadcast/multicast data using lowest | 292 | /* Send management frames and broadcast/multicast data using lowest |
284 | * rate. */ | 293 | * rate. */ |
285 | fc = le16_to_cpu(hdr->frame_control); | 294 | fc = le16_to_cpu(hdr->frame_control); |
286 | if (!sta || !spinfo || | 295 | if (!sta || !spinfo || |
287 | (fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || | 296 | (fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || |
288 | is_multicast_ether_addr(hdr->addr1)) { | 297 | is_multicast_ether_addr(hdr->addr1)) { |
289 | sel->rate_idx = rate_lowest_index(sband, sta); | 298 | info->control.rates[0].idx = rate_lowest_index(sband, sta); |
290 | return; | 299 | return; |
291 | } | 300 | } |
292 | 301 | ||
@@ -295,7 +304,7 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_supported_band *sband, | |||
295 | if (rateidx >= sband->n_bitrates) | 304 | if (rateidx >= sband->n_bitrates) |
296 | rateidx = sband->n_bitrates - 1; | 305 | rateidx = sband->n_bitrates - 1; |
297 | 306 | ||
298 | sel->rate_idx = rateidx; | 307 | info->control.rates[0].idx = rateidx; |
299 | 308 | ||
300 | #ifdef CONFIG_MAC80211_DEBUGFS | 309 | #ifdef CONFIG_MAC80211_DEBUGFS |
301 | rate_control_pid_event_tx_rate(&spinfo->events, | 310 | rate_control_pid_event_tx_rate(&spinfo->events, |
@@ -437,10 +446,6 @@ static void rate_control_pid_free(void *priv) | |||
437 | kfree(pinfo); | 446 | kfree(pinfo); |
438 | } | 447 | } |
439 | 448 | ||
440 | static void rate_control_pid_clear(void *priv) | ||
441 | { | ||
442 | } | ||
443 | |||
444 | static void *rate_control_pid_alloc_sta(void *priv, struct ieee80211_sta *sta, | 449 | static void *rate_control_pid_alloc_sta(void *priv, struct ieee80211_sta *sta, |
445 | gfp_t gfp) | 450 | gfp_t gfp) |
446 | { | 451 | { |
@@ -471,7 +476,6 @@ static struct rate_control_ops mac80211_rcpid = { | |||
471 | .tx_status = rate_control_pid_tx_status, | 476 | .tx_status = rate_control_pid_tx_status, |
472 | .get_rate = rate_control_pid_get_rate, | 477 | .get_rate = rate_control_pid_get_rate, |
473 | .rate_init = rate_control_pid_rate_init, | 478 | .rate_init = rate_control_pid_rate_init, |
474 | .clear = rate_control_pid_clear, | ||
475 | .alloc = rate_control_pid_alloc, | 479 | .alloc = rate_control_pid_alloc, |
476 | .free = rate_control_pid_free, | 480 | .free = rate_control_pid_free, |
477 | .alloc_sta = rate_control_pid_alloc_sta, | 481 | .alloc_sta = rate_control_pid_alloc_sta, |
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c index 8121d3bc6835..a08a9b530347 100644 --- a/net/mac80211/rc80211_pid_debugfs.c +++ b/net/mac80211/rc80211_pid_debugfs.c | |||
@@ -43,6 +43,7 @@ void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, | |||
43 | { | 43 | { |
44 | union rc_pid_event_data evd; | 44 | union rc_pid_event_data evd; |
45 | 45 | ||
46 | evd.flags = stat->flags; | ||
46 | memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_info)); | 47 | memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_info)); |
47 | rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd); | 48 | rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd); |
48 | } | 49 | } |
@@ -167,8 +168,8 @@ static ssize_t rate_control_pid_events_read(struct file *file, char __user *buf, | |||
167 | switch (ev->type) { | 168 | switch (ev->type) { |
168 | case RC_PID_EVENT_TYPE_TX_STATUS: | 169 | case RC_PID_EVENT_TYPE_TX_STATUS: |
169 | p += snprintf(pb + p, length - p, "tx_status %u %u", | 170 | p += snprintf(pb + p, length - p, "tx_status %u %u", |
170 | ev->data.tx_status.status.excessive_retries, | 171 | !(ev->data.flags & IEEE80211_TX_STAT_ACK), |
171 | ev->data.tx_status.status.retry_count); | 172 | ev->data.tx_status.status.rates[0].idx); |
172 | break; | 173 | break; |
173 | case RC_PID_EVENT_TYPE_RATE_CHANGE: | 174 | case RC_PID_EVENT_TYPE_RATE_CHANGE: |
174 | p += snprintf(pb + p, length - p, "rate_change %d %d", | 175 | p += snprintf(pb + p, length - p, "rate_change %d %d", |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index cf6b121e1bbf..648a1d0e6c82 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include "tkip.h" | 26 | #include "tkip.h" |
27 | #include "wme.h" | 27 | #include "wme.h" |
28 | 28 | ||
29 | u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | 29 | static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, |
30 | struct tid_ampdu_rx *tid_agg_rx, | 30 | struct tid_ampdu_rx *tid_agg_rx, |
31 | struct sk_buff *skb, u16 mpdu_seq_num, | 31 | struct sk_buff *skb, |
32 | int bar_req); | 32 | u16 mpdu_seq_num, |
33 | int bar_req); | ||
33 | /* | 34 | /* |
34 | * monitor mode reception | 35 | * monitor mode reception |
35 | * | 36 | * |
@@ -653,13 +654,12 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
653 | static void ap_sta_ps_start(struct sta_info *sta) | 654 | static void ap_sta_ps_start(struct sta_info *sta) |
654 | { | 655 | { |
655 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 656 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
656 | DECLARE_MAC_BUF(mac); | ||
657 | 657 | ||
658 | atomic_inc(&sdata->bss->num_sta_ps); | 658 | atomic_inc(&sdata->bss->num_sta_ps); |
659 | set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); | 659 | set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); |
660 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 660 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
661 | printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", | 661 | 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); | 662 | sdata->dev->name, sta->sta.addr, sta->sta.aid); |
663 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 663 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
664 | } | 664 | } |
665 | 665 | ||
@@ -669,8 +669,6 @@ static int ap_sta_ps_end(struct sta_info *sta) | |||
669 | struct ieee80211_local *local = sdata->local; | 669 | struct ieee80211_local *local = sdata->local; |
670 | struct sk_buff *skb; | 670 | struct sk_buff *skb; |
671 | int sent = 0; | 671 | int sent = 0; |
672 | 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,27 +678,25 @@ 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 */ |
688 | while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { | 686 | while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { |
689 | info = IEEE80211_SKB_CB(skb); | ||
690 | sent++; | 687 | sent++; |
691 | info->flags |= IEEE80211_TX_CTL_REQUEUE; | 688 | skb->requeue = 1; |
692 | dev_queue_xmit(skb); | 689 | dev_queue_xmit(skb); |
693 | } | 690 | } |
694 | while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { | 691 | while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { |
695 | info = IEEE80211_SKB_CB(skb); | ||
696 | local->total_ps_buffered--; | 692 | local->total_ps_buffered--; |
697 | sent++; | 693 | sent++; |
698 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 694 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
699 | printk(KERN_DEBUG "%s: STA %s aid %d send PS frame " | 695 | printk(KERN_DEBUG "%s: STA %pM aid %d send PS frame " |
700 | "since STA not sleeping anymore\n", sdata->dev->name, | 696 | "since STA not sleeping anymore\n", sdata->dev->name, |
701 | print_mac(mac, sta->sta.addr), sta->sta.aid); | 697 | sta->sta.addr, sta->sta.aid); |
702 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 698 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
703 | info->flags |= IEEE80211_TX_CTL_REQUEUE; | 699 | skb->requeue = 1; |
704 | dev_queue_xmit(skb); | 700 | dev_queue_xmit(skb); |
705 | } | 701 | } |
706 | 702 | ||
@@ -789,15 +785,12 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | |||
789 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 785 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
790 | struct ieee80211_hdr *hdr = | 786 | struct ieee80211_hdr *hdr = |
791 | (struct ieee80211_hdr *) entry->skb_list.next->data; | 787 | (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 " | 788 | printk(KERN_DEBUG "%s: RX reassembly removed oldest " |
795 | "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " | 789 | "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " |
796 | "addr1=%s addr2=%s\n", | 790 | "addr1=%pM addr2=%pM\n", |
797 | sdata->dev->name, idx, | 791 | sdata->dev->name, idx, |
798 | jiffies - entry->first_frag_time, entry->seq, | 792 | jiffies - entry->first_frag_time, entry->seq, |
799 | entry->last_frag, print_mac(mac, hdr->addr1), | 793 | entry->last_frag, hdr->addr1, hdr->addr2); |
800 | print_mac(mac2, hdr->addr2)); | ||
801 | #endif | 794 | #endif |
802 | __skb_queue_purge(&entry->skb_list); | 795 | __skb_queue_purge(&entry->skb_list); |
803 | } | 796 | } |
@@ -866,7 +859,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
866 | unsigned int frag, seq; | 859 | unsigned int frag, seq; |
867 | struct ieee80211_fragment_entry *entry; | 860 | struct ieee80211_fragment_entry *entry; |
868 | struct sk_buff *skb; | 861 | struct sk_buff *skb; |
869 | DECLARE_MAC_BUF(mac); | ||
870 | 862 | ||
871 | hdr = (struct ieee80211_hdr *)rx->skb->data; | 863 | hdr = (struct ieee80211_hdr *)rx->skb->data; |
872 | fc = hdr->frame_control; | 864 | fc = hdr->frame_control; |
@@ -970,7 +962,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); | 962 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); |
971 | struct sk_buff *skb; | 963 | struct sk_buff *skb; |
972 | int no_pending_pkts; | 964 | int no_pending_pkts; |
973 | DECLARE_MAC_BUF(mac); | ||
974 | __le16 fc = ((struct ieee80211_hdr *)rx->skb->data)->frame_control; | 965 | __le16 fc = ((struct ieee80211_hdr *)rx->skb->data)->frame_control; |
975 | 966 | ||
976 | if (likely(!rx->sta || !ieee80211_is_pspoll(fc) || | 967 | if (likely(!rx->sta || !ieee80211_is_pspoll(fc) || |
@@ -1001,8 +992,8 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
1001 | set_sta_flags(rx->sta, WLAN_STA_PSPOLL); | 992 | set_sta_flags(rx->sta, WLAN_STA_PSPOLL); |
1002 | 993 | ||
1003 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 994 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1004 | printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n", | 995 | 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, | 996 | rx->sta->sta.addr, rx->sta->sta.aid, |
1006 | skb_queue_len(&rx->sta->ps_tx_buf)); | 997 | skb_queue_len(&rx->sta->ps_tx_buf)); |
1007 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 998 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1008 | 999 | ||
@@ -1025,9 +1016,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
1025 | * Should we send it a null-func frame indicating we | 1016 | * Should we send it a null-func frame indicating we |
1026 | * have nothing buffered for it? | 1017 | * have nothing buffered for it? |
1027 | */ | 1018 | */ |
1028 | printk(KERN_DEBUG "%s: STA %s sent PS Poll even " | 1019 | printk(KERN_DEBUG "%s: STA %pM sent PS Poll even " |
1029 | "though there are no buffered frames for it\n", | 1020 | "though there are no buffered frames for it\n", |
1030 | rx->dev->name, print_mac(mac, rx->sta->sta.addr)); | 1021 | rx->dev->name, rx->sta->sta.addr); |
1031 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1022 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1032 | } | 1023 | } |
1033 | 1024 | ||
@@ -1097,10 +1088,6 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1097 | u8 src[ETH_ALEN] __aligned(2); | 1088 | u8 src[ETH_ALEN] __aligned(2); |
1098 | struct sk_buff *skb = rx->skb; | 1089 | struct sk_buff *skb = rx->skb; |
1099 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1090 | 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 | 1091 | ||
1105 | if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) | 1092 | if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) |
1106 | return -1; | 1093 | return -1; |
@@ -1279,7 +1266,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1279 | int remaining, err; | 1266 | int remaining, err; |
1280 | u8 dst[ETH_ALEN]; | 1267 | u8 dst[ETH_ALEN]; |
1281 | u8 src[ETH_ALEN]; | 1268 | u8 src[ETH_ALEN]; |
1282 | DECLARE_MAC_BUF(mac); | ||
1283 | 1269 | ||
1284 | if (unlikely(!ieee80211_is_data(fc))) | 1270 | if (unlikely(!ieee80211_is_data(fc))) |
1285 | return RX_CONTINUE; | 1271 | return RX_CONTINUE; |
@@ -1552,14 +1538,6 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
1552 | if (len < IEEE80211_MIN_ACTION_SIZE + 1) | 1538 | if (len < IEEE80211_MIN_ACTION_SIZE + 1) |
1553 | return RX_DROP_MONITOR; | 1539 | return RX_DROP_MONITOR; |
1554 | 1540 | ||
1555 | /* | ||
1556 | * FIXME: revisit this, I'm sure we should handle most | ||
1557 | * of these frames in other modes as well! | ||
1558 | */ | ||
1559 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | ||
1560 | sdata->vif.type != NL80211_IFTYPE_ADHOC) | ||
1561 | return RX_CONTINUE; | ||
1562 | |||
1563 | switch (mgmt->u.action.category) { | 1541 | switch (mgmt->u.action.category) { |
1564 | case WLAN_CATEGORY_BACK: | 1542 | case WLAN_CATEGORY_BACK: |
1565 | switch (mgmt->u.action.u.addba_req.action_code) { | 1543 | switch (mgmt->u.action.u.addba_req.action_code) { |
@@ -1632,8 +1610,6 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1632 | { | 1610 | { |
1633 | int keyidx; | 1611 | int keyidx; |
1634 | unsigned int hdrlen; | 1612 | unsigned int hdrlen; |
1635 | DECLARE_MAC_BUF(mac); | ||
1636 | DECLARE_MAC_BUF(mac2); | ||
1637 | 1613 | ||
1638 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 1614 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
1639 | if (rx->skb->len >= hdrlen + 4) | 1615 | if (rx->skb->len >= hdrlen + 4) |
@@ -2002,17 +1978,17 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2002 | 1978 | ||
2003 | static inline int seq_less(u16 sq1, u16 sq2) | 1979 | static inline int seq_less(u16 sq1, u16 sq2) |
2004 | { | 1980 | { |
2005 | return (((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1)); | 1981 | return ((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1); |
2006 | } | 1982 | } |
2007 | 1983 | ||
2008 | static inline u16 seq_inc(u16 sq) | 1984 | static inline u16 seq_inc(u16 sq) |
2009 | { | 1985 | { |
2010 | return ((sq + 1) & SEQ_MASK); | 1986 | return (sq + 1) & SEQ_MASK; |
2011 | } | 1987 | } |
2012 | 1988 | ||
2013 | static inline u16 seq_sub(u16 sq1, u16 sq2) | 1989 | static inline u16 seq_sub(u16 sq1, u16 sq2) |
2014 | { | 1990 | { |
2015 | return ((sq1 - sq2) & SEQ_MASK); | 1991 | return (sq1 - sq2) & SEQ_MASK; |
2016 | } | 1992 | } |
2017 | 1993 | ||
2018 | 1994 | ||
@@ -2020,10 +1996,11 @@ static inline u16 seq_sub(u16 sq1, u16 sq2) | |||
2020 | * As it function blongs to Rx path it must be called with | 1996 | * As it function blongs to Rx path it must be called with |
2021 | * the proper rcu_read_lock protection for its flow. | 1997 | * the proper rcu_read_lock protection for its flow. |
2022 | */ | 1998 | */ |
2023 | u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | 1999 | static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, |
2024 | struct tid_ampdu_rx *tid_agg_rx, | 2000 | struct tid_ampdu_rx *tid_agg_rx, |
2025 | struct sk_buff *skb, u16 mpdu_seq_num, | 2001 | struct sk_buff *skb, |
2026 | int bar_req) | 2002 | u16 mpdu_seq_num, |
2003 | int bar_req) | ||
2027 | { | 2004 | { |
2028 | struct ieee80211_local *local = hw_to_local(hw); | 2005 | struct ieee80211_local *local = hw_to_local(hw); |
2029 | struct ieee80211_rx_status status; | 2006 | struct ieee80211_rx_status status; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 416bb41099f3..f5c7c3371929 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -159,7 +159,7 @@ ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_i | |||
159 | { | 159 | { |
160 | struct ieee80211_bss *bss; | 160 | struct ieee80211_bss *bss; |
161 | 161 | ||
162 | if (mesh_config_len != MESH_CFG_LEN) | 162 | if (mesh_config_len != IEEE80211_MESH_CONFIG_LEN) |
163 | return NULL; | 163 | return NULL; |
164 | 164 | ||
165 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); | 165 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); |
@@ -448,18 +448,17 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) | |||
448 | 448 | ||
449 | if (local->hw_scanning) { | 449 | if (local->hw_scanning) { |
450 | local->hw_scanning = false; | 450 | local->hw_scanning = false; |
451 | if (ieee80211_hw_config(local)) | 451 | /* |
452 | printk(KERN_DEBUG "%s: failed to restore operational " | 452 | * Somebody might have requested channel change during scan |
453 | "channel after scan\n", wiphy_name(local->hw.wiphy)); | 453 | * that we won't have acted upon, try now. ieee80211_hw_config |
454 | 454 | * will set the flag based on actual changes. | |
455 | */ | ||
456 | ieee80211_hw_config(local, 0); | ||
455 | goto done; | 457 | goto done; |
456 | } | 458 | } |
457 | 459 | ||
458 | local->sw_scanning = false; | 460 | local->sw_scanning = false; |
459 | if (ieee80211_hw_config(local)) | 461 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
460 | printk(KERN_DEBUG "%s: failed to restore operational " | ||
461 | "channel after scan\n", wiphy_name(local->hw.wiphy)); | ||
462 | |||
463 | 462 | ||
464 | netif_tx_lock_bh(local->mdev); | 463 | netif_tx_lock_bh(local->mdev); |
465 | netif_addr_lock(local->mdev); | 464 | netif_addr_lock(local->mdev); |
@@ -546,12 +545,9 @@ void ieee80211_scan_work(struct work_struct *work) | |||
546 | 545 | ||
547 | if (!skip) { | 546 | if (!skip) { |
548 | local->scan_channel = chan; | 547 | local->scan_channel = chan; |
549 | if (ieee80211_hw_config(local)) { | 548 | if (ieee80211_hw_config(local, |
550 | printk(KERN_DEBUG "%s: failed to set freq to " | 549 | IEEE80211_CONF_CHANGE_CHANNEL)) |
551 | "%d MHz for scan\n", wiphy_name(local->hw.wiphy), | ||
552 | chan->center_freq); | ||
553 | skip = 1; | 550 | skip = 1; |
554 | } | ||
555 | } | 551 | } |
556 | 552 | ||
557 | /* advance state machine to next channel/band */ | 553 | /* advance state machine to next channel/band */ |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 7fef8ea1f5ec..b22110a4a75e 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, | |||
137 | static void __sta_info_free(struct ieee80211_local *local, | 137 | static 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: |
@@ -294,7 +290,7 @@ int sta_info_insert(struct sta_info *sta) | |||
294 | } | 290 | } |
295 | 291 | ||
296 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || | 292 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || |
297 | is_multicast_ether_addr(sta->sta.addr))) { | 293 | is_multicast_ether_addr(sta->sta.addr))) { |
298 | err = -EINVAL; | 294 | err = -EINVAL; |
299 | goto out_free; | 295 | goto out_free; |
300 | } | 296 | } |
@@ -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) |
@@ -830,7 +821,7 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | |||
830 | } | 821 | } |
831 | 822 | ||
832 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | 823 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, |
833 | const u8 *addr) | 824 | const u8 *addr) |
834 | { | 825 | { |
835 | struct sta_info *sta = sta_info_get(hw_to_local(hw), addr); | 826 | struct sta_info *sta = sta_info_get(hw_to_local(hw), addr); |
836 | 827 | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 168a39a298bd..5ad9250b63ab 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -160,18 +160,20 @@ struct sta_ampdu_mlme { | |||
160 | * @list: global linked list entry | 160 | * @list: global linked list entry |
161 | * @hnext: hash table linked list pointer | 161 | * @hnext: hash table linked list pointer |
162 | * @local: pointer to the global information | 162 | * @local: pointer to the global information |
163 | * @sdata: TBD | 163 | * @sdata: virtual interface this station belongs to |
164 | * @key: TBD | 164 | * @key: peer key negotiated with this station, if any |
165 | * @rate_ctrl: TBD | 165 | * @rate_ctrl: rate control algorithm reference |
166 | * @rate_ctrl_priv: TBD | 166 | * @rate_ctrl_priv: rate control private per-STA pointer |
167 | * @last_tx_rate: rate used for last transmit, to report to userspace as | ||
168 | * "the" transmit rate | ||
167 | * @lock: used for locking all fields that require locking, see comments | 169 | * @lock: used for locking all fields that require locking, see comments |
168 | * in the header file. | 170 | * in the header file. |
169 | * @flaglock: spinlock for flags accesses | 171 | * @flaglock: spinlock for flags accesses |
170 | * @addr: MAC address of this STA | 172 | * @addr: MAC address of this STA |
171 | * @aid: STA's unique AID (1..2007, 0 = not assigned yet), | 173 | * @aid: STA's unique AID (1..2007, 0 = not assigned yet), |
172 | * only used in AP (and IBSS?) mode | 174 | * only used in AP (and IBSS?) mode |
173 | * @listen_interval: TBD | 175 | * @listen_interval: listen interval of this station, when we're acting as AP |
174 | * @pin_status: TBD | 176 | * @pin_status: used internally for pinning a STA struct into memory |
175 | * @flags: STA flags, see &enum ieee80211_sta_info_flags | 177 | * @flags: STA flags, see &enum ieee80211_sta_info_flags |
176 | * @ps_tx_buf: buffer of frames to transmit to this station | 178 | * @ps_tx_buf: buffer of frames to transmit to this station |
177 | * when it leaves power saving state | 179 | * when it leaves power saving state |
@@ -180,8 +182,8 @@ struct sta_ampdu_mlme { | |||
180 | * power saving state | 182 | * power saving state |
181 | * @rx_packets: Number of MSDUs received from this STA | 183 | * @rx_packets: Number of MSDUs received from this STA |
182 | * @rx_bytes: Number of bytes received from this STA | 184 | * @rx_bytes: Number of bytes received from this STA |
183 | * @wep_weak_iv_count: TBD | 185 | * @wep_weak_iv_count: number of weak WEP IVs received from this station |
184 | * @last_rx: TBD | 186 | * @last_rx: time (in jiffies) when last frame was received from this STA |
185 | * @num_duplicates: number of duplicate frames received from this STA | 187 | * @num_duplicates: number of duplicate frames received from this STA |
186 | * @rx_fragments: number of received MPDUs | 188 | * @rx_fragments: number of received MPDUs |
187 | * @rx_dropped: number of dropped MPDUs from this STA | 189 | * @rx_dropped: number of dropped MPDUs from this STA |
@@ -189,26 +191,26 @@ struct sta_ampdu_mlme { | |||
189 | * @last_qual: qual of last received frame from this STA | 191 | * @last_qual: qual of last received frame from this STA |
190 | * @last_noise: noise of last received frame from this STA | 192 | * @last_noise: noise of last received frame from this STA |
191 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) | 193 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) |
192 | * @tx_filtered_count: TBD | 194 | * @tx_filtered_count: number of frames the hardware filtered for this STA |
193 | * @tx_retry_failed: TBD | 195 | * @tx_retry_failed: number of frames that failed retry |
194 | * @tx_retry_count: TBD | 196 | * @tx_retry_count: total number of retries for frames to this STA |
195 | * @fail_avg: moving percentage of failed MSDUs | 197 | * @fail_avg: moving percentage of failed MSDUs |
196 | * @tx_packets: number of RX/TX MSDUs | 198 | * @tx_packets: number of RX/TX MSDUs |
197 | * @tx_bytes: TBD | 199 | * @tx_bytes: number of bytes transmitted to this STA |
198 | * @tx_fragments: number of transmitted MPDUs | 200 | * @tx_fragments: number of transmitted MPDUs |
199 | * @last_txrate_idx: Index of the last used transmit rate | 201 | * @last_txrate: description of the last used transmit rate |
200 | * @tid_seq: TBD | 202 | * @tid_seq: per-TID sequence numbers for sending to this STA |
201 | * @ampdu_mlme: TBD | 203 | * @ampdu_mlme: A-MPDU state machine state |
202 | * @timer_to_tid: identity mapping to ID timers | 204 | * @timer_to_tid: identity mapping to ID timers |
203 | * @tid_to_tx_q: map tid to tx queue | 205 | * @tid_to_tx_q: map tid to tx queue |
204 | * @llid: Local link ID | 206 | * @llid: Local link ID |
205 | * @plid: Peer link ID | 207 | * @plid: Peer link ID |
206 | * @reason: Cancel reason on PLINK_HOLDING state | 208 | * @reason: Cancel reason on PLINK_HOLDING state |
207 | * @plink_retries: Retries in establishment | 209 | * @plink_retries: Retries in establishment |
208 | * @ignore_plink_timer: TBD | 210 | * @ignore_plink_timer: ignore the peer-link timer (used internally) |
209 | * @plink_state plink_state: TBD | 211 | * @plink_state: peer link state |
210 | * @plink_timeout: TBD | 212 | * @plink_timeout: timeout of peer link |
211 | * @plink_timer: TBD | 213 | * @plink_timer: peer link watch timer |
212 | * @debugfs: debug filesystem info | 214 | * @debugfs: debug filesystem info |
213 | * @sta: station information we share with the driver | 215 | * @sta: station information we share with the driver |
214 | */ | 216 | */ |
@@ -267,7 +269,7 @@ struct sta_info { | |||
267 | unsigned long tx_packets; | 269 | unsigned long tx_packets; |
268 | unsigned long tx_bytes; | 270 | unsigned long tx_bytes; |
269 | unsigned long tx_fragments; | 271 | unsigned long tx_fragments; |
270 | unsigned int last_txrate_idx; | 272 | struct ieee80211_tx_rate last_tx_rate; |
271 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; | 273 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; |
272 | 274 | ||
273 | /* | 275 | /* |
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..0d81b2cfd1a6 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -46,13 +46,20 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
46 | struct ieee80211_local *local = tx->local; | 46 | struct ieee80211_local *local = tx->local; |
47 | struct ieee80211_supported_band *sband; | 47 | struct ieee80211_supported_band *sband; |
48 | struct ieee80211_hdr *hdr; | 48 | struct ieee80211_hdr *hdr; |
49 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
50 | |||
51 | /* assume HW handles this */ | ||
52 | if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS) | ||
53 | return 0; | ||
54 | |||
55 | /* uh huh? */ | ||
56 | if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) | ||
57 | return 0; | ||
49 | 58 | ||
50 | sband = local->hw.wiphy->bands[tx->channel->band]; | 59 | sband = local->hw.wiphy->bands[tx->channel->band]; |
51 | txrate = &sband->bitrates[tx->rate_idx]; | 60 | txrate = &sband->bitrates[info->control.rates[0].idx]; |
52 | 61 | ||
53 | erp = 0; | 62 | erp = txrate->flags & IEEE80211_RATE_ERP_G; |
54 | if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
55 | erp = txrate->flags & IEEE80211_RATE_ERP_G; | ||
56 | 63 | ||
57 | /* | 64 | /* |
58 | * data and mgmt (except PS Poll): | 65 | * data and mgmt (except PS Poll): |
@@ -116,7 +123,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
116 | if (r->bitrate > txrate->bitrate) | 123 | if (r->bitrate > txrate->bitrate) |
117 | break; | 124 | break; |
118 | 125 | ||
119 | if (tx->sdata->bss_conf.basic_rates & BIT(i)) | 126 | if (tx->sdata->vif.bss_conf.basic_rates & BIT(i)) |
120 | rate = r->bitrate; | 127 | rate = r->bitrate; |
121 | 128 | ||
122 | switch (sband->band) { | 129 | switch (sband->band) { |
@@ -150,7 +157,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
150 | * to closest integer */ | 157 | * to closest integer */ |
151 | 158 | ||
152 | dur = ieee80211_frame_duration(local, 10, rate, erp, | 159 | dur = ieee80211_frame_duration(local, 10, rate, erp, |
153 | tx->sdata->bss_conf.use_short_preamble); | 160 | tx->sdata->vif.bss_conf.use_short_preamble); |
154 | 161 | ||
155 | if (next_frag_len) { | 162 | if (next_frag_len) { |
156 | /* Frame is fragmented: duration increases with time needed to | 163 | /* Frame is fragmented: duration increases with time needed to |
@@ -159,7 +166,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
159 | /* next fragment */ | 166 | /* next fragment */ |
160 | dur += ieee80211_frame_duration(local, next_frag_len, | 167 | dur += ieee80211_frame_duration(local, next_frag_len, |
161 | txrate->bitrate, erp, | 168 | txrate->bitrate, erp, |
162 | tx->sdata->bss_conf.use_short_preamble); | 169 | tx->sdata->vif.bss_conf.use_short_preamble); |
163 | } | 170 | } |
164 | 171 | ||
165 | return cpu_to_le16(dur); | 172 | return cpu_to_le16(dur); |
@@ -201,10 +208,9 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
201 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && | 208 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && |
202 | ieee80211_is_data(hdr->frame_control))) { | 209 | ieee80211_is_data(hdr->frame_control))) { |
203 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 210 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
204 | DECLARE_MAC_BUF(mac); | ||
205 | printk(KERN_DEBUG "%s: dropped data frame to not " | 211 | printk(KERN_DEBUG "%s: dropped data frame to not " |
206 | "associated station %s\n", | 212 | "associated station %pM\n", |
207 | tx->dev->name, print_mac(mac, hdr->addr1)); | 213 | tx->dev->name, hdr->addr1); |
208 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 214 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
209 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); | 215 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); |
210 | return TX_DROP; | 216 | return TX_DROP; |
@@ -331,7 +337,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
331 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 337 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
332 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 338 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
333 | u32 staflags; | 339 | u32 staflags; |
334 | DECLARE_MAC_BUF(mac); | ||
335 | 340 | ||
336 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) | 341 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) |
337 | return TX_CONTINUE; | 342 | return TX_CONTINUE; |
@@ -341,9 +346,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
341 | if (unlikely((staflags & WLAN_STA_PS) && | 346 | if (unlikely((staflags & WLAN_STA_PS) && |
342 | !(staflags & WLAN_STA_PSPOLL))) { | 347 | !(staflags & WLAN_STA_PSPOLL))) { |
343 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 348 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
344 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " | 349 | printk(KERN_DEBUG "STA %pM aid %d: PS buffer (entries " |
345 | "before %d)\n", | 350 | "before %d)\n", |
346 | print_mac(mac, sta->sta.addr), sta->sta.aid, | 351 | sta->sta.addr, sta->sta.aid, |
347 | skb_queue_len(&sta->ps_tx_buf)); | 352 | skb_queue_len(&sta->ps_tx_buf)); |
348 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 353 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
349 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 354 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
@@ -352,9 +357,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
352 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); | 357 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); |
353 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 358 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
354 | if (net_ratelimit()) { | 359 | if (net_ratelimit()) { |
355 | printk(KERN_DEBUG "%s: STA %s TX " | 360 | printk(KERN_DEBUG "%s: STA %pM TX " |
356 | "buffer full - dropping oldest frame\n", | 361 | "buffer full - dropping oldest frame\n", |
357 | tx->dev->name, print_mac(mac, sta->sta.addr)); | 362 | tx->dev->name, sta->sta.addr); |
358 | } | 363 | } |
359 | #endif | 364 | #endif |
360 | dev_kfree_skb(old); | 365 | dev_kfree_skb(old); |
@@ -371,9 +376,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
371 | } | 376 | } |
372 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 377 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
373 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { | 378 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { |
374 | printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " | 379 | printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll " |
375 | "set -> send frame\n", tx->dev->name, | 380 | "set -> send frame\n", tx->dev->name, |
376 | print_mac(mac, sta->sta.addr)); | 381 | sta->sta.addr); |
377 | } | 382 | } |
378 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 383 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
379 | clear_sta_flags(sta, WLAN_STA_PSPOLL); | 384 | clear_sta_flags(sta, WLAN_STA_PSPOLL); |
@@ -439,140 +444,154 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
439 | static ieee80211_tx_result debug_noinline | 444 | static ieee80211_tx_result debug_noinline |
440 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | 445 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) |
441 | { | 446 | { |
442 | struct rate_selection rsel; | ||
443 | struct ieee80211_supported_band *sband; | ||
444 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 447 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
448 | struct ieee80211_hdr *hdr = (void *)tx->skb->data; | ||
449 | struct ieee80211_supported_band *sband; | ||
450 | struct ieee80211_rate *rate; | ||
451 | int i, len; | ||
452 | bool inval = false, rts = false, short_preamble = false; | ||
453 | struct ieee80211_tx_rate_control txrc; | ||
445 | 454 | ||
446 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 455 | memset(&txrc, 0, sizeof(txrc)); |
447 | 456 | ||
448 | if (likely(tx->rate_idx < 0)) { | 457 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
449 | rate_control_get_rate(tx->sdata, sband, tx->sta, | ||
450 | tx->skb, &rsel); | ||
451 | if (tx->sta) | ||
452 | tx->sta->last_txrate_idx = rsel.rate_idx; | ||
453 | tx->rate_idx = rsel.rate_idx; | ||
454 | if (unlikely(rsel.probe_idx >= 0)) { | ||
455 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
456 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; | ||
457 | info->control.retries[0].rate_idx = tx->rate_idx; | ||
458 | info->control.retries[0].limit = tx->local->hw.max_altrate_tries; | ||
459 | tx->rate_idx = rsel.probe_idx; | ||
460 | } else if (info->control.retries[0].limit == 0) | ||
461 | info->control.retries[0].rate_idx = -1; | ||
462 | |||
463 | if (unlikely(tx->rate_idx < 0)) | ||
464 | return TX_DROP; | ||
465 | } else | ||
466 | info->control.retries[0].rate_idx = -1; | ||
467 | 458 | ||
468 | if (tx->sdata->bss_conf.use_cts_prot && | 459 | len = min_t(int, tx->skb->len + FCS_LEN, |
469 | (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { | 460 | tx->local->fragmentation_threshold); |
470 | tx->last_frag_rate_idx = tx->rate_idx; | 461 | |
471 | if (rsel.probe_idx >= 0) | 462 | /* set up the tx rate control struct we give the RC algo */ |
472 | tx->flags &= ~IEEE80211_TX_PROBE_LAST_FRAG; | 463 | txrc.hw = local_to_hw(tx->local); |
473 | else | 464 | txrc.sband = sband; |
474 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; | 465 | txrc.bss_conf = &tx->sdata->vif.bss_conf; |
475 | tx->rate_idx = rsel.nonerp_idx; | 466 | txrc.skb = tx->skb; |
476 | info->tx_rate_idx = rsel.nonerp_idx; | 467 | txrc.reported_rate.idx = -1; |
477 | info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 468 | txrc.max_rate_idx = tx->sdata->max_ratectrl_rateidx; |
478 | } else { | 469 | |
479 | tx->last_frag_rate_idx = tx->rate_idx; | 470 | /* set up RTS protection if desired */ |
480 | info->tx_rate_idx = tx->rate_idx; | 471 | if (tx->local->rts_threshold < IEEE80211_MAX_RTS_THRESHOLD && |
472 | len > tx->local->rts_threshold) { | ||
473 | txrc.rts = rts = true; | ||
481 | } | 474 | } |
482 | info->tx_rate_idx = tx->rate_idx; | ||
483 | 475 | ||
484 | return TX_CONTINUE; | 476 | /* |
485 | } | 477 | * Use short preamble if the BSS can handle it, but not for |
478 | * management frames unless we know the receiver can handle | ||
479 | * that -- the management frame might be to a station that | ||
480 | * just wants a probe response. | ||
481 | */ | ||
482 | if (tx->sdata->vif.bss_conf.use_short_preamble && | ||
483 | (ieee80211_is_data(hdr->frame_control) || | ||
484 | (tx->sta && test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE)))) | ||
485 | txrc.short_preamble = short_preamble = true; | ||
486 | 486 | ||
487 | static ieee80211_tx_result debug_noinline | ||
488 | ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | ||
489 | { | ||
490 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | ||
491 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
492 | struct ieee80211_supported_band *sband; | ||
493 | 487 | ||
494 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 488 | rate_control_get_rate(tx->sdata, tx->sta, &txrc); |
489 | |||
490 | if (unlikely(info->control.rates[0].idx < 0)) | ||
491 | return TX_DROP; | ||
492 | |||
493 | if (txrc.reported_rate.idx < 0) | ||
494 | txrc.reported_rate = info->control.rates[0]; | ||
495 | 495 | ||
496 | if (tx->sta) | 496 | if (tx->sta) |
497 | info->control.sta = &tx->sta->sta; | 497 | tx->sta->last_tx_rate = txrc.reported_rate; |
498 | 498 | ||
499 | if (!info->control.retry_limit) { | 499 | if (unlikely(!info->control.rates[0].count)) |
500 | if (!is_multicast_ether_addr(hdr->addr1)) { | 500 | info->control.rates[0].count = 1; |
501 | int len = min_t(int, tx->skb->len + FCS_LEN, | ||
502 | tx->local->fragmentation_threshold); | ||
503 | if (len > tx->local->rts_threshold | ||
504 | && tx->local->rts_threshold < | ||
505 | IEEE80211_MAX_RTS_THRESHOLD) { | ||
506 | info->flags |= IEEE80211_TX_CTL_USE_RTS_CTS; | ||
507 | info->flags |= | ||
508 | IEEE80211_TX_CTL_LONG_RETRY_LIMIT; | ||
509 | info->control.retry_limit = | ||
510 | tx->local->long_retry_limit; | ||
511 | } else { | ||
512 | info->control.retry_limit = | ||
513 | tx->local->short_retry_limit; | ||
514 | } | ||
515 | } else { | ||
516 | info->control.retry_limit = 1; | ||
517 | } | ||
518 | } | ||
519 | 501 | ||
520 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { | 502 | if (is_multicast_ether_addr(hdr->addr1)) { |
521 | /* Do not use multiple retry rates when sending fragmented | 503 | /* |
522 | * frames. | 504 | * XXX: verify the rate is in the basic rateset |
523 | * TODO: The last fragment could still use multiple retry | 505 | */ |
524 | * rates. */ | 506 | return TX_CONTINUE; |
525 | info->control.retries[0].rate_idx = -1; | ||
526 | } | 507 | } |
527 | 508 | ||
528 | /* Use CTS protection for unicast frames sent using extended rates if | 509 | /* |
529 | * there are associated non-ERP stations and RTS/CTS is not configured | 510 | * set up the RTS/CTS rate as the fastest basic rate |
530 | * for the frame. */ | 511 | * that is not faster than the data rate |
531 | if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && | 512 | * |
532 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && | 513 | * XXX: Should this check all retry rates? |
533 | (tx->flags & IEEE80211_TX_UNICAST) && | 514 | */ |
534 | tx->sdata->bss_conf.use_cts_prot && | 515 | if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) { |
535 | !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)) | 516 | s8 baserate = 0; |
536 | info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT; | 517 | |
537 | 518 | rate = &sband->bitrates[info->control.rates[0].idx]; | |
538 | /* Transmit data frames using short preambles if the driver supports | 519 | |
539 | * short preambles at the selected rate and short preambles are | 520 | for (i = 0; i < sband->n_bitrates; i++) { |
540 | * available on the network at the current point in time. */ | 521 | /* must be a basic rate */ |
541 | if (ieee80211_is_data(hdr->frame_control) && | 522 | if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i))) |
542 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && | 523 | continue; |
543 | tx->sdata->bss_conf.use_short_preamble && | 524 | /* must not be faster than the data rate */ |
544 | (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { | 525 | if (sband->bitrates[i].bitrate > rate->bitrate) |
545 | info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; | 526 | continue; |
527 | /* maximum */ | ||
528 | if (sband->bitrates[baserate].bitrate < | ||
529 | sband->bitrates[i].bitrate) | ||
530 | baserate = i; | ||
531 | } | ||
532 | |||
533 | info->control.rts_cts_rate_idx = baserate; | ||
546 | } | 534 | } |
547 | 535 | ||
548 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || | 536 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { |
549 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { | 537 | /* |
550 | struct ieee80211_rate *rate; | 538 | * make sure there's no valid rate following |
551 | s8 baserate = -1; | 539 | * an invalid one, just in case drivers don't |
552 | int idx; | 540 | * take the API seriously to stop at -1. |
541 | */ | ||
542 | if (inval) { | ||
543 | info->control.rates[i].idx = -1; | ||
544 | continue; | ||
545 | } | ||
546 | if (info->control.rates[i].idx < 0) { | ||
547 | inval = true; | ||
548 | continue; | ||
549 | } | ||
553 | 550 | ||
554 | /* Do not use multiple retry rates when using RTS/CTS */ | 551 | /* |
555 | info->control.retries[0].rate_idx = -1; | 552 | * For now assume MCS is already set up correctly, this |
553 | * needs to be fixed. | ||
554 | */ | ||
555 | if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) { | ||
556 | WARN_ON(info->control.rates[i].idx > 76); | ||
557 | continue; | ||
558 | } | ||
556 | 559 | ||
557 | /* Use min(data rate, max base rate) as CTS/RTS rate */ | 560 | /* set up RTS protection if desired */ |
558 | rate = &sband->bitrates[tx->rate_idx]; | 561 | if (rts) |
562 | info->control.rates[i].flags |= | ||
563 | IEEE80211_TX_RC_USE_RTS_CTS; | ||
559 | 564 | ||
560 | for (idx = 0; idx < sband->n_bitrates; idx++) { | 565 | /* RC is busted */ |
561 | if (sband->bitrates[idx].bitrate > rate->bitrate) | 566 | if (WARN_ON_ONCE(info->control.rates[i].idx >= |
562 | continue; | 567 | sband->n_bitrates)) { |
563 | if (tx->sdata->bss_conf.basic_rates & BIT(idx) && | 568 | info->control.rates[i].idx = -1; |
564 | (baserate < 0 || | 569 | continue; |
565 | (sband->bitrates[baserate].bitrate | ||
566 | < sband->bitrates[idx].bitrate))) | ||
567 | baserate = idx; | ||
568 | } | 570 | } |
569 | 571 | ||
570 | if (baserate >= 0) | 572 | rate = &sband->bitrates[info->control.rates[i].idx]; |
571 | info->control.rts_cts_rate_idx = baserate; | 573 | |
572 | else | 574 | /* set up short preamble */ |
573 | info->control.rts_cts_rate_idx = 0; | 575 | if (short_preamble && |
576 | rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) | ||
577 | info->control.rates[i].flags |= | ||
578 | IEEE80211_TX_RC_USE_SHORT_PREAMBLE; | ||
579 | |||
580 | /* set up G protection */ | ||
581 | if (!rts && tx->sdata->vif.bss_conf.use_cts_prot && | ||
582 | rate->flags & IEEE80211_RATE_ERP_G) | ||
583 | info->control.rates[i].flags |= | ||
584 | IEEE80211_TX_RC_USE_CTS_PROTECT; | ||
574 | } | 585 | } |
575 | 586 | ||
587 | return TX_CONTINUE; | ||
588 | } | ||
589 | |||
590 | static ieee80211_tx_result debug_noinline | ||
591 | ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | ||
592 | { | ||
593 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
594 | |||
576 | if (tx->sta) | 595 | if (tx->sta) |
577 | info->control.sta = &tx->sta->sta; | 596 | info->control.sta = &tx->sta->sta; |
578 | 597 | ||
@@ -602,8 +621,18 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
602 | if (ieee80211_hdrlen(hdr->frame_control) < 24) | 621 | if (ieee80211_hdrlen(hdr->frame_control) < 24) |
603 | return TX_CONTINUE; | 622 | return TX_CONTINUE; |
604 | 623 | ||
624 | /* | ||
625 | * Anything but QoS data that has a sequence number field | ||
626 | * (is long enough) gets a sequence number from the global | ||
627 | * counter. | ||
628 | */ | ||
605 | if (!ieee80211_is_data_qos(hdr->frame_control)) { | 629 | if (!ieee80211_is_data_qos(hdr->frame_control)) { |
630 | /* driver should assign sequence number */ | ||
606 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 631 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
632 | /* for pure STA mode without beacons, we can do it */ | ||
633 | hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number); | ||
634 | tx->sdata->sequence_number += 0x10; | ||
635 | tx->sdata->sequence_number &= IEEE80211_SCTL_SEQ; | ||
607 | return TX_CONTINUE; | 636 | return TX_CONTINUE; |
608 | } | 637 | } |
609 | 638 | ||
@@ -632,6 +661,7 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
632 | static ieee80211_tx_result debug_noinline | 661 | static ieee80211_tx_result debug_noinline |
633 | ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) | 662 | ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) |
634 | { | 663 | { |
664 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
635 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 665 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
636 | size_t hdrlen, per_fragm, num_fragm, payload_len, left; | 666 | size_t hdrlen, per_fragm, num_fragm, payload_len, left; |
637 | struct sk_buff **frags, *first, *frag; | 667 | struct sk_buff **frags, *first, *frag; |
@@ -648,9 +678,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) | |||
648 | * This scenario is handled in __ieee80211_tx_prepare but extra | 678 | * This scenario is handled in __ieee80211_tx_prepare but extra |
649 | * caution taken here as fragmented ampdu may cause Tx stop. | 679 | * caution taken here as fragmented ampdu may cause Tx stop. |
650 | */ | 680 | */ |
651 | if (WARN_ON(tx->flags & IEEE80211_TX_CTL_AMPDU || | 681 | if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) |
652 | skb_get_queue_mapping(tx->skb) >= | ||
653 | ieee80211_num_regular_queues(&tx->local->hw))) | ||
654 | return TX_DROP; | 682 | return TX_DROP; |
655 | 683 | ||
656 | first = tx->skb; | 684 | first = tx->skb; |
@@ -684,20 +712,45 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) | |||
684 | IEEE80211_ENCRYPT_TAILROOM); | 712 | IEEE80211_ENCRYPT_TAILROOM); |
685 | if (!frag) | 713 | if (!frag) |
686 | goto fail; | 714 | goto fail; |
715 | |||
687 | /* Make sure that all fragments use the same priority so | 716 | /* Make sure that all fragments use the same priority so |
688 | * that they end up using the same TX queue */ | 717 | * that they end up using the same TX queue */ |
689 | frag->priority = first->priority; | 718 | frag->priority = first->priority; |
719 | |||
690 | skb_reserve(frag, tx->local->tx_headroom + | 720 | skb_reserve(frag, tx->local->tx_headroom + |
691 | IEEE80211_ENCRYPT_HEADROOM); | 721 | IEEE80211_ENCRYPT_HEADROOM); |
722 | |||
723 | /* copy TX information */ | ||
724 | info = IEEE80211_SKB_CB(frag); | ||
725 | memcpy(info, first->cb, sizeof(frag->cb)); | ||
726 | |||
727 | /* copy/fill in 802.11 header */ | ||
692 | fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen); | 728 | fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen); |
693 | memcpy(fhdr, first->data, hdrlen); | 729 | memcpy(fhdr, first->data, hdrlen); |
694 | if (i == num_fragm - 2) | ||
695 | fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS); | ||
696 | fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG)); | 730 | fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG)); |
731 | |||
732 | if (i == num_fragm - 2) { | ||
733 | /* clear MOREFRAGS bit for the last fragment */ | ||
734 | fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS); | ||
735 | } else { | ||
736 | /* | ||
737 | * No multi-rate retries for fragmented frames, that | ||
738 | * would completely throw off the NAV at other STAs. | ||
739 | */ | ||
740 | info->control.rates[1].idx = -1; | ||
741 | info->control.rates[2].idx = -1; | ||
742 | info->control.rates[3].idx = -1; | ||
743 | info->control.rates[4].idx = -1; | ||
744 | BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5); | ||
745 | info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
746 | } | ||
747 | |||
748 | /* copy data */ | ||
697 | copylen = left > per_fragm ? per_fragm : left; | 749 | copylen = left > per_fragm ? per_fragm : left; |
698 | memcpy(skb_put(frag, copylen), pos, copylen); | 750 | memcpy(skb_put(frag, copylen), pos, copylen); |
699 | memcpy(frag->cb, first->cb, sizeof(frag->cb)); | 751 | |
700 | skb_copy_queue_mapping(frag, first); | 752 | skb_copy_queue_mapping(frag, first); |
753 | |||
701 | frag->do_not_encrypt = first->do_not_encrypt; | 754 | frag->do_not_encrypt = first->do_not_encrypt; |
702 | 755 | ||
703 | pos += copylen; | 756 | pos += copylen; |
@@ -757,12 +810,10 @@ ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx) | |||
757 | tx->extra_frag[0]->len); | 810 | tx->extra_frag[0]->len); |
758 | 811 | ||
759 | for (i = 0; i < tx->num_extra_frag; i++) { | 812 | for (i = 0; i < tx->num_extra_frag; i++) { |
760 | if (i + 1 < tx->num_extra_frag) { | 813 | if (i + 1 < tx->num_extra_frag) |
761 | next_len = tx->extra_frag[i + 1]->len; | 814 | next_len = tx->extra_frag[i + 1]->len; |
762 | } else { | 815 | else |
763 | next_len = 0; | 816 | next_len = 0; |
764 | tx->rate_idx = tx->last_frag_rate_idx; | ||
765 | } | ||
766 | 817 | ||
767 | hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data; | 818 | hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data; |
768 | hdr->duration_id = ieee80211_duration(tx, 0, next_len); | 819 | hdr->duration_id = ieee80211_duration(tx, 0, next_len); |
@@ -815,7 +866,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
815 | (struct ieee80211_radiotap_header *) skb->data; | 866 | (struct ieee80211_radiotap_header *) skb->data; |
816 | struct ieee80211_supported_band *sband; | 867 | struct ieee80211_supported_band *sband; |
817 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); | 868 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); |
818 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
819 | 869 | ||
820 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 870 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
821 | 871 | ||
@@ -829,8 +879,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
829 | */ | 879 | */ |
830 | 880 | ||
831 | while (!ret) { | 881 | while (!ret) { |
832 | int i, target_rate; | ||
833 | |||
834 | ret = ieee80211_radiotap_iterator_next(&iterator); | 882 | ret = ieee80211_radiotap_iterator_next(&iterator); |
835 | 883 | ||
836 | if (ret) | 884 | if (ret) |
@@ -844,38 +892,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
844 | * get_unaligned((type *)iterator.this_arg) to dereference | 892 | * get_unaligned((type *)iterator.this_arg) to dereference |
845 | * iterator.this_arg for type "type" safely on all arches. | 893 | * iterator.this_arg for type "type" safely on all arches. |
846 | */ | 894 | */ |
847 | case IEEE80211_RADIOTAP_RATE: | ||
848 | /* | ||
849 | * radiotap rate u8 is in 500kbps units eg, 0x02=1Mbps | ||
850 | * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps | ||
851 | */ | ||
852 | target_rate = (*iterator.this_arg) * 5; | ||
853 | for (i = 0; i < sband->n_bitrates; i++) { | ||
854 | struct ieee80211_rate *r; | ||
855 | |||
856 | r = &sband->bitrates[i]; | ||
857 | |||
858 | if (r->bitrate == target_rate) { | ||
859 | tx->rate_idx = i; | ||
860 | break; | ||
861 | } | ||
862 | } | ||
863 | break; | ||
864 | |||
865 | case IEEE80211_RADIOTAP_ANTENNA: | ||
866 | /* | ||
867 | * radiotap uses 0 for 1st ant, mac80211 is 1 for | ||
868 | * 1st ant | ||
869 | */ | ||
870 | info->antenna_sel_tx = (*iterator.this_arg) + 1; | ||
871 | break; | ||
872 | |||
873 | #if 0 | ||
874 | case IEEE80211_RADIOTAP_DBM_TX_POWER: | ||
875 | control->power_level = *iterator.this_arg; | ||
876 | break; | ||
877 | #endif | ||
878 | |||
879 | case IEEE80211_RADIOTAP_FLAGS: | 895 | case IEEE80211_RADIOTAP_FLAGS: |
880 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { | 896 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { |
881 | /* | 897 | /* |
@@ -933,7 +949,8 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
933 | struct ieee80211_sub_if_data *sdata; | 949 | struct ieee80211_sub_if_data *sdata; |
934 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 950 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
935 | 951 | ||
936 | int hdrlen; | 952 | int hdrlen, tid; |
953 | u8 *qc, *state; | ||
937 | 954 | ||
938 | memset(tx, 0, sizeof(*tx)); | 955 | memset(tx, 0, sizeof(*tx)); |
939 | tx->skb = skb; | 956 | tx->skb = skb; |
@@ -941,8 +958,6 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
941 | tx->local = local; | 958 | tx->local = local; |
942 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 959 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
943 | tx->channel = local->hw.conf.channel; | 960 | tx->channel = local->hw.conf.channel; |
944 | tx->rate_idx = -1; | ||
945 | tx->last_frag_rate_idx = -1; | ||
946 | /* | 961 | /* |
947 | * Set this flag (used below to indicate "automatic fragmentation"), | 962 | * Set this flag (used below to indicate "automatic fragmentation"), |
948 | * it will be cleared/left by radiotap as desired. | 963 | * it will be cleared/left by radiotap as desired. |
@@ -966,6 +981,15 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
966 | 981 | ||
967 | tx->sta = sta_info_get(local, hdr->addr1); | 982 | tx->sta = sta_info_get(local, hdr->addr1); |
968 | 983 | ||
984 | if (tx->sta && ieee80211_is_data_qos(hdr->frame_control)) { | ||
985 | qc = ieee80211_get_qos_ctl(hdr); | ||
986 | tid = *qc & IEEE80211_QOS_CTL_TID_MASK; | ||
987 | |||
988 | state = &tx->sta->ampdu_mlme.tid_state_tx[tid]; | ||
989 | if (*state == HT_AGG_STATE_OPERATIONAL) | ||
990 | info->flags |= IEEE80211_TX_CTL_AMPDU; | ||
991 | } | ||
992 | |||
969 | if (is_multicast_ether_addr(hdr->addr1)) { | 993 | if (is_multicast_ether_addr(hdr->addr1)) { |
970 | tx->flags &= ~IEEE80211_TX_UNICAST; | 994 | tx->flags &= ~IEEE80211_TX_UNICAST; |
971 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | 995 | info->flags |= IEEE80211_TX_CTL_NO_ACK; |
@@ -1043,23 +1067,11 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1043 | if (!tx->extra_frag[i]) | 1067 | if (!tx->extra_frag[i]) |
1044 | continue; | 1068 | continue; |
1045 | info = IEEE80211_SKB_CB(tx->extra_frag[i]); | 1069 | info = IEEE80211_SKB_CB(tx->extra_frag[i]); |
1046 | info->flags &= ~(IEEE80211_TX_CTL_USE_RTS_CTS | | 1070 | info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | |
1047 | IEEE80211_TX_CTL_USE_CTS_PROTECT | | ||
1048 | IEEE80211_TX_CTL_CLEAR_PS_FILT | | ||
1049 | IEEE80211_TX_CTL_FIRST_FRAGMENT); | 1071 | IEEE80211_TX_CTL_FIRST_FRAGMENT); |
1050 | if (netif_subqueue_stopped(local->mdev, | 1072 | if (netif_subqueue_stopped(local->mdev, |
1051 | tx->extra_frag[i])) | 1073 | tx->extra_frag[i])) |
1052 | return IEEE80211_TX_FRAG_AGAIN; | 1074 | return IEEE80211_TX_FRAG_AGAIN; |
1053 | if (i == tx->num_extra_frag) { | ||
1054 | info->tx_rate_idx = tx->last_frag_rate_idx; | ||
1055 | |||
1056 | if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) | ||
1057 | info->flags |= | ||
1058 | IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
1059 | else | ||
1060 | info->flags &= | ||
1061 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
1062 | } | ||
1063 | 1075 | ||
1064 | ret = local->ops->tx(local_to_hw(local), | 1076 | ret = local->ops->tx(local_to_hw(local), |
1065 | tx->extra_frag[i]); | 1077 | tx->extra_frag[i]); |
@@ -1168,7 +1180,7 @@ retry: | |||
1168 | * queues, there's no reason for a driver to reject | 1180 | * queues, there's no reason for a driver to reject |
1169 | * a frame there, warn and drop it. | 1181 | * a frame there, warn and drop it. |
1170 | */ | 1182 | */ |
1171 | if (WARN_ON(queue >= ieee80211_num_regular_queues(&local->hw))) | 1183 | if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) |
1172 | goto drop; | 1184 | goto drop; |
1173 | 1185 | ||
1174 | store = &local->pending_packet[queue]; | 1186 | store = &local->pending_packet[queue]; |
@@ -1196,9 +1208,6 @@ retry: | |||
1196 | store->skb = skb; | 1208 | store->skb = skb; |
1197 | store->extra_frag = tx.extra_frag; | 1209 | store->extra_frag = tx.extra_frag; |
1198 | store->num_extra_frag = tx.num_extra_frag; | 1210 | store->num_extra_frag = tx.num_extra_frag; |
1199 | store->last_frag_rate_idx = tx.last_frag_rate_idx; | ||
1200 | store->last_frag_rate_ctrl_probe = | ||
1201 | !!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG); | ||
1202 | } | 1211 | } |
1203 | out: | 1212 | out: |
1204 | rcu_read_unlock(); | 1213 | rcu_read_unlock(); |
@@ -1593,12 +1602,10 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1593 | compare_ether_addr(dev->dev_addr, | 1602 | compare_ether_addr(dev->dev_addr, |
1594 | skb->data + ETH_ALEN) == 0))) { | 1603 | skb->data + ETH_ALEN) == 0))) { |
1595 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1604 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1596 | DECLARE_MAC_BUF(mac); | ||
1597 | |||
1598 | if (net_ratelimit()) | 1605 | if (net_ratelimit()) |
1599 | printk(KERN_DEBUG "%s: dropped frame to %s" | 1606 | printk(KERN_DEBUG "%s: dropped frame to %pM" |
1600 | " (unauthorized port)\n", dev->name, | 1607 | " (unauthorized port)\n", dev->name, |
1601 | print_mac(mac, hdr.addr1)); | 1608 | hdr.addr1); |
1602 | #endif | 1609 | #endif |
1603 | 1610 | ||
1604 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); | 1611 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); |
@@ -1757,10 +1764,7 @@ void ieee80211_tx_pending(unsigned long data) | |||
1757 | store = &local->pending_packet[i]; | 1764 | store = &local->pending_packet[i]; |
1758 | tx.extra_frag = store->extra_frag; | 1765 | tx.extra_frag = store->extra_frag; |
1759 | tx.num_extra_frag = store->num_extra_frag; | 1766 | tx.num_extra_frag = store->num_extra_frag; |
1760 | tx.last_frag_rate_idx = store->last_frag_rate_idx; | ||
1761 | tx.flags = 0; | 1767 | tx.flags = 0; |
1762 | if (store->last_frag_rate_ctrl_probe) | ||
1763 | tx.flags |= IEEE80211_TX_PROBE_LAST_FRAG; | ||
1764 | ret = __ieee80211_tx(local, store->skb, &tx); | 1768 | ret = __ieee80211_tx(local, store->skb, &tx); |
1765 | if (ret) { | 1769 | if (ret) { |
1766 | if (ret == IEEE80211_TX_FRAG_AGAIN) | 1770 | if (ret == IEEE80211_TX_FRAG_AGAIN) |
@@ -1848,7 +1852,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1848 | struct ieee80211_sub_if_data *sdata = NULL; | 1852 | struct ieee80211_sub_if_data *sdata = NULL; |
1849 | struct ieee80211_if_ap *ap = NULL; | 1853 | struct ieee80211_if_ap *ap = NULL; |
1850 | struct ieee80211_if_sta *ifsta = NULL; | 1854 | struct ieee80211_if_sta *ifsta = NULL; |
1851 | struct rate_selection rsel; | ||
1852 | struct beacon_data *beacon; | 1855 | struct beacon_data *beacon; |
1853 | struct ieee80211_supported_band *sband; | 1856 | struct ieee80211_supported_band *sband; |
1854 | enum ieee80211_band band = local->hw.conf.channel->band; | 1857 | enum ieee80211_band band = local->hw.conf.channel->band; |
@@ -1952,33 +1955,23 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1952 | skb->do_not_encrypt = 1; | 1955 | skb->do_not_encrypt = 1; |
1953 | 1956 | ||
1954 | info->band = band; | 1957 | info->band = band; |
1955 | rate_control_get_rate(sdata, sband, NULL, skb, &rsel); | 1958 | /* |
1956 | 1959 | * XXX: For now, always use the lowest rate | |
1957 | if (unlikely(rsel.rate_idx < 0)) { | 1960 | */ |
1958 | if (net_ratelimit()) { | 1961 | info->control.rates[0].idx = 0; |
1959 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " | 1962 | info->control.rates[0].count = 1; |
1960 | "no rate found\n", | 1963 | info->control.rates[1].idx = -1; |
1961 | wiphy_name(local->hw.wiphy)); | 1964 | info->control.rates[2].idx = -1; |
1962 | } | 1965 | info->control.rates[3].idx = -1; |
1963 | dev_kfree_skb_any(skb); | 1966 | info->control.rates[4].idx = -1; |
1964 | skb = NULL; | 1967 | BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5); |
1965 | goto out; | ||
1966 | } | ||
1967 | 1968 | ||
1968 | info->control.vif = vif; | 1969 | info->control.vif = vif; |
1969 | info->tx_rate_idx = rsel.rate_idx; | ||
1970 | 1970 | ||
1971 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | 1971 | info->flags |= IEEE80211_TX_CTL_NO_ACK; |
1972 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; | 1972 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; |
1973 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 1973 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
1974 | if (sdata->bss_conf.use_short_preamble && | 1974 | out: |
1975 | sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) | ||
1976 | info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; | ||
1977 | |||
1978 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | ||
1979 | info->control.retry_limit = 1; | ||
1980 | |||
1981 | out: | ||
1982 | rcu_read_unlock(); | 1975 | rcu_read_unlock(); |
1983 | return skb; | 1976 | return skb; |
1984 | } | 1977 | } |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index cee4884b9d06..0f841317c7e9 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -239,7 +239,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | |||
239 | erp = 0; | 239 | erp = 0; |
240 | if (vif) { | 240 | if (vif) { |
241 | sdata = vif_to_sdata(vif); | 241 | sdata = vif_to_sdata(vif); |
242 | short_preamble = sdata->bss_conf.use_short_preamble; | 242 | short_preamble = sdata->vif.bss_conf.use_short_preamble; |
243 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | 243 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) |
244 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 244 | erp = rate->flags & IEEE80211_RATE_ERP_G; |
245 | } | 245 | } |
@@ -272,7 +272,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
272 | erp = 0; | 272 | erp = 0; |
273 | if (vif) { | 273 | if (vif) { |
274 | sdata = vif_to_sdata(vif); | 274 | sdata = vif_to_sdata(vif); |
275 | short_preamble = sdata->bss_conf.use_short_preamble; | 275 | short_preamble = sdata->vif.bss_conf.use_short_preamble; |
276 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | 276 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) |
277 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 277 | erp = rate->flags & IEEE80211_RATE_ERP_G; |
278 | } | 278 | } |
@@ -312,7 +312,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
312 | erp = 0; | 312 | erp = 0; |
313 | if (vif) { | 313 | if (vif) { |
314 | sdata = vif_to_sdata(vif); | 314 | sdata = vif_to_sdata(vif); |
315 | short_preamble = sdata->bss_conf.use_short_preamble; | 315 | short_preamble = sdata->vif.bss_conf.use_short_preamble; |
316 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | 316 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) |
317 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 317 | erp = rate->flags & IEEE80211_RATE_ERP_G; |
318 | } | 318 | } |
@@ -532,8 +532,8 @@ void ieee802_11_parse_elems(u8 *start, size_t len, | |||
532 | if (elen >= sizeof(struct ieee80211_ht_cap)) | 532 | if (elen >= sizeof(struct ieee80211_ht_cap)) |
533 | elems->ht_cap_elem = (void *)pos; | 533 | elems->ht_cap_elem = (void *)pos; |
534 | break; | 534 | break; |
535 | case WLAN_EID_HT_EXTRA_INFO: | 535 | case WLAN_EID_HT_INFORMATION: |
536 | if (elen >= sizeof(struct ieee80211_ht_addt_info)) | 536 | if (elen >= sizeof(struct ieee80211_ht_info)) |
537 | elems->ht_info_elem = (void *)pos; | 537 | elems->ht_info_elem = (void *)pos; |
538 | break; | 538 | break; |
539 | case WLAN_EID_MESH_ID: | 539 | case WLAN_EID_MESH_ID: |
@@ -638,19 +638,15 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz) | |||
638 | 638 | ||
639 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | 639 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
640 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | 640 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && |
641 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | 641 | chan->flags & IEEE80211_CHAN_NO_IBSS) |
642 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
643 | "%d MHz\n", sdata->dev->name, chan->center_freq); | ||
644 | return ret; | 642 | return ret; |
645 | } | ||
646 | local->oper_channel = chan; | 643 | local->oper_channel = chan; |
647 | 644 | ||
648 | if (local->sw_scanning || local->hw_scanning) | 645 | if (local->sw_scanning || local->hw_scanning) |
649 | ret = 0; | 646 | ret = 0; |
650 | else | 647 | else |
651 | ret = ieee80211_hw_config(local); | 648 | ret = ieee80211_hw_config( |
652 | 649 | local, IEEE80211_CONF_CHANGE_CHANNEL); | |
653 | rate_control_clear(local); | ||
654 | } | 650 | } |
655 | 651 | ||
656 | return ret; | 652 | return ret; |
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index f0e2d3ecb5c4..7bbb98e846a3 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -49,17 +49,19 @@ void ieee80211_wep_free(struct ieee80211_local *local) | |||
49 | crypto_free_blkcipher(local->wep_rx_tfm); | 49 | crypto_free_blkcipher(local->wep_rx_tfm); |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline int ieee80211_wep_weak_iv(u32 iv, int keylen) | 52 | static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen) |
53 | { | 53 | { |
54 | /* Fluhrer, Mantin, and Shamir have reported weaknesses in the | 54 | /* |
55 | * Fluhrer, Mantin, and Shamir have reported weaknesses in the | ||
55 | * key scheduling algorithm of RC4. At least IVs (KeyByte + 3, | 56 | * key scheduling algorithm of RC4. At least IVs (KeyByte + 3, |
56 | * 0xff, N) can be used to speedup attacks, so avoid using them. */ | 57 | * 0xff, N) can be used to speedup attacks, so avoid using them. |
58 | */ | ||
57 | if ((iv & 0xff00) == 0xff00) { | 59 | if ((iv & 0xff00) == 0xff00) { |
58 | u8 B = (iv >> 16) & 0xff; | 60 | u8 B = (iv >> 16) & 0xff; |
59 | if (B >= 3 && B < 3 + keylen) | 61 | if (B >= 3 && B < 3 + keylen) |
60 | return 1; | 62 | return true; |
61 | } | 63 | } |
62 | return 0; | 64 | return false; |
63 | } | 65 | } |
64 | 66 | ||
65 | 67 | ||
@@ -268,7 +270,7 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, | |||
268 | } | 270 | } |
269 | 271 | ||
270 | 272 | ||
271 | u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) | 273 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) |
272 | { | 274 | { |
273 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 275 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
274 | unsigned int hdrlen; | 276 | unsigned int hdrlen; |
@@ -276,16 +278,13 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) | |||
276 | u32 iv; | 278 | u32 iv; |
277 | 279 | ||
278 | if (!ieee80211_has_protected(hdr->frame_control)) | 280 | if (!ieee80211_has_protected(hdr->frame_control)) |
279 | return NULL; | 281 | return false; |
280 | 282 | ||
281 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 283 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
282 | ivpos = skb->data + hdrlen; | 284 | ivpos = skb->data + hdrlen; |
283 | iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2]; | 285 | iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2]; |
284 | 286 | ||
285 | if (ieee80211_wep_weak_iv(iv, key->conf.keylen)) | 287 | return ieee80211_wep_weak_iv(iv, key->conf.keylen); |
286 | return ivpos; | ||
287 | |||
288 | return NULL; | ||
289 | } | 288 | } |
290 | 289 | ||
291 | ieee80211_rx_result | 290 | ieee80211_rx_result |
@@ -329,6 +328,8 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
329 | ieee80211_tx_result | 328 | ieee80211_tx_result |
330 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) | 329 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) |
331 | { | 330 | { |
331 | int i; | ||
332 | |||
332 | ieee80211_tx_set_protected(tx); | 333 | ieee80211_tx_set_protected(tx); |
333 | 334 | ||
334 | if (wep_encrypt_skb(tx, tx->skb) < 0) { | 335 | if (wep_encrypt_skb(tx, tx->skb) < 0) { |
@@ -337,9 +338,8 @@ ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) | |||
337 | } | 338 | } |
338 | 339 | ||
339 | if (tx->extra_frag) { | 340 | if (tx->extra_frag) { |
340 | int i; | ||
341 | for (i = 0; i < tx->num_extra_frag; i++) { | 341 | for (i = 0; i < tx->num_extra_frag; i++) { |
342 | if (wep_encrypt_skb(tx, tx->extra_frag[i]) < 0) { | 342 | if (wep_encrypt_skb(tx, tx->extra_frag[i])) { |
343 | I802_DEBUG_INC(tx->local-> | 343 | I802_DEBUG_INC(tx->local-> |
344 | tx_handlers_drop_wep); | 344 | tx_handlers_drop_wep); |
345 | return TX_DROP; | 345 | return TX_DROP; |
diff --git a/net/mac80211/wep.h b/net/mac80211/wep.h index e587172115b8..d3f0db48314e 100644 --- a/net/mac80211/wep.h +++ b/net/mac80211/wep.h | |||
@@ -26,7 +26,7 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, struct sk_buff *skb, | |||
26 | struct ieee80211_key *key); | 26 | struct ieee80211_key *key); |
27 | int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, | 27 | int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, |
28 | struct ieee80211_key *key); | 28 | struct ieee80211_key *key); |
29 | u8 *ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); | 29 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); |
30 | 30 | ||
31 | ieee80211_rx_result | 31 | ieee80211_rx_result |
32 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); | 32 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 742f811ca416..63f36e9d1af8 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -147,7 +147,7 @@ static int ieee80211_ioctl_giwname(struct net_device *dev, | |||
147 | sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ]; | 147 | sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ]; |
148 | if (sband) { | 148 | if (sband) { |
149 | is_a = 1; | 149 | is_a = 1; |
150 | is_ht |= sband->ht_info.ht_supported; | 150 | is_ht |= sband->ht_cap.ht_supported; |
151 | } | 151 | } |
152 | 152 | ||
153 | sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ]; | 153 | sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ]; |
@@ -160,7 +160,7 @@ static int ieee80211_ioctl_giwname(struct net_device *dev, | |||
160 | if (sband->bitrates[i].bitrate == 60) | 160 | if (sband->bitrates[i].bitrate == 60) |
161 | is_g = 1; | 161 | is_g = 1; |
162 | } | 162 | } |
163 | is_ht |= sband->ht_info.ht_supported; | 163 | is_ht |= sband->ht_cap.ht_supported; |
164 | } | 164 | } |
165 | 165 | ||
166 | strcpy(name, "IEEE 802.11"); | 166 | strcpy(name, "IEEE 802.11"); |
@@ -407,13 +407,6 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | ||
411 | memcpy(sdata->u.ap.ssid, ssid, len); | ||
412 | memset(sdata->u.ap.ssid + len, 0, | ||
413 | IEEE80211_MAX_SSID_LEN - len); | ||
414 | sdata->u.ap.ssid_len = len; | ||
415 | return ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); | ||
416 | } | ||
417 | return -EOPNOTSUPP; | 410 | return -EOPNOTSUPP; |
418 | } | 411 | } |
419 | 412 | ||
@@ -437,15 +430,6 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
437 | return res; | 430 | return res; |
438 | } | 431 | } |
439 | 432 | ||
440 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | ||
441 | len = sdata->u.ap.ssid_len; | ||
442 | if (len > IW_ESSID_MAX_SIZE) | ||
443 | len = IW_ESSID_MAX_SIZE; | ||
444 | memcpy(ssid, sdata->u.ap.ssid, len); | ||
445 | data->length = len; | ||
446 | data->flags = 1; | ||
447 | return 0; | ||
448 | } | ||
449 | return -EOPNOTSUPP; | 433 | return -EOPNOTSUPP; |
450 | } | 434 | } |
451 | 435 | ||
@@ -636,8 +620,8 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
636 | 620 | ||
637 | sta = sta_info_get(local, sdata->u.sta.bssid); | 621 | sta = sta_info_get(local, sdata->u.sta.bssid); |
638 | 622 | ||
639 | if (sta && sta->last_txrate_idx < sband->n_bitrates) | 623 | if (sta && !(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) |
640 | rate->value = sband->bitrates[sta->last_txrate_idx].bitrate; | 624 | rate->value = sband->bitrates[sta->last_tx_rate.idx].bitrate; |
641 | else | 625 | else |
642 | rate->value = 0; | 626 | rate->value = 0; |
643 | 627 | ||
@@ -656,45 +640,35 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev, | |||
656 | union iwreq_data *data, char *extra) | 640 | union iwreq_data *data, char *extra) |
657 | { | 641 | { |
658 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 642 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
659 | bool need_reconfig = 0; | 643 | struct ieee80211_channel* chan = local->hw.conf.channel; |
644 | u32 reconf_flags = 0; | ||
660 | int new_power_level; | 645 | int new_power_level; |
661 | 646 | ||
662 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) | 647 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) |
663 | return -EINVAL; | 648 | return -EINVAL; |
664 | if (data->txpower.flags & IW_TXPOW_RANGE) | 649 | if (data->txpower.flags & IW_TXPOW_RANGE) |
665 | return -EINVAL; | 650 | return -EINVAL; |
651 | if (!chan) | ||
652 | return -EINVAL; | ||
666 | 653 | ||
667 | if (data->txpower.fixed) { | 654 | if (data->txpower.fixed) |
668 | new_power_level = data->txpower.value; | 655 | new_power_level = min(data->txpower.value, chan->max_power); |
669 | } else { | 656 | else /* Automatic power level setting */ |
670 | /* | ||
671 | * Automatic power level. Use maximum power for the current | ||
672 | * channel. Should be part of rate control. | ||
673 | */ | ||
674 | struct ieee80211_channel* chan = local->hw.conf.channel; | ||
675 | if (!chan) | ||
676 | return -EINVAL; | ||
677 | |||
678 | new_power_level = chan->max_power; | 657 | new_power_level = chan->max_power; |
679 | } | ||
680 | 658 | ||
681 | if (local->hw.conf.power_level != new_power_level) { | 659 | if (local->hw.conf.power_level != new_power_level) { |
682 | local->hw.conf.power_level = new_power_level; | 660 | local->hw.conf.power_level = new_power_level; |
683 | need_reconfig = 1; | 661 | reconf_flags |= IEEE80211_CONF_CHANGE_POWER; |
684 | } | 662 | } |
685 | 663 | ||
686 | if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { | 664 | if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { |
687 | local->hw.conf.radio_enabled = !(data->txpower.disabled); | 665 | local->hw.conf.radio_enabled = !(data->txpower.disabled); |
688 | need_reconfig = 1; | 666 | reconf_flags |= IEEE80211_CONF_CHANGE_RADIO_ENABLED; |
689 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); | 667 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); |
690 | } | 668 | } |
691 | 669 | ||
692 | if (need_reconfig) { | 670 | if (reconf_flags) |
693 | ieee80211_hw_config(local); | 671 | ieee80211_hw_config(local, reconf_flags); |
694 | /* The return value of hw_config is not of big interest here, | ||
695 | * as it doesn't say that it failed because of _this_ config | ||
696 | * change or something else. Ignore it. */ | ||
697 | } | ||
698 | 672 | ||
699 | return 0; | 673 | return 0; |
700 | } | 674 | } |
@@ -806,21 +780,16 @@ static int ieee80211_ioctl_siwretry(struct net_device *dev, | |||
806 | (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) | 780 | (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) |
807 | return -EINVAL; | 781 | return -EINVAL; |
808 | 782 | ||
809 | if (retry->flags & IW_RETRY_MAX) | 783 | if (retry->flags & IW_RETRY_MAX) { |
810 | local->long_retry_limit = retry->value; | 784 | local->hw.conf.long_frame_max_tx_count = retry->value; |
811 | else if (retry->flags & IW_RETRY_MIN) | 785 | } else if (retry->flags & IW_RETRY_MIN) { |
812 | local->short_retry_limit = retry->value; | 786 | local->hw.conf.short_frame_max_tx_count = retry->value; |
813 | else { | 787 | } else { |
814 | local->long_retry_limit = retry->value; | 788 | local->hw.conf.long_frame_max_tx_count = retry->value; |
815 | local->short_retry_limit = retry->value; | 789 | local->hw.conf.short_frame_max_tx_count = retry->value; |
816 | } | 790 | } |
817 | 791 | ||
818 | if (local->ops->set_retry_limit) { | 792 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS); |
819 | return local->ops->set_retry_limit( | ||
820 | local_to_hw(local), | ||
821 | local->short_retry_limit, | ||
822 | local->long_retry_limit); | ||
823 | } | ||
824 | 793 | ||
825 | return 0; | 794 | return 0; |
826 | } | 795 | } |
@@ -837,14 +806,15 @@ static int ieee80211_ioctl_giwretry(struct net_device *dev, | |||
837 | /* first return min value, iwconfig will ask max value | 806 | /* first return min value, iwconfig will ask max value |
838 | * later if needed */ | 807 | * later if needed */ |
839 | retry->flags |= IW_RETRY_LIMIT; | 808 | retry->flags |= IW_RETRY_LIMIT; |
840 | retry->value = local->short_retry_limit; | 809 | retry->value = local->hw.conf.short_frame_max_tx_count; |
841 | if (local->long_retry_limit != local->short_retry_limit) | 810 | if (local->hw.conf.long_frame_max_tx_count != |
811 | local->hw.conf.short_frame_max_tx_count) | ||
842 | retry->flags |= IW_RETRY_MIN; | 812 | retry->flags |= IW_RETRY_MIN; |
843 | return 0; | 813 | return 0; |
844 | } | 814 | } |
845 | if (retry->flags & IW_RETRY_MAX) { | 815 | if (retry->flags & IW_RETRY_MAX) { |
846 | retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; | 816 | retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; |
847 | retry->value = local->long_retry_limit; | 817 | retry->value = local->hw.conf.long_frame_max_tx_count; |
848 | } | 818 | } |
849 | 819 | ||
850 | return 0; | 820 | return 0; |
@@ -980,7 +950,7 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev, | |||
980 | 950 | ||
981 | if (wrq->disabled) { | 951 | if (wrq->disabled) { |
982 | conf->flags &= ~IEEE80211_CONF_PS; | 952 | conf->flags &= ~IEEE80211_CONF_PS; |
983 | return ieee80211_hw_config(local); | 953 | return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
984 | } | 954 | } |
985 | 955 | ||
986 | switch (wrq->flags & IW_POWER_MODE) { | 956 | switch (wrq->flags & IW_POWER_MODE) { |
@@ -993,7 +963,7 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev, | |||
993 | return -EINVAL; | 963 | return -EINVAL; |
994 | } | 964 | } |
995 | 965 | ||
996 | return ieee80211_hw_config(local); | 966 | return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
997 | } | 967 | } |
998 | 968 | ||
999 | static int ieee80211_ioctl_giwpower(struct net_device *dev, | 969 | static int ieee80211_ioctl_giwpower(struct net_device *dev, |
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index 139b5f267b34..ac71b38f7cb5 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c | |||
@@ -114,8 +114,8 @@ u16 ieee80211_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
114 | { | 114 | { |
115 | struct ieee80211_master_priv *mpriv = netdev_priv(dev); | 115 | struct ieee80211_master_priv *mpriv = netdev_priv(dev); |
116 | struct ieee80211_local *local = mpriv->local; | 116 | struct ieee80211_local *local = mpriv->local; |
117 | struct ieee80211_hw *hw = &local->hw; | ||
117 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 118 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
118 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
119 | struct sta_info *sta; | 119 | struct sta_info *sta; |
120 | u16 queue; | 120 | u16 queue; |
121 | u8 tid; | 121 | u8 tid; |
@@ -124,21 +124,19 @@ u16 ieee80211_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
124 | if (unlikely(queue >= local->hw.queues)) | 124 | if (unlikely(queue >= local->hw.queues)) |
125 | queue = local->hw.queues - 1; | 125 | queue = local->hw.queues - 1; |
126 | 126 | ||
127 | if (info->flags & IEEE80211_TX_CTL_REQUEUE) { | 127 | if (skb->requeue) { |
128 | if (!hw->ampdu_queues) | ||
129 | return queue; | ||
130 | |||
128 | rcu_read_lock(); | 131 | rcu_read_lock(); |
129 | sta = sta_info_get(local, hdr->addr1); | 132 | sta = sta_info_get(local, hdr->addr1); |
130 | tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; | 133 | tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; |
131 | if (sta) { | 134 | if (sta) { |
132 | struct ieee80211_hw *hw = &local->hw; | ||
133 | int ampdu_queue = sta->tid_to_tx_q[tid]; | 135 | int ampdu_queue = sta->tid_to_tx_q[tid]; |
134 | 136 | ||
135 | if ((ampdu_queue < ieee80211_num_queues(hw)) && | 137 | if ((ampdu_queue < ieee80211_num_queues(hw)) && |
136 | test_bit(ampdu_queue, local->queue_pool)) { | 138 | test_bit(ampdu_queue, local->queue_pool)) |
137 | queue = ampdu_queue; | 139 | queue = ampdu_queue; |
138 | info->flags |= IEEE80211_TX_CTL_AMPDU; | ||
139 | } else { | ||
140 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | ||
141 | } | ||
142 | } | 140 | } |
143 | rcu_read_unlock(); | 141 | rcu_read_unlock(); |
144 | 142 | ||
@@ -159,20 +157,18 @@ u16 ieee80211_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
159 | *p++ = ack_policy | tid; | 157 | *p++ = ack_policy | tid; |
160 | *p = 0; | 158 | *p = 0; |
161 | 159 | ||
160 | if (!hw->ampdu_queues) | ||
161 | return queue; | ||
162 | |||
162 | rcu_read_lock(); | 163 | rcu_read_lock(); |
163 | 164 | ||
164 | sta = sta_info_get(local, hdr->addr1); | 165 | sta = sta_info_get(local, hdr->addr1); |
165 | if (sta) { | 166 | if (sta) { |
166 | int ampdu_queue = sta->tid_to_tx_q[tid]; | 167 | int ampdu_queue = sta->tid_to_tx_q[tid]; |
167 | struct ieee80211_hw *hw = &local->hw; | ||
168 | 168 | ||
169 | if ((ampdu_queue < ieee80211_num_queues(hw)) && | 169 | if ((ampdu_queue < ieee80211_num_queues(hw)) && |
170 | test_bit(ampdu_queue, local->queue_pool)) { | 170 | test_bit(ampdu_queue, local->queue_pool)) |
171 | queue = ampdu_queue; | 171 | queue = ampdu_queue; |
172 | info->flags |= IEEE80211_TX_CTL_AMPDU; | ||
173 | } else { | ||
174 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | ||
175 | } | ||
176 | } | 172 | } |
177 | 173 | ||
178 | rcu_read_unlock(); | 174 | rcu_read_unlock(); |
@@ -206,13 +202,11 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local, | |||
206 | * on the previous queue | 202 | * on the previous queue |
207 | * since HT is strict in order */ | 203 | * since HT is strict in order */ |
208 | #ifdef CONFIG_MAC80211_HT_DEBUG | 204 | #ifdef CONFIG_MAC80211_HT_DEBUG |
209 | if (net_ratelimit()) { | 205 | if (net_ratelimit()) |
210 | DECLARE_MAC_BUF(mac); | ||
211 | printk(KERN_DEBUG "allocated aggregation queue" | 206 | printk(KERN_DEBUG "allocated aggregation queue" |
212 | " %d tid %d addr %s pool=0x%lX\n", | 207 | " %d tid %d addr %pM pool=0x%lX\n", |
213 | i, tid, print_mac(mac, sta->sta.addr), | 208 | i, tid, sta->sta.addr, |
214 | local->queue_pool[0]); | 209 | local->queue_pool[0]); |
215 | } | ||
216 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 210 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
217 | return 0; | 211 | return 0; |
218 | } | 212 | } |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 6db649480e8f..7aa63caf8d50 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -49,8 +49,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
49 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && | 49 | !(tx->flags & IEEE80211_TX_FRAGMENTED) && |
50 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && | 50 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && |
51 | !wpa_test) { | 51 | !wpa_test) { |
52 | /* hwaccel - with no need for preallocated room for Michael MIC | 52 | /* hwaccel - with no need for preallocated room for MMIC */ |
53 | */ | ||
54 | return TX_CONTINUE; | 53 | return TX_CONTINUE; |
55 | } | 54 | } |
56 | 55 | ||
@@ -67,8 +66,6 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
67 | #else | 66 | #else |
68 | authenticator = 1; | 67 | authenticator = 1; |
69 | #endif | 68 | #endif |
70 | /* At this point we know we're using ALG_TKIP. To get the MIC key | ||
71 | * we now will rely on the offset from the ieee80211_key_conf::key */ | ||
72 | key_offset = authenticator ? | 69 | key_offset = authenticator ? |
73 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY : | 70 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY : |
74 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; | 71 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; |
@@ -90,11 +87,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
90 | u8 mic[MICHAEL_MIC_LEN]; | 87 | u8 mic[MICHAEL_MIC_LEN]; |
91 | struct sk_buff *skb = rx->skb; | 88 | struct sk_buff *skb = rx->skb; |
92 | int authenticator = 1, wpa_test = 0; | 89 | int authenticator = 1, wpa_test = 0; |
93 | DECLARE_MAC_BUF(mac); | ||
94 | 90 | ||
95 | /* | 91 | /* No way to verify the MIC if the hardware stripped it */ |
96 | * No way to verify the MIC if the hardware stripped it | ||
97 | */ | ||
98 | if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) | 92 | if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) |
99 | return RX_CONTINUE; | 93 | return RX_CONTINUE; |
100 | 94 | ||
@@ -116,8 +110,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
116 | #else | 110 | #else |
117 | authenticator = 1; | 111 | authenticator = 1; |
118 | #endif | 112 | #endif |
119 | /* At this point we know we're using ALG_TKIP. To get the MIC key | ||
120 | * we now will rely on the offset from the ieee80211_key_conf::key */ | ||
121 | key_offset = authenticator ? | 113 | key_offset = authenticator ? |
122 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY : | 114 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY : |
123 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY; | 115 | NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY; |
@@ -202,6 +194,7 @@ ieee80211_tx_result | |||
202 | ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) | 194 | ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) |
203 | { | 195 | { |
204 | struct sk_buff *skb = tx->skb; | 196 | struct sk_buff *skb = tx->skb; |
197 | int i; | ||
205 | 198 | ||
206 | ieee80211_tx_set_protected(tx); | 199 | ieee80211_tx_set_protected(tx); |
207 | 200 | ||
@@ -209,9 +202,8 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) | |||
209 | return TX_DROP; | 202 | return TX_DROP; |
210 | 203 | ||
211 | if (tx->extra_frag) { | 204 | if (tx->extra_frag) { |
212 | int i; | ||
213 | for (i = 0; i < tx->num_extra_frag; i++) { | 205 | for (i = 0; i < tx->num_extra_frag; i++) { |
214 | if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0) | 206 | if (tkip_encrypt_skb(tx, tx->extra_frag[i])) |
215 | return TX_DROP; | 207 | return TX_DROP; |
216 | } | 208 | } |
217 | } | 209 | } |
@@ -227,7 +219,6 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) | |||
227 | int hdrlen, res, hwaccel = 0, wpa_test = 0; | 219 | int hdrlen, res, hwaccel = 0, wpa_test = 0; |
228 | struct ieee80211_key *key = rx->key; | 220 | struct ieee80211_key *key = rx->key; |
229 | struct sk_buff *skb = rx->skb; | 221 | struct sk_buff *skb = rx->skb; |
230 | DECLARE_MAC_BUF(mac); | ||
231 | 222 | ||
232 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 223 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
233 | 224 | ||
@@ -350,7 +341,7 @@ static inline void ccmp_pn2hdr(u8 *hdr, u8 *pn, int key_id) | |||
350 | } | 341 | } |
351 | 342 | ||
352 | 343 | ||
353 | static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr) | 344 | static inline void ccmp_hdr2pn(u8 *pn, u8 *hdr) |
354 | { | 345 | { |
355 | pn[0] = hdr[7]; | 346 | pn[0] = hdr[7]; |
356 | pn[1] = hdr[6]; | 347 | pn[1] = hdr[6]; |
@@ -358,7 +349,6 @@ static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr) | |||
358 | pn[3] = hdr[4]; | 349 | pn[3] = hdr[4]; |
359 | pn[4] = hdr[1]; | 350 | pn[4] = hdr[1]; |
360 | pn[5] = hdr[0]; | 351 | pn[5] = hdr[0]; |
361 | return (hdr[3] >> 6) & 0x03; | ||
362 | } | 352 | } |
363 | 353 | ||
364 | 354 | ||
@@ -373,7 +363,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
373 | 363 | ||
374 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && | 364 | if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && |
375 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { | 365 | !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { |
376 | /* hwaccel - with no need for preallocated room for CCMP " | 366 | /* hwaccel - with no need for preallocated room for CCMP |
377 | * header or MIC fields */ | 367 | * header or MIC fields */ |
378 | info->control.hw_key = &tx->key->conf; | 368 | info->control.hw_key = &tx->key->conf; |
379 | return 0; | 369 | return 0; |
@@ -426,6 +416,7 @@ ieee80211_tx_result | |||
426 | ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) | 416 | ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) |
427 | { | 417 | { |
428 | struct sk_buff *skb = tx->skb; | 418 | struct sk_buff *skb = tx->skb; |
419 | int i; | ||
429 | 420 | ||
430 | ieee80211_tx_set_protected(tx); | 421 | ieee80211_tx_set_protected(tx); |
431 | 422 | ||
@@ -433,9 +424,8 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) | |||
433 | return TX_DROP; | 424 | return TX_DROP; |
434 | 425 | ||
435 | if (tx->extra_frag) { | 426 | if (tx->extra_frag) { |
436 | int i; | ||
437 | for (i = 0; i < tx->num_extra_frag; i++) { | 427 | for (i = 0; i < tx->num_extra_frag; i++) { |
438 | if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0) | 428 | if (ccmp_encrypt_skb(tx, tx->extra_frag[i])) |
439 | return TX_DROP; | 429 | return TX_DROP; |
440 | } | 430 | } |
441 | } | 431 | } |
@@ -453,7 +443,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
453 | struct sk_buff *skb = rx->skb; | 443 | struct sk_buff *skb = rx->skb; |
454 | u8 pn[CCMP_PN_LEN]; | 444 | u8 pn[CCMP_PN_LEN]; |
455 | int data_len; | 445 | int data_len; |
456 | DECLARE_MAC_BUF(mac); | ||
457 | 446 | ||
458 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 447 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
459 | 448 | ||
@@ -468,7 +457,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
468 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) | 457 | (rx->status->flag & RX_FLAG_IV_STRIPPED)) |
469 | return RX_CONTINUE; | 458 | return RX_CONTINUE; |
470 | 459 | ||
471 | (void) ccmp_hdr2pn(pn, skb->data + hdrlen); | 460 | ccmp_hdr2pn(pn, skb->data + hdrlen); |
472 | 461 | ||
473 | if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { | 462 | if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { |
474 | key->u.ccmp.replays++; | 463 | key->u.ccmp.replays++; |
@@ -483,9 +472,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
483 | key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf, | 472 | key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf, |
484 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, | 473 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, |
485 | skb->data + skb->len - CCMP_MIC_LEN, | 474 | skb->data + skb->len - CCMP_MIC_LEN, |
486 | skb->data + hdrlen + CCMP_HDR_LEN)) { | 475 | skb->data + hdrlen + CCMP_HDR_LEN)) |
487 | return RX_DROP_UNUSABLE; | 476 | return RX_DROP_UNUSABLE; |
488 | } | ||
489 | } | 477 | } |
490 | 478 | ||
491 | memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN); | 479 | memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN); |
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..cb3e031335eb 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -730,9 +730,9 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related) | |||
730 | if (ic == NULL) | 730 | if (ic == NULL) |
731 | return NF_DROP; | 731 | return NF_DROP; |
732 | 732 | ||
733 | IP_VS_DBG(12, "Outgoing ICMP (%d,%d) %u.%u.%u.%u->%u.%u.%u.%u\n", | 733 | IP_VS_DBG(12, "Outgoing ICMP (%d,%d) %pI4->%pI4\n", |
734 | ic->type, ntohs(icmp_id(ic)), | 734 | ic->type, ntohs(icmp_id(ic)), |
735 | NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); | 735 | &iph->saddr, &iph->daddr); |
736 | 736 | ||
737 | /* | 737 | /* |
738 | * Work through seeing if this is for us. | 738 | * Work through seeing if this is for us. |
@@ -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. |
@@ -1070,9 +1070,9 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum) | |||
1070 | if (ic == NULL) | 1070 | if (ic == NULL) |
1071 | return NF_DROP; | 1071 | return NF_DROP; |
1072 | 1072 | ||
1073 | IP_VS_DBG(12, "Incoming ICMP (%d,%d) %u.%u.%u.%u->%u.%u.%u.%u\n", | 1073 | IP_VS_DBG(12, "Incoming ICMP (%d,%d) %pI4->%pI4\n", |
1074 | ic->type, ntohs(icmp_id(ic)), | 1074 | ic->type, ntohs(icmp_id(ic)), |
1075 | NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); | 1075 | &iph->saddr, &iph->daddr); |
1076 | 1076 | ||
1077 | /* | 1077 | /* |
1078 | * Work through seeing if this is for us. | 1078 | * Work through seeing if this is for us. |
@@ -1127,8 +1127,8 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum) | |||
1127 | /* Ensure the checksum is correct */ | 1127 | /* Ensure the checksum is correct */ |
1128 | if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) { | 1128 | if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) { |
1129 | /* Failed checksum! */ | 1129 | /* Failed checksum! */ |
1130 | IP_VS_DBG(1, "Incoming ICMP: failed checksum from %d.%d.%d.%d!\n", | 1130 | IP_VS_DBG(1, "Incoming ICMP: failed checksum from %pI4!\n", |
1131 | NIPQUAD(iph->saddr)); | 1131 | &iph->saddr); |
1132 | goto out; | 1132 | goto out; |
1133 | } | 1133 | } |
1134 | 1134 | ||
@@ -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..e01061f49cdc 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -1168,15 +1168,9 @@ ip_vs_add_service(struct ip_vs_service_user_kern *u, | |||
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | #ifdef CONFIG_IP_VS_IPV6 | 1170 | #ifdef CONFIG_IP_VS_IPV6 |
1171 | if (u->af == AF_INET6) { | 1171 | if (u->af == AF_INET6 && (u->netmask < 1 || u->netmask > 128)) { |
1172 | if (!sched->supports_ipv6) { | 1172 | ret = -EINVAL; |
1173 | ret = -EAFNOSUPPORT; | 1173 | goto out_err; |
1174 | goto out_err; | ||
1175 | } | ||
1176 | if ((u->netmask < 1) || (u->netmask > 128)) { | ||
1177 | ret = -EINVAL; | ||
1178 | goto out_err; | ||
1179 | } | ||
1180 | } | 1174 | } |
1181 | #endif | 1175 | #endif |
1182 | 1176 | ||
@@ -1272,15 +1266,9 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u) | |||
1272 | old_sched = sched; | 1266 | old_sched = sched; |
1273 | 1267 | ||
1274 | #ifdef CONFIG_IP_VS_IPV6 | 1268 | #ifdef CONFIG_IP_VS_IPV6 |
1275 | if (u->af == AF_INET6) { | 1269 | if (u->af == AF_INET6 && (u->netmask < 1 || u->netmask > 128)) { |
1276 | if (!sched->supports_ipv6) { | 1270 | ret = -EINVAL; |
1277 | ret = -EAFNOSUPPORT; | 1271 | goto out; |
1278 | goto out; | ||
1279 | } | ||
1280 | if ((u->netmask < 1) || (u->netmask > 128)) { | ||
1281 | ret = -EINVAL; | ||
1282 | goto out; | ||
1283 | } | ||
1284 | } | 1272 | } |
1285 | #endif | 1273 | #endif |
1286 | 1274 | ||
@@ -1557,7 +1545,7 @@ static struct ctl_table vs_vars[] = { | |||
1557 | .data = &sysctl_ip_vs_amemthresh, | 1545 | .data = &sysctl_ip_vs_amemthresh, |
1558 | .maxlen = sizeof(int), | 1546 | .maxlen = sizeof(int), |
1559 | .mode = 0644, | 1547 | .mode = 0644, |
1560 | .proc_handler = &proc_dointvec, | 1548 | .proc_handler = proc_dointvec, |
1561 | }, | 1549 | }, |
1562 | #ifdef CONFIG_IP_VS_DEBUG | 1550 | #ifdef CONFIG_IP_VS_DEBUG |
1563 | { | 1551 | { |
@@ -1565,7 +1553,7 @@ static struct ctl_table vs_vars[] = { | |||
1565 | .data = &sysctl_ip_vs_debug_level, | 1553 | .data = &sysctl_ip_vs_debug_level, |
1566 | .maxlen = sizeof(int), | 1554 | .maxlen = sizeof(int), |
1567 | .mode = 0644, | 1555 | .mode = 0644, |
1568 | .proc_handler = &proc_dointvec, | 1556 | .proc_handler = proc_dointvec, |
1569 | }, | 1557 | }, |
1570 | #endif | 1558 | #endif |
1571 | { | 1559 | { |
@@ -1573,28 +1561,28 @@ static struct ctl_table vs_vars[] = { | |||
1573 | .data = &sysctl_ip_vs_am_droprate, | 1561 | .data = &sysctl_ip_vs_am_droprate, |
1574 | .maxlen = sizeof(int), | 1562 | .maxlen = sizeof(int), |
1575 | .mode = 0644, | 1563 | .mode = 0644, |
1576 | .proc_handler = &proc_dointvec, | 1564 | .proc_handler = proc_dointvec, |
1577 | }, | 1565 | }, |
1578 | { | 1566 | { |
1579 | .procname = "drop_entry", | 1567 | .procname = "drop_entry", |
1580 | .data = &sysctl_ip_vs_drop_entry, | 1568 | .data = &sysctl_ip_vs_drop_entry, |
1581 | .maxlen = sizeof(int), | 1569 | .maxlen = sizeof(int), |
1582 | .mode = 0644, | 1570 | .mode = 0644, |
1583 | .proc_handler = &proc_do_defense_mode, | 1571 | .proc_handler = proc_do_defense_mode, |
1584 | }, | 1572 | }, |
1585 | { | 1573 | { |
1586 | .procname = "drop_packet", | 1574 | .procname = "drop_packet", |
1587 | .data = &sysctl_ip_vs_drop_packet, | 1575 | .data = &sysctl_ip_vs_drop_packet, |
1588 | .maxlen = sizeof(int), | 1576 | .maxlen = sizeof(int), |
1589 | .mode = 0644, | 1577 | .mode = 0644, |
1590 | .proc_handler = &proc_do_defense_mode, | 1578 | .proc_handler = proc_do_defense_mode, |
1591 | }, | 1579 | }, |
1592 | { | 1580 | { |
1593 | .procname = "secure_tcp", | 1581 | .procname = "secure_tcp", |
1594 | .data = &sysctl_ip_vs_secure_tcp, | 1582 | .data = &sysctl_ip_vs_secure_tcp, |
1595 | .maxlen = sizeof(int), | 1583 | .maxlen = sizeof(int), |
1596 | .mode = 0644, | 1584 | .mode = 0644, |
1597 | .proc_handler = &proc_do_defense_mode, | 1585 | .proc_handler = proc_do_defense_mode, |
1598 | }, | 1586 | }, |
1599 | #if 0 | 1587 | #if 0 |
1600 | { | 1588 | { |
@@ -1602,84 +1590,84 @@ static struct ctl_table vs_vars[] = { | |||
1602 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED], | 1590 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED], |
1603 | .maxlen = sizeof(int), | 1591 | .maxlen = sizeof(int), |
1604 | .mode = 0644, | 1592 | .mode = 0644, |
1605 | .proc_handler = &proc_dointvec_jiffies, | 1593 | .proc_handler = proc_dointvec_jiffies, |
1606 | }, | 1594 | }, |
1607 | { | 1595 | { |
1608 | .procname = "timeout_synsent", | 1596 | .procname = "timeout_synsent", |
1609 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT], | 1597 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT], |
1610 | .maxlen = sizeof(int), | 1598 | .maxlen = sizeof(int), |
1611 | .mode = 0644, | 1599 | .mode = 0644, |
1612 | .proc_handler = &proc_dointvec_jiffies, | 1600 | .proc_handler = proc_dointvec_jiffies, |
1613 | }, | 1601 | }, |
1614 | { | 1602 | { |
1615 | .procname = "timeout_synrecv", | 1603 | .procname = "timeout_synrecv", |
1616 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV], | 1604 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV], |
1617 | .maxlen = sizeof(int), | 1605 | .maxlen = sizeof(int), |
1618 | .mode = 0644, | 1606 | .mode = 0644, |
1619 | .proc_handler = &proc_dointvec_jiffies, | 1607 | .proc_handler = proc_dointvec_jiffies, |
1620 | }, | 1608 | }, |
1621 | { | 1609 | { |
1622 | .procname = "timeout_finwait", | 1610 | .procname = "timeout_finwait", |
1623 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT], | 1611 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT], |
1624 | .maxlen = sizeof(int), | 1612 | .maxlen = sizeof(int), |
1625 | .mode = 0644, | 1613 | .mode = 0644, |
1626 | .proc_handler = &proc_dointvec_jiffies, | 1614 | .proc_handler = proc_dointvec_jiffies, |
1627 | }, | 1615 | }, |
1628 | { | 1616 | { |
1629 | .procname = "timeout_timewait", | 1617 | .procname = "timeout_timewait", |
1630 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_TIME_WAIT], | 1618 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_TIME_WAIT], |
1631 | .maxlen = sizeof(int), | 1619 | .maxlen = sizeof(int), |
1632 | .mode = 0644, | 1620 | .mode = 0644, |
1633 | .proc_handler = &proc_dointvec_jiffies, | 1621 | .proc_handler = proc_dointvec_jiffies, |
1634 | }, | 1622 | }, |
1635 | { | 1623 | { |
1636 | .procname = "timeout_close", | 1624 | .procname = "timeout_close", |
1637 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE], | 1625 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE], |
1638 | .maxlen = sizeof(int), | 1626 | .maxlen = sizeof(int), |
1639 | .mode = 0644, | 1627 | .mode = 0644, |
1640 | .proc_handler = &proc_dointvec_jiffies, | 1628 | .proc_handler = proc_dointvec_jiffies, |
1641 | }, | 1629 | }, |
1642 | { | 1630 | { |
1643 | .procname = "timeout_closewait", | 1631 | .procname = "timeout_closewait", |
1644 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT], | 1632 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT], |
1645 | .maxlen = sizeof(int), | 1633 | .maxlen = sizeof(int), |
1646 | .mode = 0644, | 1634 | .mode = 0644, |
1647 | .proc_handler = &proc_dointvec_jiffies, | 1635 | .proc_handler = proc_dointvec_jiffies, |
1648 | }, | 1636 | }, |
1649 | { | 1637 | { |
1650 | .procname = "timeout_lastack", | 1638 | .procname = "timeout_lastack", |
1651 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK], | 1639 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK], |
1652 | .maxlen = sizeof(int), | 1640 | .maxlen = sizeof(int), |
1653 | .mode = 0644, | 1641 | .mode = 0644, |
1654 | .proc_handler = &proc_dointvec_jiffies, | 1642 | .proc_handler = proc_dointvec_jiffies, |
1655 | }, | 1643 | }, |
1656 | { | 1644 | { |
1657 | .procname = "timeout_listen", | 1645 | .procname = "timeout_listen", |
1658 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN], | 1646 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN], |
1659 | .maxlen = sizeof(int), | 1647 | .maxlen = sizeof(int), |
1660 | .mode = 0644, | 1648 | .mode = 0644, |
1661 | .proc_handler = &proc_dointvec_jiffies, | 1649 | .proc_handler = proc_dointvec_jiffies, |
1662 | }, | 1650 | }, |
1663 | { | 1651 | { |
1664 | .procname = "timeout_synack", | 1652 | .procname = "timeout_synack", |
1665 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK], | 1653 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK], |
1666 | .maxlen = sizeof(int), | 1654 | .maxlen = sizeof(int), |
1667 | .mode = 0644, | 1655 | .mode = 0644, |
1668 | .proc_handler = &proc_dointvec_jiffies, | 1656 | .proc_handler = proc_dointvec_jiffies, |
1669 | }, | 1657 | }, |
1670 | { | 1658 | { |
1671 | .procname = "timeout_udp", | 1659 | .procname = "timeout_udp", |
1672 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP], | 1660 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP], |
1673 | .maxlen = sizeof(int), | 1661 | .maxlen = sizeof(int), |
1674 | .mode = 0644, | 1662 | .mode = 0644, |
1675 | .proc_handler = &proc_dointvec_jiffies, | 1663 | .proc_handler = proc_dointvec_jiffies, |
1676 | }, | 1664 | }, |
1677 | { | 1665 | { |
1678 | .procname = "timeout_icmp", | 1666 | .procname = "timeout_icmp", |
1679 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_ICMP], | 1667 | .data = &vs_timeout_table_dos.timeout[IP_VS_S_ICMP], |
1680 | .maxlen = sizeof(int), | 1668 | .maxlen = sizeof(int), |
1681 | .mode = 0644, | 1669 | .mode = 0644, |
1682 | .proc_handler = &proc_dointvec_jiffies, | 1670 | .proc_handler = proc_dointvec_jiffies, |
1683 | }, | 1671 | }, |
1684 | #endif | 1672 | #endif |
1685 | { | 1673 | { |
@@ -1687,35 +1675,35 @@ static struct ctl_table vs_vars[] = { | |||
1687 | .data = &sysctl_ip_vs_cache_bypass, | 1675 | .data = &sysctl_ip_vs_cache_bypass, |
1688 | .maxlen = sizeof(int), | 1676 | .maxlen = sizeof(int), |
1689 | .mode = 0644, | 1677 | .mode = 0644, |
1690 | .proc_handler = &proc_dointvec, | 1678 | .proc_handler = proc_dointvec, |
1691 | }, | 1679 | }, |
1692 | { | 1680 | { |
1693 | .procname = "expire_nodest_conn", | 1681 | .procname = "expire_nodest_conn", |
1694 | .data = &sysctl_ip_vs_expire_nodest_conn, | 1682 | .data = &sysctl_ip_vs_expire_nodest_conn, |
1695 | .maxlen = sizeof(int), | 1683 | .maxlen = sizeof(int), |
1696 | .mode = 0644, | 1684 | .mode = 0644, |
1697 | .proc_handler = &proc_dointvec, | 1685 | .proc_handler = proc_dointvec, |
1698 | }, | 1686 | }, |
1699 | { | 1687 | { |
1700 | .procname = "expire_quiescent_template", | 1688 | .procname = "expire_quiescent_template", |
1701 | .data = &sysctl_ip_vs_expire_quiescent_template, | 1689 | .data = &sysctl_ip_vs_expire_quiescent_template, |
1702 | .maxlen = sizeof(int), | 1690 | .maxlen = sizeof(int), |
1703 | .mode = 0644, | 1691 | .mode = 0644, |
1704 | .proc_handler = &proc_dointvec, | 1692 | .proc_handler = proc_dointvec, |
1705 | }, | 1693 | }, |
1706 | { | 1694 | { |
1707 | .procname = "sync_threshold", | 1695 | .procname = "sync_threshold", |
1708 | .data = &sysctl_ip_vs_sync_threshold, | 1696 | .data = &sysctl_ip_vs_sync_threshold, |
1709 | .maxlen = sizeof(sysctl_ip_vs_sync_threshold), | 1697 | .maxlen = sizeof(sysctl_ip_vs_sync_threshold), |
1710 | .mode = 0644, | 1698 | .mode = 0644, |
1711 | .proc_handler = &proc_do_sync_threshold, | 1699 | .proc_handler = proc_do_sync_threshold, |
1712 | }, | 1700 | }, |
1713 | { | 1701 | { |
1714 | .procname = "nat_icmp_send", | 1702 | .procname = "nat_icmp_send", |
1715 | .data = &sysctl_ip_vs_nat_icmp_send, | 1703 | .data = &sysctl_ip_vs_nat_icmp_send, |
1716 | .maxlen = sizeof(int), | 1704 | .maxlen = sizeof(int), |
1717 | .mode = 0644, | 1705 | .mode = 0644, |
1718 | .proc_handler = &proc_dointvec, | 1706 | .proc_handler = proc_dointvec, |
1719 | }, | 1707 | }, |
1720 | { .ctl_name = 0 } | 1708 | { .ctl_name = 0 } |
1721 | }; | 1709 | }; |
@@ -1867,9 +1855,9 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v) | |||
1867 | if (iter->table == ip_vs_svc_table) { | 1855 | if (iter->table == ip_vs_svc_table) { |
1868 | #ifdef CONFIG_IP_VS_IPV6 | 1856 | #ifdef CONFIG_IP_VS_IPV6 |
1869 | if (svc->af == AF_INET6) | 1857 | if (svc->af == AF_INET6) |
1870 | seq_printf(seq, "%s [" NIP6_FMT "]:%04X %s ", | 1858 | seq_printf(seq, "%s [%pI6]:%04X %s ", |
1871 | ip_vs_proto_name(svc->protocol), | 1859 | ip_vs_proto_name(svc->protocol), |
1872 | NIP6(svc->addr.in6), | 1860 | &svc->addr.in6, |
1873 | ntohs(svc->port), | 1861 | ntohs(svc->port), |
1874 | svc->scheduler->name); | 1862 | svc->scheduler->name); |
1875 | else | 1863 | else |
@@ -1895,9 +1883,9 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v) | |||
1895 | #ifdef CONFIG_IP_VS_IPV6 | 1883 | #ifdef CONFIG_IP_VS_IPV6 |
1896 | if (dest->af == AF_INET6) | 1884 | if (dest->af == AF_INET6) |
1897 | seq_printf(seq, | 1885 | seq_printf(seq, |
1898 | " -> [" NIP6_FMT "]:%04X" | 1886 | " -> [%pI6]:%04X" |
1899 | " %-7s %-6d %-10d %-10d\n", | 1887 | " %-7s %-6d %-10d %-10d\n", |
1900 | NIP6(dest->addr.in6), | 1888 | &dest->addr.in6, |
1901 | ntohs(dest->port), | 1889 | ntohs(dest->port), |
1902 | ip_vs_fwd_name(atomic_read(&dest->conn_flags)), | 1890 | ip_vs_fwd_name(atomic_read(&dest->conn_flags)), |
1903 | atomic_read(&dest->weight), | 1891 | atomic_read(&dest->weight), |
@@ -2141,8 +2129,8 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
2141 | 2129 | ||
2142 | /* Check for valid protocol: TCP or UDP, even for fwmark!=0 */ | 2130 | /* Check for valid protocol: TCP or UDP, even for fwmark!=0 */ |
2143 | if (usvc.protocol != IPPROTO_TCP && usvc.protocol != IPPROTO_UDP) { | 2131 | if (usvc.protocol != IPPROTO_TCP && usvc.protocol != IPPROTO_UDP) { |
2144 | IP_VS_ERR("set_ctl: invalid protocol: %d %d.%d.%d.%d:%d %s\n", | 2132 | IP_VS_ERR("set_ctl: invalid protocol: %d %pI4:%d %s\n", |
2145 | usvc.protocol, NIPQUAD(usvc.addr.ip), | 2133 | usvc.protocol, &usvc.addr.ip, |
2146 | ntohs(usvc.port), usvc.sched_name); | 2134 | ntohs(usvc.port), usvc.sched_name); |
2147 | ret = -EFAULT; | 2135 | ret = -EFAULT; |
2148 | goto out_unlock; | 2136 | goto out_unlock; |
diff --git a/net/netfilter/ipvs/ip_vs_dh.c b/net/netfilter/ipvs/ip_vs_dh.c index a16943fd72f1..a9dac74bb13f 100644 --- a/net/netfilter/ipvs/ip_vs_dh.c +++ b/net/netfilter/ipvs/ip_vs_dh.c | |||
@@ -64,9 +64,16 @@ struct ip_vs_dh_bucket { | |||
64 | /* | 64 | /* |
65 | * Returns hash value for IPVS DH entry | 65 | * Returns hash value for IPVS DH entry |
66 | */ | 66 | */ |
67 | static inline unsigned ip_vs_dh_hashkey(__be32 addr) | 67 | static inline unsigned ip_vs_dh_hashkey(int af, const union nf_inet_addr *addr) |
68 | { | 68 | { |
69 | return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK; | 69 | __be32 addr_fold = addr->ip; |
70 | |||
71 | #ifdef CONFIG_IP_VS_IPV6 | ||
72 | if (af == AF_INET6) | ||
73 | addr_fold = addr->ip6[0]^addr->ip6[1]^ | ||
74 | addr->ip6[2]^addr->ip6[3]; | ||
75 | #endif | ||
76 | return (ntohl(addr_fold)*2654435761UL) & IP_VS_DH_TAB_MASK; | ||
70 | } | 77 | } |
71 | 78 | ||
72 | 79 | ||
@@ -74,9 +81,10 @@ static inline unsigned ip_vs_dh_hashkey(__be32 addr) | |||
74 | * Get ip_vs_dest associated with supplied parameters. | 81 | * Get ip_vs_dest associated with supplied parameters. |
75 | */ | 82 | */ |
76 | static inline struct ip_vs_dest * | 83 | static inline struct ip_vs_dest * |
77 | ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __be32 addr) | 84 | ip_vs_dh_get(int af, struct ip_vs_dh_bucket *tbl, |
85 | const union nf_inet_addr *addr) | ||
78 | { | 86 | { |
79 | return (tbl[ip_vs_dh_hashkey(addr)]).dest; | 87 | return (tbl[ip_vs_dh_hashkey(af, addr)]).dest; |
80 | } | 88 | } |
81 | 89 | ||
82 | 90 | ||
@@ -202,12 +210,14 @@ ip_vs_dh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
202 | { | 210 | { |
203 | struct ip_vs_dest *dest; | 211 | struct ip_vs_dest *dest; |
204 | struct ip_vs_dh_bucket *tbl; | 212 | struct ip_vs_dh_bucket *tbl; |
205 | struct iphdr *iph = ip_hdr(skb); | 213 | struct ip_vs_iphdr iph; |
214 | |||
215 | ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph); | ||
206 | 216 | ||
207 | IP_VS_DBG(6, "ip_vs_dh_schedule(): Scheduling...\n"); | 217 | IP_VS_DBG(6, "ip_vs_dh_schedule(): Scheduling...\n"); |
208 | 218 | ||
209 | tbl = (struct ip_vs_dh_bucket *)svc->sched_data; | 219 | tbl = (struct ip_vs_dh_bucket *)svc->sched_data; |
210 | dest = ip_vs_dh_get(tbl, iph->daddr); | 220 | dest = ip_vs_dh_get(svc->af, tbl, &iph.daddr); |
211 | if (!dest | 221 | if (!dest |
212 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) | 222 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) |
213 | || atomic_read(&dest->weight) <= 0 | 223 | || atomic_read(&dest->weight) <= 0 |
@@ -215,11 +225,10 @@ ip_vs_dh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
215 | return NULL; | 225 | return NULL; |
216 | } | 226 | } |
217 | 227 | ||
218 | IP_VS_DBG(6, "DH: destination IP address %u.%u.%u.%u " | 228 | IP_VS_DBG_BUF(6, "DH: destination IP address %s --> server %s:%d\n", |
219 | "--> server %u.%u.%u.%u:%d\n", | 229 | IP_VS_DBG_ADDR(svc->af, &iph.daddr), |
220 | NIPQUAD(iph->daddr), | 230 | IP_VS_DBG_ADDR(svc->af, &dest->addr), |
221 | NIPQUAD(dest->addr.ip), | 231 | ntohs(dest->port)); |
222 | ntohs(dest->port)); | ||
223 | 232 | ||
224 | return dest; | 233 | return dest; |
225 | } | 234 | } |
@@ -234,9 +243,6 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = | |||
234 | .refcnt = ATOMIC_INIT(0), | 243 | .refcnt = ATOMIC_INIT(0), |
235 | .module = THIS_MODULE, | 244 | .module = THIS_MODULE, |
236 | .n_list = LIST_HEAD_INIT(ip_vs_dh_scheduler.n_list), | 245 | .n_list = LIST_HEAD_INIT(ip_vs_dh_scheduler.n_list), |
237 | #ifdef CONFIG_IP_VS_IPV6 | ||
238 | .supports_ipv6 = 0, | ||
239 | #endif | ||
240 | .init_service = ip_vs_dh_init_svc, | 246 | .init_service = ip_vs_dh_init_svc, |
241 | .done_service = ip_vs_dh_done_svc, | 247 | .done_service = ip_vs_dh_done_svc, |
242 | .update_service = ip_vs_dh_update_svc, | 248 | .update_service = ip_vs_dh_update_svc, |
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c index 2e7dbd8b73a4..428edbf481cc 100644 --- a/net/netfilter/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c | |||
@@ -178,10 +178,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
178 | &start, &end) != 1) | 178 | &start, &end) != 1) |
179 | return 1; | 179 | return 1; |
180 | 180 | ||
181 | IP_VS_DBG(7, "PASV response (%u.%u.%u.%u:%d) -> " | 181 | IP_VS_DBG(7, "PASV response (%pI4:%d) -> %pI4:%d detected\n", |
182 | "%u.%u.%u.%u:%d detected\n", | 182 | &from.ip, ntohs(port), &cp->caddr.ip, 0); |
183 | NIPQUAD(from.ip), ntohs(port), | ||
184 | NIPQUAD(cp->caddr.ip), 0); | ||
185 | 183 | ||
186 | /* | 184 | /* |
187 | * Now update or create an connection entry for it | 185 | * Now update or create an connection entry for it |
@@ -312,8 +310,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
312 | &start, &end) != 1) | 310 | &start, &end) != 1) |
313 | return 1; | 311 | return 1; |
314 | 312 | ||
315 | IP_VS_DBG(7, "PORT %u.%u.%u.%u:%d detected\n", | 313 | IP_VS_DBG(7, "PORT %pI4:%d detected\n", &to.ip, ntohs(port)); |
316 | NIPQUAD(to.ip), ntohs(port)); | ||
317 | 314 | ||
318 | /* Passive mode off */ | 315 | /* Passive mode off */ |
319 | cp->app_data = NULL; | 316 | cp->app_data = NULL; |
@@ -321,9 +318,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
321 | /* | 318 | /* |
322 | * Now update or create a connection entry for it | 319 | * Now update or create a connection entry for it |
323 | */ | 320 | */ |
324 | IP_VS_DBG(7, "protocol %s %u.%u.%u.%u:%d %u.%u.%u.%u:%d\n", | 321 | IP_VS_DBG(7, "protocol %s %pI4:%d %pI4:%d\n", |
325 | ip_vs_proto_name(iph->protocol), | 322 | ip_vs_proto_name(iph->protocol), |
326 | NIPQUAD(to.ip), ntohs(port), NIPQUAD(cp->vaddr.ip), 0); | 323 | &to.ip, ntohs(port), &cp->vaddr.ip, 0); |
327 | 324 | ||
328 | n_cp = ip_vs_conn_in_get(AF_INET, iph->protocol, | 325 | n_cp = ip_vs_conn_in_get(AF_INET, iph->protocol, |
329 | &to, port, | 326 | &to, port, |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 6ecef3518cac..9394f539966a 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
@@ -86,7 +86,8 @@ static int sysctl_ip_vs_lblc_expiration = 24*60*60*HZ; | |||
86 | */ | 86 | */ |
87 | struct ip_vs_lblc_entry { | 87 | struct ip_vs_lblc_entry { |
88 | struct list_head list; | 88 | struct list_head list; |
89 | __be32 addr; /* destination IP address */ | 89 | int af; /* address family */ |
90 | union nf_inet_addr addr; /* destination IP address */ | ||
90 | struct ip_vs_dest *dest; /* real server (cache) */ | 91 | struct ip_vs_dest *dest; /* real server (cache) */ |
91 | unsigned long lastuse; /* last used time */ | 92 | unsigned long lastuse; /* last used time */ |
92 | }; | 93 | }; |
@@ -115,7 +116,7 @@ static ctl_table vs_vars_table[] = { | |||
115 | .data = &sysctl_ip_vs_lblc_expiration, | 116 | .data = &sysctl_ip_vs_lblc_expiration, |
116 | .maxlen = sizeof(int), | 117 | .maxlen = sizeof(int), |
117 | .mode = 0644, | 118 | .mode = 0644, |
118 | .proc_handler = &proc_dointvec_jiffies, | 119 | .proc_handler = proc_dointvec_jiffies, |
119 | }, | 120 | }, |
120 | { .ctl_name = 0 } | 121 | { .ctl_name = 0 } |
121 | }; | 122 | }; |
@@ -137,9 +138,17 @@ static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en) | |||
137 | /* | 138 | /* |
138 | * Returns hash value for IPVS LBLC entry | 139 | * Returns hash value for IPVS LBLC entry |
139 | */ | 140 | */ |
140 | static inline unsigned ip_vs_lblc_hashkey(__be32 addr) | 141 | static inline unsigned |
142 | ip_vs_lblc_hashkey(int af, const union nf_inet_addr *addr) | ||
141 | { | 143 | { |
142 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK; | 144 | __be32 addr_fold = addr->ip; |
145 | |||
146 | #ifdef CONFIG_IP_VS_IPV6 | ||
147 | if (af == AF_INET6) | ||
148 | addr_fold = addr->ip6[0]^addr->ip6[1]^ | ||
149 | addr->ip6[2]^addr->ip6[3]; | ||
150 | #endif | ||
151 | return (ntohl(addr_fold)*2654435761UL) & IP_VS_LBLC_TAB_MASK; | ||
143 | } | 152 | } |
144 | 153 | ||
145 | 154 | ||
@@ -150,7 +159,7 @@ static inline unsigned ip_vs_lblc_hashkey(__be32 addr) | |||
150 | static void | 159 | static void |
151 | ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en) | 160 | ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en) |
152 | { | 161 | { |
153 | unsigned hash = ip_vs_lblc_hashkey(en->addr); | 162 | unsigned hash = ip_vs_lblc_hashkey(en->af, &en->addr); |
154 | 163 | ||
155 | list_add(&en->list, &tbl->bucket[hash]); | 164 | list_add(&en->list, &tbl->bucket[hash]); |
156 | atomic_inc(&tbl->entries); | 165 | atomic_inc(&tbl->entries); |
@@ -162,13 +171,14 @@ ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en) | |||
162 | * lock | 171 | * lock |
163 | */ | 172 | */ |
164 | static inline struct ip_vs_lblc_entry * | 173 | static inline struct ip_vs_lblc_entry * |
165 | ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __be32 addr) | 174 | ip_vs_lblc_get(int af, struct ip_vs_lblc_table *tbl, |
175 | const union nf_inet_addr *addr) | ||
166 | { | 176 | { |
167 | unsigned hash = ip_vs_lblc_hashkey(addr); | 177 | unsigned hash = ip_vs_lblc_hashkey(af, addr); |
168 | struct ip_vs_lblc_entry *en; | 178 | struct ip_vs_lblc_entry *en; |
169 | 179 | ||
170 | list_for_each_entry(en, &tbl->bucket[hash], list) | 180 | list_for_each_entry(en, &tbl->bucket[hash], list) |
171 | if (en->addr == addr) | 181 | if (ip_vs_addr_equal(af, &en->addr, addr)) |
172 | return en; | 182 | return en; |
173 | 183 | ||
174 | return NULL; | 184 | return NULL; |
@@ -180,12 +190,12 @@ ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __be32 addr) | |||
180 | * address to a server. Called under write lock. | 190 | * address to a server. Called under write lock. |
181 | */ | 191 | */ |
182 | static inline struct ip_vs_lblc_entry * | 192 | static inline struct ip_vs_lblc_entry * |
183 | ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, __be32 daddr, | 193 | ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, const union nf_inet_addr *daddr, |
184 | struct ip_vs_dest *dest) | 194 | struct ip_vs_dest *dest) |
185 | { | 195 | { |
186 | struct ip_vs_lblc_entry *en; | 196 | struct ip_vs_lblc_entry *en; |
187 | 197 | ||
188 | en = ip_vs_lblc_get(tbl, daddr); | 198 | en = ip_vs_lblc_get(dest->af, tbl, daddr); |
189 | if (!en) { | 199 | if (!en) { |
190 | en = kmalloc(sizeof(*en), GFP_ATOMIC); | 200 | en = kmalloc(sizeof(*en), GFP_ATOMIC); |
191 | if (!en) { | 201 | if (!en) { |
@@ -193,7 +203,8 @@ ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, __be32 daddr, | |||
193 | return NULL; | 203 | return NULL; |
194 | } | 204 | } |
195 | 205 | ||
196 | en->addr = daddr; | 206 | en->af = dest->af; |
207 | ip_vs_addr_copy(dest->af, &en->addr, daddr); | ||
197 | en->lastuse = jiffies; | 208 | en->lastuse = jiffies; |
198 | 209 | ||
199 | atomic_inc(&dest->refcnt); | 210 | atomic_inc(&dest->refcnt); |
@@ -369,7 +380,7 @@ static int ip_vs_lblc_done_svc(struct ip_vs_service *svc) | |||
369 | 380 | ||
370 | 381 | ||
371 | static inline struct ip_vs_dest * | 382 | static inline struct ip_vs_dest * |
372 | __ip_vs_lblc_schedule(struct ip_vs_service *svc, struct iphdr *iph) | 383 | __ip_vs_lblc_schedule(struct ip_vs_service *svc) |
373 | { | 384 | { |
374 | struct ip_vs_dest *dest, *least; | 385 | struct ip_vs_dest *dest, *least; |
375 | int loh, doh; | 386 | int loh, doh; |
@@ -420,12 +431,13 @@ __ip_vs_lblc_schedule(struct ip_vs_service *svc, struct iphdr *iph) | |||
420 | } | 431 | } |
421 | } | 432 | } |
422 | 433 | ||
423 | IP_VS_DBG(6, "LBLC: server %d.%d.%d.%d:%d " | 434 | IP_VS_DBG_BUF(6, "LBLC: server %s:%d " |
424 | "activeconns %d refcnt %d weight %d overhead %d\n", | 435 | "activeconns %d refcnt %d weight %d overhead %d\n", |
425 | NIPQUAD(least->addr.ip), ntohs(least->port), | 436 | IP_VS_DBG_ADDR(least->af, &least->addr), |
426 | atomic_read(&least->activeconns), | 437 | ntohs(least->port), |
427 | atomic_read(&least->refcnt), | 438 | atomic_read(&least->activeconns), |
428 | atomic_read(&least->weight), loh); | 439 | atomic_read(&least->refcnt), |
440 | atomic_read(&least->weight), loh); | ||
429 | 441 | ||
430 | return least; | 442 | return least; |
431 | } | 443 | } |
@@ -459,15 +471,17 @@ static struct ip_vs_dest * | |||
459 | ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | 471 | ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) |
460 | { | 472 | { |
461 | struct ip_vs_lblc_table *tbl = svc->sched_data; | 473 | struct ip_vs_lblc_table *tbl = svc->sched_data; |
462 | struct iphdr *iph = ip_hdr(skb); | 474 | struct ip_vs_iphdr iph; |
463 | struct ip_vs_dest *dest = NULL; | 475 | struct ip_vs_dest *dest = NULL; |
464 | struct ip_vs_lblc_entry *en; | 476 | struct ip_vs_lblc_entry *en; |
465 | 477 | ||
478 | ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph); | ||
479 | |||
466 | IP_VS_DBG(6, "ip_vs_lblc_schedule(): Scheduling...\n"); | 480 | IP_VS_DBG(6, "ip_vs_lblc_schedule(): Scheduling...\n"); |
467 | 481 | ||
468 | /* First look in our cache */ | 482 | /* First look in our cache */ |
469 | read_lock(&svc->sched_lock); | 483 | read_lock(&svc->sched_lock); |
470 | en = ip_vs_lblc_get(tbl, iph->daddr); | 484 | en = ip_vs_lblc_get(svc->af, tbl, &iph.daddr); |
471 | if (en) { | 485 | if (en) { |
472 | /* We only hold a read lock, but this is atomic */ | 486 | /* We only hold a read lock, but this is atomic */ |
473 | en->lastuse = jiffies; | 487 | en->lastuse = jiffies; |
@@ -491,7 +505,7 @@ ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
491 | goto out; | 505 | goto out; |
492 | 506 | ||
493 | /* No cache entry or it is invalid, time to schedule */ | 507 | /* No cache entry or it is invalid, time to schedule */ |
494 | dest = __ip_vs_lblc_schedule(svc, iph); | 508 | dest = __ip_vs_lblc_schedule(svc); |
495 | if (!dest) { | 509 | if (!dest) { |
496 | IP_VS_DBG(1, "no destination available\n"); | 510 | IP_VS_DBG(1, "no destination available\n"); |
497 | return NULL; | 511 | return NULL; |
@@ -499,15 +513,13 @@ ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
499 | 513 | ||
500 | /* If we fail to create a cache entry, we'll just use the valid dest */ | 514 | /* If we fail to create a cache entry, we'll just use the valid dest */ |
501 | write_lock(&svc->sched_lock); | 515 | write_lock(&svc->sched_lock); |
502 | ip_vs_lblc_new(tbl, iph->daddr, dest); | 516 | ip_vs_lblc_new(tbl, &iph.daddr, dest); |
503 | write_unlock(&svc->sched_lock); | 517 | write_unlock(&svc->sched_lock); |
504 | 518 | ||
505 | out: | 519 | out: |
506 | IP_VS_DBG(6, "LBLC: destination IP address %u.%u.%u.%u " | 520 | IP_VS_DBG_BUF(6, "LBLC: destination IP address %s --> server %s:%d\n", |
507 | "--> server %u.%u.%u.%u:%d\n", | 521 | IP_VS_DBG_ADDR(svc->af, &iph.daddr), |
508 | NIPQUAD(iph->daddr), | 522 | IP_VS_DBG_ADDR(svc->af, &dest->addr), ntohs(dest->port)); |
509 | NIPQUAD(dest->addr.ip), | ||
510 | ntohs(dest->port)); | ||
511 | 523 | ||
512 | return dest; | 524 | return dest; |
513 | } | 525 | } |
@@ -522,9 +534,6 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler = | |||
522 | .refcnt = ATOMIC_INIT(0), | 534 | .refcnt = ATOMIC_INIT(0), |
523 | .module = THIS_MODULE, | 535 | .module = THIS_MODULE, |
524 | .n_list = LIST_HEAD_INIT(ip_vs_lblc_scheduler.n_list), | 536 | .n_list = LIST_HEAD_INIT(ip_vs_lblc_scheduler.n_list), |
525 | #ifdef CONFIG_IP_VS_IPV6 | ||
526 | .supports_ipv6 = 0, | ||
527 | #endif | ||
528 | .init_service = ip_vs_lblc_init_svc, | 537 | .init_service = ip_vs_lblc_init_svc, |
529 | .done_service = ip_vs_lblc_done_svc, | 538 | .done_service = ip_vs_lblc_done_svc, |
530 | .schedule = ip_vs_lblc_schedule, | 539 | .schedule = ip_vs_lblc_schedule, |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index 1f75ea83bcf8..92dc76a6842c 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -202,12 +202,13 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set) | |||
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | IP_VS_DBG(6, "ip_vs_dest_set_min: server %d.%d.%d.%d:%d " | 205 | IP_VS_DBG_BUF(6, "ip_vs_dest_set_min: server %s:%d " |
206 | "activeconns %d refcnt %d weight %d overhead %d\n", | 206 | "activeconns %d refcnt %d weight %d overhead %d\n", |
207 | NIPQUAD(least->addr.ip), ntohs(least->port), | 207 | IP_VS_DBG_ADDR(least->af, &least->addr), |
208 | atomic_read(&least->activeconns), | 208 | ntohs(least->port), |
209 | atomic_read(&least->refcnt), | 209 | atomic_read(&least->activeconns), |
210 | atomic_read(&least->weight), loh); | 210 | atomic_read(&least->refcnt), |
211 | atomic_read(&least->weight), loh); | ||
211 | return least; | 212 | return least; |
212 | } | 213 | } |
213 | 214 | ||
@@ -248,12 +249,12 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | |||
248 | } | 249 | } |
249 | } | 250 | } |
250 | 251 | ||
251 | IP_VS_DBG(6, "ip_vs_dest_set_max: server %d.%d.%d.%d:%d " | 252 | IP_VS_DBG_BUF(6, "ip_vs_dest_set_max: server %s:%d " |
252 | "activeconns %d refcnt %d weight %d overhead %d\n", | 253 | "activeconns %d refcnt %d weight %d overhead %d\n", |
253 | NIPQUAD(most->addr.ip), ntohs(most->port), | 254 | IP_VS_DBG_ADDR(most->af, &most->addr), ntohs(most->port), |
254 | atomic_read(&most->activeconns), | 255 | atomic_read(&most->activeconns), |
255 | atomic_read(&most->refcnt), | 256 | atomic_read(&most->refcnt), |
256 | atomic_read(&most->weight), moh); | 257 | atomic_read(&most->weight), moh); |
257 | return most; | 258 | return most; |
258 | } | 259 | } |
259 | 260 | ||
@@ -264,7 +265,8 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | |||
264 | */ | 265 | */ |
265 | struct ip_vs_lblcr_entry { | 266 | struct ip_vs_lblcr_entry { |
266 | struct list_head list; | 267 | struct list_head list; |
267 | __be32 addr; /* destination IP address */ | 268 | int af; /* address family */ |
269 | union nf_inet_addr addr; /* destination IP address */ | ||
268 | struct ip_vs_dest_set set; /* destination server set */ | 270 | struct ip_vs_dest_set set; /* destination server set */ |
269 | unsigned long lastuse; /* last used time */ | 271 | unsigned long lastuse; /* last used time */ |
270 | }; | 272 | }; |
@@ -293,7 +295,7 @@ static ctl_table vs_vars_table[] = { | |||
293 | .data = &sysctl_ip_vs_lblcr_expiration, | 295 | .data = &sysctl_ip_vs_lblcr_expiration, |
294 | .maxlen = sizeof(int), | 296 | .maxlen = sizeof(int), |
295 | .mode = 0644, | 297 | .mode = 0644, |
296 | .proc_handler = &proc_dointvec_jiffies, | 298 | .proc_handler = proc_dointvec_jiffies, |
297 | }, | 299 | }, |
298 | { .ctl_name = 0 } | 300 | { .ctl_name = 0 } |
299 | }; | 301 | }; |
@@ -311,9 +313,17 @@ static inline void ip_vs_lblcr_free(struct ip_vs_lblcr_entry *en) | |||
311 | /* | 313 | /* |
312 | * Returns hash value for IPVS LBLCR entry | 314 | * Returns hash value for IPVS LBLCR entry |
313 | */ | 315 | */ |
314 | static inline unsigned ip_vs_lblcr_hashkey(__be32 addr) | 316 | static inline unsigned |
317 | ip_vs_lblcr_hashkey(int af, const union nf_inet_addr *addr) | ||
315 | { | 318 | { |
316 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLCR_TAB_MASK; | 319 | __be32 addr_fold = addr->ip; |
320 | |||
321 | #ifdef CONFIG_IP_VS_IPV6 | ||
322 | if (af == AF_INET6) | ||
323 | addr_fold = addr->ip6[0]^addr->ip6[1]^ | ||
324 | addr->ip6[2]^addr->ip6[3]; | ||
325 | #endif | ||
326 | return (ntohl(addr_fold)*2654435761UL) & IP_VS_LBLCR_TAB_MASK; | ||
317 | } | 327 | } |
318 | 328 | ||
319 | 329 | ||
@@ -324,7 +334,7 @@ static inline unsigned ip_vs_lblcr_hashkey(__be32 addr) | |||
324 | static void | 334 | static void |
325 | ip_vs_lblcr_hash(struct ip_vs_lblcr_table *tbl, struct ip_vs_lblcr_entry *en) | 335 | ip_vs_lblcr_hash(struct ip_vs_lblcr_table *tbl, struct ip_vs_lblcr_entry *en) |
326 | { | 336 | { |
327 | unsigned hash = ip_vs_lblcr_hashkey(en->addr); | 337 | unsigned hash = ip_vs_lblcr_hashkey(en->af, &en->addr); |
328 | 338 | ||
329 | list_add(&en->list, &tbl->bucket[hash]); | 339 | list_add(&en->list, &tbl->bucket[hash]); |
330 | atomic_inc(&tbl->entries); | 340 | atomic_inc(&tbl->entries); |
@@ -336,13 +346,14 @@ ip_vs_lblcr_hash(struct ip_vs_lblcr_table *tbl, struct ip_vs_lblcr_entry *en) | |||
336 | * read lock. | 346 | * read lock. |
337 | */ | 347 | */ |
338 | static inline struct ip_vs_lblcr_entry * | 348 | static inline struct ip_vs_lblcr_entry * |
339 | ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __be32 addr) | 349 | ip_vs_lblcr_get(int af, struct ip_vs_lblcr_table *tbl, |
350 | const union nf_inet_addr *addr) | ||
340 | { | 351 | { |
341 | unsigned hash = ip_vs_lblcr_hashkey(addr); | 352 | unsigned hash = ip_vs_lblcr_hashkey(af, addr); |
342 | struct ip_vs_lblcr_entry *en; | 353 | struct ip_vs_lblcr_entry *en; |
343 | 354 | ||
344 | list_for_each_entry(en, &tbl->bucket[hash], list) | 355 | list_for_each_entry(en, &tbl->bucket[hash], list) |
345 | if (en->addr == addr) | 356 | if (ip_vs_addr_equal(af, &en->addr, addr)) |
346 | return en; | 357 | return en; |
347 | 358 | ||
348 | return NULL; | 359 | return NULL; |
@@ -354,12 +365,12 @@ ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __be32 addr) | |||
354 | * IP address to a server. Called under write lock. | 365 | * IP address to a server. Called under write lock. |
355 | */ | 366 | */ |
356 | static inline struct ip_vs_lblcr_entry * | 367 | static inline struct ip_vs_lblcr_entry * |
357 | ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, __be32 daddr, | 368 | ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr, |
358 | struct ip_vs_dest *dest) | 369 | struct ip_vs_dest *dest) |
359 | { | 370 | { |
360 | struct ip_vs_lblcr_entry *en; | 371 | struct ip_vs_lblcr_entry *en; |
361 | 372 | ||
362 | en = ip_vs_lblcr_get(tbl, daddr); | 373 | en = ip_vs_lblcr_get(dest->af, tbl, daddr); |
363 | if (!en) { | 374 | if (!en) { |
364 | en = kmalloc(sizeof(*en), GFP_ATOMIC); | 375 | en = kmalloc(sizeof(*en), GFP_ATOMIC); |
365 | if (!en) { | 376 | if (!en) { |
@@ -367,7 +378,8 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, __be32 daddr, | |||
367 | return NULL; | 378 | return NULL; |
368 | } | 379 | } |
369 | 380 | ||
370 | en->addr = daddr; | 381 | en->af = dest->af; |
382 | ip_vs_addr_copy(dest->af, &en->addr, daddr); | ||
371 | en->lastuse = jiffies; | 383 | en->lastuse = jiffies; |
372 | 384 | ||
373 | /* initilize its dest set */ | 385 | /* initilize its dest set */ |
@@ -544,7 +556,7 @@ static int ip_vs_lblcr_done_svc(struct ip_vs_service *svc) | |||
544 | 556 | ||
545 | 557 | ||
546 | static inline struct ip_vs_dest * | 558 | static inline struct ip_vs_dest * |
547 | __ip_vs_lblcr_schedule(struct ip_vs_service *svc, struct iphdr *iph) | 559 | __ip_vs_lblcr_schedule(struct ip_vs_service *svc) |
548 | { | 560 | { |
549 | struct ip_vs_dest *dest, *least; | 561 | struct ip_vs_dest *dest, *least; |
550 | int loh, doh; | 562 | int loh, doh; |
@@ -596,12 +608,13 @@ __ip_vs_lblcr_schedule(struct ip_vs_service *svc, struct iphdr *iph) | |||
596 | } | 608 | } |
597 | } | 609 | } |
598 | 610 | ||
599 | IP_VS_DBG(6, "LBLCR: server %d.%d.%d.%d:%d " | 611 | IP_VS_DBG_BUF(6, "LBLCR: server %s:%d " |
600 | "activeconns %d refcnt %d weight %d overhead %d\n", | 612 | "activeconns %d refcnt %d weight %d overhead %d\n", |
601 | NIPQUAD(least->addr.ip), ntohs(least->port), | 613 | IP_VS_DBG_ADDR(least->af, &least->addr), |
602 | atomic_read(&least->activeconns), | 614 | ntohs(least->port), |
603 | atomic_read(&least->refcnt), | 615 | atomic_read(&least->activeconns), |
604 | atomic_read(&least->weight), loh); | 616 | atomic_read(&least->refcnt), |
617 | atomic_read(&least->weight), loh); | ||
605 | 618 | ||
606 | return least; | 619 | return least; |
607 | } | 620 | } |
@@ -635,15 +648,17 @@ static struct ip_vs_dest * | |||
635 | ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | 648 | ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) |
636 | { | 649 | { |
637 | struct ip_vs_lblcr_table *tbl = svc->sched_data; | 650 | struct ip_vs_lblcr_table *tbl = svc->sched_data; |
638 | struct iphdr *iph = ip_hdr(skb); | 651 | struct ip_vs_iphdr iph; |
639 | struct ip_vs_dest *dest = NULL; | 652 | struct ip_vs_dest *dest = NULL; |
640 | struct ip_vs_lblcr_entry *en; | 653 | struct ip_vs_lblcr_entry *en; |
641 | 654 | ||
655 | ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph); | ||
656 | |||
642 | IP_VS_DBG(6, "ip_vs_lblcr_schedule(): Scheduling...\n"); | 657 | IP_VS_DBG(6, "ip_vs_lblcr_schedule(): Scheduling...\n"); |
643 | 658 | ||
644 | /* First look in our cache */ | 659 | /* First look in our cache */ |
645 | read_lock(&svc->sched_lock); | 660 | read_lock(&svc->sched_lock); |
646 | en = ip_vs_lblcr_get(tbl, iph->daddr); | 661 | en = ip_vs_lblcr_get(svc->af, tbl, &iph.daddr); |
647 | if (en) { | 662 | if (en) { |
648 | /* We only hold a read lock, but this is atomic */ | 663 | /* We only hold a read lock, but this is atomic */ |
649 | en->lastuse = jiffies; | 664 | en->lastuse = jiffies; |
@@ -673,7 +688,7 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
673 | } | 688 | } |
674 | 689 | ||
675 | /* The cache entry is invalid, time to schedule */ | 690 | /* The cache entry is invalid, time to schedule */ |
676 | dest = __ip_vs_lblcr_schedule(svc, iph); | 691 | dest = __ip_vs_lblcr_schedule(svc); |
677 | if (!dest) { | 692 | if (!dest) { |
678 | IP_VS_DBG(1, "no destination available\n"); | 693 | IP_VS_DBG(1, "no destination available\n"); |
679 | read_unlock(&svc->sched_lock); | 694 | read_unlock(&svc->sched_lock); |
@@ -691,7 +706,7 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
691 | goto out; | 706 | goto out; |
692 | 707 | ||
693 | /* No cache entry, time to schedule */ | 708 | /* No cache entry, time to schedule */ |
694 | dest = __ip_vs_lblcr_schedule(svc, iph); | 709 | dest = __ip_vs_lblcr_schedule(svc); |
695 | if (!dest) { | 710 | if (!dest) { |
696 | IP_VS_DBG(1, "no destination available\n"); | 711 | IP_VS_DBG(1, "no destination available\n"); |
697 | return NULL; | 712 | return NULL; |
@@ -699,15 +714,13 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
699 | 714 | ||
700 | /* If we fail to create a cache entry, we'll just use the valid dest */ | 715 | /* If we fail to create a cache entry, we'll just use the valid dest */ |
701 | write_lock(&svc->sched_lock); | 716 | write_lock(&svc->sched_lock); |
702 | ip_vs_lblcr_new(tbl, iph->daddr, dest); | 717 | ip_vs_lblcr_new(tbl, &iph.daddr, dest); |
703 | write_unlock(&svc->sched_lock); | 718 | write_unlock(&svc->sched_lock); |
704 | 719 | ||
705 | out: | 720 | out: |
706 | IP_VS_DBG(6, "LBLCR: destination IP address %u.%u.%u.%u " | 721 | IP_VS_DBG_BUF(6, "LBLCR: destination IP address %s --> server %s:%d\n", |
707 | "--> server %u.%u.%u.%u:%d\n", | 722 | IP_VS_DBG_ADDR(svc->af, &iph.daddr), |
708 | NIPQUAD(iph->daddr), | 723 | IP_VS_DBG_ADDR(svc->af, &dest->addr), ntohs(dest->port)); |
709 | NIPQUAD(dest->addr.ip), | ||
710 | ntohs(dest->port)); | ||
711 | 724 | ||
712 | return dest; | 725 | return dest; |
713 | } | 726 | } |
@@ -722,9 +735,6 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler = | |||
722 | .refcnt = ATOMIC_INIT(0), | 735 | .refcnt = ATOMIC_INIT(0), |
723 | .module = THIS_MODULE, | 736 | .module = THIS_MODULE, |
724 | .n_list = LIST_HEAD_INIT(ip_vs_lblcr_scheduler.n_list), | 737 | .n_list = LIST_HEAD_INIT(ip_vs_lblcr_scheduler.n_list), |
725 | #ifdef CONFIG_IP_VS_IPV6 | ||
726 | .supports_ipv6 = 0, | ||
727 | #endif | ||
728 | .init_service = ip_vs_lblcr_init_svc, | 738 | .init_service = ip_vs_lblcr_init_svc, |
729 | .done_service = ip_vs_lblcr_done_svc, | 739 | .done_service = ip_vs_lblcr_done_svc, |
730 | .schedule = ip_vs_lblcr_schedule, | 740 | .schedule = ip_vs_lblcr_schedule, |
diff --git a/net/netfilter/ipvs/ip_vs_lc.c b/net/netfilter/ipvs/ip_vs_lc.c index b69f808ac461..51912cab777b 100644 --- a/net/netfilter/ipvs/ip_vs_lc.c +++ b/net/netfilter/ipvs/ip_vs_lc.c | |||
@@ -81,9 +81,6 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = { | |||
81 | .refcnt = ATOMIC_INIT(0), | 81 | .refcnt = ATOMIC_INIT(0), |
82 | .module = THIS_MODULE, | 82 | .module = THIS_MODULE, |
83 | .n_list = LIST_HEAD_INIT(ip_vs_lc_scheduler.n_list), | 83 | .n_list = LIST_HEAD_INIT(ip_vs_lc_scheduler.n_list), |
84 | #ifdef CONFIG_IP_VS_IPV6 | ||
85 | .supports_ipv6 = 1, | ||
86 | #endif | ||
87 | .schedule = ip_vs_lc_schedule, | 84 | .schedule = ip_vs_lc_schedule, |
88 | }; | 85 | }; |
89 | 86 | ||
diff --git a/net/netfilter/ipvs/ip_vs_nq.c b/net/netfilter/ipvs/ip_vs_nq.c index 9a2d8033f08f..6758ad2ceaaf 100644 --- a/net/netfilter/ipvs/ip_vs_nq.c +++ b/net/netfilter/ipvs/ip_vs_nq.c | |||
@@ -116,9 +116,6 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler = | |||
116 | .refcnt = ATOMIC_INIT(0), | 116 | .refcnt = ATOMIC_INIT(0), |
117 | .module = THIS_MODULE, | 117 | .module = THIS_MODULE, |
118 | .n_list = LIST_HEAD_INIT(ip_vs_nq_scheduler.n_list), | 118 | .n_list = LIST_HEAD_INIT(ip_vs_nq_scheduler.n_list), |
119 | #ifdef CONFIG_IP_VS_IPV6 | ||
120 | .supports_ipv6 = 1, | ||
121 | #endif | ||
122 | .schedule = ip_vs_nq_schedule, | 119 | .schedule = ip_vs_nq_schedule, |
123 | }; | 120 | }; |
124 | 121 | ||
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c index 0791f9e08feb..a01520e3d6b8 100644 --- a/net/netfilter/ipvs/ip_vs_proto.c +++ b/net/netfilter/ipvs/ip_vs_proto.c | |||
@@ -164,26 +164,21 @@ ip_vs_tcpudp_debug_packet_v4(struct ip_vs_protocol *pp, | |||
164 | if (ih == NULL) | 164 | if (ih == NULL) |
165 | sprintf(buf, "%s TRUNCATED", pp->name); | 165 | sprintf(buf, "%s TRUNCATED", pp->name); |
166 | else if (ih->frag_off & htons(IP_OFFSET)) | 166 | else if (ih->frag_off & htons(IP_OFFSET)) |
167 | sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u frag", | 167 | sprintf(buf, "%s %pI4->%pI4 frag", |
168 | pp->name, NIPQUAD(ih->saddr), | 168 | pp->name, &ih->saddr, &ih->daddr); |
169 | NIPQUAD(ih->daddr)); | ||
170 | else { | 169 | else { |
171 | __be16 _ports[2], *pptr | 170 | __be16 _ports[2], *pptr |
172 | ; | 171 | ; |
173 | pptr = skb_header_pointer(skb, offset + ih->ihl*4, | 172 | pptr = skb_header_pointer(skb, offset + ih->ihl*4, |
174 | sizeof(_ports), _ports); | 173 | sizeof(_ports), _ports); |
175 | if (pptr == NULL) | 174 | if (pptr == NULL) |
176 | sprintf(buf, "%s TRUNCATED %u.%u.%u.%u->%u.%u.%u.%u", | 175 | sprintf(buf, "%s TRUNCATED %pI4->%pI4", |
177 | pp->name, | 176 | pp->name, &ih->saddr, &ih->daddr); |
178 | NIPQUAD(ih->saddr), | ||
179 | NIPQUAD(ih->daddr)); | ||
180 | else | 177 | else |
181 | sprintf(buf, "%s %u.%u.%u.%u:%u->%u.%u.%u.%u:%u", | 178 | sprintf(buf, "%s %pI4:%u->%pI4:%u", |
182 | pp->name, | 179 | pp->name, |
183 | NIPQUAD(ih->saddr), | 180 | &ih->saddr, ntohs(pptr[0]), |
184 | ntohs(pptr[0]), | 181 | &ih->daddr, ntohs(pptr[1])); |
185 | NIPQUAD(ih->daddr), | ||
186 | ntohs(pptr[1])); | ||
187 | } | 182 | } |
188 | 183 | ||
189 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); | 184 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); |
@@ -203,26 +198,21 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp, | |||
203 | if (ih == NULL) | 198 | if (ih == NULL) |
204 | sprintf(buf, "%s TRUNCATED", pp->name); | 199 | sprintf(buf, "%s TRUNCATED", pp->name); |
205 | else if (ih->nexthdr == IPPROTO_FRAGMENT) | 200 | else if (ih->nexthdr == IPPROTO_FRAGMENT) |
206 | sprintf(buf, "%s " NIP6_FMT "->" NIP6_FMT " frag", | 201 | sprintf(buf, "%s %pI6->%pI6 frag", |
207 | pp->name, NIP6(ih->saddr), | 202 | pp->name, &ih->saddr, &ih->daddr); |
208 | NIP6(ih->daddr)); | ||
209 | else { | 203 | else { |
210 | __be16 _ports[2], *pptr; | 204 | __be16 _ports[2], *pptr; |
211 | 205 | ||
212 | pptr = skb_header_pointer(skb, offset + sizeof(struct ipv6hdr), | 206 | pptr = skb_header_pointer(skb, offset + sizeof(struct ipv6hdr), |
213 | sizeof(_ports), _ports); | 207 | sizeof(_ports), _ports); |
214 | if (pptr == NULL) | 208 | if (pptr == NULL) |
215 | sprintf(buf, "%s TRUNCATED " NIP6_FMT "->" NIP6_FMT, | 209 | sprintf(buf, "%s TRUNCATED %pI6->%pI6", |
216 | pp->name, | 210 | pp->name, &ih->saddr, &ih->daddr); |
217 | NIP6(ih->saddr), | ||
218 | NIP6(ih->daddr)); | ||
219 | else | 211 | else |
220 | sprintf(buf, "%s " NIP6_FMT ":%u->" NIP6_FMT ":%u", | 212 | sprintf(buf, "%s %pI6:%u->%pI6:%u", |
221 | pp->name, | 213 | pp->name, |
222 | NIP6(ih->saddr), | 214 | &ih->saddr, ntohs(pptr[0]), |
223 | ntohs(pptr[0]), | 215 | &ih->daddr, ntohs(pptr[1])); |
224 | NIP6(ih->daddr), | ||
225 | ntohs(pptr[1])); | ||
226 | } | 216 | } |
227 | 217 | ||
228 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); | 218 | 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..79f56c1e7c19 100644 --- a/net/netfilter/ipvs/ip_vs_proto_ah_esp.c +++ b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c | |||
@@ -135,9 +135,8 @@ ah_esp_debug_packet_v4(struct ip_vs_protocol *pp, const struct sk_buff *skb, | |||
135 | if (ih == NULL) | 135 | if (ih == NULL) |
136 | sprintf(buf, "%s TRUNCATED", pp->name); | 136 | sprintf(buf, "%s TRUNCATED", pp->name); |
137 | else | 137 | else |
138 | sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u", | 138 | sprintf(buf, "%s %pI4->%pI4", |
139 | pp->name, NIPQUAD(ih->saddr), | 139 | pp->name, &ih->saddr, &ih->daddr); |
140 | NIPQUAD(ih->daddr)); | ||
141 | 140 | ||
142 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); | 141 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); |
143 | } | 142 | } |
@@ -154,9 +153,8 @@ ah_esp_debug_packet_v6(struct ip_vs_protocol *pp, const struct sk_buff *skb, | |||
154 | if (ih == NULL) | 153 | if (ih == NULL) |
155 | sprintf(buf, "%s TRUNCATED", pp->name); | 154 | sprintf(buf, "%s TRUNCATED", pp->name); |
156 | else | 155 | else |
157 | sprintf(buf, "%s " NIP6_FMT "->" NIP6_FMT, | 156 | sprintf(buf, "%s %pI6->%pI6", |
158 | pp->name, NIP6(ih->saddr), | 157 | pp->name, &ih->saddr, &ih->daddr); |
159 | NIP6(ih->daddr)); | ||
160 | 158 | ||
161 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); | 159 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); |
162 | } | 160 | } |
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index dd4566ea2bff..8cba41802850 100644 --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c | |||
@@ -192,8 +192,8 @@ tcp_snat_handler(struct sk_buff *skb, | |||
192 | /* Adjust TCP checksums */ | 192 | /* Adjust TCP checksums */ |
193 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 193 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
194 | tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr, | 194 | tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr, |
195 | htonl(oldlen), | 195 | htons(oldlen), |
196 | htonl(skb->len - tcphoff)); | 196 | htons(skb->len - tcphoff)); |
197 | } else if (!cp->app) { | 197 | } else if (!cp->app) { |
198 | /* Only port and addr are changed, do fast csum update */ | 198 | /* Only port and addr are changed, do fast csum update */ |
199 | tcp_fast_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr, | 199 | tcp_fast_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr, |
@@ -267,8 +267,8 @@ tcp_dnat_handler(struct sk_buff *skb, | |||
267 | */ | 267 | */ |
268 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 268 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
269 | tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr, | 269 | tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr, |
270 | htonl(oldlen), | 270 | htons(oldlen), |
271 | htonl(skb->len - tcphoff)); | 271 | htons(skb->len - tcphoff)); |
272 | } else if (!cp->app) { | 272 | } else if (!cp->app) { |
273 | /* Only port and addr are changed, do fast csum update */ | 273 | /* Only port and addr are changed, do fast csum update */ |
274 | tcp_fast_csum_update(cp->af, tcph, &cp->vaddr, &cp->daddr, | 274 | tcp_fast_csum_update(cp->af, tcph, &cp->vaddr, &cp->daddr, |
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c index 6eb6039d6343..d2930a71084b 100644 --- a/net/netfilter/ipvs/ip_vs_proto_udp.c +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c | |||
@@ -203,8 +203,8 @@ udp_snat_handler(struct sk_buff *skb, | |||
203 | */ | 203 | */ |
204 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 204 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
205 | udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, | 205 | udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, |
206 | htonl(oldlen), | 206 | htons(oldlen), |
207 | htonl(skb->len - udphoff)); | 207 | htons(skb->len - udphoff)); |
208 | } else if (!cp->app && (udph->check != 0)) { | 208 | } else if (!cp->app && (udph->check != 0)) { |
209 | /* Only port and addr are changed, do fast csum update */ | 209 | /* Only port and addr are changed, do fast csum update */ |
210 | udp_fast_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, | 210 | udp_fast_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, |
@@ -279,8 +279,8 @@ udp_dnat_handler(struct sk_buff *skb, | |||
279 | */ | 279 | */ |
280 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 280 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
281 | udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, | 281 | udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, |
282 | htonl(oldlen), | 282 | htons(oldlen), |
283 | htonl(skb->len - udphoff)); | 283 | htons(skb->len - udphoff)); |
284 | } else if (!cp->app && (udph->check != 0)) { | 284 | } else if (!cp->app && (udph->check != 0)) { |
285 | /* Only port and addr are changed, do fast csum update */ | 285 | /* Only port and addr are changed, do fast csum update */ |
286 | udp_fast_csum_update(cp->af, udph, &cp->vaddr, &cp->daddr, | 286 | udp_fast_csum_update(cp->af, udph, &cp->vaddr, &cp->daddr, |
diff --git a/net/netfilter/ipvs/ip_vs_rr.c b/net/netfilter/ipvs/ip_vs_rr.c index a22195f68ac4..8fb51c169eb8 100644 --- a/net/netfilter/ipvs/ip_vs_rr.c +++ b/net/netfilter/ipvs/ip_vs_rr.c | |||
@@ -89,9 +89,6 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = { | |||
89 | .refcnt = ATOMIC_INIT(0), | 89 | .refcnt = ATOMIC_INIT(0), |
90 | .module = THIS_MODULE, | 90 | .module = THIS_MODULE, |
91 | .n_list = LIST_HEAD_INIT(ip_vs_rr_scheduler.n_list), | 91 | .n_list = LIST_HEAD_INIT(ip_vs_rr_scheduler.n_list), |
92 | #ifdef CONFIG_IP_VS_IPV6 | ||
93 | .supports_ipv6 = 1, | ||
94 | #endif | ||
95 | .init_service = ip_vs_rr_init_svc, | 92 | .init_service = ip_vs_rr_init_svc, |
96 | .update_service = ip_vs_rr_update_svc, | 93 | .update_service = ip_vs_rr_update_svc, |
97 | .schedule = ip_vs_rr_schedule, | 94 | .schedule = ip_vs_rr_schedule, |
diff --git a/net/netfilter/ipvs/ip_vs_sed.c b/net/netfilter/ipvs/ip_vs_sed.c index 7d2f22f04b83..691a6a0086e1 100644 --- a/net/netfilter/ipvs/ip_vs_sed.c +++ b/net/netfilter/ipvs/ip_vs_sed.c | |||
@@ -118,9 +118,6 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler = | |||
118 | .refcnt = ATOMIC_INIT(0), | 118 | .refcnt = ATOMIC_INIT(0), |
119 | .module = THIS_MODULE, | 119 | .module = THIS_MODULE, |
120 | .n_list = LIST_HEAD_INIT(ip_vs_sed_scheduler.n_list), | 120 | .n_list = LIST_HEAD_INIT(ip_vs_sed_scheduler.n_list), |
121 | #ifdef CONFIG_IP_VS_IPV6 | ||
122 | .supports_ipv6 = 1, | ||
123 | #endif | ||
124 | .schedule = ip_vs_sed_schedule, | 121 | .schedule = ip_vs_sed_schedule, |
125 | }; | 122 | }; |
126 | 123 | ||
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c index 1d96de27fefd..0e53955ef139 100644 --- a/net/netfilter/ipvs/ip_vs_sh.c +++ b/net/netfilter/ipvs/ip_vs_sh.c | |||
@@ -61,9 +61,16 @@ struct ip_vs_sh_bucket { | |||
61 | /* | 61 | /* |
62 | * Returns hash value for IPVS SH entry | 62 | * Returns hash value for IPVS SH entry |
63 | */ | 63 | */ |
64 | static inline unsigned ip_vs_sh_hashkey(__be32 addr) | 64 | static inline unsigned ip_vs_sh_hashkey(int af, const union nf_inet_addr *addr) |
65 | { | 65 | { |
66 | return (ntohl(addr)*2654435761UL) & IP_VS_SH_TAB_MASK; | 66 | __be32 addr_fold = addr->ip; |
67 | |||
68 | #ifdef CONFIG_IP_VS_IPV6 | ||
69 | if (af == AF_INET6) | ||
70 | addr_fold = addr->ip6[0]^addr->ip6[1]^ | ||
71 | addr->ip6[2]^addr->ip6[3]; | ||
72 | #endif | ||
73 | return (ntohl(addr_fold)*2654435761UL) & IP_VS_SH_TAB_MASK; | ||
67 | } | 74 | } |
68 | 75 | ||
69 | 76 | ||
@@ -71,9 +78,10 @@ static inline unsigned ip_vs_sh_hashkey(__be32 addr) | |||
71 | * Get ip_vs_dest associated with supplied parameters. | 78 | * Get ip_vs_dest associated with supplied parameters. |
72 | */ | 79 | */ |
73 | static inline struct ip_vs_dest * | 80 | static inline struct ip_vs_dest * |
74 | ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __be32 addr) | 81 | ip_vs_sh_get(int af, struct ip_vs_sh_bucket *tbl, |
82 | const union nf_inet_addr *addr) | ||
75 | { | 83 | { |
76 | return (tbl[ip_vs_sh_hashkey(addr)]).dest; | 84 | return (tbl[ip_vs_sh_hashkey(af, addr)]).dest; |
77 | } | 85 | } |
78 | 86 | ||
79 | 87 | ||
@@ -199,12 +207,14 @@ ip_vs_sh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
199 | { | 207 | { |
200 | struct ip_vs_dest *dest; | 208 | struct ip_vs_dest *dest; |
201 | struct ip_vs_sh_bucket *tbl; | 209 | struct ip_vs_sh_bucket *tbl; |
202 | struct iphdr *iph = ip_hdr(skb); | 210 | struct ip_vs_iphdr iph; |
211 | |||
212 | ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph); | ||
203 | 213 | ||
204 | IP_VS_DBG(6, "ip_vs_sh_schedule(): Scheduling...\n"); | 214 | IP_VS_DBG(6, "ip_vs_sh_schedule(): Scheduling...\n"); |
205 | 215 | ||
206 | tbl = (struct ip_vs_sh_bucket *)svc->sched_data; | 216 | tbl = (struct ip_vs_sh_bucket *)svc->sched_data; |
207 | dest = ip_vs_sh_get(tbl, iph->saddr); | 217 | dest = ip_vs_sh_get(svc->af, tbl, &iph.saddr); |
208 | if (!dest | 218 | if (!dest |
209 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) | 219 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) |
210 | || atomic_read(&dest->weight) <= 0 | 220 | || atomic_read(&dest->weight) <= 0 |
@@ -212,11 +222,10 @@ ip_vs_sh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
212 | return NULL; | 222 | return NULL; |
213 | } | 223 | } |
214 | 224 | ||
215 | IP_VS_DBG(6, "SH: source IP address %u.%u.%u.%u " | 225 | IP_VS_DBG_BUF(6, "SH: source IP address %s --> server %s:%d\n", |
216 | "--> server %u.%u.%u.%u:%d\n", | 226 | IP_VS_DBG_ADDR(svc->af, &iph.saddr), |
217 | NIPQUAD(iph->saddr), | 227 | IP_VS_DBG_ADDR(svc->af, &dest->addr), |
218 | NIPQUAD(dest->addr.ip), | 228 | ntohs(dest->port)); |
219 | ntohs(dest->port)); | ||
220 | 229 | ||
221 | return dest; | 230 | return dest; |
222 | } | 231 | } |
@@ -231,9 +240,6 @@ static struct ip_vs_scheduler ip_vs_sh_scheduler = | |||
231 | .refcnt = ATOMIC_INIT(0), | 240 | .refcnt = ATOMIC_INIT(0), |
232 | .module = THIS_MODULE, | 241 | .module = THIS_MODULE, |
233 | .n_list = LIST_HEAD_INIT(ip_vs_sh_scheduler.n_list), | 242 | .n_list = LIST_HEAD_INIT(ip_vs_sh_scheduler.n_list), |
234 | #ifdef CONFIG_IP_VS_IPV6 | ||
235 | .supports_ipv6 = 0, | ||
236 | #endif | ||
237 | .init_service = ip_vs_sh_init_svc, | 243 | .init_service = ip_vs_sh_init_svc, |
238 | .done_service = ip_vs_sh_done_svc, | 244 | .done_service = ip_vs_sh_done_svc, |
239 | .update_service = ip_vs_sh_update_svc, | 245 | .update_service = ip_vs_sh_update_svc, |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index de5e7e118eed..6be5d4efa51b 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
@@ -580,8 +580,8 @@ static int bind_mcastif_addr(struct socket *sock, char *ifname) | |||
580 | IP_VS_ERR("You probably need to specify IP address on " | 580 | IP_VS_ERR("You probably need to specify IP address on " |
581 | "multicast interface.\n"); | 581 | "multicast interface.\n"); |
582 | 582 | ||
583 | IP_VS_DBG(7, "binding socket with (%s) %u.%u.%u.%u\n", | 583 | IP_VS_DBG(7, "binding socket with (%s) %pI4\n", |
584 | ifname, NIPQUAD(addr)); | 584 | ifname, &addr); |
585 | 585 | ||
586 | /* Now bind the socket with the address of multicast interface */ | 586 | /* Now bind the socket with the address of multicast interface */ |
587 | sin.sin_family = AF_INET; | 587 | sin.sin_family = AF_INET; |
diff --git a/net/netfilter/ipvs/ip_vs_wlc.c b/net/netfilter/ipvs/ip_vs_wlc.c index 8c596e712599..57b452bbb4ea 100644 --- a/net/netfilter/ipvs/ip_vs_wlc.c +++ b/net/netfilter/ipvs/ip_vs_wlc.c | |||
@@ -106,9 +106,6 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler = | |||
106 | .refcnt = ATOMIC_INIT(0), | 106 | .refcnt = ATOMIC_INIT(0), |
107 | .module = THIS_MODULE, | 107 | .module = THIS_MODULE, |
108 | .n_list = LIST_HEAD_INIT(ip_vs_wlc_scheduler.n_list), | 108 | .n_list = LIST_HEAD_INIT(ip_vs_wlc_scheduler.n_list), |
109 | #ifdef CONFIG_IP_VS_IPV6 | ||
110 | .supports_ipv6 = 1, | ||
111 | #endif | ||
112 | .schedule = ip_vs_wlc_schedule, | 109 | .schedule = ip_vs_wlc_schedule, |
113 | }; | 110 | }; |
114 | 111 | ||
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c index 7ea92fed50bf..2f618dc29c5b 100644 --- a/net/netfilter/ipvs/ip_vs_wrr.c +++ b/net/netfilter/ipvs/ip_vs_wrr.c | |||
@@ -213,9 +213,6 @@ static struct ip_vs_scheduler ip_vs_wrr_scheduler = { | |||
213 | .refcnt = ATOMIC_INIT(0), | 213 | .refcnt = ATOMIC_INIT(0), |
214 | .module = THIS_MODULE, | 214 | .module = THIS_MODULE, |
215 | .n_list = LIST_HEAD_INIT(ip_vs_wrr_scheduler.n_list), | 215 | .n_list = LIST_HEAD_INIT(ip_vs_wrr_scheduler.n_list), |
216 | #ifdef CONFIG_IP_VS_IPV6 | ||
217 | .supports_ipv6 = 1, | ||
218 | #endif | ||
219 | .init_service = ip_vs_wrr_init_svc, | 216 | .init_service = ip_vs_wrr_init_svc, |
220 | .done_service = ip_vs_wrr_done_svc, | 217 | .done_service = ip_vs_wrr_done_svc, |
221 | .update_service = ip_vs_wrr_update_svc, | 218 | .update_service = ip_vs_wrr_update_svc, |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index e90d52f199bc..425ab144f15d 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
@@ -82,14 +82,13 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos) | |||
82 | 82 | ||
83 | if (ip_route_output_key(&init_net, &rt, &fl)) { | 83 | if (ip_route_output_key(&init_net, &rt, &fl)) { |
84 | spin_unlock(&dest->dst_lock); | 84 | spin_unlock(&dest->dst_lock); |
85 | IP_VS_DBG_RL("ip_route_output error, " | 85 | IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n", |
86 | "dest: %u.%u.%u.%u\n", | 86 | &dest->addr.ip); |
87 | NIPQUAD(dest->addr.ip)); | ||
88 | return NULL; | 87 | return NULL; |
89 | } | 88 | } |
90 | __ip_vs_dst_set(dest, rtos, dst_clone(&rt->u.dst)); | 89 | __ip_vs_dst_set(dest, rtos, dst_clone(&rt->u.dst)); |
91 | IP_VS_DBG(10, "new dst %u.%u.%u.%u, refcnt=%d, rtos=%X\n", | 90 | IP_VS_DBG(10, "new dst %pI4, refcnt=%d, rtos=%X\n", |
92 | NIPQUAD(dest->addr.ip), | 91 | &dest->addr.ip, |
93 | atomic_read(&rt->u.dst.__refcnt), rtos); | 92 | atomic_read(&rt->u.dst.__refcnt), rtos); |
94 | } | 93 | } |
95 | spin_unlock(&dest->dst_lock); | 94 | spin_unlock(&dest->dst_lock); |
@@ -104,8 +103,8 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos) | |||
104 | }; | 103 | }; |
105 | 104 | ||
106 | if (ip_route_output_key(&init_net, &rt, &fl)) { | 105 | if (ip_route_output_key(&init_net, &rt, &fl)) { |
107 | IP_VS_DBG_RL("ip_route_output error, dest: " | 106 | IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n", |
108 | "%u.%u.%u.%u\n", NIPQUAD(cp->daddr.ip)); | 107 | &cp->daddr.ip); |
109 | return NULL; | 108 | return NULL; |
110 | } | 109 | } |
111 | } | 110 | } |
@@ -141,14 +140,13 @@ __ip_vs_get_out_rt_v6(struct ip_vs_conn *cp) | |||
141 | NULL, &fl); | 140 | NULL, &fl); |
142 | if (!rt) { | 141 | if (!rt) { |
143 | spin_unlock(&dest->dst_lock); | 142 | spin_unlock(&dest->dst_lock); |
144 | IP_VS_DBG_RL("ip6_route_output error, " | 143 | IP_VS_DBG_RL("ip6_route_output error, dest: %pI6\n", |
145 | "dest: " NIP6_FMT "\n", | 144 | &dest->addr.in6); |
146 | NIP6(dest->addr.in6)); | ||
147 | return NULL; | 145 | return NULL; |
148 | } | 146 | } |
149 | __ip_vs_dst_set(dest, 0, dst_clone(&rt->u.dst)); | 147 | __ip_vs_dst_set(dest, 0, dst_clone(&rt->u.dst)); |
150 | IP_VS_DBG(10, "new dst " NIP6_FMT ", refcnt=%d\n", | 148 | IP_VS_DBG(10, "new dst %pI6, refcnt=%d\n", |
151 | NIP6(dest->addr.in6), | 149 | &dest->addr.in6, |
152 | atomic_read(&rt->u.dst.__refcnt)); | 150 | atomic_read(&rt->u.dst.__refcnt)); |
153 | } | 151 | } |
154 | spin_unlock(&dest->dst_lock); | 152 | spin_unlock(&dest->dst_lock); |
@@ -167,8 +165,8 @@ __ip_vs_get_out_rt_v6(struct ip_vs_conn *cp) | |||
167 | 165 | ||
168 | rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl); | 166 | rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl); |
169 | if (!rt) { | 167 | if (!rt) { |
170 | IP_VS_DBG_RL("ip6_route_output error, dest: " | 168 | IP_VS_DBG_RL("ip6_route_output error, dest: %pI6\n", |
171 | NIP6_FMT "\n", NIP6(cp->daddr.in6)); | 169 | &cp->daddr.in6); |
172 | return NULL; | 170 | return NULL; |
173 | } | 171 | } |
174 | } | 172 | } |
@@ -237,8 +235,8 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
237 | EnterFunction(10); | 235 | EnterFunction(10); |
238 | 236 | ||
239 | if (ip_route_output_key(&init_net, &rt, &fl)) { | 237 | if (ip_route_output_key(&init_net, &rt, &fl)) { |
240 | IP_VS_DBG_RL("ip_vs_bypass_xmit(): ip_route_output error, " | 238 | IP_VS_DBG_RL("ip_vs_bypass_xmit(): ip_route_output error, dest: %pI4\n", |
241 | "dest: %u.%u.%u.%u\n", NIPQUAD(iph->daddr)); | 239 | &iph->daddr); |
242 | goto tx_error_icmp; | 240 | goto tx_error_icmp; |
243 | } | 241 | } |
244 | 242 | ||
@@ -301,8 +299,8 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
301 | 299 | ||
302 | rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl); | 300 | rt = (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl); |
303 | if (!rt) { | 301 | if (!rt) { |
304 | IP_VS_DBG_RL("ip_vs_bypass_xmit_v6(): ip6_route_output error, " | 302 | IP_VS_DBG_RL("ip_vs_bypass_xmit_v6(): ip6_route_output error, dest: %pI6\n", |
305 | "dest: " NIP6_FMT "\n", NIP6(iph->daddr)); | 303 | &iph->daddr); |
306 | goto tx_error_icmp; | 304 | goto tx_error_icmp; |
307 | } | 305 | } |
308 | 306 | ||
diff --git a/net/netfilter/nf_conntrack_acct.c b/net/netfilter/nf_conntrack_acct.c index b92df5c1dfcf..9fe8982bd7c9 100644 --- a/net/netfilter/nf_conntrack_acct.c +++ b/net/netfilter/nf_conntrack_acct.c | |||
@@ -35,7 +35,7 @@ static struct ctl_table acct_sysctl_table[] = { | |||
35 | .data = &init_net.ct.sysctl_acct, | 35 | .data = &init_net.ct.sysctl_acct, |
36 | .maxlen = sizeof(unsigned int), | 36 | .maxlen = sizeof(unsigned int), |
37 | .mode = 0644, | 37 | .mode = 0644, |
38 | .proc_handler = &proc_dointvec, | 38 | .proc_handler = proc_dointvec, |
39 | }, | 39 | }, |
40 | {} | 40 | {} |
41 | }; | 41 | }; |
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index 4f7107107e99..629500901bd4 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c | |||
@@ -462,16 +462,13 @@ static int help(struct sk_buff *skb, | |||
462 | different IP address. Simply don't record it for | 462 | different IP address. Simply don't record it for |
463 | NAT. */ | 463 | NAT. */ |
464 | if (cmd.l3num == PF_INET) { | 464 | if (cmd.l3num == PF_INET) { |
465 | pr_debug("conntrack_ftp: NOT RECORDING: " NIPQUAD_FMT | 465 | pr_debug("conntrack_ftp: NOT RECORDING: %pI4 != %pI4\n", |
466 | " != " NIPQUAD_FMT "\n", | 466 | &cmd.u3.ip, |
467 | NIPQUAD(cmd.u3.ip), | 467 | &ct->tuplehash[dir].tuple.src.u3.ip); |
468 | NIPQUAD(ct->tuplehash[dir].tuple.src.u3.ip)); | ||
469 | } else { | 468 | } else { |
470 | pr_debug("conntrack_ftp: NOT RECORDING: " NIP6_FMT | 469 | pr_debug("conntrack_ftp: NOT RECORDING: %pI6 != %pI6\n", |
471 | " != " NIP6_FMT "\n", | 470 | cmd.u3.ip6, |
472 | NIP6(*((struct in6_addr *)cmd.u3.ip6)), | 471 | ct->tuplehash[dir].tuple.src.u3.ip6); |
473 | NIP6(*((struct in6_addr *) | ||
474 | ct->tuplehash[dir].tuple.src.u3.ip6))); | ||
475 | } | 472 | } |
476 | 473 | ||
477 | /* Thanks to Cristiano Lincoln Mattos | 474 | /* 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/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c index 20633fdf7e6b..4d681a04447e 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c | |||
@@ -156,9 +156,9 @@ static int help(struct sk_buff *skb, unsigned int protoff, | |||
156 | /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ | 156 | /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ |
157 | 157 | ||
158 | iph = ip_hdr(skb); | 158 | iph = ip_hdr(skb); |
159 | pr_debug("DCC found in master %u.%u.%u.%u:%u %u.%u.%u.%u:%u\n", | 159 | pr_debug("DCC found in master %pI4:%u %pI4:%u\n", |
160 | NIPQUAD(iph->saddr), ntohs(th->source), | 160 | &iph->saddr, ntohs(th->source), |
161 | NIPQUAD(iph->daddr), ntohs(th->dest)); | 161 | &iph->daddr, ntohs(th->dest)); |
162 | 162 | ||
163 | for (i = 0; i < ARRAY_SIZE(dccprotos); i++) { | 163 | for (i = 0; i < ARRAY_SIZE(dccprotos); i++) { |
164 | if (memcmp(data, dccprotos[i], strlen(dccprotos[i]))) { | 164 | if (memcmp(data, dccprotos[i], strlen(dccprotos[i]))) { |
@@ -185,10 +185,9 @@ static int help(struct sk_buff *skb, unsigned int protoff, | |||
185 | tuple->dst.u3.ip != htonl(dcc_ip)) { | 185 | tuple->dst.u3.ip != htonl(dcc_ip)) { |
186 | if (net_ratelimit()) | 186 | if (net_ratelimit()) |
187 | printk(KERN_WARNING | 187 | printk(KERN_WARNING |
188 | "Forged DCC command from " | 188 | "Forged DCC command from %pI4: %pI4:%u\n", |
189 | "%u.%u.%u.%u: %u.%u.%u.%u:%u\n", | 189 | &tuple->src.u3.ip, |
190 | NIPQUAD(tuple->src.u3.ip), | 190 | &dcc_ip, dcc_port); |
191 | HIPQUAD(dcc_ip), dcc_port); | ||
192 | continue; | 191 | continue; |
193 | } | 192 | } |
194 | 193 | ||
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c index dbe680af85d2..4be80d7b8795 100644 --- a/net/netfilter/nf_conntrack_proto_generic.c +++ b/net/netfilter/nf_conntrack_proto_generic.c | |||
@@ -67,7 +67,7 @@ static struct ctl_table generic_sysctl_table[] = { | |||
67 | .data = &nf_ct_generic_timeout, | 67 | .data = &nf_ct_generic_timeout, |
68 | .maxlen = sizeof(unsigned int), | 68 | .maxlen = sizeof(unsigned int), |
69 | .mode = 0644, | 69 | .mode = 0644, |
70 | .proc_handler = &proc_dointvec_jiffies, | 70 | .proc_handler = proc_dointvec_jiffies, |
71 | }, | 71 | }, |
72 | { | 72 | { |
73 | .ctl_name = 0 | 73 | .ctl_name = 0 |
@@ -80,7 +80,7 @@ static struct ctl_table generic_compat_sysctl_table[] = { | |||
80 | .data = &nf_ct_generic_timeout, | 80 | .data = &nf_ct_generic_timeout, |
81 | .maxlen = sizeof(unsigned int), | 81 | .maxlen = sizeof(unsigned int), |
82 | .mode = 0644, | 82 | .mode = 0644, |
83 | .proc_handler = &proc_dointvec_jiffies, | 83 | .proc_handler = proc_dointvec_jiffies, |
84 | }, | 84 | }, |
85 | { | 85 | { |
86 | .ctl_name = 0 | 86 | .ctl_name = 0 |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index ae8c2609e230..c2bd457bc2f2 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -548,49 +548,49 @@ static struct ctl_table sctp_sysctl_table[] = { | |||
548 | .data = &sctp_timeouts[SCTP_CONNTRACK_CLOSED], | 548 | .data = &sctp_timeouts[SCTP_CONNTRACK_CLOSED], |
549 | .maxlen = sizeof(unsigned int), | 549 | .maxlen = sizeof(unsigned int), |
550 | .mode = 0644, | 550 | .mode = 0644, |
551 | .proc_handler = &proc_dointvec_jiffies, | 551 | .proc_handler = proc_dointvec_jiffies, |
552 | }, | 552 | }, |
553 | { | 553 | { |
554 | .procname = "nf_conntrack_sctp_timeout_cookie_wait", | 554 | .procname = "nf_conntrack_sctp_timeout_cookie_wait", |
555 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_WAIT], | 555 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_WAIT], |
556 | .maxlen = sizeof(unsigned int), | 556 | .maxlen = sizeof(unsigned int), |
557 | .mode = 0644, | 557 | .mode = 0644, |
558 | .proc_handler = &proc_dointvec_jiffies, | 558 | .proc_handler = proc_dointvec_jiffies, |
559 | }, | 559 | }, |
560 | { | 560 | { |
561 | .procname = "nf_conntrack_sctp_timeout_cookie_echoed", | 561 | .procname = "nf_conntrack_sctp_timeout_cookie_echoed", |
562 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_ECHOED], | 562 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_ECHOED], |
563 | .maxlen = sizeof(unsigned int), | 563 | .maxlen = sizeof(unsigned int), |
564 | .mode = 0644, | 564 | .mode = 0644, |
565 | .proc_handler = &proc_dointvec_jiffies, | 565 | .proc_handler = proc_dointvec_jiffies, |
566 | }, | 566 | }, |
567 | { | 567 | { |
568 | .procname = "nf_conntrack_sctp_timeout_established", | 568 | .procname = "nf_conntrack_sctp_timeout_established", |
569 | .data = &sctp_timeouts[SCTP_CONNTRACK_ESTABLISHED], | 569 | .data = &sctp_timeouts[SCTP_CONNTRACK_ESTABLISHED], |
570 | .maxlen = sizeof(unsigned int), | 570 | .maxlen = sizeof(unsigned int), |
571 | .mode = 0644, | 571 | .mode = 0644, |
572 | .proc_handler = &proc_dointvec_jiffies, | 572 | .proc_handler = proc_dointvec_jiffies, |
573 | }, | 573 | }, |
574 | { | 574 | { |
575 | .procname = "nf_conntrack_sctp_timeout_shutdown_sent", | 575 | .procname = "nf_conntrack_sctp_timeout_shutdown_sent", |
576 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_SENT], | 576 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_SENT], |
577 | .maxlen = sizeof(unsigned int), | 577 | .maxlen = sizeof(unsigned int), |
578 | .mode = 0644, | 578 | .mode = 0644, |
579 | .proc_handler = &proc_dointvec_jiffies, | 579 | .proc_handler = proc_dointvec_jiffies, |
580 | }, | 580 | }, |
581 | { | 581 | { |
582 | .procname = "nf_conntrack_sctp_timeout_shutdown_recd", | 582 | .procname = "nf_conntrack_sctp_timeout_shutdown_recd", |
583 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_RECD], | 583 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_RECD], |
584 | .maxlen = sizeof(unsigned int), | 584 | .maxlen = sizeof(unsigned int), |
585 | .mode = 0644, | 585 | .mode = 0644, |
586 | .proc_handler = &proc_dointvec_jiffies, | 586 | .proc_handler = proc_dointvec_jiffies, |
587 | }, | 587 | }, |
588 | { | 588 | { |
589 | .procname = "nf_conntrack_sctp_timeout_shutdown_ack_sent", | 589 | .procname = "nf_conntrack_sctp_timeout_shutdown_ack_sent", |
590 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_ACK_SENT], | 590 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_ACK_SENT], |
591 | .maxlen = sizeof(unsigned int), | 591 | .maxlen = sizeof(unsigned int), |
592 | .mode = 0644, | 592 | .mode = 0644, |
593 | .proc_handler = &proc_dointvec_jiffies, | 593 | .proc_handler = proc_dointvec_jiffies, |
594 | }, | 594 | }, |
595 | { | 595 | { |
596 | .ctl_name = 0 | 596 | .ctl_name = 0 |
@@ -604,49 +604,49 @@ static struct ctl_table sctp_compat_sysctl_table[] = { | |||
604 | .data = &sctp_timeouts[SCTP_CONNTRACK_CLOSED], | 604 | .data = &sctp_timeouts[SCTP_CONNTRACK_CLOSED], |
605 | .maxlen = sizeof(unsigned int), | 605 | .maxlen = sizeof(unsigned int), |
606 | .mode = 0644, | 606 | .mode = 0644, |
607 | .proc_handler = &proc_dointvec_jiffies, | 607 | .proc_handler = proc_dointvec_jiffies, |
608 | }, | 608 | }, |
609 | { | 609 | { |
610 | .procname = "ip_conntrack_sctp_timeout_cookie_wait", | 610 | .procname = "ip_conntrack_sctp_timeout_cookie_wait", |
611 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_WAIT], | 611 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_WAIT], |
612 | .maxlen = sizeof(unsigned int), | 612 | .maxlen = sizeof(unsigned int), |
613 | .mode = 0644, | 613 | .mode = 0644, |
614 | .proc_handler = &proc_dointvec_jiffies, | 614 | .proc_handler = proc_dointvec_jiffies, |
615 | }, | 615 | }, |
616 | { | 616 | { |
617 | .procname = "ip_conntrack_sctp_timeout_cookie_echoed", | 617 | .procname = "ip_conntrack_sctp_timeout_cookie_echoed", |
618 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_ECHOED], | 618 | .data = &sctp_timeouts[SCTP_CONNTRACK_COOKIE_ECHOED], |
619 | .maxlen = sizeof(unsigned int), | 619 | .maxlen = sizeof(unsigned int), |
620 | .mode = 0644, | 620 | .mode = 0644, |
621 | .proc_handler = &proc_dointvec_jiffies, | 621 | .proc_handler = proc_dointvec_jiffies, |
622 | }, | 622 | }, |
623 | { | 623 | { |
624 | .procname = "ip_conntrack_sctp_timeout_established", | 624 | .procname = "ip_conntrack_sctp_timeout_established", |
625 | .data = &sctp_timeouts[SCTP_CONNTRACK_ESTABLISHED], | 625 | .data = &sctp_timeouts[SCTP_CONNTRACK_ESTABLISHED], |
626 | .maxlen = sizeof(unsigned int), | 626 | .maxlen = sizeof(unsigned int), |
627 | .mode = 0644, | 627 | .mode = 0644, |
628 | .proc_handler = &proc_dointvec_jiffies, | 628 | .proc_handler = proc_dointvec_jiffies, |
629 | }, | 629 | }, |
630 | { | 630 | { |
631 | .procname = "ip_conntrack_sctp_timeout_shutdown_sent", | 631 | .procname = "ip_conntrack_sctp_timeout_shutdown_sent", |
632 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_SENT], | 632 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_SENT], |
633 | .maxlen = sizeof(unsigned int), | 633 | .maxlen = sizeof(unsigned int), |
634 | .mode = 0644, | 634 | .mode = 0644, |
635 | .proc_handler = &proc_dointvec_jiffies, | 635 | .proc_handler = proc_dointvec_jiffies, |
636 | }, | 636 | }, |
637 | { | 637 | { |
638 | .procname = "ip_conntrack_sctp_timeout_shutdown_recd", | 638 | .procname = "ip_conntrack_sctp_timeout_shutdown_recd", |
639 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_RECD], | 639 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_RECD], |
640 | .maxlen = sizeof(unsigned int), | 640 | .maxlen = sizeof(unsigned int), |
641 | .mode = 0644, | 641 | .mode = 0644, |
642 | .proc_handler = &proc_dointvec_jiffies, | 642 | .proc_handler = proc_dointvec_jiffies, |
643 | }, | 643 | }, |
644 | { | 644 | { |
645 | .procname = "ip_conntrack_sctp_timeout_shutdown_ack_sent", | 645 | .procname = "ip_conntrack_sctp_timeout_shutdown_ack_sent", |
646 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_ACK_SENT], | 646 | .data = &sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_ACK_SENT], |
647 | .maxlen = sizeof(unsigned int), | 647 | .maxlen = sizeof(unsigned int), |
648 | .mode = 0644, | 648 | .mode = 0644, |
649 | .proc_handler = &proc_dointvec_jiffies, | 649 | .proc_handler = proc_dointvec_jiffies, |
650 | }, | 650 | }, |
651 | { | 651 | { |
652 | .ctl_name = 0 | 652 | .ctl_name = 0 |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index f947ec41e391..a1edb9c1adee 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -1192,70 +1192,70 @@ static struct ctl_table tcp_sysctl_table[] = { | |||
1192 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_SENT], | 1192 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_SENT], |
1193 | .maxlen = sizeof(unsigned int), | 1193 | .maxlen = sizeof(unsigned int), |
1194 | .mode = 0644, | 1194 | .mode = 0644, |
1195 | .proc_handler = &proc_dointvec_jiffies, | 1195 | .proc_handler = proc_dointvec_jiffies, |
1196 | }, | 1196 | }, |
1197 | { | 1197 | { |
1198 | .procname = "nf_conntrack_tcp_timeout_syn_recv", | 1198 | .procname = "nf_conntrack_tcp_timeout_syn_recv", |
1199 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_RECV], | 1199 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_RECV], |
1200 | .maxlen = sizeof(unsigned int), | 1200 | .maxlen = sizeof(unsigned int), |
1201 | .mode = 0644, | 1201 | .mode = 0644, |
1202 | .proc_handler = &proc_dointvec_jiffies, | 1202 | .proc_handler = proc_dointvec_jiffies, |
1203 | }, | 1203 | }, |
1204 | { | 1204 | { |
1205 | .procname = "nf_conntrack_tcp_timeout_established", | 1205 | .procname = "nf_conntrack_tcp_timeout_established", |
1206 | .data = &tcp_timeouts[TCP_CONNTRACK_ESTABLISHED], | 1206 | .data = &tcp_timeouts[TCP_CONNTRACK_ESTABLISHED], |
1207 | .maxlen = sizeof(unsigned int), | 1207 | .maxlen = sizeof(unsigned int), |
1208 | .mode = 0644, | 1208 | .mode = 0644, |
1209 | .proc_handler = &proc_dointvec_jiffies, | 1209 | .proc_handler = proc_dointvec_jiffies, |
1210 | }, | 1210 | }, |
1211 | { | 1211 | { |
1212 | .procname = "nf_conntrack_tcp_timeout_fin_wait", | 1212 | .procname = "nf_conntrack_tcp_timeout_fin_wait", |
1213 | .data = &tcp_timeouts[TCP_CONNTRACK_FIN_WAIT], | 1213 | .data = &tcp_timeouts[TCP_CONNTRACK_FIN_WAIT], |
1214 | .maxlen = sizeof(unsigned int), | 1214 | .maxlen = sizeof(unsigned int), |
1215 | .mode = 0644, | 1215 | .mode = 0644, |
1216 | .proc_handler = &proc_dointvec_jiffies, | 1216 | .proc_handler = proc_dointvec_jiffies, |
1217 | }, | 1217 | }, |
1218 | { | 1218 | { |
1219 | .procname = "nf_conntrack_tcp_timeout_close_wait", | 1219 | .procname = "nf_conntrack_tcp_timeout_close_wait", |
1220 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE_WAIT], | 1220 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE_WAIT], |
1221 | .maxlen = sizeof(unsigned int), | 1221 | .maxlen = sizeof(unsigned int), |
1222 | .mode = 0644, | 1222 | .mode = 0644, |
1223 | .proc_handler = &proc_dointvec_jiffies, | 1223 | .proc_handler = proc_dointvec_jiffies, |
1224 | }, | 1224 | }, |
1225 | { | 1225 | { |
1226 | .procname = "nf_conntrack_tcp_timeout_last_ack", | 1226 | .procname = "nf_conntrack_tcp_timeout_last_ack", |
1227 | .data = &tcp_timeouts[TCP_CONNTRACK_LAST_ACK], | 1227 | .data = &tcp_timeouts[TCP_CONNTRACK_LAST_ACK], |
1228 | .maxlen = sizeof(unsigned int), | 1228 | .maxlen = sizeof(unsigned int), |
1229 | .mode = 0644, | 1229 | .mode = 0644, |
1230 | .proc_handler = &proc_dointvec_jiffies, | 1230 | .proc_handler = proc_dointvec_jiffies, |
1231 | }, | 1231 | }, |
1232 | { | 1232 | { |
1233 | .procname = "nf_conntrack_tcp_timeout_time_wait", | 1233 | .procname = "nf_conntrack_tcp_timeout_time_wait", |
1234 | .data = &tcp_timeouts[TCP_CONNTRACK_TIME_WAIT], | 1234 | .data = &tcp_timeouts[TCP_CONNTRACK_TIME_WAIT], |
1235 | .maxlen = sizeof(unsigned int), | 1235 | .maxlen = sizeof(unsigned int), |
1236 | .mode = 0644, | 1236 | .mode = 0644, |
1237 | .proc_handler = &proc_dointvec_jiffies, | 1237 | .proc_handler = proc_dointvec_jiffies, |
1238 | }, | 1238 | }, |
1239 | { | 1239 | { |
1240 | .procname = "nf_conntrack_tcp_timeout_close", | 1240 | .procname = "nf_conntrack_tcp_timeout_close", |
1241 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE], | 1241 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE], |
1242 | .maxlen = sizeof(unsigned int), | 1242 | .maxlen = sizeof(unsigned int), |
1243 | .mode = 0644, | 1243 | .mode = 0644, |
1244 | .proc_handler = &proc_dointvec_jiffies, | 1244 | .proc_handler = proc_dointvec_jiffies, |
1245 | }, | 1245 | }, |
1246 | { | 1246 | { |
1247 | .procname = "nf_conntrack_tcp_timeout_max_retrans", | 1247 | .procname = "nf_conntrack_tcp_timeout_max_retrans", |
1248 | .data = &nf_ct_tcp_timeout_max_retrans, | 1248 | .data = &nf_ct_tcp_timeout_max_retrans, |
1249 | .maxlen = sizeof(unsigned int), | 1249 | .maxlen = sizeof(unsigned int), |
1250 | .mode = 0644, | 1250 | .mode = 0644, |
1251 | .proc_handler = &proc_dointvec_jiffies, | 1251 | .proc_handler = proc_dointvec_jiffies, |
1252 | }, | 1252 | }, |
1253 | { | 1253 | { |
1254 | .procname = "nf_conntrack_tcp_timeout_unacknowledged", | 1254 | .procname = "nf_conntrack_tcp_timeout_unacknowledged", |
1255 | .data = &nf_ct_tcp_timeout_unacknowledged, | 1255 | .data = &nf_ct_tcp_timeout_unacknowledged, |
1256 | .maxlen = sizeof(unsigned int), | 1256 | .maxlen = sizeof(unsigned int), |
1257 | .mode = 0644, | 1257 | .mode = 0644, |
1258 | .proc_handler = &proc_dointvec_jiffies, | 1258 | .proc_handler = proc_dointvec_jiffies, |
1259 | }, | 1259 | }, |
1260 | { | 1260 | { |
1261 | .ctl_name = NET_NF_CONNTRACK_TCP_LOOSE, | 1261 | .ctl_name = NET_NF_CONNTRACK_TCP_LOOSE, |
@@ -1263,7 +1263,7 @@ static struct ctl_table tcp_sysctl_table[] = { | |||
1263 | .data = &nf_ct_tcp_loose, | 1263 | .data = &nf_ct_tcp_loose, |
1264 | .maxlen = sizeof(unsigned int), | 1264 | .maxlen = sizeof(unsigned int), |
1265 | .mode = 0644, | 1265 | .mode = 0644, |
1266 | .proc_handler = &proc_dointvec, | 1266 | .proc_handler = proc_dointvec, |
1267 | }, | 1267 | }, |
1268 | { | 1268 | { |
1269 | .ctl_name = NET_NF_CONNTRACK_TCP_BE_LIBERAL, | 1269 | .ctl_name = NET_NF_CONNTRACK_TCP_BE_LIBERAL, |
@@ -1271,7 +1271,7 @@ static struct ctl_table tcp_sysctl_table[] = { | |||
1271 | .data = &nf_ct_tcp_be_liberal, | 1271 | .data = &nf_ct_tcp_be_liberal, |
1272 | .maxlen = sizeof(unsigned int), | 1272 | .maxlen = sizeof(unsigned int), |
1273 | .mode = 0644, | 1273 | .mode = 0644, |
1274 | .proc_handler = &proc_dointvec, | 1274 | .proc_handler = proc_dointvec, |
1275 | }, | 1275 | }, |
1276 | { | 1276 | { |
1277 | .ctl_name = NET_NF_CONNTRACK_TCP_MAX_RETRANS, | 1277 | .ctl_name = NET_NF_CONNTRACK_TCP_MAX_RETRANS, |
@@ -1279,7 +1279,7 @@ static struct ctl_table tcp_sysctl_table[] = { | |||
1279 | .data = &nf_ct_tcp_max_retrans, | 1279 | .data = &nf_ct_tcp_max_retrans, |
1280 | .maxlen = sizeof(unsigned int), | 1280 | .maxlen = sizeof(unsigned int), |
1281 | .mode = 0644, | 1281 | .mode = 0644, |
1282 | .proc_handler = &proc_dointvec, | 1282 | .proc_handler = proc_dointvec, |
1283 | }, | 1283 | }, |
1284 | { | 1284 | { |
1285 | .ctl_name = 0 | 1285 | .ctl_name = 0 |
@@ -1293,63 +1293,63 @@ static struct ctl_table tcp_compat_sysctl_table[] = { | |||
1293 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_SENT], | 1293 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_SENT], |
1294 | .maxlen = sizeof(unsigned int), | 1294 | .maxlen = sizeof(unsigned int), |
1295 | .mode = 0644, | 1295 | .mode = 0644, |
1296 | .proc_handler = &proc_dointvec_jiffies, | 1296 | .proc_handler = proc_dointvec_jiffies, |
1297 | }, | 1297 | }, |
1298 | { | 1298 | { |
1299 | .procname = "ip_conntrack_tcp_timeout_syn_recv", | 1299 | .procname = "ip_conntrack_tcp_timeout_syn_recv", |
1300 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_RECV], | 1300 | .data = &tcp_timeouts[TCP_CONNTRACK_SYN_RECV], |
1301 | .maxlen = sizeof(unsigned int), | 1301 | .maxlen = sizeof(unsigned int), |
1302 | .mode = 0644, | 1302 | .mode = 0644, |
1303 | .proc_handler = &proc_dointvec_jiffies, | 1303 | .proc_handler = proc_dointvec_jiffies, |
1304 | }, | 1304 | }, |
1305 | { | 1305 | { |
1306 | .procname = "ip_conntrack_tcp_timeout_established", | 1306 | .procname = "ip_conntrack_tcp_timeout_established", |
1307 | .data = &tcp_timeouts[TCP_CONNTRACK_ESTABLISHED], | 1307 | .data = &tcp_timeouts[TCP_CONNTRACK_ESTABLISHED], |
1308 | .maxlen = sizeof(unsigned int), | 1308 | .maxlen = sizeof(unsigned int), |
1309 | .mode = 0644, | 1309 | .mode = 0644, |
1310 | .proc_handler = &proc_dointvec_jiffies, | 1310 | .proc_handler = proc_dointvec_jiffies, |
1311 | }, | 1311 | }, |
1312 | { | 1312 | { |
1313 | .procname = "ip_conntrack_tcp_timeout_fin_wait", | 1313 | .procname = "ip_conntrack_tcp_timeout_fin_wait", |
1314 | .data = &tcp_timeouts[TCP_CONNTRACK_FIN_WAIT], | 1314 | .data = &tcp_timeouts[TCP_CONNTRACK_FIN_WAIT], |
1315 | .maxlen = sizeof(unsigned int), | 1315 | .maxlen = sizeof(unsigned int), |
1316 | .mode = 0644, | 1316 | .mode = 0644, |
1317 | .proc_handler = &proc_dointvec_jiffies, | 1317 | .proc_handler = proc_dointvec_jiffies, |
1318 | }, | 1318 | }, |
1319 | { | 1319 | { |
1320 | .procname = "ip_conntrack_tcp_timeout_close_wait", | 1320 | .procname = "ip_conntrack_tcp_timeout_close_wait", |
1321 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE_WAIT], | 1321 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE_WAIT], |
1322 | .maxlen = sizeof(unsigned int), | 1322 | .maxlen = sizeof(unsigned int), |
1323 | .mode = 0644, | 1323 | .mode = 0644, |
1324 | .proc_handler = &proc_dointvec_jiffies, | 1324 | .proc_handler = proc_dointvec_jiffies, |
1325 | }, | 1325 | }, |
1326 | { | 1326 | { |
1327 | .procname = "ip_conntrack_tcp_timeout_last_ack", | 1327 | .procname = "ip_conntrack_tcp_timeout_last_ack", |
1328 | .data = &tcp_timeouts[TCP_CONNTRACK_LAST_ACK], | 1328 | .data = &tcp_timeouts[TCP_CONNTRACK_LAST_ACK], |
1329 | .maxlen = sizeof(unsigned int), | 1329 | .maxlen = sizeof(unsigned int), |
1330 | .mode = 0644, | 1330 | .mode = 0644, |
1331 | .proc_handler = &proc_dointvec_jiffies, | 1331 | .proc_handler = proc_dointvec_jiffies, |
1332 | }, | 1332 | }, |
1333 | { | 1333 | { |
1334 | .procname = "ip_conntrack_tcp_timeout_time_wait", | 1334 | .procname = "ip_conntrack_tcp_timeout_time_wait", |
1335 | .data = &tcp_timeouts[TCP_CONNTRACK_TIME_WAIT], | 1335 | .data = &tcp_timeouts[TCP_CONNTRACK_TIME_WAIT], |
1336 | .maxlen = sizeof(unsigned int), | 1336 | .maxlen = sizeof(unsigned int), |
1337 | .mode = 0644, | 1337 | .mode = 0644, |
1338 | .proc_handler = &proc_dointvec_jiffies, | 1338 | .proc_handler = proc_dointvec_jiffies, |
1339 | }, | 1339 | }, |
1340 | { | 1340 | { |
1341 | .procname = "ip_conntrack_tcp_timeout_close", | 1341 | .procname = "ip_conntrack_tcp_timeout_close", |
1342 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE], | 1342 | .data = &tcp_timeouts[TCP_CONNTRACK_CLOSE], |
1343 | .maxlen = sizeof(unsigned int), | 1343 | .maxlen = sizeof(unsigned int), |
1344 | .mode = 0644, | 1344 | .mode = 0644, |
1345 | .proc_handler = &proc_dointvec_jiffies, | 1345 | .proc_handler = proc_dointvec_jiffies, |
1346 | }, | 1346 | }, |
1347 | { | 1347 | { |
1348 | .procname = "ip_conntrack_tcp_timeout_max_retrans", | 1348 | .procname = "ip_conntrack_tcp_timeout_max_retrans", |
1349 | .data = &nf_ct_tcp_timeout_max_retrans, | 1349 | .data = &nf_ct_tcp_timeout_max_retrans, |
1350 | .maxlen = sizeof(unsigned int), | 1350 | .maxlen = sizeof(unsigned int), |
1351 | .mode = 0644, | 1351 | .mode = 0644, |
1352 | .proc_handler = &proc_dointvec_jiffies, | 1352 | .proc_handler = proc_dointvec_jiffies, |
1353 | }, | 1353 | }, |
1354 | { | 1354 | { |
1355 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_LOOSE, | 1355 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_LOOSE, |
@@ -1357,7 +1357,7 @@ static struct ctl_table tcp_compat_sysctl_table[] = { | |||
1357 | .data = &nf_ct_tcp_loose, | 1357 | .data = &nf_ct_tcp_loose, |
1358 | .maxlen = sizeof(unsigned int), | 1358 | .maxlen = sizeof(unsigned int), |
1359 | .mode = 0644, | 1359 | .mode = 0644, |
1360 | .proc_handler = &proc_dointvec, | 1360 | .proc_handler = proc_dointvec, |
1361 | }, | 1361 | }, |
1362 | { | 1362 | { |
1363 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL, | 1363 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL, |
@@ -1365,7 +1365,7 @@ static struct ctl_table tcp_compat_sysctl_table[] = { | |||
1365 | .data = &nf_ct_tcp_be_liberal, | 1365 | .data = &nf_ct_tcp_be_liberal, |
1366 | .maxlen = sizeof(unsigned int), | 1366 | .maxlen = sizeof(unsigned int), |
1367 | .mode = 0644, | 1367 | .mode = 0644, |
1368 | .proc_handler = &proc_dointvec, | 1368 | .proc_handler = proc_dointvec, |
1369 | }, | 1369 | }, |
1370 | { | 1370 | { |
1371 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS, | 1371 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS, |
@@ -1373,7 +1373,7 @@ static struct ctl_table tcp_compat_sysctl_table[] = { | |||
1373 | .data = &nf_ct_tcp_max_retrans, | 1373 | .data = &nf_ct_tcp_max_retrans, |
1374 | .maxlen = sizeof(unsigned int), | 1374 | .maxlen = sizeof(unsigned int), |
1375 | .mode = 0644, | 1375 | .mode = 0644, |
1376 | .proc_handler = &proc_dointvec, | 1376 | .proc_handler = proc_dointvec, |
1377 | }, | 1377 | }, |
1378 | { | 1378 | { |
1379 | .ctl_name = 0 | 1379 | .ctl_name = 0 |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index 7c2ca48698be..2b8b1f579f93 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -143,14 +143,14 @@ static struct ctl_table udp_sysctl_table[] = { | |||
143 | .data = &nf_ct_udp_timeout, | 143 | .data = &nf_ct_udp_timeout, |
144 | .maxlen = sizeof(unsigned int), | 144 | .maxlen = sizeof(unsigned int), |
145 | .mode = 0644, | 145 | .mode = 0644, |
146 | .proc_handler = &proc_dointvec_jiffies, | 146 | .proc_handler = proc_dointvec_jiffies, |
147 | }, | 147 | }, |
148 | { | 148 | { |
149 | .procname = "nf_conntrack_udp_timeout_stream", | 149 | .procname = "nf_conntrack_udp_timeout_stream", |
150 | .data = &nf_ct_udp_timeout_stream, | 150 | .data = &nf_ct_udp_timeout_stream, |
151 | .maxlen = sizeof(unsigned int), | 151 | .maxlen = sizeof(unsigned int), |
152 | .mode = 0644, | 152 | .mode = 0644, |
153 | .proc_handler = &proc_dointvec_jiffies, | 153 | .proc_handler = proc_dointvec_jiffies, |
154 | }, | 154 | }, |
155 | { | 155 | { |
156 | .ctl_name = 0 | 156 | .ctl_name = 0 |
@@ -163,14 +163,14 @@ static struct ctl_table udp_compat_sysctl_table[] = { | |||
163 | .data = &nf_ct_udp_timeout, | 163 | .data = &nf_ct_udp_timeout, |
164 | .maxlen = sizeof(unsigned int), | 164 | .maxlen = sizeof(unsigned int), |
165 | .mode = 0644, | 165 | .mode = 0644, |
166 | .proc_handler = &proc_dointvec_jiffies, | 166 | .proc_handler = proc_dointvec_jiffies, |
167 | }, | 167 | }, |
168 | { | 168 | { |
169 | .procname = "ip_conntrack_udp_timeout_stream", | 169 | .procname = "ip_conntrack_udp_timeout_stream", |
170 | .data = &nf_ct_udp_timeout_stream, | 170 | .data = &nf_ct_udp_timeout_stream, |
171 | .maxlen = sizeof(unsigned int), | 171 | .maxlen = sizeof(unsigned int), |
172 | .mode = 0644, | 172 | .mode = 0644, |
173 | .proc_handler = &proc_dointvec_jiffies, | 173 | .proc_handler = proc_dointvec_jiffies, |
174 | }, | 174 | }, |
175 | { | 175 | { |
176 | .ctl_name = 0 | 176 | .ctl_name = 0 |
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index d22d839e4f94..4579d8de13b1 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
@@ -151,7 +151,7 @@ static struct ctl_table udplite_sysctl_table[] = { | |||
151 | .data = &nf_ct_udplite_timeout, | 151 | .data = &nf_ct_udplite_timeout, |
152 | .maxlen = sizeof(unsigned int), | 152 | .maxlen = sizeof(unsigned int), |
153 | .mode = 0644, | 153 | .mode = 0644, |
154 | .proc_handler = &proc_dointvec_jiffies, | 154 | .proc_handler = proc_dointvec_jiffies, |
155 | }, | 155 | }, |
156 | { | 156 | { |
157 | .ctl_name = CTL_UNNUMBERED, | 157 | .ctl_name = CTL_UNNUMBERED, |
@@ -159,7 +159,7 @@ static struct ctl_table udplite_sysctl_table[] = { | |||
159 | .data = &nf_ct_udplite_timeout_stream, | 159 | .data = &nf_ct_udplite_timeout_stream, |
160 | .maxlen = sizeof(unsigned int), | 160 | .maxlen = sizeof(unsigned int), |
161 | .mode = 0644, | 161 | .mode = 0644, |
162 | .proc_handler = &proc_dointvec_jiffies, | 162 | .proc_handler = proc_dointvec_jiffies, |
163 | }, | 163 | }, |
164 | { | 164 | { |
165 | .ctl_name = 0 | 165 | .ctl_name = 0 |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 98106d4e89f0..f37b9b74c6a8 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -336,7 +336,7 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
336 | .data = &nf_conntrack_max, | 336 | .data = &nf_conntrack_max, |
337 | .maxlen = sizeof(int), | 337 | .maxlen = sizeof(int), |
338 | .mode = 0644, | 338 | .mode = 0644, |
339 | .proc_handler = &proc_dointvec, | 339 | .proc_handler = proc_dointvec, |
340 | }, | 340 | }, |
341 | { | 341 | { |
342 | .ctl_name = NET_NF_CONNTRACK_COUNT, | 342 | .ctl_name = NET_NF_CONNTRACK_COUNT, |
@@ -344,7 +344,7 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
344 | .data = &init_net.ct.count, | 344 | .data = &init_net.ct.count, |
345 | .maxlen = sizeof(int), | 345 | .maxlen = sizeof(int), |
346 | .mode = 0444, | 346 | .mode = 0444, |
347 | .proc_handler = &proc_dointvec, | 347 | .proc_handler = proc_dointvec, |
348 | }, | 348 | }, |
349 | { | 349 | { |
350 | .ctl_name = NET_NF_CONNTRACK_BUCKETS, | 350 | .ctl_name = NET_NF_CONNTRACK_BUCKETS, |
@@ -352,7 +352,7 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
352 | .data = &nf_conntrack_htable_size, | 352 | .data = &nf_conntrack_htable_size, |
353 | .maxlen = sizeof(unsigned int), | 353 | .maxlen = sizeof(unsigned int), |
354 | .mode = 0444, | 354 | .mode = 0444, |
355 | .proc_handler = &proc_dointvec, | 355 | .proc_handler = proc_dointvec, |
356 | }, | 356 | }, |
357 | { | 357 | { |
358 | .ctl_name = NET_NF_CONNTRACK_CHECKSUM, | 358 | .ctl_name = NET_NF_CONNTRACK_CHECKSUM, |
@@ -360,7 +360,7 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
360 | .data = &init_net.ct.sysctl_checksum, | 360 | .data = &init_net.ct.sysctl_checksum, |
361 | .maxlen = sizeof(unsigned int), | 361 | .maxlen = sizeof(unsigned int), |
362 | .mode = 0644, | 362 | .mode = 0644, |
363 | .proc_handler = &proc_dointvec, | 363 | .proc_handler = proc_dointvec, |
364 | }, | 364 | }, |
365 | { | 365 | { |
366 | .ctl_name = NET_NF_CONNTRACK_LOG_INVALID, | 366 | .ctl_name = NET_NF_CONNTRACK_LOG_INVALID, |
@@ -368,8 +368,8 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
368 | .data = &init_net.ct.sysctl_log_invalid, | 368 | .data = &init_net.ct.sysctl_log_invalid, |
369 | .maxlen = sizeof(unsigned int), | 369 | .maxlen = sizeof(unsigned int), |
370 | .mode = 0644, | 370 | .mode = 0644, |
371 | .proc_handler = &proc_dointvec_minmax, | 371 | .proc_handler = proc_dointvec_minmax, |
372 | .strategy = &sysctl_intvec, | 372 | .strategy = sysctl_intvec, |
373 | .extra1 = &log_invalid_proto_min, | 373 | .extra1 = &log_invalid_proto_min, |
374 | .extra2 = &log_invalid_proto_max, | 374 | .extra2 = &log_invalid_proto_max, |
375 | }, | 375 | }, |
@@ -379,7 +379,7 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
379 | .data = &nf_ct_expect_max, | 379 | .data = &nf_ct_expect_max, |
380 | .maxlen = sizeof(int), | 380 | .maxlen = sizeof(int), |
381 | .mode = 0644, | 381 | .mode = 0644, |
382 | .proc_handler = &proc_dointvec, | 382 | .proc_handler = proc_dointvec, |
383 | }, | 383 | }, |
384 | { .ctl_name = 0 } | 384 | { .ctl_name = 0 } |
385 | }; | 385 | }; |
@@ -393,7 +393,7 @@ static ctl_table nf_ct_netfilter_table[] = { | |||
393 | .data = &nf_conntrack_max, | 393 | .data = &nf_conntrack_max, |
394 | .maxlen = sizeof(int), | 394 | .maxlen = sizeof(int), |
395 | .mode = 0644, | 395 | .mode = 0644, |
396 | .proc_handler = &proc_dointvec, | 396 | .proc_handler = proc_dointvec, |
397 | }, | 397 | }, |
398 | { .ctl_name = 0 } | 398 | { .ctl_name = 0 } |
399 | }; | 399 | }; |
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 6fc4292d46e6..f97fded024c4 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -893,23 +893,21 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | |||
893 | 893 | ||
894 | switch (family) { | 894 | switch (family) { |
895 | case NFPROTO_IPV4: | 895 | case NFPROTO_IPV4: |
896 | return seq_printf(s, "%ld %u.%u.%u.%u:%u->" | 896 | return seq_printf(s, "%ld %pI4:%u->%pI4:%u %u %u %u\n", |
897 | "%u.%u.%u.%u:%u %u %u %u\n", | ||
898 | (long)(ent->expires - jiffies)/HZ, | 897 | (long)(ent->expires - jiffies)/HZ, |
899 | NIPQUAD(ent->dst.ip.src), | 898 | &ent->dst.ip.src, |
900 | ntohs(ent->dst.src_port), | 899 | ntohs(ent->dst.src_port), |
901 | NIPQUAD(ent->dst.ip.dst), | 900 | &ent->dst.ip.dst, |
902 | ntohs(ent->dst.dst_port), | 901 | ntohs(ent->dst.dst_port), |
903 | ent->rateinfo.credit, ent->rateinfo.credit_cap, | 902 | ent->rateinfo.credit, ent->rateinfo.credit_cap, |
904 | ent->rateinfo.cost); | 903 | ent->rateinfo.cost); |
905 | #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) | 904 | #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) |
906 | case NFPROTO_IPV6: | 905 | case NFPROTO_IPV6: |
907 | return seq_printf(s, "%ld " NIP6_FMT ":%u->" | 906 | 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, | 907 | (long)(ent->expires - jiffies)/HZ, |
910 | NIP6(*(struct in6_addr *)&ent->dst.ip6.src), | 908 | &ent->dst.ip6.src, |
911 | ntohs(ent->dst.src_port), | 909 | ntohs(ent->dst.src_port), |
912 | NIP6(*(struct in6_addr *)&ent->dst.ip6.dst), | 910 | &ent->dst.ip6.dst, |
913 | ntohs(ent->dst.dst_port), | 911 | ntohs(ent->dst.dst_port), |
914 | ent->rateinfo.credit, ent->rateinfo.credit_cap, | 912 | ent->rateinfo.credit, ent->rateinfo.credit_cap, |
915 | ent->rateinfo.cost); | 913 | ent->rateinfo.cost); |
diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c index 7ac54eab0b00..501f9b623188 100644 --- a/net/netfilter/xt_iprange.c +++ b/net/netfilter/xt_iprange.c | |||
@@ -26,12 +26,11 @@ iprange_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par) | |||
26 | if ((ntohl(iph->saddr) < ntohl(info->src.min_ip) | 26 | if ((ntohl(iph->saddr) < ntohl(info->src.min_ip) |
27 | || ntohl(iph->saddr) > ntohl(info->src.max_ip)) | 27 | || ntohl(iph->saddr) > ntohl(info->src.max_ip)) |
28 | ^ !!(info->flags & IPRANGE_SRC_INV)) { | 28 | ^ !!(info->flags & IPRANGE_SRC_INV)) { |
29 | pr_debug("src IP %u.%u.%u.%u NOT in range %s" | 29 | pr_debug("src IP %pI4 NOT in range %s%pI4-%pI4\n", |
30 | "%u.%u.%u.%u-%u.%u.%u.%u\n", | 30 | &iph->saddr, |
31 | NIPQUAD(iph->saddr), | ||
32 | info->flags & IPRANGE_SRC_INV ? "(INV) " : "", | 31 | info->flags & IPRANGE_SRC_INV ? "(INV) " : "", |
33 | NIPQUAD(info->src.min_ip), | 32 | &info->src.min_ip, |
34 | NIPQUAD(info->src.max_ip)); | 33 | &info->src.max_ip); |
35 | return false; | 34 | return false; |
36 | } | 35 | } |
37 | } | 36 | } |
@@ -39,12 +38,11 @@ iprange_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par) | |||
39 | if ((ntohl(iph->daddr) < ntohl(info->dst.min_ip) | 38 | if ((ntohl(iph->daddr) < ntohl(info->dst.min_ip) |
40 | || ntohl(iph->daddr) > ntohl(info->dst.max_ip)) | 39 | || ntohl(iph->daddr) > ntohl(info->dst.max_ip)) |
41 | ^ !!(info->flags & IPRANGE_DST_INV)) { | 40 | ^ !!(info->flags & IPRANGE_DST_INV)) { |
42 | pr_debug("dst IP %u.%u.%u.%u NOT in range %s" | 41 | pr_debug("dst IP %pI4 NOT in range %s%pI4-%pI4\n", |
43 | "%u.%u.%u.%u-%u.%u.%u.%u\n", | 42 | &iph->daddr, |
44 | NIPQUAD(iph->daddr), | ||
45 | info->flags & IPRANGE_DST_INV ? "(INV) " : "", | 43 | info->flags & IPRANGE_DST_INV ? "(INV) " : "", |
46 | NIPQUAD(info->dst.min_ip), | 44 | &info->dst.min_ip, |
47 | NIPQUAD(info->dst.max_ip)); | 45 | &info->dst.max_ip); |
48 | return false; | 46 | return false; |
49 | } | 47 | } |
50 | } | 48 | } |
@@ -63,12 +61,11 @@ iprange_mt4(const struct sk_buff *skb, const struct xt_match_param *par) | |||
63 | m |= ntohl(iph->saddr) > ntohl(info->src_max.ip); | 61 | m |= ntohl(iph->saddr) > ntohl(info->src_max.ip); |
64 | m ^= !!(info->flags & IPRANGE_SRC_INV); | 62 | m ^= !!(info->flags & IPRANGE_SRC_INV); |
65 | if (m) { | 63 | if (m) { |
66 | pr_debug("src IP " NIPQUAD_FMT " NOT in range %s" | 64 | pr_debug("src IP %pI4 NOT in range %s%pI4-%pI4\n", |
67 | NIPQUAD_FMT "-" NIPQUAD_FMT "\n", | 65 | &iph->saddr, |
68 | NIPQUAD(iph->saddr), | ||
69 | (info->flags & IPRANGE_SRC_INV) ? "(INV) " : "", | 66 | (info->flags & IPRANGE_SRC_INV) ? "(INV) " : "", |
70 | NIPQUAD(info->src_max.ip), | 67 | &info->src_max.ip, |
71 | NIPQUAD(info->src_max.ip)); | 68 | &info->src_max.ip); |
72 | return false; | 69 | return false; |
73 | } | 70 | } |
74 | } | 71 | } |
@@ -77,12 +74,11 @@ iprange_mt4(const struct sk_buff *skb, const struct xt_match_param *par) | |||
77 | m |= ntohl(iph->daddr) > ntohl(info->dst_max.ip); | 74 | m |= ntohl(iph->daddr) > ntohl(info->dst_max.ip); |
78 | m ^= !!(info->flags & IPRANGE_DST_INV); | 75 | m ^= !!(info->flags & IPRANGE_DST_INV); |
79 | if (m) { | 76 | if (m) { |
80 | pr_debug("dst IP " NIPQUAD_FMT " NOT in range %s" | 77 | pr_debug("dst IP %pI4 NOT in range %s%pI4-%pI4\n", |
81 | NIPQUAD_FMT "-" NIPQUAD_FMT "\n", | 78 | &iph->daddr, |
82 | NIPQUAD(iph->daddr), | ||
83 | (info->flags & IPRANGE_DST_INV) ? "(INV) " : "", | 79 | (info->flags & IPRANGE_DST_INV) ? "(INV) " : "", |
84 | NIPQUAD(info->dst_min.ip), | 80 | &info->dst_min.ip, |
85 | NIPQUAD(info->dst_max.ip)); | 81 | &info->dst_max.ip); |
86 | return false; | 82 | return false; |
87 | } | 83 | } |
88 | } | 84 | } |
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index 280c471bcdf4..3c3dd22b1d06 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
@@ -422,13 +422,11 @@ static int recent_seq_show(struct seq_file *seq, void *v) | |||
422 | 422 | ||
423 | i = (e->index - 1) % ip_pkt_list_tot; | 423 | i = (e->index - 1) % ip_pkt_list_tot; |
424 | if (e->family == NFPROTO_IPV4) | 424 | if (e->family == NFPROTO_IPV4) |
425 | seq_printf(seq, "src=" NIPQUAD_FMT " ttl: %u last_seen: %lu " | 425 | seq_printf(seq, "src=%pI4 ttl: %u last_seen: %lu oldest_pkt: %u", |
426 | "oldest_pkt: %u", NIPQUAD(e->addr.ip), e->ttl, | 426 | &e->addr.ip, e->ttl, e->stamps[i], e->index); |
427 | e->stamps[i], e->index); | ||
428 | else | 427 | else |
429 | seq_printf(seq, "src=" NIP6_FMT " ttl: %u last_seen: %lu " | 428 | seq_printf(seq, "src=%pI6 ttl: %u last_seen: %lu oldest_pkt: %u", |
430 | "oldest_pkt: %u", NIP6(e->addr.in6), e->ttl, | 429 | &e->addr.in6, e->ttl, e->stamps[i], e->index); |
431 | e->stamps[i], e->index); | ||
432 | for (i = 0; i < e->nstamps; i++) | 430 | for (i = 0; i < e->nstamps; i++) |
433 | seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]); | 431 | seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]); |
434 | seq_printf(seq, "\n"); | 432 | seq_printf(seq, "\n"); |
diff --git a/net/netlabel/netlabel_addrlist.c b/net/netlabel/netlabel_addrlist.c index 249f6b92f153..834c6eb7f484 100644 --- a/net/netlabel/netlabel_addrlist.c +++ b/net/netlabel/netlabel_addrlist.c | |||
@@ -337,7 +337,7 @@ void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf, | |||
337 | 337 | ||
338 | if (dev != NULL) | 338 | if (dev != NULL) |
339 | audit_log_format(audit_buf, " netif=%s", dev); | 339 | audit_log_format(audit_buf, " netif=%s", dev); |
340 | audit_log_format(audit_buf, " %s=" NIPQUAD_FMT, dir, NIPQUAD(addr)); | 340 | audit_log_format(audit_buf, " %s=%pI4", dir, &addr); |
341 | if (mask_val != 0xffffffff) { | 341 | if (mask_val != 0xffffffff) { |
342 | u32 mask_len = 0; | 342 | u32 mask_len = 0; |
343 | while (mask_val > 0) { | 343 | while (mask_val > 0) { |
@@ -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 | */ |
236 | int nla_memcpy(void *dest, struct nlattr *src, int count) | 236 | int 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/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c index 34c96c9674df..7b49591fe87c 100644 --- a/net/netrom/sysctl_net_netrom.c +++ b/net/netrom/sysctl_net_netrom.c | |||
@@ -41,8 +41,8 @@ static ctl_table nr_table[] = { | |||
41 | .data = &sysctl_netrom_default_path_quality, | 41 | .data = &sysctl_netrom_default_path_quality, |
42 | .maxlen = sizeof(int), | 42 | .maxlen = sizeof(int), |
43 | .mode = 0644, | 43 | .mode = 0644, |
44 | .proc_handler = &proc_dointvec_minmax, | 44 | .proc_handler = proc_dointvec_minmax, |
45 | .strategy = &sysctl_intvec, | 45 | .strategy = sysctl_intvec, |
46 | .extra1 = &min_quality, | 46 | .extra1 = &min_quality, |
47 | .extra2 = &max_quality | 47 | .extra2 = &max_quality |
48 | }, | 48 | }, |
@@ -52,8 +52,8 @@ static ctl_table nr_table[] = { | |||
52 | .data = &sysctl_netrom_obsolescence_count_initialiser, | 52 | .data = &sysctl_netrom_obsolescence_count_initialiser, |
53 | .maxlen = sizeof(int), | 53 | .maxlen = sizeof(int), |
54 | .mode = 0644, | 54 | .mode = 0644, |
55 | .proc_handler = &proc_dointvec_minmax, | 55 | .proc_handler = proc_dointvec_minmax, |
56 | .strategy = &sysctl_intvec, | 56 | .strategy = sysctl_intvec, |
57 | .extra1 = &min_obs, | 57 | .extra1 = &min_obs, |
58 | .extra2 = &max_obs | 58 | .extra2 = &max_obs |
59 | }, | 59 | }, |
@@ -63,8 +63,8 @@ static ctl_table nr_table[] = { | |||
63 | .data = &sysctl_netrom_network_ttl_initialiser, | 63 | .data = &sysctl_netrom_network_ttl_initialiser, |
64 | .maxlen = sizeof(int), | 64 | .maxlen = sizeof(int), |
65 | .mode = 0644, | 65 | .mode = 0644, |
66 | .proc_handler = &proc_dointvec_minmax, | 66 | .proc_handler = proc_dointvec_minmax, |
67 | .strategy = &sysctl_intvec, | 67 | .strategy = sysctl_intvec, |
68 | .extra1 = &min_ttl, | 68 | .extra1 = &min_ttl, |
69 | .extra2 = &max_ttl | 69 | .extra2 = &max_ttl |
70 | }, | 70 | }, |
@@ -74,8 +74,8 @@ static ctl_table nr_table[] = { | |||
74 | .data = &sysctl_netrom_transport_timeout, | 74 | .data = &sysctl_netrom_transport_timeout, |
75 | .maxlen = sizeof(int), | 75 | .maxlen = sizeof(int), |
76 | .mode = 0644, | 76 | .mode = 0644, |
77 | .proc_handler = &proc_dointvec_minmax, | 77 | .proc_handler = proc_dointvec_minmax, |
78 | .strategy = &sysctl_intvec, | 78 | .strategy = sysctl_intvec, |
79 | .extra1 = &min_t1, | 79 | .extra1 = &min_t1, |
80 | .extra2 = &max_t1 | 80 | .extra2 = &max_t1 |
81 | }, | 81 | }, |
@@ -85,8 +85,8 @@ static ctl_table nr_table[] = { | |||
85 | .data = &sysctl_netrom_transport_maximum_tries, | 85 | .data = &sysctl_netrom_transport_maximum_tries, |
86 | .maxlen = sizeof(int), | 86 | .maxlen = sizeof(int), |
87 | .mode = 0644, | 87 | .mode = 0644, |
88 | .proc_handler = &proc_dointvec_minmax, | 88 | .proc_handler = proc_dointvec_minmax, |
89 | .strategy = &sysctl_intvec, | 89 | .strategy = sysctl_intvec, |
90 | .extra1 = &min_n2, | 90 | .extra1 = &min_n2, |
91 | .extra2 = &max_n2 | 91 | .extra2 = &max_n2 |
92 | }, | 92 | }, |
@@ -96,8 +96,8 @@ static ctl_table nr_table[] = { | |||
96 | .data = &sysctl_netrom_transport_acknowledge_delay, | 96 | .data = &sysctl_netrom_transport_acknowledge_delay, |
97 | .maxlen = sizeof(int), | 97 | .maxlen = sizeof(int), |
98 | .mode = 0644, | 98 | .mode = 0644, |
99 | .proc_handler = &proc_dointvec_minmax, | 99 | .proc_handler = proc_dointvec_minmax, |
100 | .strategy = &sysctl_intvec, | 100 | .strategy = sysctl_intvec, |
101 | .extra1 = &min_t2, | 101 | .extra1 = &min_t2, |
102 | .extra2 = &max_t2 | 102 | .extra2 = &max_t2 |
103 | }, | 103 | }, |
@@ -107,8 +107,8 @@ static ctl_table nr_table[] = { | |||
107 | .data = &sysctl_netrom_transport_busy_delay, | 107 | .data = &sysctl_netrom_transport_busy_delay, |
108 | .maxlen = sizeof(int), | 108 | .maxlen = sizeof(int), |
109 | .mode = 0644, | 109 | .mode = 0644, |
110 | .proc_handler = &proc_dointvec_minmax, | 110 | .proc_handler = proc_dointvec_minmax, |
111 | .strategy = &sysctl_intvec, | 111 | .strategy = sysctl_intvec, |
112 | .extra1 = &min_t4, | 112 | .extra1 = &min_t4, |
113 | .extra2 = &max_t4 | 113 | .extra2 = &max_t4 |
114 | }, | 114 | }, |
@@ -118,8 +118,8 @@ static ctl_table nr_table[] = { | |||
118 | .data = &sysctl_netrom_transport_requested_window_size, | 118 | .data = &sysctl_netrom_transport_requested_window_size, |
119 | .maxlen = sizeof(int), | 119 | .maxlen = sizeof(int), |
120 | .mode = 0644, | 120 | .mode = 0644, |
121 | .proc_handler = &proc_dointvec_minmax, | 121 | .proc_handler = proc_dointvec_minmax, |
122 | .strategy = &sysctl_intvec, | 122 | .strategy = sysctl_intvec, |
123 | .extra1 = &min_window, | 123 | .extra1 = &min_window, |
124 | .extra2 = &max_window | 124 | .extra2 = &max_window |
125 | }, | 125 | }, |
@@ -129,8 +129,8 @@ static ctl_table nr_table[] = { | |||
129 | .data = &sysctl_netrom_transport_no_activity_timeout, | 129 | .data = &sysctl_netrom_transport_no_activity_timeout, |
130 | .maxlen = sizeof(int), | 130 | .maxlen = sizeof(int), |
131 | .mode = 0644, | 131 | .mode = 0644, |
132 | .proc_handler = &proc_dointvec_minmax, | 132 | .proc_handler = proc_dointvec_minmax, |
133 | .strategy = &sysctl_intvec, | 133 | .strategy = sysctl_intvec, |
134 | .extra1 = &min_idle, | 134 | .extra1 = &min_idle, |
135 | .extra2 = &max_idle | 135 | .extra2 = &max_idle |
136 | }, | 136 | }, |
@@ -140,8 +140,8 @@ static ctl_table nr_table[] = { | |||
140 | .data = &sysctl_netrom_routing_control, | 140 | .data = &sysctl_netrom_routing_control, |
141 | .maxlen = sizeof(int), | 141 | .maxlen = sizeof(int), |
142 | .mode = 0644, | 142 | .mode = 0644, |
143 | .proc_handler = &proc_dointvec_minmax, | 143 | .proc_handler = proc_dointvec_minmax, |
144 | .strategy = &sysctl_intvec, | 144 | .strategy = sysctl_intvec, |
145 | .extra1 = &min_route, | 145 | .extra1 = &min_route, |
146 | .extra2 = &max_route | 146 | .extra2 = &max_route |
147 | }, | 147 | }, |
@@ -151,8 +151,8 @@ static ctl_table nr_table[] = { | |||
151 | .data = &sysctl_netrom_link_fails_count, | 151 | .data = &sysctl_netrom_link_fails_count, |
152 | .maxlen = sizeof(int), | 152 | .maxlen = sizeof(int), |
153 | .mode = 0644, | 153 | .mode = 0644, |
154 | .proc_handler = &proc_dointvec_minmax, | 154 | .proc_handler = proc_dointvec_minmax, |
155 | .strategy = &sysctl_intvec, | 155 | .strategy = sysctl_intvec, |
156 | .extra1 = &min_fails, | 156 | .extra1 = &min_fails, |
157 | .extra2 = &max_fails | 157 | .extra2 = &max_fails |
158 | }, | 158 | }, |
@@ -162,8 +162,8 @@ static ctl_table nr_table[] = { | |||
162 | .data = &sysctl_netrom_reset_circuit, | 162 | .data = &sysctl_netrom_reset_circuit, |
163 | .maxlen = sizeof(int), | 163 | .maxlen = sizeof(int), |
164 | .mode = 0644, | 164 | .mode = 0644, |
165 | .proc_handler = &proc_dointvec_minmax, | 165 | .proc_handler = proc_dointvec_minmax, |
166 | .strategy = &sysctl_intvec, | 166 | .strategy = sysctl_intvec, |
167 | .extra1 = &min_reset, | 167 | .extra1 = &min_reset, |
168 | .extra2 = &max_reset | 168 | .extra2 = &max_reset |
169 | }, | 169 | }, |
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index defeb7a0d502..f400ff168904 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -35,7 +35,11 @@ | |||
35 | 35 | ||
36 | static struct net_proto_family phonet_proto_family; | 36 | static struct net_proto_family phonet_proto_family; |
37 | static struct phonet_protocol *phonet_proto_get(int protocol); | 37 | static struct phonet_protocol *phonet_proto_get(int protocol); |
38 | static inline void phonet_proto_put(struct phonet_protocol *pp); | 38 | |
39 | static inline void phonet_proto_put(struct phonet_protocol *pp) | ||
40 | { | ||
41 | module_put(pp->prot->owner); | ||
42 | } | ||
39 | 43 | ||
40 | /* protocol family functions */ | 44 | /* protocol family functions */ |
41 | 45 | ||
@@ -428,11 +432,6 @@ static struct phonet_protocol *phonet_proto_get(int protocol) | |||
428 | return pp; | 432 | return pp; |
429 | } | 433 | } |
430 | 434 | ||
431 | static inline void phonet_proto_put(struct phonet_protocol *pp) | ||
432 | { | ||
433 | module_put(pp->prot->owner); | ||
434 | } | ||
435 | |||
436 | /* Module registration */ | 435 | /* Module registration */ |
437 | static int __init phonet_init(void) | 436 | static int __init phonet_init(void) |
438 | { | 437 | { |
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c index 9978afbd9f2a..e6e8e44852e5 100644 --- a/net/phonet/pep-gprs.c +++ b/net/phonet/pep-gprs.c | |||
@@ -41,7 +41,6 @@ struct gprs_dev { | |||
41 | void (*old_write_space)(struct sock *); | 41 | void (*old_write_space)(struct sock *); |
42 | 42 | ||
43 | struct net_device *net; | 43 | struct net_device *net; |
44 | struct net_device_stats stats; | ||
45 | 44 | ||
46 | struct sk_buff_head tx_queue; | 45 | struct sk_buff_head tx_queue; |
47 | struct work_struct tx_work; | 46 | struct work_struct tx_work; |
@@ -49,14 +48,14 @@ struct gprs_dev { | |||
49 | unsigned tx_max; | 48 | unsigned tx_max; |
50 | }; | 49 | }; |
51 | 50 | ||
52 | static int gprs_type_trans(struct sk_buff *skb) | 51 | static __be16 gprs_type_trans(struct sk_buff *skb) |
53 | { | 52 | { |
54 | const u8 *pvfc; | 53 | const u8 *pvfc; |
55 | u8 buf; | 54 | u8 buf; |
56 | 55 | ||
57 | pvfc = skb_header_pointer(skb, 0, 1, &buf); | 56 | pvfc = skb_header_pointer(skb, 0, 1, &buf); |
58 | if (!pvfc) | 57 | if (!pvfc) |
59 | return 0; | 58 | return htons(0); |
60 | /* Look at IP version field */ | 59 | /* Look at IP version field */ |
61 | switch (*pvfc >> 4) { | 60 | switch (*pvfc >> 4) { |
62 | case 4: | 61 | case 4: |
@@ -64,7 +63,7 @@ static int gprs_type_trans(struct sk_buff *skb) | |||
64 | case 6: | 63 | case 6: |
65 | return htons(ETH_P_IPV6); | 64 | return htons(ETH_P_IPV6); |
66 | } | 65 | } |
67 | return 0; | 66 | return htons(0); |
68 | } | 67 | } |
69 | 68 | ||
70 | /* | 69 | /* |
@@ -83,8 +82,9 @@ static void gprs_state_change(struct sock *sk) | |||
83 | 82 | ||
84 | static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | 83 | static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) |
85 | { | 84 | { |
85 | struct net_device *net = dev->net; | ||
86 | int err = 0; | 86 | int err = 0; |
87 | u16 protocol = gprs_type_trans(skb); | 87 | __be16 protocol = gprs_type_trans(skb); |
88 | 88 | ||
89 | if (!protocol) { | 89 | if (!protocol) { |
90 | err = -EINVAL; | 90 | err = -EINVAL; |
@@ -99,7 +99,7 @@ static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | |||
99 | * so wrap the IP packet as a single fragment of an head-less | 99 | * so wrap the IP packet as a single fragment of an head-less |
100 | * socket buffer. The network stack will pull what it needs, | 100 | * socket buffer. The network stack will pull what it needs, |
101 | * but at least, the whole IP payload is not memcpy'd. */ | 101 | * but at least, the whole IP payload is not memcpy'd. */ |
102 | rskb = netdev_alloc_skb(dev->net, 0); | 102 | rskb = netdev_alloc_skb(net, 0); |
103 | if (!rskb) { | 103 | if (!rskb) { |
104 | err = -ENOBUFS; | 104 | err = -ENOBUFS; |
105 | goto drop; | 105 | goto drop; |
@@ -123,11 +123,11 @@ static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | |||
123 | 123 | ||
124 | skb->protocol = protocol; | 124 | skb->protocol = protocol; |
125 | skb_reset_mac_header(skb); | 125 | skb_reset_mac_header(skb); |
126 | skb->dev = dev->net; | 126 | skb->dev = net; |
127 | 127 | ||
128 | if (likely(dev->net->flags & IFF_UP)) { | 128 | if (likely(net->flags & IFF_UP)) { |
129 | dev->stats.rx_packets++; | 129 | net->stats.rx_packets++; |
130 | dev->stats.rx_bytes += skb->len; | 130 | net->stats.rx_bytes += skb->len; |
131 | netif_rx(skb); | 131 | netif_rx(skb); |
132 | skb = NULL; | 132 | skb = NULL; |
133 | } else | 133 | } else |
@@ -136,7 +136,7 @@ static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | |||
136 | drop: | 136 | drop: |
137 | if (skb) { | 137 | if (skb) { |
138 | dev_kfree_skb(skb); | 138 | dev_kfree_skb(skb); |
139 | dev->stats.rx_dropped++; | 139 | net->stats.rx_dropped++; |
140 | } | 140 | } |
141 | return err; | 141 | return err; |
142 | } | 142 | } |
@@ -199,14 +199,15 @@ static int gprs_xmit(struct sk_buff *skb, struct net_device *net) | |||
199 | static void gprs_tx(struct work_struct *work) | 199 | static void gprs_tx(struct work_struct *work) |
200 | { | 200 | { |
201 | struct gprs_dev *dev = container_of(work, struct gprs_dev, tx_work); | 201 | struct gprs_dev *dev = container_of(work, struct gprs_dev, tx_work); |
202 | struct net_device *net = dev->net; | ||
202 | struct sock *sk = dev->sk; | 203 | struct sock *sk = dev->sk; |
203 | struct sk_buff *skb; | 204 | struct sk_buff *skb; |
204 | 205 | ||
205 | while ((skb = skb_dequeue(&dev->tx_queue)) != NULL) { | 206 | while ((skb = skb_dequeue(&dev->tx_queue)) != NULL) { |
206 | int err; | 207 | int err; |
207 | 208 | ||
208 | dev->stats.tx_bytes += skb->len; | 209 | net->stats.tx_bytes += skb->len; |
209 | dev->stats.tx_packets++; | 210 | net->stats.tx_packets++; |
210 | 211 | ||
211 | skb_orphan(skb); | 212 | skb_orphan(skb); |
212 | skb_set_owner_w(skb, sk); | 213 | skb_set_owner_w(skb, sk); |
@@ -215,9 +216,9 @@ static void gprs_tx(struct work_struct *work) | |||
215 | err = pep_write(sk, skb); | 216 | err = pep_write(sk, skb); |
216 | if (err) { | 217 | if (err) { |
217 | LIMIT_NETDEBUG(KERN_WARNING"%s: TX error (%d)\n", | 218 | LIMIT_NETDEBUG(KERN_WARNING"%s: TX error (%d)\n", |
218 | dev->net->name, err); | 219 | net->name, err); |
219 | dev->stats.tx_aborted_errors++; | 220 | net->stats.tx_aborted_errors++; |
220 | dev->stats.tx_errors++; | 221 | net->stats.tx_errors++; |
221 | } | 222 | } |
222 | release_sock(sk); | 223 | release_sock(sk); |
223 | } | 224 | } |
@@ -236,13 +237,6 @@ static int gprs_set_mtu(struct net_device *net, int new_mtu) | |||
236 | return 0; | 237 | return 0; |
237 | } | 238 | } |
238 | 239 | ||
239 | static struct net_device_stats *gprs_get_stats(struct net_device *net) | ||
240 | { | ||
241 | struct gprs_dev *dev = netdev_priv(net); | ||
242 | |||
243 | return &dev->stats; | ||
244 | } | ||
245 | |||
246 | static void gprs_setup(struct net_device *net) | 240 | static void gprs_setup(struct net_device *net) |
247 | { | 241 | { |
248 | net->features = NETIF_F_FRAGLIST; | 242 | net->features = NETIF_F_FRAGLIST; |
@@ -256,7 +250,6 @@ static void gprs_setup(struct net_device *net) | |||
256 | net->destructor = free_netdev; | 250 | net->destructor = free_netdev; |
257 | net->hard_start_xmit = gprs_xmit; /* mandatory */ | 251 | net->hard_start_xmit = gprs_xmit; /* mandatory */ |
258 | net->change_mtu = gprs_set_mtu; | 252 | net->change_mtu = gprs_set_mtu; |
259 | net->get_stats = gprs_get_stats; | ||
260 | } | 253 | } |
261 | 254 | ||
262 | /* | 255 | /* |
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c index 600a4309b8c8..0e3347bbdb12 100644 --- a/net/phonet/sysctl.c +++ b/net/phonet/sysctl.c | |||
@@ -89,7 +89,7 @@ static struct ctl_table phonet_table[] = { | |||
89 | .data = &local_port_range, | 89 | .data = &local_port_range, |
90 | .maxlen = sizeof(local_port_range), | 90 | .maxlen = sizeof(local_port_range), |
91 | .mode = 0644, | 91 | .mode = 0644, |
92 | .proc_handler = &proc_local_port_range, | 92 | .proc_handler = proc_local_port_range, |
93 | .strategy = NULL, | 93 | .strategy = NULL, |
94 | }, | 94 | }, |
95 | { .ctl_name = 0 } | 95 | { .ctl_name = 0 } |
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c index bfdade72e066..84efde97c5a7 100644 --- a/net/rfkill/rfkill-input.c +++ b/net/rfkill/rfkill-input.c | |||
@@ -24,138 +24,318 @@ MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); | |||
24 | MODULE_DESCRIPTION("Input layer to RF switch connector"); | 24 | MODULE_DESCRIPTION("Input layer to RF switch connector"); |
25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
26 | 26 | ||
27 | enum rfkill_input_master_mode { | ||
28 | RFKILL_INPUT_MASTER_DONOTHING = 0, | ||
29 | RFKILL_INPUT_MASTER_RESTORE = 1, | ||
30 | RFKILL_INPUT_MASTER_UNBLOCKALL = 2, | ||
31 | RFKILL_INPUT_MASTER_MAX, /* marker */ | ||
32 | }; | ||
33 | |||
34 | /* Delay (in ms) between consecutive switch ops */ | ||
35 | #define RFKILL_OPS_DELAY 200 | ||
36 | |||
37 | static enum rfkill_input_master_mode rfkill_master_switch_mode = | ||
38 | RFKILL_INPUT_MASTER_UNBLOCKALL; | ||
39 | module_param_named(master_switch_mode, rfkill_master_switch_mode, uint, 0); | ||
40 | MODULE_PARM_DESC(master_switch_mode, | ||
41 | "SW_RFKILL_ALL ON should: 0=do nothing; 1=restore; 2=unblock all"); | ||
42 | |||
43 | enum rfkill_global_sched_op { | ||
44 | RFKILL_GLOBAL_OP_EPO = 0, | ||
45 | RFKILL_GLOBAL_OP_RESTORE, | ||
46 | RFKILL_GLOBAL_OP_UNLOCK, | ||
47 | RFKILL_GLOBAL_OP_UNBLOCK, | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * Currently, the code marked with RFKILL_NEED_SWSET is inactive. | ||
52 | * If handling of EV_SW SW_WLAN/WWAN/BLUETOOTH/etc is needed in the | ||
53 | * future, when such events are added, that code will be necessary. | ||
54 | */ | ||
55 | |||
27 | struct rfkill_task { | 56 | struct rfkill_task { |
28 | struct work_struct work; | 57 | struct delayed_work dwork; |
29 | enum rfkill_type type; | 58 | |
30 | struct mutex mutex; /* ensures that task is serialized */ | 59 | /* ensures that task is serialized */ |
31 | spinlock_t lock; /* for accessing last and desired state */ | 60 | struct mutex mutex; |
32 | unsigned long last; /* last schedule */ | 61 | |
33 | enum rfkill_state desired_state; /* on/off */ | 62 | /* protects everything below */ |
63 | spinlock_t lock; | ||
64 | |||
65 | /* pending regular switch operations (1=pending) */ | ||
66 | unsigned long sw_pending[BITS_TO_LONGS(RFKILL_TYPE_MAX)]; | ||
67 | |||
68 | #ifdef RFKILL_NEED_SWSET | ||
69 | /* set operation pending (1=pending) */ | ||
70 | unsigned long sw_setpending[BITS_TO_LONGS(RFKILL_TYPE_MAX)]; | ||
71 | |||
72 | /* desired state for pending set operation (1=unblock) */ | ||
73 | unsigned long sw_newstate[BITS_TO_LONGS(RFKILL_TYPE_MAX)]; | ||
74 | #endif | ||
75 | |||
76 | /* should the state be complemented (1=yes) */ | ||
77 | unsigned long sw_togglestate[BITS_TO_LONGS(RFKILL_TYPE_MAX)]; | ||
78 | |||
79 | bool global_op_pending; | ||
80 | enum rfkill_global_sched_op op; | ||
81 | |||
82 | /* last time it was scheduled */ | ||
83 | unsigned long last_scheduled; | ||
34 | }; | 84 | }; |
35 | 85 | ||
86 | static void __rfkill_handle_global_op(enum rfkill_global_sched_op op) | ||
87 | { | ||
88 | unsigned int i; | ||
89 | |||
90 | switch (op) { | ||
91 | case RFKILL_GLOBAL_OP_EPO: | ||
92 | rfkill_epo(); | ||
93 | break; | ||
94 | case RFKILL_GLOBAL_OP_RESTORE: | ||
95 | rfkill_restore_states(); | ||
96 | break; | ||
97 | case RFKILL_GLOBAL_OP_UNLOCK: | ||
98 | rfkill_remove_epo_lock(); | ||
99 | break; | ||
100 | case RFKILL_GLOBAL_OP_UNBLOCK: | ||
101 | rfkill_remove_epo_lock(); | ||
102 | for (i = 0; i < RFKILL_TYPE_MAX; i++) | ||
103 | rfkill_switch_all(i, RFKILL_STATE_UNBLOCKED); | ||
104 | break; | ||
105 | default: | ||
106 | /* memory corruption or bug, fail safely */ | ||
107 | rfkill_epo(); | ||
108 | WARN(1, "Unknown requested operation %d! " | ||
109 | "rfkill Emergency Power Off activated\n", | ||
110 | op); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | #ifdef RFKILL_NEED_SWSET | ||
115 | static void __rfkill_handle_normal_op(const enum rfkill_type type, | ||
116 | const bool sp, const bool s, const bool c) | ||
117 | { | ||
118 | enum rfkill_state state; | ||
119 | |||
120 | if (sp) | ||
121 | state = (s) ? RFKILL_STATE_UNBLOCKED : | ||
122 | RFKILL_STATE_SOFT_BLOCKED; | ||
123 | else | ||
124 | state = rfkill_get_global_state(type); | ||
125 | |||
126 | if (c) | ||
127 | state = rfkill_state_complement(state); | ||
128 | |||
129 | rfkill_switch_all(type, state); | ||
130 | } | ||
131 | #else | ||
132 | static void __rfkill_handle_normal_op(const enum rfkill_type type, | ||
133 | const bool c) | ||
134 | { | ||
135 | enum rfkill_state state; | ||
136 | |||
137 | state = rfkill_get_global_state(type); | ||
138 | if (c) | ||
139 | state = rfkill_state_complement(state); | ||
140 | |||
141 | rfkill_switch_all(type, state); | ||
142 | } | ||
143 | #endif | ||
144 | |||
36 | static void rfkill_task_handler(struct work_struct *work) | 145 | static void rfkill_task_handler(struct work_struct *work) |
37 | { | 146 | { |
38 | struct rfkill_task *task = container_of(work, struct rfkill_task, work); | 147 | struct rfkill_task *task = container_of(work, |
148 | struct rfkill_task, dwork.work); | ||
149 | bool doit = true; | ||
39 | 150 | ||
40 | mutex_lock(&task->mutex); | 151 | mutex_lock(&task->mutex); |
41 | 152 | ||
42 | rfkill_switch_all(task->type, task->desired_state); | 153 | spin_lock_irq(&task->lock); |
154 | while (doit) { | ||
155 | if (task->global_op_pending) { | ||
156 | enum rfkill_global_sched_op op = task->op; | ||
157 | task->global_op_pending = false; | ||
158 | memset(task->sw_pending, 0, sizeof(task->sw_pending)); | ||
159 | spin_unlock_irq(&task->lock); | ||
160 | |||
161 | __rfkill_handle_global_op(op); | ||
162 | |||
163 | /* make sure we do at least one pass with | ||
164 | * !task->global_op_pending */ | ||
165 | spin_lock_irq(&task->lock); | ||
166 | continue; | ||
167 | } else if (!rfkill_is_epo_lock_active()) { | ||
168 | unsigned int i = 0; | ||
169 | |||
170 | while (!task->global_op_pending && | ||
171 | i < RFKILL_TYPE_MAX) { | ||
172 | if (test_and_clear_bit(i, task->sw_pending)) { | ||
173 | bool c; | ||
174 | #ifdef RFKILL_NEED_SWSET | ||
175 | bool sp, s; | ||
176 | sp = test_and_clear_bit(i, | ||
177 | task->sw_setpending); | ||
178 | s = test_bit(i, task->sw_newstate); | ||
179 | #endif | ||
180 | c = test_and_clear_bit(i, | ||
181 | task->sw_togglestate); | ||
182 | spin_unlock_irq(&task->lock); | ||
183 | |||
184 | #ifdef RFKILL_NEED_SWSET | ||
185 | __rfkill_handle_normal_op(i, sp, s, c); | ||
186 | #else | ||
187 | __rfkill_handle_normal_op(i, c); | ||
188 | #endif | ||
189 | |||
190 | spin_lock_irq(&task->lock); | ||
191 | } | ||
192 | i++; | ||
193 | } | ||
194 | } | ||
195 | doit = task->global_op_pending; | ||
196 | } | ||
197 | spin_unlock_irq(&task->lock); | ||
43 | 198 | ||
44 | mutex_unlock(&task->mutex); | 199 | mutex_unlock(&task->mutex); |
45 | } | 200 | } |
46 | 201 | ||
47 | static void rfkill_task_epo_handler(struct work_struct *work) | 202 | static struct rfkill_task rfkill_task = { |
203 | .dwork = __DELAYED_WORK_INITIALIZER(rfkill_task.dwork, | ||
204 | rfkill_task_handler), | ||
205 | .mutex = __MUTEX_INITIALIZER(rfkill_task.mutex), | ||
206 | .lock = __SPIN_LOCK_UNLOCKED(rfkill_task.lock), | ||
207 | }; | ||
208 | |||
209 | static unsigned long rfkill_ratelimit(const unsigned long last) | ||
48 | { | 210 | { |
49 | rfkill_epo(); | 211 | const unsigned long delay = msecs_to_jiffies(RFKILL_OPS_DELAY); |
212 | return (time_after(jiffies, last + delay)) ? 0 : delay; | ||
50 | } | 213 | } |
51 | 214 | ||
52 | static DECLARE_WORK(epo_work, rfkill_task_epo_handler); | 215 | static void rfkill_schedule_ratelimited(void) |
216 | { | ||
217 | if (!delayed_work_pending(&rfkill_task.dwork)) { | ||
218 | schedule_delayed_work(&rfkill_task.dwork, | ||
219 | rfkill_ratelimit(rfkill_task.last_scheduled)); | ||
220 | rfkill_task.last_scheduled = jiffies; | ||
221 | } | ||
222 | } | ||
53 | 223 | ||
54 | static void rfkill_schedule_epo(void) | 224 | static void rfkill_schedule_global_op(enum rfkill_global_sched_op op) |
55 | { | 225 | { |
56 | schedule_work(&epo_work); | 226 | unsigned long flags; |
227 | |||
228 | spin_lock_irqsave(&rfkill_task.lock, flags); | ||
229 | rfkill_task.op = op; | ||
230 | rfkill_task.global_op_pending = true; | ||
231 | if (op == RFKILL_GLOBAL_OP_EPO && !rfkill_is_epo_lock_active()) { | ||
232 | /* bypass the limiter for EPO */ | ||
233 | cancel_delayed_work(&rfkill_task.dwork); | ||
234 | schedule_delayed_work(&rfkill_task.dwork, 0); | ||
235 | rfkill_task.last_scheduled = jiffies; | ||
236 | } else | ||
237 | rfkill_schedule_ratelimited(); | ||
238 | spin_unlock_irqrestore(&rfkill_task.lock, flags); | ||
57 | } | 239 | } |
58 | 240 | ||
59 | static void rfkill_schedule_set(struct rfkill_task *task, | 241 | #ifdef RFKILL_NEED_SWSET |
242 | /* Use this if you need to add EV_SW SW_WLAN/WWAN/BLUETOOTH/etc handling */ | ||
243 | |||
244 | static void rfkill_schedule_set(enum rfkill_type type, | ||
60 | enum rfkill_state desired_state) | 245 | enum rfkill_state desired_state) |
61 | { | 246 | { |
62 | unsigned long flags; | 247 | unsigned long flags; |
63 | 248 | ||
64 | if (unlikely(work_pending(&epo_work))) | 249 | if (rfkill_is_epo_lock_active()) |
65 | return; | 250 | return; |
66 | 251 | ||
67 | spin_lock_irqsave(&task->lock, flags); | 252 | spin_lock_irqsave(&rfkill_task.lock, flags); |
68 | 253 | if (!rfkill_task.global_op_pending) { | |
69 | if (time_after(jiffies, task->last + msecs_to_jiffies(200))) { | 254 | set_bit(type, rfkill_task.sw_pending); |
70 | task->desired_state = desired_state; | 255 | set_bit(type, rfkill_task.sw_setpending); |
71 | task->last = jiffies; | 256 | clear_bit(type, rfkill_task.sw_togglestate); |
72 | schedule_work(&task->work); | 257 | if (desired_state) |
258 | set_bit(type, rfkill_task.sw_newstate); | ||
259 | else | ||
260 | clear_bit(type, rfkill_task.sw_newstate); | ||
261 | rfkill_schedule_ratelimited(); | ||
73 | } | 262 | } |
74 | 263 | spin_unlock_irqrestore(&rfkill_task.lock, flags); | |
75 | spin_unlock_irqrestore(&task->lock, flags); | ||
76 | } | 264 | } |
265 | #endif | ||
77 | 266 | ||
78 | static void rfkill_schedule_toggle(struct rfkill_task *task) | 267 | static void rfkill_schedule_toggle(enum rfkill_type type) |
79 | { | 268 | { |
80 | unsigned long flags; | 269 | unsigned long flags; |
81 | 270 | ||
82 | if (unlikely(work_pending(&epo_work))) | 271 | if (rfkill_is_epo_lock_active()) |
83 | return; | 272 | return; |
84 | 273 | ||
85 | spin_lock_irqsave(&task->lock, flags); | 274 | spin_lock_irqsave(&rfkill_task.lock, flags); |
86 | 275 | if (!rfkill_task.global_op_pending) { | |
87 | if (time_after(jiffies, task->last + msecs_to_jiffies(200))) { | 276 | set_bit(type, rfkill_task.sw_pending); |
88 | task->desired_state = | 277 | change_bit(type, rfkill_task.sw_togglestate); |
89 | rfkill_state_complement(task->desired_state); | 278 | rfkill_schedule_ratelimited(); |
90 | task->last = jiffies; | ||
91 | schedule_work(&task->work); | ||
92 | } | 279 | } |
93 | 280 | spin_unlock_irqrestore(&rfkill_task.lock, flags); | |
94 | spin_unlock_irqrestore(&task->lock, flags); | ||
95 | } | 281 | } |
96 | 282 | ||
97 | #define DEFINE_RFKILL_TASK(n, t) \ | ||
98 | struct rfkill_task n = { \ | ||
99 | .work = __WORK_INITIALIZER(n.work, \ | ||
100 | rfkill_task_handler), \ | ||
101 | .type = t, \ | ||
102 | .mutex = __MUTEX_INITIALIZER(n.mutex), \ | ||
103 | .lock = __SPIN_LOCK_UNLOCKED(n.lock), \ | ||
104 | .desired_state = RFKILL_STATE_UNBLOCKED, \ | ||
105 | } | ||
106 | |||
107 | static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); | ||
108 | static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH); | ||
109 | static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB); | ||
110 | static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX); | ||
111 | static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN); | ||
112 | |||
113 | static void rfkill_schedule_evsw_rfkillall(int state) | 283 | static void rfkill_schedule_evsw_rfkillall(int state) |
114 | { | 284 | { |
115 | /* EVERY radio type. state != 0 means radios ON */ | ||
116 | /* handle EPO (emergency power off) through shortcut */ | ||
117 | if (state) { | 285 | if (state) { |
118 | rfkill_schedule_set(&rfkill_wwan, | 286 | switch (rfkill_master_switch_mode) { |
119 | RFKILL_STATE_UNBLOCKED); | 287 | case RFKILL_INPUT_MASTER_UNBLOCKALL: |
120 | rfkill_schedule_set(&rfkill_wimax, | 288 | rfkill_schedule_global_op(RFKILL_GLOBAL_OP_UNBLOCK); |
121 | RFKILL_STATE_UNBLOCKED); | 289 | break; |
122 | rfkill_schedule_set(&rfkill_uwb, | 290 | case RFKILL_INPUT_MASTER_RESTORE: |
123 | RFKILL_STATE_UNBLOCKED); | 291 | rfkill_schedule_global_op(RFKILL_GLOBAL_OP_RESTORE); |
124 | rfkill_schedule_set(&rfkill_bt, | 292 | break; |
125 | RFKILL_STATE_UNBLOCKED); | 293 | case RFKILL_INPUT_MASTER_DONOTHING: |
126 | rfkill_schedule_set(&rfkill_wlan, | 294 | rfkill_schedule_global_op(RFKILL_GLOBAL_OP_UNLOCK); |
127 | RFKILL_STATE_UNBLOCKED); | 295 | break; |
296 | default: | ||
297 | /* memory corruption or driver bug! fail safely */ | ||
298 | rfkill_schedule_global_op(RFKILL_GLOBAL_OP_EPO); | ||
299 | WARN(1, "Unknown rfkill_master_switch_mode (%d), " | ||
300 | "driver bug or memory corruption detected!\n", | ||
301 | rfkill_master_switch_mode); | ||
302 | break; | ||
303 | } | ||
128 | } else | 304 | } else |
129 | rfkill_schedule_epo(); | 305 | rfkill_schedule_global_op(RFKILL_GLOBAL_OP_EPO); |
130 | } | 306 | } |
131 | 307 | ||
132 | static void rfkill_event(struct input_handle *handle, unsigned int type, | 308 | static void rfkill_event(struct input_handle *handle, unsigned int type, |
133 | unsigned int code, int data) | 309 | unsigned int code, int data) |
134 | { | 310 | { |
135 | if (type == EV_KEY && data == 1) { | 311 | if (type == EV_KEY && data == 1) { |
312 | enum rfkill_type t; | ||
313 | |||
136 | switch (code) { | 314 | switch (code) { |
137 | case KEY_WLAN: | 315 | case KEY_WLAN: |
138 | rfkill_schedule_toggle(&rfkill_wlan); | 316 | t = RFKILL_TYPE_WLAN; |
139 | break; | 317 | break; |
140 | case KEY_BLUETOOTH: | 318 | case KEY_BLUETOOTH: |
141 | rfkill_schedule_toggle(&rfkill_bt); | 319 | t = RFKILL_TYPE_BLUETOOTH; |
142 | break; | 320 | break; |
143 | case KEY_UWB: | 321 | case KEY_UWB: |
144 | rfkill_schedule_toggle(&rfkill_uwb); | 322 | t = RFKILL_TYPE_UWB; |
145 | break; | 323 | break; |
146 | case KEY_WIMAX: | 324 | case KEY_WIMAX: |
147 | rfkill_schedule_toggle(&rfkill_wimax); | 325 | t = RFKILL_TYPE_WIMAX; |
148 | break; | 326 | break; |
149 | default: | 327 | default: |
150 | break; | 328 | return; |
151 | } | 329 | } |
330 | rfkill_schedule_toggle(t); | ||
331 | return; | ||
152 | } else if (type == EV_SW) { | 332 | } else if (type == EV_SW) { |
153 | switch (code) { | 333 | switch (code) { |
154 | case SW_RFKILL_ALL: | 334 | case SW_RFKILL_ALL: |
155 | rfkill_schedule_evsw_rfkillall(data); | 335 | rfkill_schedule_evsw_rfkillall(data); |
156 | break; | 336 | return; |
157 | default: | 337 | default: |
158 | break; | 338 | return; |
159 | } | 339 | } |
160 | } | 340 | } |
161 | } | 341 | } |
@@ -256,18 +436,23 @@ static struct input_handler rfkill_handler = { | |||
256 | 436 | ||
257 | static int __init rfkill_handler_init(void) | 437 | static int __init rfkill_handler_init(void) |
258 | { | 438 | { |
259 | unsigned long last_run = jiffies - msecs_to_jiffies(500); | 439 | if (rfkill_master_switch_mode >= RFKILL_INPUT_MASTER_MAX) |
260 | rfkill_wlan.last = last_run; | 440 | return -EINVAL; |
261 | rfkill_bt.last = last_run; | 441 | |
262 | rfkill_uwb.last = last_run; | 442 | /* |
263 | rfkill_wimax.last = last_run; | 443 | * The penalty to not doing this is a possible RFKILL_OPS_DELAY delay |
444 | * at the first use. Acceptable, but if we can avoid it, why not? | ||
445 | */ | ||
446 | rfkill_task.last_scheduled = | ||
447 | jiffies - msecs_to_jiffies(RFKILL_OPS_DELAY) - 1; | ||
264 | return input_register_handler(&rfkill_handler); | 448 | return input_register_handler(&rfkill_handler); |
265 | } | 449 | } |
266 | 450 | ||
267 | static void __exit rfkill_handler_exit(void) | 451 | static void __exit rfkill_handler_exit(void) |
268 | { | 452 | { |
269 | input_unregister_handler(&rfkill_handler); | 453 | input_unregister_handler(&rfkill_handler); |
270 | flush_scheduled_work(); | 454 | cancel_delayed_work_sync(&rfkill_task.dwork); |
455 | rfkill_remove_epo_lock(); | ||
271 | } | 456 | } |
272 | 457 | ||
273 | module_init(rfkill_handler_init); | 458 | module_init(rfkill_handler_init); |
diff --git a/net/rfkill/rfkill-input.h b/net/rfkill/rfkill-input.h index bbfa646157c6..fe8df6b5b935 100644 --- a/net/rfkill/rfkill-input.h +++ b/net/rfkill/rfkill-input.h | |||
@@ -14,5 +14,8 @@ | |||
14 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); | 14 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); |
15 | void rfkill_epo(void); | 15 | void rfkill_epo(void); |
16 | void rfkill_restore_states(void); | 16 | void rfkill_restore_states(void); |
17 | void rfkill_remove_epo_lock(void); | ||
18 | bool rfkill_is_epo_lock_active(void); | ||
19 | enum rfkill_state rfkill_get_global_state(const enum rfkill_type type); | ||
17 | 20 | ||
18 | #endif /* __RFKILL_INPUT_H */ | 21 | #endif /* __RFKILL_INPUT_H */ |
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 25ba3bd57e66..ec26eae8004d 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -51,6 +51,7 @@ struct rfkill_gsw_state { | |||
51 | 51 | ||
52 | static struct rfkill_gsw_state rfkill_global_states[RFKILL_TYPE_MAX]; | 52 | static struct rfkill_gsw_state rfkill_global_states[RFKILL_TYPE_MAX]; |
53 | static unsigned long rfkill_states_lockdflt[BITS_TO_LONGS(RFKILL_TYPE_MAX)]; | 53 | static unsigned long rfkill_states_lockdflt[BITS_TO_LONGS(RFKILL_TYPE_MAX)]; |
54 | static bool rfkill_epo_lock_active; | ||
54 | 55 | ||
55 | static BLOCKING_NOTIFIER_HEAD(rfkill_notifier_list); | 56 | static BLOCKING_NOTIFIER_HEAD(rfkill_notifier_list); |
56 | 57 | ||
@@ -264,11 +265,14 @@ static void __rfkill_switch_all(const enum rfkill_type type, | |||
264 | * | 265 | * |
265 | * Acquires rfkill_global_mutex and calls __rfkill_switch_all(@type, @state). | 266 | * Acquires rfkill_global_mutex and calls __rfkill_switch_all(@type, @state). |
266 | * Please refer to __rfkill_switch_all() for details. | 267 | * Please refer to __rfkill_switch_all() for details. |
268 | * | ||
269 | * Does nothing if the EPO lock is active. | ||
267 | */ | 270 | */ |
268 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) | 271 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) |
269 | { | 272 | { |
270 | mutex_lock(&rfkill_global_mutex); | 273 | mutex_lock(&rfkill_global_mutex); |
271 | __rfkill_switch_all(type, state); | 274 | if (!rfkill_epo_lock_active) |
275 | __rfkill_switch_all(type, state); | ||
272 | mutex_unlock(&rfkill_global_mutex); | 276 | mutex_unlock(&rfkill_global_mutex); |
273 | } | 277 | } |
274 | EXPORT_SYMBOL(rfkill_switch_all); | 278 | EXPORT_SYMBOL(rfkill_switch_all); |
@@ -289,6 +293,7 @@ void rfkill_epo(void) | |||
289 | 293 | ||
290 | mutex_lock(&rfkill_global_mutex); | 294 | mutex_lock(&rfkill_global_mutex); |
291 | 295 | ||
296 | rfkill_epo_lock_active = true; | ||
292 | list_for_each_entry(rfkill, &rfkill_list, node) { | 297 | list_for_each_entry(rfkill, &rfkill_list, node) { |
293 | mutex_lock(&rfkill->mutex); | 298 | mutex_lock(&rfkill->mutex); |
294 | rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1); | 299 | rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1); |
@@ -317,6 +322,7 @@ void rfkill_restore_states(void) | |||
317 | 322 | ||
318 | mutex_lock(&rfkill_global_mutex); | 323 | mutex_lock(&rfkill_global_mutex); |
319 | 324 | ||
325 | rfkill_epo_lock_active = false; | ||
320 | for (i = 0; i < RFKILL_TYPE_MAX; i++) | 326 | for (i = 0; i < RFKILL_TYPE_MAX; i++) |
321 | __rfkill_switch_all(i, rfkill_global_states[i].default_state); | 327 | __rfkill_switch_all(i, rfkill_global_states[i].default_state); |
322 | mutex_unlock(&rfkill_global_mutex); | 328 | mutex_unlock(&rfkill_global_mutex); |
@@ -324,6 +330,48 @@ void rfkill_restore_states(void) | |||
324 | EXPORT_SYMBOL_GPL(rfkill_restore_states); | 330 | EXPORT_SYMBOL_GPL(rfkill_restore_states); |
325 | 331 | ||
326 | /** | 332 | /** |
333 | * rfkill_remove_epo_lock - unlock state changes | ||
334 | * | ||
335 | * Used by rfkill-input manually unlock state changes, when | ||
336 | * the EPO switch is deactivated. | ||
337 | */ | ||
338 | void rfkill_remove_epo_lock(void) | ||
339 | { | ||
340 | mutex_lock(&rfkill_global_mutex); | ||
341 | rfkill_epo_lock_active = false; | ||
342 | mutex_unlock(&rfkill_global_mutex); | ||
343 | } | ||
344 | EXPORT_SYMBOL_GPL(rfkill_remove_epo_lock); | ||
345 | |||
346 | /** | ||
347 | * rfkill_is_epo_lock_active - returns true EPO is active | ||
348 | * | ||
349 | * Returns 0 (false) if there is NOT an active EPO contidion, | ||
350 | * and 1 (true) if there is an active EPO contition, which | ||
351 | * locks all radios in one of the BLOCKED states. | ||
352 | * | ||
353 | * Can be called in atomic context. | ||
354 | */ | ||
355 | bool rfkill_is_epo_lock_active(void) | ||
356 | { | ||
357 | return rfkill_epo_lock_active; | ||
358 | } | ||
359 | EXPORT_SYMBOL_GPL(rfkill_is_epo_lock_active); | ||
360 | |||
361 | /** | ||
362 | * rfkill_get_global_state - returns global state for a type | ||
363 | * @type: the type to get the global state of | ||
364 | * | ||
365 | * Returns the current global state for a given wireless | ||
366 | * device type. | ||
367 | */ | ||
368 | enum rfkill_state rfkill_get_global_state(const enum rfkill_type type) | ||
369 | { | ||
370 | return rfkill_global_states[type].current_state; | ||
371 | } | ||
372 | EXPORT_SYMBOL_GPL(rfkill_get_global_state); | ||
373 | |||
374 | /** | ||
327 | * rfkill_force_state - Force the internal rfkill radio state | 375 | * rfkill_force_state - Force the internal rfkill radio state |
328 | * @rfkill: pointer to the rfkill class to modify. | 376 | * @rfkill: pointer to the rfkill class to modify. |
329 | * @state: the current radio state the class should be forced to. | 377 | * @state: the current radio state the class should be forced to. |
@@ -431,9 +479,15 @@ static ssize_t rfkill_state_store(struct device *dev, | |||
431 | state != RFKILL_STATE_SOFT_BLOCKED) | 479 | state != RFKILL_STATE_SOFT_BLOCKED) |
432 | return -EINVAL; | 480 | return -EINVAL; |
433 | 481 | ||
434 | if (mutex_lock_interruptible(&rfkill->mutex)) | 482 | error = mutex_lock_killable(&rfkill->mutex); |
435 | return -ERESTARTSYS; | 483 | if (error) |
436 | error = rfkill_toggle_radio(rfkill, state, 0); | 484 | return error; |
485 | |||
486 | if (!rfkill_epo_lock_active) | ||
487 | error = rfkill_toggle_radio(rfkill, state, 0); | ||
488 | else | ||
489 | error = -EPERM; | ||
490 | |||
437 | mutex_unlock(&rfkill->mutex); | 491 | mutex_unlock(&rfkill->mutex); |
438 | 492 | ||
439 | return error ? error : count; | 493 | return error ? error : count; |
@@ -472,12 +526,12 @@ static ssize_t rfkill_claim_store(struct device *dev, | |||
472 | * Take the global lock to make sure the kernel is not in | 526 | * Take the global lock to make sure the kernel is not in |
473 | * the middle of rfkill_switch_all | 527 | * the middle of rfkill_switch_all |
474 | */ | 528 | */ |
475 | error = mutex_lock_interruptible(&rfkill_global_mutex); | 529 | error = mutex_lock_killable(&rfkill_global_mutex); |
476 | if (error) | 530 | if (error) |
477 | return error; | 531 | return error; |
478 | 532 | ||
479 | if (rfkill->user_claim != claim) { | 533 | if (rfkill->user_claim != claim) { |
480 | if (!claim) { | 534 | if (!claim && !rfkill_epo_lock_active) { |
481 | mutex_lock(&rfkill->mutex); | 535 | mutex_lock(&rfkill->mutex); |
482 | rfkill_toggle_radio(rfkill, | 536 | rfkill_toggle_radio(rfkill, |
483 | rfkill_global_states[rfkill->type].current_state, | 537 | rfkill_global_states[rfkill->type].current_state, |
@@ -527,8 +581,17 @@ static int rfkill_resume(struct device *dev) | |||
527 | 581 | ||
528 | dev->power.power_state.event = PM_EVENT_ON; | 582 | dev->power.power_state.event = PM_EVENT_ON; |
529 | 583 | ||
530 | /* restore radio state AND notify everybody */ | 584 | /* |
531 | rfkill_toggle_radio(rfkill, rfkill->state, 1); | 585 | * If we are under EPO, kick transmitter offline, |
586 | * otherwise restore to pre-suspend state. | ||
587 | * | ||
588 | * Issue a notification in any case | ||
589 | */ | ||
590 | rfkill_toggle_radio(rfkill, | ||
591 | rfkill_epo_lock_active ? | ||
592 | RFKILL_STATE_SOFT_BLOCKED : | ||
593 | rfkill->state, | ||
594 | 1); | ||
532 | 595 | ||
533 | mutex_unlock(&rfkill->mutex); | 596 | mutex_unlock(&rfkill->mutex); |
534 | } | 597 | } |
@@ -711,7 +774,7 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill) | |||
711 | int error; | 774 | int error; |
712 | 775 | ||
713 | if (!rfkill->led_trigger.name) | 776 | if (!rfkill->led_trigger.name) |
714 | rfkill->led_trigger.name = rfkill->dev.bus_id; | 777 | rfkill->led_trigger.name = dev_name(&rfkill->dev); |
715 | if (!rfkill->led_trigger.activate) | 778 | if (!rfkill->led_trigger.activate) |
716 | rfkill->led_trigger.activate = rfkill_led_trigger_activate; | 779 | rfkill->led_trigger.activate = rfkill_led_trigger_activate; |
717 | error = led_trigger_register(&rfkill->led_trigger); | 780 | error = led_trigger_register(&rfkill->led_trigger); |
@@ -752,8 +815,7 @@ int __must_check rfkill_register(struct rfkill *rfkill) | |||
752 | "badly initialized rfkill struct\n")) | 815 | "badly initialized rfkill struct\n")) |
753 | return -EINVAL; | 816 | return -EINVAL; |
754 | 817 | ||
755 | snprintf(dev->bus_id, sizeof(dev->bus_id), | 818 | dev_set_name(dev, "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1); |
756 | "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1); | ||
757 | 819 | ||
758 | rfkill_led_trigger_register(rfkill); | 820 | rfkill_led_trigger_register(rfkill); |
759 | 821 | ||
@@ -833,6 +895,7 @@ int rfkill_set_default(enum rfkill_type type, enum rfkill_state state) | |||
833 | 895 | ||
834 | if (!test_and_set_bit(type, rfkill_states_lockdflt)) { | 896 | if (!test_and_set_bit(type, rfkill_states_lockdflt)) { |
835 | rfkill_global_states[type].default_state = state; | 897 | rfkill_global_states[type].default_state = state; |
898 | rfkill_global_states[type].current_state = state; | ||
836 | error = 0; | 899 | error = 0; |
837 | } else | 900 | } else |
838 | error = -EPERM; | 901 | error = -EPERM; |
diff --git a/net/rose/sysctl_net_rose.c b/net/rose/sysctl_net_rose.c index 20be3485a97f..3bfe504faf86 100644 --- a/net/rose/sysctl_net_rose.c +++ b/net/rose/sysctl_net_rose.c | |||
@@ -31,8 +31,8 @@ static ctl_table rose_table[] = { | |||
31 | .data = &sysctl_rose_restart_request_timeout, | 31 | .data = &sysctl_rose_restart_request_timeout, |
32 | .maxlen = sizeof(int), | 32 | .maxlen = sizeof(int), |
33 | .mode = 0644, | 33 | .mode = 0644, |
34 | .proc_handler = &proc_dointvec_minmax, | 34 | .proc_handler = proc_dointvec_minmax, |
35 | .strategy = &sysctl_intvec, | 35 | .strategy = sysctl_intvec, |
36 | .extra1 = &min_timer, | 36 | .extra1 = &min_timer, |
37 | .extra2 = &max_timer | 37 | .extra2 = &max_timer |
38 | }, | 38 | }, |
@@ -42,8 +42,8 @@ static ctl_table rose_table[] = { | |||
42 | .data = &sysctl_rose_call_request_timeout, | 42 | .data = &sysctl_rose_call_request_timeout, |
43 | .maxlen = sizeof(int), | 43 | .maxlen = sizeof(int), |
44 | .mode = 0644, | 44 | .mode = 0644, |
45 | .proc_handler = &proc_dointvec_minmax, | 45 | .proc_handler = proc_dointvec_minmax, |
46 | .strategy = &sysctl_intvec, | 46 | .strategy = sysctl_intvec, |
47 | .extra1 = &min_timer, | 47 | .extra1 = &min_timer, |
48 | .extra2 = &max_timer | 48 | .extra2 = &max_timer |
49 | }, | 49 | }, |
@@ -53,8 +53,8 @@ static ctl_table rose_table[] = { | |||
53 | .data = &sysctl_rose_reset_request_timeout, | 53 | .data = &sysctl_rose_reset_request_timeout, |
54 | .maxlen = sizeof(int), | 54 | .maxlen = sizeof(int), |
55 | .mode = 0644, | 55 | .mode = 0644, |
56 | .proc_handler = &proc_dointvec_minmax, | 56 | .proc_handler = proc_dointvec_minmax, |
57 | .strategy = &sysctl_intvec, | 57 | .strategy = sysctl_intvec, |
58 | .extra1 = &min_timer, | 58 | .extra1 = &min_timer, |
59 | .extra2 = &max_timer | 59 | .extra2 = &max_timer |
60 | }, | 60 | }, |
@@ -64,8 +64,8 @@ static ctl_table rose_table[] = { | |||
64 | .data = &sysctl_rose_clear_request_timeout, | 64 | .data = &sysctl_rose_clear_request_timeout, |
65 | .maxlen = sizeof(int), | 65 | .maxlen = sizeof(int), |
66 | .mode = 0644, | 66 | .mode = 0644, |
67 | .proc_handler = &proc_dointvec_minmax, | 67 | .proc_handler = proc_dointvec_minmax, |
68 | .strategy = &sysctl_intvec, | 68 | .strategy = sysctl_intvec, |
69 | .extra1 = &min_timer, | 69 | .extra1 = &min_timer, |
70 | .extra2 = &max_timer | 70 | .extra2 = &max_timer |
71 | }, | 71 | }, |
@@ -75,8 +75,8 @@ static ctl_table rose_table[] = { | |||
75 | .data = &sysctl_rose_no_activity_timeout, | 75 | .data = &sysctl_rose_no_activity_timeout, |
76 | .maxlen = sizeof(int), | 76 | .maxlen = sizeof(int), |
77 | .mode = 0644, | 77 | .mode = 0644, |
78 | .proc_handler = &proc_dointvec_minmax, | 78 | .proc_handler = proc_dointvec_minmax, |
79 | .strategy = &sysctl_intvec, | 79 | .strategy = sysctl_intvec, |
80 | .extra1 = &min_idle, | 80 | .extra1 = &min_idle, |
81 | .extra2 = &max_idle | 81 | .extra2 = &max_idle |
82 | }, | 82 | }, |
@@ -86,8 +86,8 @@ static ctl_table rose_table[] = { | |||
86 | .data = &sysctl_rose_ack_hold_back_timeout, | 86 | .data = &sysctl_rose_ack_hold_back_timeout, |
87 | .maxlen = sizeof(int), | 87 | .maxlen = sizeof(int), |
88 | .mode = 0644, | 88 | .mode = 0644, |
89 | .proc_handler = &proc_dointvec_minmax, | 89 | .proc_handler = proc_dointvec_minmax, |
90 | .strategy = &sysctl_intvec, | 90 | .strategy = sysctl_intvec, |
91 | .extra1 = &min_timer, | 91 | .extra1 = &min_timer, |
92 | .extra2 = &max_timer | 92 | .extra2 = &max_timer |
93 | }, | 93 | }, |
@@ -97,8 +97,8 @@ static ctl_table rose_table[] = { | |||
97 | .data = &sysctl_rose_routing_control, | 97 | .data = &sysctl_rose_routing_control, |
98 | .maxlen = sizeof(int), | 98 | .maxlen = sizeof(int), |
99 | .mode = 0644, | 99 | .mode = 0644, |
100 | .proc_handler = &proc_dointvec_minmax, | 100 | .proc_handler = proc_dointvec_minmax, |
101 | .strategy = &sysctl_intvec, | 101 | .strategy = sysctl_intvec, |
102 | .extra1 = &min_route, | 102 | .extra1 = &min_route, |
103 | .extra2 = &max_route | 103 | .extra2 = &max_route |
104 | }, | 104 | }, |
@@ -108,8 +108,8 @@ static ctl_table rose_table[] = { | |||
108 | .data = &sysctl_rose_link_fail_timeout, | 108 | .data = &sysctl_rose_link_fail_timeout, |
109 | .maxlen = sizeof(int), | 109 | .maxlen = sizeof(int), |
110 | .mode = 0644, | 110 | .mode = 0644, |
111 | .proc_handler = &proc_dointvec_minmax, | 111 | .proc_handler = proc_dointvec_minmax, |
112 | .strategy = &sysctl_intvec, | 112 | .strategy = sysctl_intvec, |
113 | .extra1 = &min_ftimer, | 113 | .extra1 = &min_ftimer, |
114 | .extra2 = &max_ftimer | 114 | .extra2 = &max_ftimer |
115 | }, | 115 | }, |
@@ -119,8 +119,8 @@ static ctl_table rose_table[] = { | |||
119 | .data = &sysctl_rose_maximum_vcs, | 119 | .data = &sysctl_rose_maximum_vcs, |
120 | .maxlen = sizeof(int), | 120 | .maxlen = sizeof(int), |
121 | .mode = 0644, | 121 | .mode = 0644, |
122 | .proc_handler = &proc_dointvec_minmax, | 122 | .proc_handler = proc_dointvec_minmax, |
123 | .strategy = &sysctl_intvec, | 123 | .strategy = sysctl_intvec, |
124 | .extra1 = &min_maxvcs, | 124 | .extra1 = &min_maxvcs, |
125 | .extra2 = &max_maxvcs | 125 | .extra2 = &max_maxvcs |
126 | }, | 126 | }, |
@@ -130,8 +130,8 @@ static ctl_table rose_table[] = { | |||
130 | .data = &sysctl_rose_window_size, | 130 | .data = &sysctl_rose_window_size, |
131 | .maxlen = sizeof(int), | 131 | .maxlen = sizeof(int), |
132 | .mode = 0644, | 132 | .mode = 0644, |
133 | .proc_handler = &proc_dointvec_minmax, | 133 | .proc_handler = proc_dointvec_minmax, |
134 | .strategy = &sysctl_intvec, | 134 | .strategy = sysctl_intvec, |
135 | .extra1 = &min_window, | 135 | .extra1 = &min_window, |
136 | .extra2 = &max_window | 136 | .extra2 = &max_window |
137 | }, | 137 | }, |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 32e489118beb..d7d2bed7a699 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -96,9 +96,9 @@ static int rxrpc_validate_address(struct rxrpc_sock *rx, | |||
96 | 96 | ||
97 | switch (srx->transport.family) { | 97 | switch (srx->transport.family) { |
98 | case AF_INET: | 98 | case AF_INET: |
99 | _debug("INET: %x @ %u.%u.%u.%u", | 99 | _debug("INET: %x @ %pI4", |
100 | ntohs(srx->transport.sin.sin_port), | 100 | ntohs(srx->transport.sin.sin_port), |
101 | NIPQUAD(srx->transport.sin.sin_addr)); | 101 | &srx->transport.sin.sin_addr); |
102 | if (srx->transport_len > 8) | 102 | if (srx->transport_len > 8) |
103 | memset((void *)&srx->transport + 8, 0, | 103 | memset((void *)&srx->transport + 8, 0, |
104 | srx->transport_len - 8); | 104 | srx->transport_len - 8); |
diff --git a/net/rxrpc/ar-error.c b/net/rxrpc/ar-error.c index 6cb3e8890e7e..d4d1ae26d293 100644 --- a/net/rxrpc/ar-error.c +++ b/net/rxrpc/ar-error.c | |||
@@ -49,8 +49,7 @@ void rxrpc_UDP_error_report(struct sock *sk) | |||
49 | addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset); | 49 | addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset); |
50 | port = serr->port; | 50 | port = serr->port; |
51 | 51 | ||
52 | _net("Rx UDP Error from "NIPQUAD_FMT":%hu", | 52 | _net("Rx UDP Error from %pI4:%hu", &addr, ntohs(port)); |
53 | NIPQUAD(addr), ntohs(port)); | ||
54 | _debug("Msg l:%d d:%d", skb->len, skb->data_len); | 53 | _debug("Msg l:%d d:%d", skb->len, skb->data_len); |
55 | 54 | ||
56 | peer = rxrpc_find_peer(local, addr, port); | 55 | peer = rxrpc_find_peer(local, addr, port); |
diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c index f3a2bd747a8f..807535ff29b5 100644 --- a/net/rxrpc/ar-local.c +++ b/net/rxrpc/ar-local.c | |||
@@ -131,10 +131,10 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx) | |||
131 | struct rxrpc_local *local; | 131 | struct rxrpc_local *local; |
132 | int ret; | 132 | int ret; |
133 | 133 | ||
134 | _enter("{%d,%u,%u.%u.%u.%u+%hu}", | 134 | _enter("{%d,%u,%pI4+%hu}", |
135 | srx->transport_type, | 135 | srx->transport_type, |
136 | srx->transport.family, | 136 | srx->transport.family, |
137 | NIPQUAD(srx->transport.sin.sin_addr), | 137 | &srx->transport.sin.sin_addr, |
138 | ntohs(srx->transport.sin.sin_port)); | 138 | ntohs(srx->transport.sin.sin_port)); |
139 | 139 | ||
140 | down_write(&rxrpc_local_sem); | 140 | down_write(&rxrpc_local_sem); |
@@ -143,10 +143,10 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx) | |||
143 | read_lock_bh(&rxrpc_local_lock); | 143 | read_lock_bh(&rxrpc_local_lock); |
144 | 144 | ||
145 | list_for_each_entry(local, &rxrpc_locals, link) { | 145 | list_for_each_entry(local, &rxrpc_locals, link) { |
146 | _debug("CMP {%d,%u,%u.%u.%u.%u+%hu}", | 146 | _debug("CMP {%d,%u,%pI4+%hu}", |
147 | local->srx.transport_type, | 147 | local->srx.transport_type, |
148 | local->srx.transport.family, | 148 | local->srx.transport.family, |
149 | NIPQUAD(local->srx.transport.sin.sin_addr), | 149 | &local->srx.transport.sin.sin_addr, |
150 | ntohs(local->srx.transport.sin.sin_port)); | 150 | ntohs(local->srx.transport.sin.sin_port)); |
151 | 151 | ||
152 | if (local->srx.transport_type != srx->transport_type || | 152 | if (local->srx.transport_type != srx->transport_type || |
@@ -188,11 +188,11 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx) | |||
188 | 188 | ||
189 | up_write(&rxrpc_local_sem); | 189 | up_write(&rxrpc_local_sem); |
190 | 190 | ||
191 | _net("LOCAL new %d {%d,%u,%u.%u.%u.%u+%hu}", | 191 | _net("LOCAL new %d {%d,%u,%pI4+%hu}", |
192 | local->debug_id, | 192 | local->debug_id, |
193 | local->srx.transport_type, | 193 | local->srx.transport_type, |
194 | local->srx.transport.family, | 194 | local->srx.transport.family, |
195 | NIPQUAD(local->srx.transport.sin.sin_addr), | 195 | &local->srx.transport.sin.sin_addr, |
196 | ntohs(local->srx.transport.sin.sin_port)); | 196 | ntohs(local->srx.transport.sin.sin_port)); |
197 | 197 | ||
198 | _leave(" = %p [new]", local); | 198 | _leave(" = %p [new]", local); |
@@ -203,11 +203,11 @@ found_local: | |||
203 | read_unlock_bh(&rxrpc_local_lock); | 203 | read_unlock_bh(&rxrpc_local_lock); |
204 | up_write(&rxrpc_local_sem); | 204 | up_write(&rxrpc_local_sem); |
205 | 205 | ||
206 | _net("LOCAL old %d {%d,%u,%u.%u.%u.%u+%hu}", | 206 | _net("LOCAL old %d {%d,%u,%pI4+%hu}", |
207 | local->debug_id, | 207 | local->debug_id, |
208 | local->srx.transport_type, | 208 | local->srx.transport_type, |
209 | local->srx.transport.family, | 209 | local->srx.transport.family, |
210 | NIPQUAD(local->srx.transport.sin.sin_addr), | 210 | &local->srx.transport.sin.sin_addr, |
211 | ntohs(local->srx.transport.sin.sin_port)); | 211 | ntohs(local->srx.transport.sin.sin_port)); |
212 | 212 | ||
213 | _leave(" = %p [reuse]", local); | 213 | _leave(" = %p [reuse]", local); |
diff --git a/net/rxrpc/ar-peer.c b/net/rxrpc/ar-peer.c index 2abe2081a5e8..edc026c1eb76 100644 --- a/net/rxrpc/ar-peer.c +++ b/net/rxrpc/ar-peer.c | |||
@@ -123,10 +123,10 @@ struct rxrpc_peer *rxrpc_get_peer(struct sockaddr_rxrpc *srx, gfp_t gfp) | |||
123 | const char *new = "old"; | 123 | const char *new = "old"; |
124 | int usage; | 124 | int usage; |
125 | 125 | ||
126 | _enter("{%d,%d,%u.%u.%u.%u+%hu}", | 126 | _enter("{%d,%d,%pI4+%hu}", |
127 | srx->transport_type, | 127 | srx->transport_type, |
128 | srx->transport_len, | 128 | srx->transport_len, |
129 | NIPQUAD(srx->transport.sin.sin_addr), | 129 | &srx->transport.sin.sin_addr, |
130 | ntohs(srx->transport.sin.sin_port)); | 130 | ntohs(srx->transport.sin.sin_port)); |
131 | 131 | ||
132 | /* search the peer list first */ | 132 | /* search the peer list first */ |
@@ -177,12 +177,12 @@ struct rxrpc_peer *rxrpc_get_peer(struct sockaddr_rxrpc *srx, gfp_t gfp) | |||
177 | new = "new"; | 177 | new = "new"; |
178 | 178 | ||
179 | success: | 179 | success: |
180 | _net("PEER %s %d {%d,%u,%u.%u.%u.%u+%hu}", | 180 | _net("PEER %s %d {%d,%u,%pI4+%hu}", |
181 | new, | 181 | new, |
182 | peer->debug_id, | 182 | peer->debug_id, |
183 | peer->srx.transport_type, | 183 | peer->srx.transport_type, |
184 | peer->srx.transport.family, | 184 | peer->srx.transport.family, |
185 | NIPQUAD(peer->srx.transport.sin.sin_addr), | 185 | &peer->srx.transport.sin.sin_addr, |
186 | ntohs(peer->srx.transport.sin.sin_port)); | 186 | ntohs(peer->srx.transport.sin.sin_port)); |
187 | 187 | ||
188 | _leave(" = %p {u=%d}", peer, atomic_read(&peer->usage)); | 188 | _leave(" = %p {u=%d}", peer, atomic_read(&peer->usage)); |
diff --git a/net/rxrpc/ar-proc.c b/net/rxrpc/ar-proc.c index 017322e2786d..38047f713f2c 100644 --- a/net/rxrpc/ar-proc.c +++ b/net/rxrpc/ar-proc.c | |||
@@ -61,12 +61,12 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) | |||
61 | call = list_entry(v, struct rxrpc_call, link); | 61 | call = list_entry(v, struct rxrpc_call, link); |
62 | trans = call->conn->trans; | 62 | trans = call->conn->trans; |
63 | 63 | ||
64 | sprintf(lbuff, NIPQUAD_FMT":%u", | 64 | sprintf(lbuff, "%pI4:%u", |
65 | NIPQUAD(trans->local->srx.transport.sin.sin_addr), | 65 | &trans->local->srx.transport.sin.sin_addr, |
66 | ntohs(trans->local->srx.transport.sin.sin_port)); | 66 | ntohs(trans->local->srx.transport.sin.sin_port)); |
67 | 67 | ||
68 | sprintf(rbuff, NIPQUAD_FMT":%u", | 68 | sprintf(rbuff, "%pI4:%u", |
69 | NIPQUAD(trans->peer->srx.transport.sin.sin_addr), | 69 | &trans->peer->srx.transport.sin.sin_addr, |
70 | ntohs(trans->peer->srx.transport.sin.sin_port)); | 70 | ntohs(trans->peer->srx.transport.sin.sin_port)); |
71 | 71 | ||
72 | seq_printf(seq, | 72 | seq_printf(seq, |
@@ -144,12 +144,12 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v) | |||
144 | conn = list_entry(v, struct rxrpc_connection, link); | 144 | conn = list_entry(v, struct rxrpc_connection, link); |
145 | trans = conn->trans; | 145 | trans = conn->trans; |
146 | 146 | ||
147 | sprintf(lbuff, NIPQUAD_FMT":%u", | 147 | sprintf(lbuff, "%pI4:%u", |
148 | NIPQUAD(trans->local->srx.transport.sin.sin_addr), | 148 | &trans->local->srx.transport.sin.sin_addr, |
149 | ntohs(trans->local->srx.transport.sin.sin_port)); | 149 | ntohs(trans->local->srx.transport.sin.sin_port)); |
150 | 150 | ||
151 | sprintf(rbuff, NIPQUAD_FMT":%u", | 151 | sprintf(rbuff, "%pI4:%u", |
152 | NIPQUAD(trans->peer->srx.transport.sin.sin_addr), | 152 | &trans->peer->srx.transport.sin.sin_addr, |
153 | ntohs(trans->peer->srx.transport.sin.sin_port)); | 153 | ntohs(trans->peer->srx.transport.sin.sin_port)); |
154 | 154 | ||
155 | seq_printf(seq, | 155 | seq_printf(seq, |
diff --git a/net/rxrpc/ar-transport.c b/net/rxrpc/ar-transport.c index 64069c8769a5..0936e1acc30e 100644 --- a/net/rxrpc/ar-transport.c +++ b/net/rxrpc/ar-transport.c | |||
@@ -78,10 +78,10 @@ struct rxrpc_transport *rxrpc_get_transport(struct rxrpc_local *local, | |||
78 | const char *new = "old"; | 78 | const char *new = "old"; |
79 | int usage; | 79 | int usage; |
80 | 80 | ||
81 | _enter("{%u.%u.%u.%u+%hu},{%u.%u.%u.%u+%hu},", | 81 | _enter("{%pI4+%hu},{%pI4+%hu},", |
82 | NIPQUAD(local->srx.transport.sin.sin_addr), | 82 | &local->srx.transport.sin.sin_addr, |
83 | ntohs(local->srx.transport.sin.sin_port), | 83 | ntohs(local->srx.transport.sin.sin_port), |
84 | NIPQUAD(peer->srx.transport.sin.sin_addr), | 84 | &peer->srx.transport.sin.sin_addr, |
85 | ntohs(peer->srx.transport.sin.sin_port)); | 85 | ntohs(peer->srx.transport.sin.sin_port)); |
86 | 86 | ||
87 | /* search the transport list first */ | 87 | /* search the transport list first */ |
@@ -149,10 +149,10 @@ struct rxrpc_transport *rxrpc_find_transport(struct rxrpc_local *local, | |||
149 | { | 149 | { |
150 | struct rxrpc_transport *trans; | 150 | struct rxrpc_transport *trans; |
151 | 151 | ||
152 | _enter("{%u.%u.%u.%u+%hu},{%u.%u.%u.%u+%hu},", | 152 | _enter("{%pI4+%hu},{%pI4+%hu},", |
153 | NIPQUAD(local->srx.transport.sin.sin_addr), | 153 | &local->srx.transport.sin.sin_addr, |
154 | ntohs(local->srx.transport.sin.sin_port), | 154 | ntohs(local->srx.transport.sin.sin_port), |
155 | NIPQUAD(peer->srx.transport.sin.sin_addr), | 155 | &peer->srx.transport.sin.sin_addr, |
156 | ntohs(peer->srx.transport.sin.sin_port)); | 156 | ntohs(peer->srx.transport.sin.sin_port)); |
157 | 157 | ||
158 | /* search the transport list */ | 158 | /* search the transport list */ |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index ba3f6e49fddc..ef8f91030a15 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -897,7 +897,7 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn, | |||
897 | /* get the IPv4 address of the entity that requested the ticket */ | 897 | /* get the IPv4 address of the entity that requested the ticket */ |
898 | memcpy(&addr, p, sizeof(addr)); | 898 | memcpy(&addr, p, sizeof(addr)); |
899 | p += 4; | 899 | p += 4; |
900 | _debug("KIV ADDR : "NIPQUAD_FMT, NIPQUAD(addr)); | 900 | _debug("KIV ADDR : %pI4", &addr); |
901 | 901 | ||
902 | /* get the session key from the ticket */ | 902 | /* get the session key from the ticket */ |
903 | memcpy(&key, p, sizeof(key)); | 903 | memcpy(&key, p, sizeof(key)); |
diff --git a/net/sched/Kconfig b/net/sched/Kconfig index 6767e54155db..36543b6fcef3 100644 --- a/net/sched/Kconfig +++ b/net/sched/Kconfig | |||
@@ -316,6 +316,17 @@ config NET_CLS_FLOW | |||
316 | To compile this code as a module, choose M here: the | 316 | To compile this code as a module, choose M here: the |
317 | module will be called cls_flow. | 317 | module will be called cls_flow. |
318 | 318 | ||
319 | config NET_CLS_CGROUP | ||
320 | bool "Control Group Classifier" | ||
321 | select NET_CLS | ||
322 | depends on CGROUPS | ||
323 | ---help--- | ||
324 | Say Y here if you want to classify packets based on the control | ||
325 | cgroup of their process. | ||
326 | |||
327 | To compile this code as a module, choose M here: the | ||
328 | module will be called cls_cgroup. | ||
329 | |||
319 | config NET_EMATCH | 330 | config NET_EMATCH |
320 | bool "Extended Matches" | 331 | bool "Extended Matches" |
321 | select NET_CLS | 332 | select NET_CLS |
diff --git a/net/sched/Makefile b/net/sched/Makefile index e60c9925b269..70b35f8708c3 100644 --- a/net/sched/Makefile +++ b/net/sched/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o | |||
38 | obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o | 38 | obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o |
39 | obj-$(CONFIG_NET_CLS_BASIC) += cls_basic.o | 39 | obj-$(CONFIG_NET_CLS_BASIC) += cls_basic.o |
40 | obj-$(CONFIG_NET_CLS_FLOW) += cls_flow.o | 40 | obj-$(CONFIG_NET_CLS_FLOW) += cls_flow.o |
41 | obj-$(CONFIG_NET_CLS_CGROUP) += cls_cgroup.o | ||
41 | obj-$(CONFIG_NET_EMATCH) += ematch.o | 42 | obj-$(CONFIG_NET_EMATCH) += ematch.o |
42 | obj-$(CONFIG_NET_EMATCH_CMP) += em_cmp.o | 43 | obj-$(CONFIG_NET_EMATCH_CMP) += em_cmp.o |
43 | obj-$(CONFIG_NET_EMATCH_NBYTE) += em_nbyte.o | 44 | obj-$(CONFIG_NET_EMATCH_NBYTE) += em_nbyte.o |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c new file mode 100644 index 000000000000..53ada2c0e41c --- /dev/null +++ b/net/sched/cls_cgroup.c | |||
@@ -0,0 +1,290 @@ | |||
1 | /* | ||
2 | * net/sched/cls_cgroup.c Control Group Classifier | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * Authors: Thomas Graf <tgraf@suug.ch> | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/skbuff.h> | ||
17 | #include <linux/cgroup.h> | ||
18 | #include <net/rtnetlink.h> | ||
19 | #include <net/pkt_cls.h> | ||
20 | |||
21 | struct cgroup_cls_state | ||
22 | { | ||
23 | struct cgroup_subsys_state css; | ||
24 | u32 classid; | ||
25 | }; | ||
26 | |||
27 | static inline struct cgroup_cls_state *net_cls_state(struct cgroup *cgrp) | ||
28 | { | ||
29 | return (struct cgroup_cls_state *) | ||
30 | cgroup_subsys_state(cgrp, net_cls_subsys_id); | ||
31 | } | ||
32 | |||
33 | static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss, | ||
34 | struct cgroup *cgrp) | ||
35 | { | ||
36 | struct cgroup_cls_state *cs; | ||
37 | |||
38 | if (!(cs = kzalloc(sizeof(*cs), GFP_KERNEL))) | ||
39 | return ERR_PTR(-ENOMEM); | ||
40 | |||
41 | if (cgrp->parent) | ||
42 | cs->classid = net_cls_state(cgrp->parent)->classid; | ||
43 | |||
44 | return &cs->css; | ||
45 | } | ||
46 | |||
47 | static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp) | ||
48 | { | ||
49 | kfree(ss); | ||
50 | } | ||
51 | |||
52 | static u64 read_classid(struct cgroup *cgrp, struct cftype *cft) | ||
53 | { | ||
54 | return net_cls_state(cgrp)->classid; | ||
55 | } | ||
56 | |||
57 | static int write_classid(struct cgroup *cgrp, struct cftype *cft, u64 value) | ||
58 | { | ||
59 | if (!cgroup_lock_live_group(cgrp)) | ||
60 | return -ENODEV; | ||
61 | |||
62 | net_cls_state(cgrp)->classid = (u32) value; | ||
63 | |||
64 | cgroup_unlock(); | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static struct cftype ss_files[] = { | ||
70 | { | ||
71 | .name = "classid", | ||
72 | .read_u64 = read_classid, | ||
73 | .write_u64 = write_classid, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp) | ||
78 | { | ||
79 | return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files)); | ||
80 | } | ||
81 | |||
82 | struct cgroup_subsys net_cls_subsys = { | ||
83 | .name = "net_cls", | ||
84 | .create = cgrp_create, | ||
85 | .destroy = cgrp_destroy, | ||
86 | .populate = cgrp_populate, | ||
87 | .subsys_id = net_cls_subsys_id, | ||
88 | }; | ||
89 | |||
90 | struct cls_cgroup_head | ||
91 | { | ||
92 | u32 handle; | ||
93 | struct tcf_exts exts; | ||
94 | struct tcf_ematch_tree ematches; | ||
95 | }; | ||
96 | |||
97 | static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp, | ||
98 | struct tcf_result *res) | ||
99 | { | ||
100 | struct cls_cgroup_head *head = tp->root; | ||
101 | struct cgroup_cls_state *cs; | ||
102 | int ret = 0; | ||
103 | |||
104 | /* | ||
105 | * Due to the nature of the classifier it is required to ignore all | ||
106 | * packets originating from softirq context as accessing `current' | ||
107 | * would lead to false results. | ||
108 | * | ||
109 | * This test assumes that all callers of dev_queue_xmit() explicitely | ||
110 | * disable bh. Knowing this, it is possible to detect softirq based | ||
111 | * calls by looking at the number of nested bh disable calls because | ||
112 | * softirqs always disables bh. | ||
113 | */ | ||
114 | if (softirq_count() != SOFTIRQ_OFFSET) | ||
115 | return -1; | ||
116 | |||
117 | rcu_read_lock(); | ||
118 | cs = (struct cgroup_cls_state *) task_subsys_state(current, | ||
119 | net_cls_subsys_id); | ||
120 | if (cs->classid && tcf_em_tree_match(skb, &head->ematches, NULL)) { | ||
121 | res->classid = cs->classid; | ||
122 | res->class = 0; | ||
123 | ret = tcf_exts_exec(skb, &head->exts, res); | ||
124 | } else | ||
125 | ret = -1; | ||
126 | |||
127 | rcu_read_unlock(); | ||
128 | |||
129 | return ret; | ||
130 | } | ||
131 | |||
132 | static unsigned long cls_cgroup_get(struct tcf_proto *tp, u32 handle) | ||
133 | { | ||
134 | return 0UL; | ||
135 | } | ||
136 | |||
137 | static void cls_cgroup_put(struct tcf_proto *tp, unsigned long f) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | static int cls_cgroup_init(struct tcf_proto *tp) | ||
142 | { | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static const struct tcf_ext_map cgroup_ext_map = { | ||
147 | .action = TCA_CGROUP_ACT, | ||
148 | .police = TCA_CGROUP_POLICE, | ||
149 | }; | ||
150 | |||
151 | static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { | ||
152 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, | ||
153 | }; | ||
154 | |||
155 | static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base, | ||
156 | u32 handle, struct nlattr **tca, | ||
157 | unsigned long *arg) | ||
158 | { | ||
159 | struct nlattr *tb[TCA_CGROUP_MAX+1]; | ||
160 | struct cls_cgroup_head *head = tp->root; | ||
161 | struct tcf_ematch_tree t; | ||
162 | struct tcf_exts e; | ||
163 | int err; | ||
164 | |||
165 | if (head == NULL) { | ||
166 | if (!handle) | ||
167 | return -EINVAL; | ||
168 | |||
169 | head = kzalloc(sizeof(*head), GFP_KERNEL); | ||
170 | if (head == NULL) | ||
171 | return -ENOBUFS; | ||
172 | |||
173 | head->handle = handle; | ||
174 | |||
175 | tcf_tree_lock(tp); | ||
176 | tp->root = head; | ||
177 | tcf_tree_unlock(tp); | ||
178 | } | ||
179 | |||
180 | if (handle != head->handle) | ||
181 | return -ENOENT; | ||
182 | |||
183 | err = nla_parse_nested(tb, TCA_CGROUP_MAX, tca[TCA_OPTIONS], | ||
184 | cgroup_policy); | ||
185 | if (err < 0) | ||
186 | return err; | ||
187 | |||
188 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &cgroup_ext_map); | ||
189 | if (err < 0) | ||
190 | return err; | ||
191 | |||
192 | err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &t); | ||
193 | if (err < 0) | ||
194 | return err; | ||
195 | |||
196 | tcf_exts_change(tp, &head->exts, &e); | ||
197 | tcf_em_tree_change(tp, &head->ematches, &t); | ||
198 | |||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | static void cls_cgroup_destroy(struct tcf_proto *tp) | ||
203 | { | ||
204 | struct cls_cgroup_head *head; | ||
205 | |||
206 | head = (struct cls_cgroup_head *)xchg(&tp->root, NULL); | ||
207 | |||
208 | if (head) { | ||
209 | tcf_exts_destroy(tp, &head->exts); | ||
210 | tcf_em_tree_destroy(tp, &head->ematches); | ||
211 | kfree(head); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | static int cls_cgroup_delete(struct tcf_proto *tp, unsigned long arg) | ||
216 | { | ||
217 | return -EOPNOTSUPP; | ||
218 | } | ||
219 | |||
220 | static void cls_cgroup_walk(struct tcf_proto *tp, struct tcf_walker *arg) | ||
221 | { | ||
222 | struct cls_cgroup_head *head = tp->root; | ||
223 | |||
224 | if (arg->count < arg->skip) | ||
225 | goto skip; | ||
226 | |||
227 | if (arg->fn(tp, (unsigned long) head, arg) < 0) { | ||
228 | arg->stop = 1; | ||
229 | return; | ||
230 | } | ||
231 | skip: | ||
232 | arg->count++; | ||
233 | } | ||
234 | |||
235 | static int cls_cgroup_dump(struct tcf_proto *tp, unsigned long fh, | ||
236 | struct sk_buff *skb, struct tcmsg *t) | ||
237 | { | ||
238 | struct cls_cgroup_head *head = tp->root; | ||
239 | unsigned char *b = skb_tail_pointer(skb); | ||
240 | struct nlattr *nest; | ||
241 | |||
242 | t->tcm_handle = head->handle; | ||
243 | |||
244 | nest = nla_nest_start(skb, TCA_OPTIONS); | ||
245 | if (nest == NULL) | ||
246 | goto nla_put_failure; | ||
247 | |||
248 | if (tcf_exts_dump(skb, &head->exts, &cgroup_ext_map) < 0 || | ||
249 | tcf_em_tree_dump(skb, &head->ematches, TCA_CGROUP_EMATCHES) < 0) | ||
250 | goto nla_put_failure; | ||
251 | |||
252 | nla_nest_end(skb, nest); | ||
253 | |||
254 | if (tcf_exts_dump_stats(skb, &head->exts, &cgroup_ext_map) < 0) | ||
255 | goto nla_put_failure; | ||
256 | |||
257 | return skb->len; | ||
258 | |||
259 | nla_put_failure: | ||
260 | nlmsg_trim(skb, b); | ||
261 | return -1; | ||
262 | } | ||
263 | |||
264 | static struct tcf_proto_ops cls_cgroup_ops __read_mostly = { | ||
265 | .kind = "cgroup", | ||
266 | .init = cls_cgroup_init, | ||
267 | .change = cls_cgroup_change, | ||
268 | .classify = cls_cgroup_classify, | ||
269 | .destroy = cls_cgroup_destroy, | ||
270 | .get = cls_cgroup_get, | ||
271 | .put = cls_cgroup_put, | ||
272 | .delete = cls_cgroup_delete, | ||
273 | .walk = cls_cgroup_walk, | ||
274 | .dump = cls_cgroup_dump, | ||
275 | .owner = THIS_MODULE, | ||
276 | }; | ||
277 | |||
278 | static int __init init_cgroup_cls(void) | ||
279 | { | ||
280 | return register_tcf_proto_ops(&cls_cgroup_ops); | ||
281 | } | ||
282 | |||
283 | static void __exit exit_cgroup_cls(void) | ||
284 | { | ||
285 | unregister_tcf_proto_ops(&cls_cgroup_ops); | ||
286 | } | ||
287 | |||
288 | module_init(init_cgroup_cls); | ||
289 | module_exit(exit_cgroup_cls); | ||
290 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index b16ad2972c6b..e5646614e88d 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -102,6 +102,10 @@ static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
102 | requeues once dequeued packet. It is used for non-standard or | 102 | requeues once dequeued packet. It is used for non-standard or |
103 | just buggy devices, which can defer output even if netif_queue_stopped()=0. | 103 | just buggy devices, which can defer output even if netif_queue_stopped()=0. |
104 | 104 | ||
105 | ---peek | ||
106 | |||
107 | like dequeue but without removing a packet from the queue | ||
108 | |||
105 | ---reset | 109 | ---reset |
106 | 110 | ||
107 | returns qdisc to initial state: purge all buffers, clear all | 111 | returns qdisc to initial state: purge all buffers, clear all |
@@ -149,6 +153,14 @@ int register_qdisc(struct Qdisc_ops *qops) | |||
149 | qops->enqueue = noop_qdisc_ops.enqueue; | 153 | qops->enqueue = noop_qdisc_ops.enqueue; |
150 | if (qops->requeue == NULL) | 154 | if (qops->requeue == NULL) |
151 | qops->requeue = noop_qdisc_ops.requeue; | 155 | qops->requeue = noop_qdisc_ops.requeue; |
156 | if (qops->peek == NULL) { | ||
157 | if (qops->dequeue == NULL) { | ||
158 | qops->peek = noop_qdisc_ops.peek; | ||
159 | } else { | ||
160 | rc = -EINVAL; | ||
161 | goto out; | ||
162 | } | ||
163 | } | ||
152 | if (qops->dequeue == NULL) | 164 | if (qops->dequeue == NULL) |
153 | qops->dequeue = noop_qdisc_ops.dequeue; | 165 | qops->dequeue = noop_qdisc_ops.dequeue; |
154 | 166 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index 43d37256c15e..6eb9a650b63d 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -480,11 +480,14 @@ static void sch_atm_dequeue(unsigned long data) | |||
480 | * If traffic is properly shaped, this won't generate nasty | 480 | * If traffic is properly shaped, this won't generate nasty |
481 | * little bursts. Otherwise, it may ... (but that's okay) | 481 | * little bursts. Otherwise, it may ... (but that's okay) |
482 | */ | 482 | */ |
483 | while ((skb = flow->q->dequeue(flow->q))) { | 483 | while ((skb = flow->q->ops->peek(flow->q))) { |
484 | if (!atm_may_send(flow->vcc, skb->truesize)) { | 484 | if (!atm_may_send(flow->vcc, skb->truesize)) |
485 | (void)flow->q->ops->requeue(skb, flow->q); | ||
486 | break; | 485 | break; |
487 | } | 486 | |
487 | skb = qdisc_dequeue_peeked(flow->q); | ||
488 | if (unlikely(!skb)) | ||
489 | break; | ||
490 | |||
488 | pr_debug("atm_tc_dequeue: sending on class %p\n", flow); | 491 | pr_debug("atm_tc_dequeue: sending on class %p\n", flow); |
489 | /* remove any LL header somebody else has attached */ | 492 | /* remove any LL header somebody else has attached */ |
490 | skb_pull(skb, skb_network_offset(skb)); | 493 | skb_pull(skb, skb_network_offset(skb)); |
@@ -516,12 +519,21 @@ static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch) | |||
516 | 519 | ||
517 | pr_debug("atm_tc_dequeue(sch %p,[qdisc %p])\n", sch, p); | 520 | pr_debug("atm_tc_dequeue(sch %p,[qdisc %p])\n", sch, p); |
518 | tasklet_schedule(&p->task); | 521 | tasklet_schedule(&p->task); |
519 | skb = p->link.q->dequeue(p->link.q); | 522 | skb = qdisc_dequeue_peeked(p->link.q); |
520 | if (skb) | 523 | if (skb) |
521 | sch->q.qlen--; | 524 | sch->q.qlen--; |
522 | return skb; | 525 | return skb; |
523 | } | 526 | } |
524 | 527 | ||
528 | static struct sk_buff *atm_tc_peek(struct Qdisc *sch) | ||
529 | { | ||
530 | struct atm_qdisc_data *p = qdisc_priv(sch); | ||
531 | |||
532 | pr_debug("atm_tc_peek(sch %p,[qdisc %p])\n", sch, p); | ||
533 | |||
534 | return p->link.q->ops->peek(p->link.q); | ||
535 | } | ||
536 | |||
525 | static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch) | 537 | static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch) |
526 | { | 538 | { |
527 | struct atm_qdisc_data *p = qdisc_priv(sch); | 539 | struct atm_qdisc_data *p = qdisc_priv(sch); |
@@ -694,6 +706,7 @@ static struct Qdisc_ops atm_qdisc_ops __read_mostly = { | |||
694 | .priv_size = sizeof(struct atm_qdisc_data), | 706 | .priv_size = sizeof(struct atm_qdisc_data), |
695 | .enqueue = atm_tc_enqueue, | 707 | .enqueue = atm_tc_enqueue, |
696 | .dequeue = atm_tc_dequeue, | 708 | .dequeue = atm_tc_dequeue, |
709 | .peek = atm_tc_peek, | ||
697 | .requeue = atm_tc_requeue, | 710 | .requeue = atm_tc_requeue, |
698 | .drop = atm_tc_drop, | 711 | .drop = atm_tc_drop, |
699 | .init = atm_tc_init, | 712 | .init = atm_tc_init, |
diff --git a/net/sched/sch_blackhole.c b/net/sched/sch_blackhole.c index 507fb488bc98..094a874b48bc 100644 --- a/net/sched/sch_blackhole.c +++ b/net/sched/sch_blackhole.c | |||
@@ -33,6 +33,7 @@ static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = { | |||
33 | .priv_size = 0, | 33 | .priv_size = 0, |
34 | .enqueue = blackhole_enqueue, | 34 | .enqueue = blackhole_enqueue, |
35 | .dequeue = blackhole_dequeue, | 35 | .dequeue = blackhole_dequeue, |
36 | .peek = blackhole_dequeue, | ||
36 | .owner = THIS_MODULE, | 37 | .owner = THIS_MODULE, |
37 | }; | 38 | }; |
38 | 39 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 03e389e8d945..63efa70abbea 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -2066,6 +2066,7 @@ static struct Qdisc_ops cbq_qdisc_ops __read_mostly = { | |||
2066 | .priv_size = sizeof(struct cbq_sched_data), | 2066 | .priv_size = sizeof(struct cbq_sched_data), |
2067 | .enqueue = cbq_enqueue, | 2067 | .enqueue = cbq_enqueue, |
2068 | .dequeue = cbq_dequeue, | 2068 | .dequeue = cbq_dequeue, |
2069 | .peek = qdisc_peek_dequeued, | ||
2069 | .requeue = cbq_requeue, | 2070 | .requeue = cbq_requeue, |
2070 | .drop = cbq_drop, | 2071 | .drop = cbq_drop, |
2071 | .init = cbq_init, | 2072 | .init = cbq_init, |
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index ba43aab3a851..3e491479ea86 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -313,6 +313,15 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | |||
313 | return skb; | 313 | return skb; |
314 | } | 314 | } |
315 | 315 | ||
316 | static struct sk_buff *dsmark_peek(struct Qdisc *sch) | ||
317 | { | ||
318 | struct dsmark_qdisc_data *p = qdisc_priv(sch); | ||
319 | |||
320 | pr_debug("dsmark_peek(sch %p,[qdisc %p])\n", sch, p); | ||
321 | |||
322 | return p->q->ops->peek(p->q); | ||
323 | } | ||
324 | |||
316 | static int dsmark_requeue(struct sk_buff *skb, struct Qdisc *sch) | 325 | static int dsmark_requeue(struct sk_buff *skb, struct Qdisc *sch) |
317 | { | 326 | { |
318 | struct dsmark_qdisc_data *p = qdisc_priv(sch); | 327 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
@@ -496,6 +505,7 @@ static struct Qdisc_ops dsmark_qdisc_ops __read_mostly = { | |||
496 | .priv_size = sizeof(struct dsmark_qdisc_data), | 505 | .priv_size = sizeof(struct dsmark_qdisc_data), |
497 | .enqueue = dsmark_enqueue, | 506 | .enqueue = dsmark_enqueue, |
498 | .dequeue = dsmark_dequeue, | 507 | .dequeue = dsmark_dequeue, |
508 | .peek = dsmark_peek, | ||
499 | .requeue = dsmark_requeue, | 509 | .requeue = dsmark_requeue, |
500 | .drop = dsmark_drop, | 510 | .drop = dsmark_drop, |
501 | .init = dsmark_init, | 511 | .init = dsmark_init, |
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c index 23d258bfe8ac..8825e8806f41 100644 --- a/net/sched/sch_fifo.c +++ b/net/sched/sch_fifo.c | |||
@@ -83,6 +83,7 @@ struct Qdisc_ops pfifo_qdisc_ops __read_mostly = { | |||
83 | .priv_size = sizeof(struct fifo_sched_data), | 83 | .priv_size = sizeof(struct fifo_sched_data), |
84 | .enqueue = pfifo_enqueue, | 84 | .enqueue = pfifo_enqueue, |
85 | .dequeue = qdisc_dequeue_head, | 85 | .dequeue = qdisc_dequeue_head, |
86 | .peek = qdisc_peek_head, | ||
86 | .requeue = qdisc_requeue, | 87 | .requeue = qdisc_requeue, |
87 | .drop = qdisc_queue_drop, | 88 | .drop = qdisc_queue_drop, |
88 | .init = fifo_init, | 89 | .init = fifo_init, |
@@ -98,6 +99,7 @@ struct Qdisc_ops bfifo_qdisc_ops __read_mostly = { | |||
98 | .priv_size = sizeof(struct fifo_sched_data), | 99 | .priv_size = sizeof(struct fifo_sched_data), |
99 | .enqueue = bfifo_enqueue, | 100 | .enqueue = bfifo_enqueue, |
100 | .dequeue = qdisc_dequeue_head, | 101 | .dequeue = qdisc_dequeue_head, |
102 | .peek = qdisc_peek_head, | ||
101 | .requeue = qdisc_requeue, | 103 | .requeue = qdisc_requeue, |
102 | .drop = qdisc_queue_drop, | 104 | .drop = qdisc_queue_drop, |
103 | .init = fifo_init, | 105 | .init = fifo_init, |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 93cd30ce6501..1192da229835 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -320,6 +320,7 @@ struct Qdisc_ops noop_qdisc_ops __read_mostly = { | |||
320 | .priv_size = 0, | 320 | .priv_size = 0, |
321 | .enqueue = noop_enqueue, | 321 | .enqueue = noop_enqueue, |
322 | .dequeue = noop_dequeue, | 322 | .dequeue = noop_dequeue, |
323 | .peek = noop_dequeue, | ||
323 | .requeue = noop_requeue, | 324 | .requeue = noop_requeue, |
324 | .owner = THIS_MODULE, | 325 | .owner = THIS_MODULE, |
325 | }; | 326 | }; |
@@ -346,6 +347,7 @@ static struct Qdisc_ops noqueue_qdisc_ops __read_mostly = { | |||
346 | .priv_size = 0, | 347 | .priv_size = 0, |
347 | .enqueue = noop_enqueue, | 348 | .enqueue = noop_enqueue, |
348 | .dequeue = noop_dequeue, | 349 | .dequeue = noop_dequeue, |
350 | .peek = noop_dequeue, | ||
349 | .requeue = noop_requeue, | 351 | .requeue = noop_requeue, |
350 | .owner = THIS_MODULE, | 352 | .owner = THIS_MODULE, |
351 | }; | 353 | }; |
@@ -411,6 +413,19 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc) | |||
411 | return NULL; | 413 | return NULL; |
412 | } | 414 | } |
413 | 415 | ||
416 | static struct sk_buff *pfifo_fast_peek(struct Qdisc* qdisc) | ||
417 | { | ||
418 | int prio; | ||
419 | struct sk_buff_head *list = qdisc_priv(qdisc); | ||
420 | |||
421 | for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { | ||
422 | if (!skb_queue_empty(list + prio)) | ||
423 | return skb_peek(list + prio); | ||
424 | } | ||
425 | |||
426 | return NULL; | ||
427 | } | ||
428 | |||
414 | static int pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc) | 429 | static int pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc) |
415 | { | 430 | { |
416 | qdisc->q.qlen++; | 431 | qdisc->q.qlen++; |
@@ -457,6 +472,7 @@ static struct Qdisc_ops pfifo_fast_ops __read_mostly = { | |||
457 | .priv_size = PFIFO_FAST_BANDS * sizeof(struct sk_buff_head), | 472 | .priv_size = PFIFO_FAST_BANDS * sizeof(struct sk_buff_head), |
458 | .enqueue = pfifo_fast_enqueue, | 473 | .enqueue = pfifo_fast_enqueue, |
459 | .dequeue = pfifo_fast_dequeue, | 474 | .dequeue = pfifo_fast_dequeue, |
475 | .peek = pfifo_fast_peek, | ||
460 | .requeue = pfifo_fast_requeue, | 476 | .requeue = pfifo_fast_requeue, |
461 | .init = pfifo_fast_init, | 477 | .init = pfifo_fast_init, |
462 | .reset = pfifo_fast_reset, | 478 | .reset = pfifo_fast_reset, |
@@ -526,6 +542,9 @@ void qdisc_reset(struct Qdisc *qdisc) | |||
526 | 542 | ||
527 | if (ops->reset) | 543 | if (ops->reset) |
528 | ops->reset(qdisc); | 544 | ops->reset(qdisc); |
545 | |||
546 | kfree_skb(qdisc->gso_skb); | ||
547 | qdisc->gso_skb = NULL; | ||
529 | } | 548 | } |
530 | EXPORT_SYMBOL(qdisc_reset); | 549 | EXPORT_SYMBOL(qdisc_reset); |
531 | 550 | ||
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index c1ad6b8de105..cb20ee3b9fc2 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
@@ -602,6 +602,7 @@ static struct Qdisc_ops gred_qdisc_ops __read_mostly = { | |||
602 | .priv_size = sizeof(struct gred_sched), | 602 | .priv_size = sizeof(struct gred_sched), |
603 | .enqueue = gred_enqueue, | 603 | .enqueue = gred_enqueue, |
604 | .dequeue = gred_dequeue, | 604 | .dequeue = gred_dequeue, |
605 | .peek = qdisc_peek_head, | ||
605 | .requeue = gred_requeue, | 606 | .requeue = gred_requeue, |
606 | .drop = gred_drop, | 607 | .drop = gred_drop, |
607 | .init = gred_init, | 608 | .init = gred_init, |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index c1e77da8cd09..d90b1652f2af 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -880,28 +880,20 @@ set_passive(struct hfsc_class *cl) | |||
880 | */ | 880 | */ |
881 | } | 881 | } |
882 | 882 | ||
883 | /* | ||
884 | * hack to get length of first packet in queue. | ||
885 | */ | ||
886 | static unsigned int | 883 | static unsigned int |
887 | qdisc_peek_len(struct Qdisc *sch) | 884 | qdisc_peek_len(struct Qdisc *sch) |
888 | { | 885 | { |
889 | struct sk_buff *skb; | 886 | struct sk_buff *skb; |
890 | unsigned int len; | 887 | unsigned int len; |
891 | 888 | ||
892 | skb = sch->dequeue(sch); | 889 | skb = sch->ops->peek(sch); |
893 | if (skb == NULL) { | 890 | if (skb == NULL) { |
894 | if (net_ratelimit()) | 891 | if (net_ratelimit()) |
895 | printk("qdisc_peek_len: non work-conserving qdisc ?\n"); | 892 | printk("qdisc_peek_len: non work-conserving qdisc ?\n"); |
896 | return 0; | 893 | return 0; |
897 | } | 894 | } |
898 | len = qdisc_pkt_len(skb); | 895 | len = qdisc_pkt_len(skb); |
899 | if (unlikely(sch->ops->requeue(skb, sch) != NET_XMIT_SUCCESS)) { | 896 | |
900 | if (net_ratelimit()) | ||
901 | printk("qdisc_peek_len: failed to requeue\n"); | ||
902 | qdisc_tree_decrease_qlen(sch, 1); | ||
903 | return 0; | ||
904 | } | ||
905 | return len; | 897 | return len; |
906 | } | 898 | } |
907 | 899 | ||
@@ -1642,7 +1634,7 @@ hfsc_dequeue(struct Qdisc *sch) | |||
1642 | } | 1634 | } |
1643 | } | 1635 | } |
1644 | 1636 | ||
1645 | skb = cl->qdisc->dequeue(cl->qdisc); | 1637 | skb = qdisc_dequeue_peeked(cl->qdisc); |
1646 | if (skb == NULL) { | 1638 | if (skb == NULL) { |
1647 | if (net_ratelimit()) | 1639 | if (net_ratelimit()) |
1648 | printk("HFSC: Non-work-conserving qdisc ?\n"); | 1640 | printk("HFSC: Non-work-conserving qdisc ?\n"); |
@@ -1735,6 +1727,7 @@ static struct Qdisc_ops hfsc_qdisc_ops __read_mostly = { | |||
1735 | .dump = hfsc_dump_qdisc, | 1727 | .dump = hfsc_dump_qdisc, |
1736 | .enqueue = hfsc_enqueue, | 1728 | .enqueue = hfsc_enqueue, |
1737 | .dequeue = hfsc_dequeue, | 1729 | .dequeue = hfsc_dequeue, |
1730 | .peek = qdisc_peek_dequeued, | ||
1738 | .requeue = hfsc_requeue, | 1731 | .requeue = hfsc_requeue, |
1739 | .drop = hfsc_drop, | 1732 | .drop = hfsc_drop, |
1740 | .cl_ops = &hfsc_class_ops, | 1733 | .cl_ops = &hfsc_class_ops, |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index d14f02056ae6..3fda8199713d 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1565,6 +1565,7 @@ static struct Qdisc_ops htb_qdisc_ops __read_mostly = { | |||
1565 | .priv_size = sizeof(struct htb_sched), | 1565 | .priv_size = sizeof(struct htb_sched), |
1566 | .enqueue = htb_enqueue, | 1566 | .enqueue = htb_enqueue, |
1567 | .dequeue = htb_dequeue, | 1567 | .dequeue = htb_dequeue, |
1568 | .peek = qdisc_peek_dequeued, | ||
1568 | .requeue = htb_requeue, | 1569 | .requeue = htb_requeue, |
1569 | .drop = htb_drop, | 1570 | .drop = htb_drop, |
1570 | .init = htb_init, | 1571 | .init = htb_init, |
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c index 915f3149dde2..155648d23b7c 100644 --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c | |||
@@ -155,6 +155,34 @@ static struct sk_buff *multiq_dequeue(struct Qdisc *sch) | |||
155 | 155 | ||
156 | } | 156 | } |
157 | 157 | ||
158 | static struct sk_buff *multiq_peek(struct Qdisc *sch) | ||
159 | { | ||
160 | struct multiq_sched_data *q = qdisc_priv(sch); | ||
161 | unsigned int curband = q->curband; | ||
162 | struct Qdisc *qdisc; | ||
163 | struct sk_buff *skb; | ||
164 | int band; | ||
165 | |||
166 | for (band = 0; band < q->bands; band++) { | ||
167 | /* cycle through bands to ensure fairness */ | ||
168 | curband++; | ||
169 | if (curband >= q->bands) | ||
170 | curband = 0; | ||
171 | |||
172 | /* Check that target subqueue is available before | ||
173 | * pulling an skb to avoid excessive requeues | ||
174 | */ | ||
175 | if (!__netif_subqueue_stopped(qdisc_dev(sch), curband)) { | ||
176 | qdisc = q->queues[curband]; | ||
177 | skb = qdisc->ops->peek(qdisc); | ||
178 | if (skb) | ||
179 | return skb; | ||
180 | } | ||
181 | } | ||
182 | return NULL; | ||
183 | |||
184 | } | ||
185 | |||
158 | static unsigned int multiq_drop(struct Qdisc *sch) | 186 | static unsigned int multiq_drop(struct Qdisc *sch) |
159 | { | 187 | { |
160 | struct multiq_sched_data *q = qdisc_priv(sch); | 188 | struct multiq_sched_data *q = qdisc_priv(sch); |
@@ -451,6 +479,7 @@ static struct Qdisc_ops multiq_qdisc_ops __read_mostly = { | |||
451 | .priv_size = sizeof(struct multiq_sched_data), | 479 | .priv_size = sizeof(struct multiq_sched_data), |
452 | .enqueue = multiq_enqueue, | 480 | .enqueue = multiq_enqueue, |
453 | .dequeue = multiq_dequeue, | 481 | .dequeue = multiq_dequeue, |
482 | .peek = multiq_peek, | ||
454 | .requeue = multiq_requeue, | 483 | .requeue = multiq_requeue, |
455 | .drop = multiq_drop, | 484 | .drop = multiq_drop, |
456 | .init = multiq_init, | 485 | .init = multiq_init, |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index a11959908d9a..f69698ff88d9 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -233,7 +233,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
233 | */ | 233 | */ |
234 | cb->time_to_send = psched_get_time(); | 234 | cb->time_to_send = psched_get_time(); |
235 | q->counter = 0; | 235 | q->counter = 0; |
236 | ret = q->qdisc->ops->requeue(skb, q->qdisc); | 236 | |
237 | __skb_queue_head(&q->qdisc->q, skb); | ||
238 | q->qdisc->qstats.backlog += qdisc_pkt_len(skb); | ||
239 | q->qdisc->qstats.requeues++; | ||
240 | ret = NET_XMIT_SUCCESS; | ||
237 | } | 241 | } |
238 | 242 | ||
239 | if (likely(ret == NET_XMIT_SUCCESS)) { | 243 | if (likely(ret == NET_XMIT_SUCCESS)) { |
@@ -283,25 +287,22 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch) | |||
283 | if (sch->flags & TCQ_F_THROTTLED) | 287 | if (sch->flags & TCQ_F_THROTTLED) |
284 | return NULL; | 288 | return NULL; |
285 | 289 | ||
286 | skb = q->qdisc->dequeue(q->qdisc); | 290 | skb = q->qdisc->ops->peek(q->qdisc); |
287 | if (skb) { | 291 | if (skb) { |
288 | const struct netem_skb_cb *cb = netem_skb_cb(skb); | 292 | const struct netem_skb_cb *cb = netem_skb_cb(skb); |
289 | psched_time_t now = psched_get_time(); | 293 | psched_time_t now = psched_get_time(); |
290 | 294 | ||
291 | /* if more time remaining? */ | 295 | /* if more time remaining? */ |
292 | if (cb->time_to_send <= now) { | 296 | if (cb->time_to_send <= now) { |
297 | skb = qdisc_dequeue_peeked(q->qdisc); | ||
298 | if (unlikely(!skb)) | ||
299 | return NULL; | ||
300 | |||
293 | pr_debug("netem_dequeue: return skb=%p\n", skb); | 301 | pr_debug("netem_dequeue: return skb=%p\n", skb); |
294 | sch->q.qlen--; | 302 | sch->q.qlen--; |
295 | return skb; | 303 | return skb; |
296 | } | 304 | } |
297 | 305 | ||
298 | if (unlikely(q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS)) { | ||
299 | qdisc_tree_decrease_qlen(q->qdisc, 1); | ||
300 | sch->qstats.drops++; | ||
301 | printk(KERN_ERR "netem: %s could not requeue\n", | ||
302 | q->qdisc->ops->id); | ||
303 | } | ||
304 | |||
305 | qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send); | 306 | qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send); |
306 | } | 307 | } |
307 | 308 | ||
@@ -351,7 +352,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
351 | return 0; | 352 | return 0; |
352 | } | 353 | } |
353 | 354 | ||
354 | static int get_correlation(struct Qdisc *sch, const struct nlattr *attr) | 355 | static void get_correlation(struct Qdisc *sch, const struct nlattr *attr) |
355 | { | 356 | { |
356 | struct netem_sched_data *q = qdisc_priv(sch); | 357 | struct netem_sched_data *q = qdisc_priv(sch); |
357 | const struct tc_netem_corr *c = nla_data(attr); | 358 | const struct tc_netem_corr *c = nla_data(attr); |
@@ -359,27 +360,24 @@ static int get_correlation(struct Qdisc *sch, const struct nlattr *attr) | |||
359 | init_crandom(&q->delay_cor, c->delay_corr); | 360 | init_crandom(&q->delay_cor, c->delay_corr); |
360 | init_crandom(&q->loss_cor, c->loss_corr); | 361 | init_crandom(&q->loss_cor, c->loss_corr); |
361 | init_crandom(&q->dup_cor, c->dup_corr); | 362 | init_crandom(&q->dup_cor, c->dup_corr); |
362 | return 0; | ||
363 | } | 363 | } |
364 | 364 | ||
365 | static int get_reorder(struct Qdisc *sch, const struct nlattr *attr) | 365 | static void get_reorder(struct Qdisc *sch, const struct nlattr *attr) |
366 | { | 366 | { |
367 | struct netem_sched_data *q = qdisc_priv(sch); | 367 | struct netem_sched_data *q = qdisc_priv(sch); |
368 | const struct tc_netem_reorder *r = nla_data(attr); | 368 | const struct tc_netem_reorder *r = nla_data(attr); |
369 | 369 | ||
370 | q->reorder = r->probability; | 370 | q->reorder = r->probability; |
371 | init_crandom(&q->reorder_cor, r->correlation); | 371 | init_crandom(&q->reorder_cor, r->correlation); |
372 | return 0; | ||
373 | } | 372 | } |
374 | 373 | ||
375 | static int get_corrupt(struct Qdisc *sch, const struct nlattr *attr) | 374 | static void get_corrupt(struct Qdisc *sch, const struct nlattr *attr) |
376 | { | 375 | { |
377 | struct netem_sched_data *q = qdisc_priv(sch); | 376 | struct netem_sched_data *q = qdisc_priv(sch); |
378 | const struct tc_netem_corrupt *r = nla_data(attr); | 377 | const struct tc_netem_corrupt *r = nla_data(attr); |
379 | 378 | ||
380 | q->corrupt = r->probability; | 379 | q->corrupt = r->probability; |
381 | init_crandom(&q->corrupt_cor, r->correlation); | 380 | init_crandom(&q->corrupt_cor, r->correlation); |
382 | return 0; | ||
383 | } | 381 | } |
384 | 382 | ||
385 | static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = { | 383 | static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = { |
@@ -438,11 +436,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt) | |||
438 | if (q->gap) | 436 | if (q->gap) |
439 | q->reorder = ~0; | 437 | q->reorder = ~0; |
440 | 438 | ||
441 | if (tb[TCA_NETEM_CORR]) { | 439 | if (tb[TCA_NETEM_CORR]) |
442 | ret = get_correlation(sch, tb[TCA_NETEM_CORR]); | 440 | get_correlation(sch, tb[TCA_NETEM_CORR]); |
443 | if (ret) | ||
444 | return ret; | ||
445 | } | ||
446 | 441 | ||
447 | if (tb[TCA_NETEM_DELAY_DIST]) { | 442 | if (tb[TCA_NETEM_DELAY_DIST]) { |
448 | ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]); | 443 | ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]); |
@@ -450,17 +445,11 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt) | |||
450 | return ret; | 445 | return ret; |
451 | } | 446 | } |
452 | 447 | ||
453 | if (tb[TCA_NETEM_REORDER]) { | 448 | if (tb[TCA_NETEM_REORDER]) |
454 | ret = get_reorder(sch, tb[TCA_NETEM_REORDER]); | 449 | get_reorder(sch, tb[TCA_NETEM_REORDER]); |
455 | if (ret) | ||
456 | return ret; | ||
457 | } | ||
458 | 450 | ||
459 | if (tb[TCA_NETEM_CORRUPT]) { | 451 | if (tb[TCA_NETEM_CORRUPT]) |
460 | ret = get_corrupt(sch, tb[TCA_NETEM_CORRUPT]); | 452 | get_corrupt(sch, tb[TCA_NETEM_CORRUPT]); |
461 | if (ret) | ||
462 | return ret; | ||
463 | } | ||
464 | 453 | ||
465 | return 0; | 454 | return 0; |
466 | } | 455 | } |
@@ -541,6 +530,7 @@ static struct Qdisc_ops tfifo_qdisc_ops __read_mostly = { | |||
541 | .priv_size = sizeof(struct fifo_sched_data), | 530 | .priv_size = sizeof(struct fifo_sched_data), |
542 | .enqueue = tfifo_enqueue, | 531 | .enqueue = tfifo_enqueue, |
543 | .dequeue = qdisc_dequeue_head, | 532 | .dequeue = qdisc_dequeue_head, |
533 | .peek = qdisc_peek_head, | ||
544 | .requeue = qdisc_requeue, | 534 | .requeue = qdisc_requeue, |
545 | .drop = qdisc_queue_drop, | 535 | .drop = qdisc_queue_drop, |
546 | .init = tfifo_init, | 536 | .init = tfifo_init, |
@@ -624,98 +614,12 @@ nla_put_failure: | |||
624 | return -1; | 614 | return -1; |
625 | } | 615 | } |
626 | 616 | ||
627 | static int netem_dump_class(struct Qdisc *sch, unsigned long cl, | ||
628 | struct sk_buff *skb, struct tcmsg *tcm) | ||
629 | { | ||
630 | struct netem_sched_data *q = qdisc_priv(sch); | ||
631 | |||
632 | if (cl != 1) /* only one class */ | ||
633 | return -ENOENT; | ||
634 | |||
635 | tcm->tcm_handle |= TC_H_MIN(1); | ||
636 | tcm->tcm_info = q->qdisc->handle; | ||
637 | |||
638 | return 0; | ||
639 | } | ||
640 | |||
641 | static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, | ||
642 | struct Qdisc **old) | ||
643 | { | ||
644 | struct netem_sched_data *q = qdisc_priv(sch); | ||
645 | |||
646 | if (new == NULL) | ||
647 | new = &noop_qdisc; | ||
648 | |||
649 | sch_tree_lock(sch); | ||
650 | *old = xchg(&q->qdisc, new); | ||
651 | qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); | ||
652 | qdisc_reset(*old); | ||
653 | sch_tree_unlock(sch); | ||
654 | |||
655 | return 0; | ||
656 | } | ||
657 | |||
658 | static struct Qdisc *netem_leaf(struct Qdisc *sch, unsigned long arg) | ||
659 | { | ||
660 | struct netem_sched_data *q = qdisc_priv(sch); | ||
661 | return q->qdisc; | ||
662 | } | ||
663 | |||
664 | static unsigned long netem_get(struct Qdisc *sch, u32 classid) | ||
665 | { | ||
666 | return 1; | ||
667 | } | ||
668 | |||
669 | static void netem_put(struct Qdisc *sch, unsigned long arg) | ||
670 | { | ||
671 | } | ||
672 | |||
673 | static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | ||
674 | struct nlattr **tca, unsigned long *arg) | ||
675 | { | ||
676 | return -ENOSYS; | ||
677 | } | ||
678 | |||
679 | static int netem_delete(struct Qdisc *sch, unsigned long arg) | ||
680 | { | ||
681 | return -ENOSYS; | ||
682 | } | ||
683 | |||
684 | static void netem_walk(struct Qdisc *sch, struct qdisc_walker *walker) | ||
685 | { | ||
686 | if (!walker->stop) { | ||
687 | if (walker->count >= walker->skip) | ||
688 | if (walker->fn(sch, 1, walker) < 0) { | ||
689 | walker->stop = 1; | ||
690 | return; | ||
691 | } | ||
692 | walker->count++; | ||
693 | } | ||
694 | } | ||
695 | |||
696 | static struct tcf_proto **netem_find_tcf(struct Qdisc *sch, unsigned long cl) | ||
697 | { | ||
698 | return NULL; | ||
699 | } | ||
700 | |||
701 | static const struct Qdisc_class_ops netem_class_ops = { | ||
702 | .graft = netem_graft, | ||
703 | .leaf = netem_leaf, | ||
704 | .get = netem_get, | ||
705 | .put = netem_put, | ||
706 | .change = netem_change_class, | ||
707 | .delete = netem_delete, | ||
708 | .walk = netem_walk, | ||
709 | .tcf_chain = netem_find_tcf, | ||
710 | .dump = netem_dump_class, | ||
711 | }; | ||
712 | |||
713 | static struct Qdisc_ops netem_qdisc_ops __read_mostly = { | 617 | static struct Qdisc_ops netem_qdisc_ops __read_mostly = { |
714 | .id = "netem", | 618 | .id = "netem", |
715 | .cl_ops = &netem_class_ops, | ||
716 | .priv_size = sizeof(struct netem_sched_data), | 619 | .priv_size = sizeof(struct netem_sched_data), |
717 | .enqueue = netem_enqueue, | 620 | .enqueue = netem_enqueue, |
718 | .dequeue = netem_dequeue, | 621 | .dequeue = netem_dequeue, |
622 | .peek = qdisc_peek_dequeued, | ||
719 | .requeue = netem_requeue, | 623 | .requeue = netem_requeue, |
720 | .drop = netem_drop, | 624 | .drop = netem_drop, |
721 | .init = netem_init, | 625 | .init = netem_init, |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 504a78cdb718..3651da3e2802 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -120,6 +120,19 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch) | |||
120 | return ret; | 120 | return ret; |
121 | } | 121 | } |
122 | 122 | ||
123 | static struct sk_buff *prio_peek(struct Qdisc *sch) | ||
124 | { | ||
125 | struct prio_sched_data *q = qdisc_priv(sch); | ||
126 | int prio; | ||
127 | |||
128 | for (prio = 0; prio < q->bands; prio++) { | ||
129 | struct Qdisc *qdisc = q->queues[prio]; | ||
130 | struct sk_buff *skb = qdisc->ops->peek(qdisc); | ||
131 | if (skb) | ||
132 | return skb; | ||
133 | } | ||
134 | return NULL; | ||
135 | } | ||
123 | 136 | ||
124 | static struct sk_buff *prio_dequeue(struct Qdisc* sch) | 137 | static struct sk_buff *prio_dequeue(struct Qdisc* sch) |
125 | { | 138 | { |
@@ -421,6 +434,7 @@ static struct Qdisc_ops prio_qdisc_ops __read_mostly = { | |||
421 | .priv_size = sizeof(struct prio_sched_data), | 434 | .priv_size = sizeof(struct prio_sched_data), |
422 | .enqueue = prio_enqueue, | 435 | .enqueue = prio_enqueue, |
423 | .dequeue = prio_dequeue, | 436 | .dequeue = prio_dequeue, |
437 | .peek = prio_peek, | ||
424 | .requeue = prio_requeue, | 438 | .requeue = prio_requeue, |
425 | .drop = prio_drop, | 439 | .drop = prio_drop, |
426 | .init = prio_init, | 440 | .init = prio_init, |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 5da05839e225..7abc51454c2d 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -140,6 +140,14 @@ static struct sk_buff * red_dequeue(struct Qdisc* sch) | |||
140 | return skb; | 140 | return skb; |
141 | } | 141 | } |
142 | 142 | ||
143 | static struct sk_buff * red_peek(struct Qdisc* sch) | ||
144 | { | ||
145 | struct red_sched_data *q = qdisc_priv(sch); | ||
146 | struct Qdisc *child = q->qdisc; | ||
147 | |||
148 | return child->ops->peek(child); | ||
149 | } | ||
150 | |||
143 | static unsigned int red_drop(struct Qdisc* sch) | 151 | static unsigned int red_drop(struct Qdisc* sch) |
144 | { | 152 | { |
145 | struct red_sched_data *q = qdisc_priv(sch); | 153 | struct red_sched_data *q = qdisc_priv(sch); |
@@ -361,6 +369,7 @@ static struct Qdisc_ops red_qdisc_ops __read_mostly = { | |||
361 | .cl_ops = &red_class_ops, | 369 | .cl_ops = &red_class_ops, |
362 | .enqueue = red_enqueue, | 370 | .enqueue = red_enqueue, |
363 | .dequeue = red_dequeue, | 371 | .dequeue = red_dequeue, |
372 | .peek = red_peek, | ||
364 | .requeue = red_requeue, | 373 | .requeue = red_requeue, |
365 | .drop = red_drop, | 374 | .drop = red_drop, |
366 | .init = red_init, | 375 | .init = red_init, |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index fe1508ef0d3d..198b83d42ba8 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -391,8 +391,19 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc *sch) | |||
391 | return NET_XMIT_CN; | 391 | return NET_XMIT_CN; |
392 | } | 392 | } |
393 | 393 | ||
394 | static struct sk_buff * | ||
395 | sfq_peek(struct Qdisc *sch) | ||
396 | { | ||
397 | struct sfq_sched_data *q = qdisc_priv(sch); | ||
398 | sfq_index a; | ||
394 | 399 | ||
400 | /* No active slots */ | ||
401 | if (q->tail == SFQ_DEPTH) | ||
402 | return NULL; | ||
395 | 403 | ||
404 | a = q->next[q->tail]; | ||
405 | return skb_peek(&q->qs[a]); | ||
406 | } | ||
396 | 407 | ||
397 | static struct sk_buff * | 408 | static struct sk_buff * |
398 | sfq_dequeue(struct Qdisc *sch) | 409 | sfq_dequeue(struct Qdisc *sch) |
@@ -624,6 +635,7 @@ static struct Qdisc_ops sfq_qdisc_ops __read_mostly = { | |||
624 | .priv_size = sizeof(struct sfq_sched_data), | 635 | .priv_size = sizeof(struct sfq_sched_data), |
625 | .enqueue = sfq_enqueue, | 636 | .enqueue = sfq_enqueue, |
626 | .dequeue = sfq_dequeue, | 637 | .dequeue = sfq_dequeue, |
638 | .peek = sfq_peek, | ||
627 | .requeue = sfq_requeue, | 639 | .requeue = sfq_requeue, |
628 | .drop = sfq_drop, | 640 | .drop = sfq_drop, |
629 | .init = sfq_init, | 641 | .init = sfq_init, |
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 94c61598b86a..435076cf620e 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -169,7 +169,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
169 | struct tbf_sched_data *q = qdisc_priv(sch); | 169 | struct tbf_sched_data *q = qdisc_priv(sch); |
170 | struct sk_buff *skb; | 170 | struct sk_buff *skb; |
171 | 171 | ||
172 | skb = q->qdisc->dequeue(q->qdisc); | 172 | skb = q->qdisc->ops->peek(q->qdisc); |
173 | 173 | ||
174 | if (skb) { | 174 | if (skb) { |
175 | psched_time_t now; | 175 | psched_time_t now; |
@@ -192,6 +192,10 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
192 | toks -= L2T(q, len); | 192 | toks -= L2T(q, len); |
193 | 193 | ||
194 | if ((toks|ptoks) >= 0) { | 194 | if ((toks|ptoks) >= 0) { |
195 | skb = qdisc_dequeue_peeked(q->qdisc); | ||
196 | if (unlikely(!skb)) | ||
197 | return NULL; | ||
198 | |||
195 | q->t_c = now; | 199 | q->t_c = now; |
196 | q->tokens = toks; | 200 | q->tokens = toks; |
197 | q->ptokens = ptoks; | 201 | q->ptokens = ptoks; |
@@ -214,12 +218,6 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
214 | (cf. CSZ, HPFQ, HFSC) | 218 | (cf. CSZ, HPFQ, HFSC) |
215 | */ | 219 | */ |
216 | 220 | ||
217 | if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) { | ||
218 | /* When requeue fails skb is dropped */ | ||
219 | qdisc_tree_decrease_qlen(q->qdisc, 1); | ||
220 | sch->qstats.drops++; | ||
221 | } | ||
222 | |||
223 | sch->qstats.overlimits++; | 221 | sch->qstats.overlimits++; |
224 | } | 222 | } |
225 | return NULL; | 223 | return NULL; |
@@ -469,6 +467,7 @@ static struct Qdisc_ops tbf_qdisc_ops __read_mostly = { | |||
469 | .priv_size = sizeof(struct tbf_sched_data), | 467 | .priv_size = sizeof(struct tbf_sched_data), |
470 | .enqueue = tbf_enqueue, | 468 | .enqueue = tbf_enqueue, |
471 | .dequeue = tbf_dequeue, | 469 | .dequeue = tbf_dequeue, |
470 | .peek = qdisc_peek_dequeued, | ||
472 | .requeue = tbf_requeue, | 471 | .requeue = tbf_requeue, |
473 | .drop = tbf_drop, | 472 | .drop = tbf_drop, |
474 | .init = tbf_init, | 473 | .init = tbf_init, |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index d35ef059abb1..bf03e7fa1849 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -123,6 +123,13 @@ teql_dequeue(struct Qdisc* sch) | |||
123 | return skb; | 123 | return skb; |
124 | } | 124 | } |
125 | 125 | ||
126 | static struct sk_buff * | ||
127 | teql_peek(struct Qdisc* sch) | ||
128 | { | ||
129 | /* teql is meant to be used as root qdisc */ | ||
130 | return NULL; | ||
131 | } | ||
132 | |||
126 | static __inline__ void | 133 | static __inline__ void |
127 | teql_neigh_release(struct neighbour *n) | 134 | teql_neigh_release(struct neighbour *n) |
128 | { | 135 | { |
@@ -433,6 +440,7 @@ static __init void teql_master_setup(struct net_device *dev) | |||
433 | 440 | ||
434 | ops->enqueue = teql_enqueue; | 441 | ops->enqueue = teql_enqueue; |
435 | ops->dequeue = teql_dequeue; | 442 | ops->dequeue = teql_dequeue; |
443 | ops->peek = teql_peek; | ||
436 | ops->requeue = teql_requeue; | 444 | ops->requeue = teql_requeue; |
437 | ops->init = teql_qdisc_init; | 445 | ops->init = teql_qdisc_init; |
438 | ops->reset = teql_reset; | 446 | ops->reset = teql_reset; |
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. */ |
728 | static void sctp_v6_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) | 721 | static 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 | ||
733 | static void sctp_v6_ecn_capable(struct sock *sk) | 726 | static void sctp_v6_ecn_capable(struct sock *sk) |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 0b65354aaf64..a8ca743241ee 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -482,9 +482,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, | |||
482 | if (saddr) | 482 | if (saddr) |
483 | fl.fl4_src = saddr->v4.sin_addr.s_addr; | 483 | fl.fl4_src = saddr->v4.sin_addr.s_addr; |
484 | 484 | ||
485 | SCTP_DEBUG_PRINTK("%s: DST:%u.%u.%u.%u, SRC:%u.%u.%u.%u - ", | 485 | SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", |
486 | __func__, NIPQUAD(fl.fl4_dst), | 486 | __func__, &fl.fl4_dst, &fl.fl4_src); |
487 | NIPQUAD(fl.fl4_src)); | ||
488 | 487 | ||
489 | if (!ip_route_output_key(&init_net, &rt, &fl)) { | 488 | if (!ip_route_output_key(&init_net, &rt, &fl)) { |
490 | dst = &rt->u.dst; | 489 | dst = &rt->u.dst; |
@@ -540,8 +539,8 @@ out_unlock: | |||
540 | rcu_read_unlock(); | 539 | rcu_read_unlock(); |
541 | out: | 540 | out: |
542 | if (dst) | 541 | if (dst) |
543 | SCTP_DEBUG_PRINTK("rt_dst:%u.%u.%u.%u, rt_src:%u.%u.%u.%u\n", | 542 | SCTP_DEBUG_PRINTK("rt_dst:%pI4, rt_src:%pI4\n", |
544 | NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_src)); | 543 | &rt->rt_dst, &rt->rt_src); |
545 | else | 544 | else |
546 | SCTP_DEBUG_PRINTK("NO ROUTE\n"); | 545 | SCTP_DEBUG_PRINTK("NO ROUTE\n"); |
547 | 546 | ||
@@ -646,7 +645,7 @@ static void sctp_v4_addr_v4map(struct sctp_sock *sp, union sctp_addr *addr) | |||
646 | /* Dump the v4 addr to the seq file. */ | 645 | /* Dump the v4 addr to the seq file. */ |
647 | static void sctp_v4_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) | 646 | static void sctp_v4_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) |
648 | { | 647 | { |
649 | seq_printf(seq, "%d.%d.%d.%d ", NIPQUAD(addr->v4.sin_addr)); | 648 | seq_printf(seq, "%pI4 ", &addr->v4.sin_addr); |
650 | } | 649 | } |
651 | 650 | ||
652 | static void sctp_v4_ecn_capable(struct sock *sk) | 651 | static void sctp_v4_ecn_capable(struct sock *sk) |
@@ -866,11 +865,10 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
866 | { | 865 | { |
867 | struct inet_sock *inet = inet_sk(skb->sk); | 866 | struct inet_sock *inet = inet_sk(skb->sk); |
868 | 867 | ||
869 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " | 868 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", |
870 | "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", | ||
871 | __func__, skb, skb->len, | 869 | __func__, skb, skb->len, |
872 | NIPQUAD(skb->rtable->rt_src), | 870 | &skb->rtable->rt_src, |
873 | NIPQUAD(skb->rtable->rt_dst)); | 871 | &skb->rtable->rt_dst); |
874 | 872 | ||
875 | inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? | 873 | inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? |
876 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; | 874 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index a6a0ea71ae93..9f2a3eb656e5 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -1123,19 +1123,17 @@ 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 |
1134 | "%s association %p could not find address " | 1133 | "%s association %p could not find address %pI4\n", |
1135 | NIPQUAD_FMT "\n", | ||
1136 | __func__, | 1134 | __func__, |
1137 | asoc, | 1135 | asoc, |
1138 | NIPQUAD(from_addr.v4.sin_addr.s_addr)); | 1136 | &from_addr.v4.sin_addr.s_addr); |
1139 | } | 1137 | } |
1140 | return SCTP_DISPOSITION_DISCARD; | 1138 | return SCTP_DISPOSITION_DISCARD; |
1141 | } | 1139 | } |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 52910697e104..f58e994e6852 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -63,8 +63,8 @@ static ctl_table sctp_table[] = { | |||
63 | .data = &sctp_rto_initial, | 63 | .data = &sctp_rto_initial, |
64 | .maxlen = sizeof(unsigned int), | 64 | .maxlen = sizeof(unsigned int), |
65 | .mode = 0644, | 65 | .mode = 0644, |
66 | .proc_handler = &proc_dointvec_minmax, | 66 | .proc_handler = proc_dointvec_minmax, |
67 | .strategy = &sysctl_intvec, | 67 | .strategy = sysctl_intvec, |
68 | .extra1 = &one, | 68 | .extra1 = &one, |
69 | .extra2 = &timer_max | 69 | .extra2 = &timer_max |
70 | }, | 70 | }, |
@@ -74,8 +74,8 @@ static ctl_table sctp_table[] = { | |||
74 | .data = &sctp_rto_min, | 74 | .data = &sctp_rto_min, |
75 | .maxlen = sizeof(unsigned int), | 75 | .maxlen = sizeof(unsigned int), |
76 | .mode = 0644, | 76 | .mode = 0644, |
77 | .proc_handler = &proc_dointvec_minmax, | 77 | .proc_handler = proc_dointvec_minmax, |
78 | .strategy = &sysctl_intvec, | 78 | .strategy = sysctl_intvec, |
79 | .extra1 = &one, | 79 | .extra1 = &one, |
80 | .extra2 = &timer_max | 80 | .extra2 = &timer_max |
81 | }, | 81 | }, |
@@ -85,8 +85,8 @@ static ctl_table sctp_table[] = { | |||
85 | .data = &sctp_rto_max, | 85 | .data = &sctp_rto_max, |
86 | .maxlen = sizeof(unsigned int), | 86 | .maxlen = sizeof(unsigned int), |
87 | .mode = 0644, | 87 | .mode = 0644, |
88 | .proc_handler = &proc_dointvec_minmax, | 88 | .proc_handler = proc_dointvec_minmax, |
89 | .strategy = &sysctl_intvec, | 89 | .strategy = sysctl_intvec, |
90 | .extra1 = &one, | 90 | .extra1 = &one, |
91 | .extra2 = &timer_max | 91 | .extra2 = &timer_max |
92 | }, | 92 | }, |
@@ -96,8 +96,8 @@ static ctl_table sctp_table[] = { | |||
96 | .data = &sctp_valid_cookie_life, | 96 | .data = &sctp_valid_cookie_life, |
97 | .maxlen = sizeof(unsigned int), | 97 | .maxlen = sizeof(unsigned int), |
98 | .mode = 0644, | 98 | .mode = 0644, |
99 | .proc_handler = &proc_dointvec_minmax, | 99 | .proc_handler = proc_dointvec_minmax, |
100 | .strategy = &sysctl_intvec, | 100 | .strategy = sysctl_intvec, |
101 | .extra1 = &one, | 101 | .extra1 = &one, |
102 | .extra2 = &timer_max | 102 | .extra2 = &timer_max |
103 | }, | 103 | }, |
@@ -107,8 +107,8 @@ static ctl_table sctp_table[] = { | |||
107 | .data = &sctp_max_burst, | 107 | .data = &sctp_max_burst, |
108 | .maxlen = sizeof(int), | 108 | .maxlen = sizeof(int), |
109 | .mode = 0644, | 109 | .mode = 0644, |
110 | .proc_handler = &proc_dointvec_minmax, | 110 | .proc_handler = proc_dointvec_minmax, |
111 | .strategy = &sysctl_intvec, | 111 | .strategy = sysctl_intvec, |
112 | .extra1 = &zero, | 112 | .extra1 = &zero, |
113 | .extra2 = &int_max | 113 | .extra2 = &int_max |
114 | }, | 114 | }, |
@@ -118,8 +118,8 @@ static ctl_table sctp_table[] = { | |||
118 | .data = &sctp_max_retrans_association, | 118 | .data = &sctp_max_retrans_association, |
119 | .maxlen = sizeof(int), | 119 | .maxlen = sizeof(int), |
120 | .mode = 0644, | 120 | .mode = 0644, |
121 | .proc_handler = &proc_dointvec_minmax, | 121 | .proc_handler = proc_dointvec_minmax, |
122 | .strategy = &sysctl_intvec, | 122 | .strategy = sysctl_intvec, |
123 | .extra1 = &one, | 123 | .extra1 = &one, |
124 | .extra2 = &int_max | 124 | .extra2 = &int_max |
125 | }, | 125 | }, |
@@ -129,8 +129,8 @@ static ctl_table sctp_table[] = { | |||
129 | .data = &sctp_sndbuf_policy, | 129 | .data = &sctp_sndbuf_policy, |
130 | .maxlen = sizeof(int), | 130 | .maxlen = sizeof(int), |
131 | .mode = 0644, | 131 | .mode = 0644, |
132 | .proc_handler = &proc_dointvec, | 132 | .proc_handler = proc_dointvec, |
133 | .strategy = &sysctl_intvec | 133 | .strategy = sysctl_intvec |
134 | }, | 134 | }, |
135 | { | 135 | { |
136 | .ctl_name = NET_SCTP_RCVBUF_POLICY, | 136 | .ctl_name = NET_SCTP_RCVBUF_POLICY, |
@@ -138,8 +138,8 @@ static ctl_table sctp_table[] = { | |||
138 | .data = &sctp_rcvbuf_policy, | 138 | .data = &sctp_rcvbuf_policy, |
139 | .maxlen = sizeof(int), | 139 | .maxlen = sizeof(int), |
140 | .mode = 0644, | 140 | .mode = 0644, |
141 | .proc_handler = &proc_dointvec, | 141 | .proc_handler = proc_dointvec, |
142 | .strategy = &sysctl_intvec | 142 | .strategy = sysctl_intvec |
143 | }, | 143 | }, |
144 | { | 144 | { |
145 | .ctl_name = NET_SCTP_PATH_MAX_RETRANS, | 145 | .ctl_name = NET_SCTP_PATH_MAX_RETRANS, |
@@ -147,8 +147,8 @@ static ctl_table sctp_table[] = { | |||
147 | .data = &sctp_max_retrans_path, | 147 | .data = &sctp_max_retrans_path, |
148 | .maxlen = sizeof(int), | 148 | .maxlen = sizeof(int), |
149 | .mode = 0644, | 149 | .mode = 0644, |
150 | .proc_handler = &proc_dointvec_minmax, | 150 | .proc_handler = proc_dointvec_minmax, |
151 | .strategy = &sysctl_intvec, | 151 | .strategy = sysctl_intvec, |
152 | .extra1 = &one, | 152 | .extra1 = &one, |
153 | .extra2 = &int_max | 153 | .extra2 = &int_max |
154 | }, | 154 | }, |
@@ -158,8 +158,8 @@ static ctl_table sctp_table[] = { | |||
158 | .data = &sctp_max_retrans_init, | 158 | .data = &sctp_max_retrans_init, |
159 | .maxlen = sizeof(int), | 159 | .maxlen = sizeof(int), |
160 | .mode = 0644, | 160 | .mode = 0644, |
161 | .proc_handler = &proc_dointvec_minmax, | 161 | .proc_handler = proc_dointvec_minmax, |
162 | .strategy = &sysctl_intvec, | 162 | .strategy = sysctl_intvec, |
163 | .extra1 = &one, | 163 | .extra1 = &one, |
164 | .extra2 = &int_max | 164 | .extra2 = &int_max |
165 | }, | 165 | }, |
@@ -169,8 +169,8 @@ static ctl_table sctp_table[] = { | |||
169 | .data = &sctp_hb_interval, | 169 | .data = &sctp_hb_interval, |
170 | .maxlen = sizeof(unsigned int), | 170 | .maxlen = sizeof(unsigned int), |
171 | .mode = 0644, | 171 | .mode = 0644, |
172 | .proc_handler = &proc_dointvec_minmax, | 172 | .proc_handler = proc_dointvec_minmax, |
173 | .strategy = &sysctl_intvec, | 173 | .strategy = sysctl_intvec, |
174 | .extra1 = &one, | 174 | .extra1 = &one, |
175 | .extra2 = &timer_max | 175 | .extra2 = &timer_max |
176 | }, | 176 | }, |
@@ -180,8 +180,8 @@ static ctl_table sctp_table[] = { | |||
180 | .data = &sctp_cookie_preserve_enable, | 180 | .data = &sctp_cookie_preserve_enable, |
181 | .maxlen = sizeof(int), | 181 | .maxlen = sizeof(int), |
182 | .mode = 0644, | 182 | .mode = 0644, |
183 | .proc_handler = &proc_dointvec, | 183 | .proc_handler = proc_dointvec, |
184 | .strategy = &sysctl_intvec | 184 | .strategy = sysctl_intvec |
185 | }, | 185 | }, |
186 | { | 186 | { |
187 | .ctl_name = NET_SCTP_RTO_ALPHA, | 187 | .ctl_name = NET_SCTP_RTO_ALPHA, |
@@ -189,8 +189,8 @@ static ctl_table sctp_table[] = { | |||
189 | .data = &sctp_rto_alpha, | 189 | .data = &sctp_rto_alpha, |
190 | .maxlen = sizeof(int), | 190 | .maxlen = sizeof(int), |
191 | .mode = 0444, | 191 | .mode = 0444, |
192 | .proc_handler = &proc_dointvec, | 192 | .proc_handler = proc_dointvec, |
193 | .strategy = &sysctl_intvec | 193 | .strategy = sysctl_intvec |
194 | }, | 194 | }, |
195 | { | 195 | { |
196 | .ctl_name = NET_SCTP_RTO_BETA, | 196 | .ctl_name = NET_SCTP_RTO_BETA, |
@@ -198,8 +198,8 @@ static ctl_table sctp_table[] = { | |||
198 | .data = &sctp_rto_beta, | 198 | .data = &sctp_rto_beta, |
199 | .maxlen = sizeof(int), | 199 | .maxlen = sizeof(int), |
200 | .mode = 0444, | 200 | .mode = 0444, |
201 | .proc_handler = &proc_dointvec, | 201 | .proc_handler = proc_dointvec, |
202 | .strategy = &sysctl_intvec | 202 | .strategy = sysctl_intvec |
203 | }, | 203 | }, |
204 | { | 204 | { |
205 | .ctl_name = NET_SCTP_ADDIP_ENABLE, | 205 | .ctl_name = NET_SCTP_ADDIP_ENABLE, |
@@ -207,8 +207,8 @@ static ctl_table sctp_table[] = { | |||
207 | .data = &sctp_addip_enable, | 207 | .data = &sctp_addip_enable, |
208 | .maxlen = sizeof(int), | 208 | .maxlen = sizeof(int), |
209 | .mode = 0644, | 209 | .mode = 0644, |
210 | .proc_handler = &proc_dointvec, | 210 | .proc_handler = proc_dointvec, |
211 | .strategy = &sysctl_intvec | 211 | .strategy = sysctl_intvec |
212 | }, | 212 | }, |
213 | { | 213 | { |
214 | .ctl_name = NET_SCTP_PRSCTP_ENABLE, | 214 | .ctl_name = NET_SCTP_PRSCTP_ENABLE, |
@@ -216,8 +216,8 @@ static ctl_table sctp_table[] = { | |||
216 | .data = &sctp_prsctp_enable, | 216 | .data = &sctp_prsctp_enable, |
217 | .maxlen = sizeof(int), | 217 | .maxlen = sizeof(int), |
218 | .mode = 0644, | 218 | .mode = 0644, |
219 | .proc_handler = &proc_dointvec, | 219 | .proc_handler = proc_dointvec, |
220 | .strategy = &sysctl_intvec | 220 | .strategy = sysctl_intvec |
221 | }, | 221 | }, |
222 | { | 222 | { |
223 | .ctl_name = NET_SCTP_SACK_TIMEOUT, | 223 | .ctl_name = NET_SCTP_SACK_TIMEOUT, |
@@ -225,8 +225,8 @@ static ctl_table sctp_table[] = { | |||
225 | .data = &sctp_sack_timeout, | 225 | .data = &sctp_sack_timeout, |
226 | .maxlen = sizeof(long), | 226 | .maxlen = sizeof(long), |
227 | .mode = 0644, | 227 | .mode = 0644, |
228 | .proc_handler = &proc_dointvec_minmax, | 228 | .proc_handler = proc_dointvec_minmax, |
229 | .strategy = &sysctl_intvec, | 229 | .strategy = sysctl_intvec, |
230 | .extra1 = &sack_timer_min, | 230 | .extra1 = &sack_timer_min, |
231 | .extra2 = &sack_timer_max, | 231 | .extra2 = &sack_timer_max, |
232 | }, | 232 | }, |
@@ -236,7 +236,7 @@ static ctl_table sctp_table[] = { | |||
236 | .data = &sysctl_sctp_mem, | 236 | .data = &sysctl_sctp_mem, |
237 | .maxlen = sizeof(sysctl_sctp_mem), | 237 | .maxlen = sizeof(sysctl_sctp_mem), |
238 | .mode = 0644, | 238 | .mode = 0644, |
239 | .proc_handler = &proc_dointvec, | 239 | .proc_handler = proc_dointvec, |
240 | }, | 240 | }, |
241 | { | 241 | { |
242 | .ctl_name = CTL_UNNUMBERED, | 242 | .ctl_name = CTL_UNNUMBERED, |
@@ -244,7 +244,7 @@ static ctl_table sctp_table[] = { | |||
244 | .data = &sysctl_sctp_rmem, | 244 | .data = &sysctl_sctp_rmem, |
245 | .maxlen = sizeof(sysctl_sctp_rmem), | 245 | .maxlen = sizeof(sysctl_sctp_rmem), |
246 | .mode = 0644, | 246 | .mode = 0644, |
247 | .proc_handler = &proc_dointvec, | 247 | .proc_handler = proc_dointvec, |
248 | }, | 248 | }, |
249 | { | 249 | { |
250 | .ctl_name = CTL_UNNUMBERED, | 250 | .ctl_name = CTL_UNNUMBERED, |
@@ -252,7 +252,7 @@ static ctl_table sctp_table[] = { | |||
252 | .data = &sysctl_sctp_wmem, | 252 | .data = &sysctl_sctp_wmem, |
253 | .maxlen = sizeof(sysctl_sctp_wmem), | 253 | .maxlen = sizeof(sysctl_sctp_wmem), |
254 | .mode = 0644, | 254 | .mode = 0644, |
255 | .proc_handler = &proc_dointvec, | 255 | .proc_handler = proc_dointvec, |
256 | }, | 256 | }, |
257 | { | 257 | { |
258 | .ctl_name = CTL_UNNUMBERED, | 258 | .ctl_name = CTL_UNNUMBERED, |
@@ -260,8 +260,8 @@ static ctl_table sctp_table[] = { | |||
260 | .data = &sctp_auth_enable, | 260 | .data = &sctp_auth_enable, |
261 | .maxlen = sizeof(int), | 261 | .maxlen = sizeof(int), |
262 | .mode = 0644, | 262 | .mode = 0644, |
263 | .proc_handler = &proc_dointvec, | 263 | .proc_handler = proc_dointvec, |
264 | .strategy = &sysctl_intvec | 264 | .strategy = sysctl_intvec |
265 | }, | 265 | }, |
266 | { | 266 | { |
267 | .ctl_name = CTL_UNNUMBERED, | 267 | .ctl_name = CTL_UNNUMBERED, |
@@ -269,8 +269,8 @@ static ctl_table sctp_table[] = { | |||
269 | .data = &sctp_addip_noauth, | 269 | .data = &sctp_addip_noauth, |
270 | .maxlen = sizeof(int), | 270 | .maxlen = sizeof(int), |
271 | .mode = 0644, | 271 | .mode = 0644, |
272 | .proc_handler = &proc_dointvec, | 272 | .proc_handler = proc_dointvec, |
273 | .strategy = &sysctl_intvec | 273 | .strategy = sysctl_intvec |
274 | }, | 274 | }, |
275 | { .ctl_name = 0 } | 275 | { .ctl_name = 0 } |
276 | }; | 276 | }; |
diff --git a/net/socket.c b/net/socket.c index 57550c3bcabe..d7128b761c8c 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -69,7 +69,6 @@ | |||
69 | #include <linux/proc_fs.h> | 69 | #include <linux/proc_fs.h> |
70 | #include <linux/seq_file.h> | 70 | #include <linux/seq_file.h> |
71 | #include <linux/mutex.h> | 71 | #include <linux/mutex.h> |
72 | #include <linux/thread_info.h> | ||
73 | #include <linux/wanrouter.h> | 72 | #include <linux/wanrouter.h> |
74 | #include <linux/if_bridge.h> | 73 | #include <linux/if_bridge.h> |
75 | #include <linux/if_frad.h> | 74 | #include <linux/if_frad.h> |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4895c341e46d..3ca518386d15 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -271,15 +271,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
271 | case AF_INET: { | 271 | case AF_INET: { |
272 | struct sockaddr_in *sin = | 272 | struct sockaddr_in *sin = |
273 | (struct sockaddr_in *)args->address; | 273 | (struct sockaddr_in *)args->address; |
274 | snprintf(servername, sizeof(servername), NIPQUAD_FMT, | 274 | snprintf(servername, sizeof(servername), "%pI4", |
275 | NIPQUAD(sin->sin_addr.s_addr)); | 275 | &sin->sin_addr.s_addr); |
276 | break; | 276 | break; |
277 | } | 277 | } |
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..03ae007641e4 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -270,10 +270,9 @@ static int rpcb_register_netid4(struct sockaddr_in *address_to_register, | |||
270 | char buf[32]; | 270 | char buf[32]; |
271 | 271 | ||
272 | /* Construct AF_INET universal address */ | 272 | /* Construct AF_INET universal address */ |
273 | snprintf(buf, sizeof(buf), | 273 | snprintf(buf, sizeof(buf), "%pI4.%u.%u", |
274 | NIPQUAD_FMT".%u.%u", | 274 | &address_to_register->sin_addr.s_addr, |
275 | NIPQUAD(address_to_register->sin_addr.s_addr), | 275 | port >> 8, port & 0xff); |
276 | port >> 8, port & 0xff); | ||
277 | map->r_addr = buf; | 276 | map->r_addr = buf; |
278 | 277 | ||
279 | dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " | 278 | dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " |
@@ -305,9 +304,9 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register, | |||
305 | snprintf(buf, sizeof(buf), "::.%u.%u", | 304 | snprintf(buf, sizeof(buf), "::.%u.%u", |
306 | port >> 8, port & 0xff); | 305 | port >> 8, port & 0xff); |
307 | else | 306 | else |
308 | snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u", | 307 | snprintf(buf, sizeof(buf), "%pI6.%u.%u", |
309 | NIP6(address_to_register->sin6_addr), | 308 | &address_to_register->sin6_addr, |
310 | port >> 8, port & 0xff); | 309 | port >> 8, port & 0xff); |
311 | map->r_addr = buf; | 310 | map->r_addr = buf; |
312 | 311 | ||
313 | dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " | 312 | dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " |
@@ -422,8 +421,8 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot) | |||
422 | struct rpc_clnt *rpcb_clnt; | 421 | struct rpc_clnt *rpcb_clnt; |
423 | int status; | 422 | int status; |
424 | 423 | ||
425 | dprintk("RPC: %s(" NIPQUAD_FMT ", %u, %u, %d)\n", | 424 | dprintk("RPC: %s(%pI4, %u, %u, %d)\n", |
426 | __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); | 425 | __func__, &sin->sin_addr.s_addr, prog, vers, prot); |
427 | 426 | ||
428 | rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, | 427 | rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, |
429 | sizeof(*sin), prot, RPCBVERS_2); | 428 | sizeof(*sin), prot, RPCBVERS_2); |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index f24800f2c098..82240e6127b2 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -162,13 +162,9 @@ static void ip_map_request(struct cache_detail *cd, | |||
162 | struct ip_map *im = container_of(h, struct ip_map, h); | 162 | struct ip_map *im = container_of(h, struct ip_map, h); |
163 | 163 | ||
164 | if (ipv6_addr_v4mapped(&(im->m_addr))) { | 164 | if (ipv6_addr_v4mapped(&(im->m_addr))) { |
165 | snprintf(text_addr, 20, NIPQUAD_FMT, | 165 | snprintf(text_addr, 20, "%pI4", &im->m_addr.s6_addr32[3]); |
166 | ntohl(im->m_addr.s6_addr32[3]) >> 24 & 0xff, | ||
167 | ntohl(im->m_addr.s6_addr32[3]) >> 16 & 0xff, | ||
168 | ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff, | ||
169 | ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff); | ||
170 | } else { | 166 | } else { |
171 | snprintf(text_addr, 40, NIP6_FMT, NIP6(im->m_addr)); | 167 | snprintf(text_addr, 40, "%pI6", &im->m_addr); |
172 | } | 168 | } |
173 | qword_add(bpp, blen, im->m_class); | 169 | qword_add(bpp, blen, im->m_class); |
174 | qword_add(bpp, blen, text_addr); | 170 | qword_add(bpp, blen, text_addr); |
@@ -208,13 +204,13 @@ static int ip_map_parse(struct cache_detail *cd, | |||
208 | len = qword_get(&mesg, buf, mlen); | 204 | len = qword_get(&mesg, buf, mlen); |
209 | if (len <= 0) return -EINVAL; | 205 | if (len <= 0) return -EINVAL; |
210 | 206 | ||
211 | if (sscanf(buf, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) == 4) { | 207 | if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) == 4) { |
212 | addr.s6_addr32[0] = 0; | 208 | addr.s6_addr32[0] = 0; |
213 | addr.s6_addr32[1] = 0; | 209 | addr.s6_addr32[1] = 0; |
214 | addr.s6_addr32[2] = htonl(0xffff); | 210 | addr.s6_addr32[2] = htonl(0xffff); |
215 | addr.s6_addr32[3] = | 211 | addr.s6_addr32[3] = |
216 | htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); | 212 | htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); |
217 | } else if (sscanf(buf, NIP6_FMT "%c", | 213 | } else if (sscanf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x%c", |
218 | &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) { | 214 | &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) { |
219 | addr.s6_addr16[0] = htons(b1); | 215 | addr.s6_addr16[0] = htons(b1); |
220 | addr.s6_addr16[1] = htons(b2); | 216 | addr.s6_addr16[1] = htons(b2); |
@@ -278,16 +274,10 @@ static int ip_map_show(struct seq_file *m, | |||
278 | dom = im->m_client->h.name; | 274 | dom = im->m_client->h.name; |
279 | 275 | ||
280 | if (ipv6_addr_v4mapped(&addr)) { | 276 | if (ipv6_addr_v4mapped(&addr)) { |
281 | seq_printf(m, "%s " NIPQUAD_FMT " %s\n", | 277 | seq_printf(m, "%s %pI4 %s\n", |
282 | im->m_class, | 278 | im->m_class, &addr.s6_addr32[3], dom); |
283 | ntohl(addr.s6_addr32[3]) >> 24 & 0xff, | ||
284 | ntohl(addr.s6_addr32[3]) >> 16 & 0xff, | ||
285 | ntohl(addr.s6_addr32[3]) >> 8 & 0xff, | ||
286 | ntohl(addr.s6_addr32[3]) >> 0 & 0xff, | ||
287 | dom); | ||
288 | } else { | 279 | } else { |
289 | seq_printf(m, "%s " NIP6_FMT " %s\n", | 280 | seq_printf(m, "%s %pI6 %s\n", im->m_class, &addr, dom); |
290 | im->m_class, NIP6(addr), dom); | ||
291 | } | 281 | } |
292 | return 0; | 282 | return 0; |
293 | } | 283 | } |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 95293f549e9c..6f7d1f2d2f36 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -250,10 +250,10 @@ static int one_sock_name(char *buf, struct svc_sock *svsk) | |||
250 | 250 | ||
251 | switch(svsk->sk_sk->sk_family) { | 251 | switch(svsk->sk_sk->sk_family) { |
252 | case AF_INET: | 252 | case AF_INET: |
253 | len = sprintf(buf, "ipv4 %s %u.%u.%u.%u %d\n", | 253 | len = sprintf(buf, "ipv4 %s %pI4 %d\n", |
254 | svsk->sk_sk->sk_protocol==IPPROTO_UDP? | 254 | svsk->sk_sk->sk_protocol == IPPROTO_UDP ? |
255 | "udp" : "tcp", | 255 | "udp" : "tcp", |
256 | NIPQUAD(inet_sk(svsk->sk_sk)->rcv_saddr), | 256 | &inet_sk(svsk->sk_sk)->rcv_saddr, |
257 | inet_sk(svsk->sk_sk)->num); | 257 | inet_sk(svsk->sk_sk)->num); |
258 | break; | 258 | break; |
259 | default: | 259 | default: |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 6fb493cbd29f..f8500f018f8a 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -1048,21 +1048,21 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) | |||
1048 | 1048 | ||
1049 | dprintk("svcrdma: new connection %p accepted with the following " | 1049 | dprintk("svcrdma: new connection %p accepted with the following " |
1050 | "attributes:\n" | 1050 | "attributes:\n" |
1051 | " local_ip : %d.%d.%d.%d\n" | 1051 | " local_ip : %pI4\n" |
1052 | " local_port : %d\n" | 1052 | " local_port : %d\n" |
1053 | " remote_ip : %d.%d.%d.%d\n" | 1053 | " remote_ip : %pI4\n" |
1054 | " remote_port : %d\n" | 1054 | " remote_port : %d\n" |
1055 | " max_sge : %d\n" | 1055 | " max_sge : %d\n" |
1056 | " sq_depth : %d\n" | 1056 | " sq_depth : %d\n" |
1057 | " max_requests : %d\n" | 1057 | " max_requests : %d\n" |
1058 | " ord : %d\n", | 1058 | " ord : %d\n", |
1059 | newxprt, | 1059 | newxprt, |
1060 | NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id-> | 1060 | &((struct sockaddr_in *)&newxprt->sc_cm_id-> |
1061 | route.addr.src_addr)->sin_addr.s_addr), | 1061 | route.addr.src_addr)->sin_addr.s_addr, |
1062 | ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id-> | 1062 | ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id-> |
1063 | route.addr.src_addr)->sin_port), | 1063 | route.addr.src_addr)->sin_port), |
1064 | NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id-> | 1064 | &((struct sockaddr_in *)&newxprt->sc_cm_id-> |
1065 | route.addr.dst_addr)->sin_addr.s_addr), | 1065 | route.addr.dst_addr)->sin_addr.s_addr, |
1066 | ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id-> | 1066 | ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id-> |
1067 | route.addr.dst_addr)->sin_port), | 1067 | route.addr.dst_addr)->sin_port), |
1068 | newxprt->sc_max_sge, | 1068 | newxprt->sc_max_sge, |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 9839c3d94145..1dd6123070e9 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -174,7 +174,7 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) | |||
174 | 174 | ||
175 | buf = kzalloc(20, GFP_KERNEL); | 175 | buf = kzalloc(20, GFP_KERNEL); |
176 | if (buf) | 176 | if (buf) |
177 | snprintf(buf, 20, NIPQUAD_FMT, NIPQUAD(addr->sin_addr.s_addr)); | 177 | snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr); |
178 | xprt->address_strings[RPC_DISPLAY_ADDR] = buf; | 178 | xprt->address_strings[RPC_DISPLAY_ADDR] = buf; |
179 | 179 | ||
180 | buf = kzalloc(8, GFP_KERNEL); | 180 | buf = kzalloc(8, GFP_KERNEL); |
@@ -186,8 +186,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) | |||
186 | 186 | ||
187 | buf = kzalloc(48, GFP_KERNEL); | 187 | buf = kzalloc(48, GFP_KERNEL); |
188 | if (buf) | 188 | if (buf) |
189 | snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s", | 189 | snprintf(buf, 48, "addr=%pI4 port=%u proto=%s", |
190 | NIPQUAD(addr->sin_addr.s_addr), | 190 | &addr->sin_addr.s_addr, |
191 | ntohs(addr->sin_port), "rdma"); | 191 | ntohs(addr->sin_port), "rdma"); |
192 | xprt->address_strings[RPC_DISPLAY_ALL] = buf; | 192 | xprt->address_strings[RPC_DISPLAY_ALL] = buf; |
193 | 193 | ||
@@ -204,8 +204,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) | |||
204 | 204 | ||
205 | buf = kzalloc(30, GFP_KERNEL); | 205 | buf = kzalloc(30, GFP_KERNEL); |
206 | if (buf) | 206 | if (buf) |
207 | snprintf(buf, 30, NIPQUAD_FMT".%u.%u", | 207 | snprintf(buf, 30, "%pI4.%u.%u", |
208 | NIPQUAD(addr->sin_addr.s_addr), | 208 | &addr->sin_addr.s_addr, |
209 | ntohs(addr->sin_port) >> 8, | 209 | ntohs(addr->sin_port) >> 8, |
210 | ntohs(addr->sin_port) & 0xff); | 210 | ntohs(addr->sin_port) & 0xff); |
211 | xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf; | 211 | xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf; |
@@ -369,8 +369,8 @@ xprt_setup_rdma(struct xprt_create *args) | |||
369 | if (ntohs(sin->sin_port) != 0) | 369 | if (ntohs(sin->sin_port) != 0) |
370 | xprt_set_bound(xprt); | 370 | xprt_set_bound(xprt); |
371 | 371 | ||
372 | dprintk("RPC: %s: %u.%u.%u.%u:%u\n", __func__, | 372 | dprintk("RPC: %s: %pI4:%u\n", |
373 | NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port)); | 373 | __func__, &sin->sin_addr.s_addr, ntohs(sin->sin_port)); |
374 | 374 | ||
375 | /* Set max requests */ | 375 | /* Set max requests */ |
376 | cdata.max_requests = xprt->max_reqs; | 376 | cdata.max_requests = xprt->max_reqs; |
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index a5fef5e6c323..78f7f728ef10 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -323,12 +323,11 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) | |||
323 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | 323 | case RDMA_CM_EVENT_DEVICE_REMOVAL: |
324 | connstate = -ENODEV; | 324 | connstate = -ENODEV; |
325 | connected: | 325 | connected: |
326 | dprintk("RPC: %s: %s: %u.%u.%u.%u:%u" | 326 | dprintk("RPC: %s: %s: %pI4:%u (ep 0x%p event 0x%x)\n", |
327 | " (ep 0x%p event 0x%x)\n", | ||
328 | __func__, | 327 | __func__, |
329 | (event->event <= 11) ? conn[event->event] : | 328 | (event->event <= 11) ? conn[event->event] : |
330 | "unknown connection error", | 329 | "unknown connection error", |
331 | NIPQUAD(addr->sin_addr.s_addr), | 330 | &addr->sin_addr.s_addr, |
332 | ntohs(addr->sin_port), | 331 | ntohs(addr->sin_port), |
333 | ep, event->event); | 332 | ep, event->event); |
334 | atomic_set(&rpcx_to_rdmax(ep->rep_xprt)->rx_buf.rb_credits, 1); | 333 | atomic_set(&rpcx_to_rdmax(ep->rep_xprt)->rx_buf.rb_credits, 1); |
@@ -348,18 +347,17 @@ connected: | |||
348 | if (connstate == 1) { | 347 | if (connstate == 1) { |
349 | int ird = attr.max_dest_rd_atomic; | 348 | int ird = attr.max_dest_rd_atomic; |
350 | int tird = ep->rep_remote_cma.responder_resources; | 349 | int tird = ep->rep_remote_cma.responder_resources; |
351 | printk(KERN_INFO "rpcrdma: connection to %u.%u.%u.%u:%u " | 350 | printk(KERN_INFO "rpcrdma: connection to %pI4:%u " |
352 | "on %s, memreg %d slots %d ird %d%s\n", | 351 | "on %s, memreg %d slots %d ird %d%s\n", |
353 | NIPQUAD(addr->sin_addr.s_addr), | 352 | &addr->sin_addr.s_addr, |
354 | ntohs(addr->sin_port), | 353 | ntohs(addr->sin_port), |
355 | ia->ri_id->device->name, | 354 | ia->ri_id->device->name, |
356 | ia->ri_memreg_strategy, | 355 | ia->ri_memreg_strategy, |
357 | xprt->rx_buf.rb_max_requests, | 356 | xprt->rx_buf.rb_max_requests, |
358 | ird, ird < 4 && ird < tird / 2 ? " (low!)" : ""); | 357 | ird, ird < 4 && ird < tird / 2 ? " (low!)" : ""); |
359 | } else if (connstate < 0) { | 358 | } else if (connstate < 0) { |
360 | printk(KERN_INFO "rpcrdma: connection to %u.%u.%u.%u:%u " | 359 | printk(KERN_INFO "rpcrdma: connection to %pI4:%u closed (%d)\n", |
361 | "closed (%d)\n", | 360 | &addr->sin_addr.s_addr, |
362 | NIPQUAD(addr->sin_addr.s_addr), | ||
363 | ntohs(addr->sin_port), | 361 | ntohs(addr->sin_port), |
364 | connstate); | 362 | connstate); |
365 | } | 363 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 0a50361e3d83..5cbb404c4cdf 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -284,8 +284,7 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt, | |||
284 | 284 | ||
285 | buf = kzalloc(20, GFP_KERNEL); | 285 | buf = kzalloc(20, GFP_KERNEL); |
286 | if (buf) { | 286 | if (buf) { |
287 | snprintf(buf, 20, NIPQUAD_FMT, | 287 | snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr); |
288 | NIPQUAD(addr->sin_addr.s_addr)); | ||
289 | } | 288 | } |
290 | xprt->address_strings[RPC_DISPLAY_ADDR] = buf; | 289 | xprt->address_strings[RPC_DISPLAY_ADDR] = buf; |
291 | 290 | ||
@@ -300,8 +299,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt, | |||
300 | 299 | ||
301 | buf = kzalloc(48, GFP_KERNEL); | 300 | buf = kzalloc(48, GFP_KERNEL); |
302 | if (buf) { | 301 | if (buf) { |
303 | snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s", | 302 | snprintf(buf, 48, "addr=%pI4 port=%u proto=%s", |
304 | NIPQUAD(addr->sin_addr.s_addr), | 303 | &addr->sin_addr.s_addr, |
305 | ntohs(addr->sin_port), | 304 | ntohs(addr->sin_port), |
306 | protocol); | 305 | protocol); |
307 | } | 306 | } |
@@ -323,8 +322,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt, | |||
323 | 322 | ||
324 | buf = kzalloc(30, GFP_KERNEL); | 323 | buf = kzalloc(30, GFP_KERNEL); |
325 | if (buf) { | 324 | if (buf) { |
326 | snprintf(buf, 30, NIPQUAD_FMT".%u.%u", | 325 | snprintf(buf, 30, "%pI4.%u.%u", |
327 | NIPQUAD(addr->sin_addr.s_addr), | 326 | &addr->sin_addr.s_addr, |
328 | ntohs(addr->sin_port) >> 8, | 327 | ntohs(addr->sin_port) >> 8, |
329 | ntohs(addr->sin_port) & 0xff); | 328 | ntohs(addr->sin_port) & 0xff); |
330 | } | 329 | } |
@@ -342,8 +341,7 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt, | |||
342 | 341 | ||
343 | buf = kzalloc(40, GFP_KERNEL); | 342 | buf = kzalloc(40, GFP_KERNEL); |
344 | if (buf) { | 343 | if (buf) { |
345 | snprintf(buf, 40, NIP6_FMT, | 344 | snprintf(buf, 40, "%pI6",&addr->sin6_addr); |
346 | NIP6(addr->sin6_addr)); | ||
347 | } | 345 | } |
348 | xprt->address_strings[RPC_DISPLAY_ADDR] = buf; | 346 | xprt->address_strings[RPC_DISPLAY_ADDR] = buf; |
349 | 347 | ||
@@ -358,18 +356,17 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt, | |||
358 | 356 | ||
359 | buf = kzalloc(64, GFP_KERNEL); | 357 | buf = kzalloc(64, GFP_KERNEL); |
360 | if (buf) { | 358 | if (buf) { |
361 | snprintf(buf, 64, "addr="NIP6_FMT" port=%u proto=%s", | 359 | snprintf(buf, 64, "addr=%pI6 port=%u proto=%s", |
362 | NIP6(addr->sin6_addr), | 360 | &addr->sin6_addr, |
363 | ntohs(addr->sin6_port), | 361 | ntohs(addr->sin6_port), |
364 | protocol); | 362 | protocol); |
365 | } | 363 | } |
366 | xprt->address_strings[RPC_DISPLAY_ALL] = buf; | 364 | xprt->address_strings[RPC_DISPLAY_ALL] = buf; |
367 | 365 | ||
368 | buf = kzalloc(36, GFP_KERNEL); | 366 | buf = kzalloc(36, GFP_KERNEL); |
369 | if (buf) { | 367 | if (buf) |
370 | snprintf(buf, 36, NIP6_SEQFMT, | 368 | snprintf(buf, 36, "%pi6", &addr->sin6_addr); |
371 | NIP6(addr->sin6_addr)); | 369 | |
372 | } | ||
373 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf; | 370 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf; |
374 | 371 | ||
375 | buf = kzalloc(8, GFP_KERNEL); | 372 | buf = kzalloc(8, GFP_KERNEL); |
@@ -381,10 +378,10 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt, | |||
381 | 378 | ||
382 | buf = kzalloc(50, GFP_KERNEL); | 379 | buf = kzalloc(50, GFP_KERNEL); |
383 | if (buf) { | 380 | if (buf) { |
384 | snprintf(buf, 50, NIP6_FMT".%u.%u", | 381 | snprintf(buf, 50, "%pI6.%u.%u", |
385 | NIP6(addr->sin6_addr), | 382 | &addr->sin6_addr, |
386 | ntohs(addr->sin6_port) >> 8, | 383 | ntohs(addr->sin6_port) >> 8, |
387 | ntohs(addr->sin6_port) & 0xff); | 384 | ntohs(addr->sin6_port) & 0xff); |
388 | } | 385 | } |
389 | xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf; | 386 | xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf; |
390 | 387 | ||
@@ -1415,8 +1412,8 @@ static int xs_bind4(struct sock_xprt *transport, struct socket *sock) | |||
1415 | if (port > last) | 1412 | if (port > last) |
1416 | nloop++; | 1413 | nloop++; |
1417 | } while (err == -EADDRINUSE && nloop != 2); | 1414 | } while (err == -EADDRINUSE && nloop != 2); |
1418 | dprintk("RPC: %s "NIPQUAD_FMT":%u: %s (%d)\n", | 1415 | dprintk("RPC: %s %pI4:%u: %s (%d)\n", |
1419 | __func__, NIPQUAD(myaddr.sin_addr), | 1416 | __func__, &myaddr.sin_addr, |
1420 | port, err ? "failed" : "ok", err); | 1417 | port, err ? "failed" : "ok", err); |
1421 | return err; | 1418 | return err; |
1422 | } | 1419 | } |
@@ -1448,8 +1445,8 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock) | |||
1448 | if (port > last) | 1445 | if (port > last) |
1449 | nloop++; | 1446 | nloop++; |
1450 | } while (err == -EADDRINUSE && nloop != 2); | 1447 | } while (err == -EADDRINUSE && nloop != 2); |
1451 | dprintk("RPC: xs_bind6 "NIP6_FMT":%u: %s (%d)\n", | 1448 | dprintk("RPC: xs_bind6 %pI6:%u: %s (%d)\n", |
1452 | NIP6(myaddr.sin6_addr), port, err ? "failed" : "ok", err); | 1449 | &myaddr.sin6_addr, port, err ? "failed" : "ok", err); |
1453 | return err; | 1450 | return err; |
1454 | } | 1451 | } |
1455 | 1452 | ||
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, | |||
243 | static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) | 243 | static 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/tipc/name_table.c b/net/tipc/name_table.c index cd72e22b132b..acab41a48d67 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -555,7 +555,7 @@ static struct name_seq *nametbl_find_seq(u32 type) | |||
555 | struct name_seq *ns; | 555 | struct name_seq *ns; |
556 | 556 | ||
557 | dbg("find_seq %u,(%u,0x%x) table = %p, hash[type] = %u\n", | 557 | dbg("find_seq %u,(%u,0x%x) table = %p, hash[type] = %u\n", |
558 | type, ntohl(type), type, table.types, hash(type)); | 558 | type, htonl(type), type, table.types, hash(type)); |
559 | 559 | ||
560 | seq_head = &table.types[hash(type)]; | 560 | seq_head = &table.types[hash(type)]; |
561 | hlist_for_each_entry(ns, seq_node, seq_head, ns_list) { | 561 | hlist_for_each_entry(ns, seq_node, seq_head, ns_list) { |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index eb90f77bb0e2..4a39771d037e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -211,7 +211,7 @@ static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp) | |||
211 | * we are guaranteed that it is a valid memory location in our | 211 | * we are guaranteed that it is a valid memory location in our |
212 | * kernel address buffer. | 212 | * kernel address buffer. |
213 | */ | 213 | */ |
214 | ((char *)sunaddr)[len]=0; | 214 | ((char *)sunaddr)[len] = 0; |
215 | len = strlen(sunaddr->sun_path)+1+sizeof(short); | 215 | len = strlen(sunaddr->sun_path)+1+sizeof(short); |
216 | return len; | 216 | return len; |
217 | } | 217 | } |
@@ -392,9 +392,9 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
392 | 392 | ||
393 | wake_up_interruptible_all(&u->peer_wait); | 393 | wake_up_interruptible_all(&u->peer_wait); |
394 | 394 | ||
395 | skpair=unix_peer(sk); | 395 | skpair = unix_peer(sk); |
396 | 396 | ||
397 | if (skpair!=NULL) { | 397 | if (skpair != NULL) { |
398 | if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { | 398 | if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { |
399 | unix_state_lock(skpair); | 399 | unix_state_lock(skpair); |
400 | /* No more writes */ | 400 | /* No more writes */ |
@@ -414,7 +414,7 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
414 | /* Try to flush out this socket. Throw out buffers at least */ | 414 | /* Try to flush out this socket. Throw out buffers at least */ |
415 | 415 | ||
416 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 416 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
417 | if (state==TCP_LISTEN) | 417 | if (state == TCP_LISTEN) |
418 | unix_release_sock(skb->sk, 1); | 418 | unix_release_sock(skb->sk, 1); |
419 | /* passed fds are erased in the kfree_skb hook */ | 419 | /* passed fds are erased in the kfree_skb hook */ |
420 | kfree_skb(skb); | 420 | kfree_skb(skb); |
@@ -630,7 +630,7 @@ static int unix_create(struct net *net, struct socket *sock, int protocol) | |||
630 | * nothing uses it. | 630 | * nothing uses it. |
631 | */ | 631 | */ |
632 | case SOCK_RAW: | 632 | case SOCK_RAW: |
633 | sock->type=SOCK_DGRAM; | 633 | sock->type = SOCK_DGRAM; |
634 | case SOCK_DGRAM: | 634 | case SOCK_DGRAM: |
635 | sock->ops = &unix_dgram_ops; | 635 | sock->ops = &unix_dgram_ops; |
636 | break; | 636 | break; |
@@ -736,14 +736,14 @@ static struct sock *unix_find_other(struct net *net, | |||
736 | 736 | ||
737 | path_put(&path); | 737 | path_put(&path); |
738 | 738 | ||
739 | err=-EPROTOTYPE; | 739 | err = -EPROTOTYPE; |
740 | if (u->sk_type != type) { | 740 | if (u->sk_type != type) { |
741 | sock_put(u); | 741 | sock_put(u); |
742 | goto fail; | 742 | goto fail; |
743 | } | 743 | } |
744 | } else { | 744 | } else { |
745 | err = -ECONNREFUSED; | 745 | err = -ECONNREFUSED; |
746 | u=unix_find_socket_byname(net, sunname, len, type, hash); | 746 | u = unix_find_socket_byname(net, sunname, len, type, hash); |
747 | if (u) { | 747 | if (u) { |
748 | struct dentry *dentry; | 748 | struct dentry *dentry; |
749 | dentry = unix_sk(u)->dentry; | 749 | dentry = unix_sk(u)->dentry; |
@@ -757,7 +757,7 @@ static struct sock *unix_find_other(struct net *net, | |||
757 | put_fail: | 757 | put_fail: |
758 | path_put(&path); | 758 | path_put(&path); |
759 | fail: | 759 | fail: |
760 | *error=err; | 760 | *error = err; |
761 | return NULL; | 761 | return NULL; |
762 | } | 762 | } |
763 | 763 | ||
@@ -767,7 +767,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
767 | struct sock *sk = sock->sk; | 767 | struct sock *sk = sock->sk; |
768 | struct net *net = sock_net(sk); | 768 | struct net *net = sock_net(sk); |
769 | struct unix_sock *u = unix_sk(sk); | 769 | struct unix_sock *u = unix_sk(sk); |
770 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 770 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
771 | struct dentry * dentry = NULL; | 771 | struct dentry * dentry = NULL; |
772 | struct nameidata nd; | 772 | struct nameidata nd; |
773 | int err; | 773 | int err; |
@@ -779,7 +779,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
779 | if (sunaddr->sun_family != AF_UNIX) | 779 | if (sunaddr->sun_family != AF_UNIX) |
780 | goto out; | 780 | goto out; |
781 | 781 | ||
782 | if (addr_len==sizeof(short)) { | 782 | if (addr_len == sizeof(short)) { |
783 | err = unix_autobind(sock); | 783 | err = unix_autobind(sock); |
784 | goto out; | 784 | goto out; |
785 | } | 785 | } |
@@ -875,8 +875,8 @@ out_mknod_unlock: | |||
875 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 875 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |
876 | path_put(&nd.path); | 876 | path_put(&nd.path); |
877 | out_mknod_parent: | 877 | out_mknod_parent: |
878 | if (err==-EEXIST) | 878 | if (err == -EEXIST) |
879 | err=-EADDRINUSE; | 879 | err = -EADDRINUSE; |
880 | unix_release_addr(addr); | 880 | unix_release_addr(addr); |
881 | goto out_up; | 881 | goto out_up; |
882 | } | 882 | } |
@@ -911,7 +911,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, | |||
911 | { | 911 | { |
912 | struct sock *sk = sock->sk; | 912 | struct sock *sk = sock->sk; |
913 | struct net *net = sock_net(sk); | 913 | struct net *net = sock_net(sk); |
914 | struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr; | 914 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr; |
915 | struct sock *other; | 915 | struct sock *other; |
916 | unsigned hash; | 916 | unsigned hash; |
917 | int err; | 917 | int err; |
@@ -927,7 +927,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, | |||
927 | goto out; | 927 | goto out; |
928 | 928 | ||
929 | restart: | 929 | restart: |
930 | other=unix_find_other(net, sunaddr, alen, sock->type, hash, &err); | 930 | other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); |
931 | if (!other) | 931 | if (!other) |
932 | goto out; | 932 | goto out; |
933 | 933 | ||
@@ -961,14 +961,14 @@ restart: | |||
961 | */ | 961 | */ |
962 | if (unix_peer(sk)) { | 962 | if (unix_peer(sk)) { |
963 | struct sock *old_peer = unix_peer(sk); | 963 | struct sock *old_peer = unix_peer(sk); |
964 | unix_peer(sk)=other; | 964 | unix_peer(sk) = other; |
965 | unix_state_double_unlock(sk, other); | 965 | unix_state_double_unlock(sk, other); |
966 | 966 | ||
967 | if (other != old_peer) | 967 | if (other != old_peer) |
968 | unix_dgram_disconnected(sk, old_peer); | 968 | unix_dgram_disconnected(sk, old_peer); |
969 | sock_put(old_peer); | 969 | sock_put(old_peer); |
970 | } else { | 970 | } else { |
971 | unix_peer(sk)=other; | 971 | unix_peer(sk) = other; |
972 | unix_state_double_unlock(sk, other); | 972 | unix_state_double_unlock(sk, other); |
973 | } | 973 | } |
974 | return 0; | 974 | return 0; |
@@ -1004,7 +1004,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) | |||
1004 | static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, | 1004 | static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, |
1005 | int addr_len, int flags) | 1005 | int addr_len, int flags) |
1006 | { | 1006 | { |
1007 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 1007 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
1008 | struct sock *sk = sock->sk; | 1008 | struct sock *sk = sock->sk; |
1009 | struct net *net = sock_net(sk); | 1009 | struct net *net = sock_net(sk); |
1010 | struct unix_sock *u = unix_sk(sk), *newu, *otheru; | 1010 | struct unix_sock *u = unix_sk(sk), *newu, *otheru; |
@@ -1179,13 +1179,13 @@ out: | |||
1179 | 1179 | ||
1180 | static int unix_socketpair(struct socket *socka, struct socket *sockb) | 1180 | static int unix_socketpair(struct socket *socka, struct socket *sockb) |
1181 | { | 1181 | { |
1182 | struct sock *ska=socka->sk, *skb = sockb->sk; | 1182 | struct sock *ska = socka->sk, *skb = sockb->sk; |
1183 | 1183 | ||
1184 | /* Join our sockets back to back */ | 1184 | /* Join our sockets back to back */ |
1185 | sock_hold(ska); | 1185 | sock_hold(ska); |
1186 | sock_hold(skb); | 1186 | sock_hold(skb); |
1187 | unix_peer(ska)=skb; | 1187 | unix_peer(ska) = skb; |
1188 | unix_peer(skb)=ska; | 1188 | unix_peer(skb) = ska; |
1189 | ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current); | 1189 | ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current); |
1190 | ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; | 1190 | ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; |
1191 | ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid; | 1191 | ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid; |
@@ -1246,7 +1246,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_ | |||
1246 | { | 1246 | { |
1247 | struct sock *sk = sock->sk; | 1247 | struct sock *sk = sock->sk; |
1248 | struct unix_sock *u; | 1248 | struct unix_sock *u; |
1249 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 1249 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
1250 | int err = 0; | 1250 | int err = 0; |
1251 | 1251 | ||
1252 | if (peer) { | 1252 | if (peer) { |
@@ -1332,7 +1332,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1332 | struct sock *sk = sock->sk; | 1332 | struct sock *sk = sock->sk; |
1333 | struct net *net = sock_net(sk); | 1333 | struct net *net = sock_net(sk); |
1334 | struct unix_sock *u = unix_sk(sk); | 1334 | struct unix_sock *u = unix_sk(sk); |
1335 | struct sockaddr_un *sunaddr=msg->msg_name; | 1335 | struct sockaddr_un *sunaddr = msg->msg_name; |
1336 | struct sock *other = NULL; | 1336 | struct sock *other = NULL; |
1337 | int namelen = 0; /* fake GCC */ | 1337 | int namelen = 0; /* fake GCC */ |
1338 | int err; | 1338 | int err; |
@@ -1373,7 +1373,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1373 | goto out; | 1373 | goto out; |
1374 | 1374 | ||
1375 | skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); | 1375 | skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); |
1376 | if (skb==NULL) | 1376 | if (skb == NULL) |
1377 | goto out; | 1377 | goto out; |
1378 | 1378 | ||
1379 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); | 1379 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); |
@@ -1399,7 +1399,7 @@ restart: | |||
1399 | 1399 | ||
1400 | other = unix_find_other(net, sunaddr, namelen, sk->sk_type, | 1400 | other = unix_find_other(net, sunaddr, namelen, sk->sk_type, |
1401 | hash, &err); | 1401 | hash, &err); |
1402 | if (other==NULL) | 1402 | if (other == NULL) |
1403 | goto out_free; | 1403 | goto out_free; |
1404 | } | 1404 | } |
1405 | 1405 | ||
@@ -1419,7 +1419,7 @@ restart: | |||
1419 | err = 0; | 1419 | err = 0; |
1420 | unix_state_lock(sk); | 1420 | unix_state_lock(sk); |
1421 | if (unix_peer(sk) == other) { | 1421 | if (unix_peer(sk) == other) { |
1422 | unix_peer(sk)=NULL; | 1422 | unix_peer(sk) = NULL; |
1423 | unix_state_unlock(sk); | 1423 | unix_state_unlock(sk); |
1424 | 1424 | ||
1425 | unix_dgram_disconnected(sk, other); | 1425 | unix_dgram_disconnected(sk, other); |
@@ -1485,10 +1485,10 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1485 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); | 1485 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); |
1486 | struct sock *sk = sock->sk; | 1486 | struct sock *sk = sock->sk; |
1487 | struct sock *other = NULL; | 1487 | struct sock *other = NULL; |
1488 | struct sockaddr_un *sunaddr=msg->msg_name; | 1488 | struct sockaddr_un *sunaddr = msg->msg_name; |
1489 | int err,size; | 1489 | int err,size; |
1490 | struct sk_buff *skb; | 1490 | struct sk_buff *skb; |
1491 | int sent=0; | 1491 | int sent = 0; |
1492 | struct scm_cookie tmp_scm; | 1492 | struct scm_cookie tmp_scm; |
1493 | 1493 | ||
1494 | if (NULL == siocb->scm) | 1494 | if (NULL == siocb->scm) |
@@ -1535,9 +1535,9 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1535 | * Grab a buffer | 1535 | * Grab a buffer |
1536 | */ | 1536 | */ |
1537 | 1537 | ||
1538 | skb=sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err); | 1538 | skb = sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err); |
1539 | 1539 | ||
1540 | if (skb==NULL) | 1540 | if (skb == NULL) |
1541 | goto out_err; | 1541 | goto out_err; |
1542 | 1542 | ||
1543 | /* | 1543 | /* |
@@ -1572,7 +1572,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1572 | skb_queue_tail(&other->sk_receive_queue, skb); | 1572 | skb_queue_tail(&other->sk_receive_queue, skb); |
1573 | unix_state_unlock(other); | 1573 | unix_state_unlock(other); |
1574 | other->sk_data_ready(other, size); | 1574 | other->sk_data_ready(other, size); |
1575 | sent+=size; | 1575 | sent += size; |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | scm_destroy(siocb->scm); | 1578 | scm_destroy(siocb->scm); |
@@ -1751,7 +1751,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1751 | struct scm_cookie tmp_scm; | 1751 | struct scm_cookie tmp_scm; |
1752 | struct sock *sk = sock->sk; | 1752 | struct sock *sk = sock->sk; |
1753 | struct unix_sock *u = unix_sk(sk); | 1753 | struct unix_sock *u = unix_sk(sk); |
1754 | struct sockaddr_un *sunaddr=msg->msg_name; | 1754 | struct sockaddr_un *sunaddr = msg->msg_name; |
1755 | int copied = 0; | 1755 | int copied = 0; |
1756 | int check_creds = 0; | 1756 | int check_creds = 0; |
1757 | int target; | 1757 | int target; |
@@ -1789,7 +1789,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1789 | 1789 | ||
1790 | unix_state_lock(sk); | 1790 | unix_state_lock(sk); |
1791 | skb = skb_dequeue(&sk->sk_receive_queue); | 1791 | skb = skb_dequeue(&sk->sk_receive_queue); |
1792 | if (skb==NULL) | 1792 | if (skb == NULL) |
1793 | { | 1793 | { |
1794 | if (copied >= target) | 1794 | if (copied >= target) |
1795 | goto unlock; | 1795 | goto unlock; |
@@ -1901,7 +1901,7 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
1901 | if (mode) { | 1901 | if (mode) { |
1902 | unix_state_lock(sk); | 1902 | unix_state_lock(sk); |
1903 | sk->sk_shutdown |= mode; | 1903 | sk->sk_shutdown |= mode; |
1904 | other=unix_peer(sk); | 1904 | other = unix_peer(sk); |
1905 | if (other) | 1905 | if (other) |
1906 | sock_hold(other); | 1906 | sock_hold(other); |
1907 | unix_state_unlock(sk); | 1907 | unix_state_unlock(sk); |
@@ -1936,7 +1936,7 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
1936 | static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 1936 | static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
1937 | { | 1937 | { |
1938 | struct sock *sk = sock->sk; | 1938 | struct sock *sk = sock->sk; |
1939 | long amount=0; | 1939 | long amount = 0; |
1940 | int err; | 1940 | int err; |
1941 | 1941 | ||
1942 | switch(cmd) | 1942 | switch(cmd) |
@@ -1962,7 +1962,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1962 | } else { | 1962 | } else { |
1963 | skb = skb_peek(&sk->sk_receive_queue); | 1963 | skb = skb_peek(&sk->sk_receive_queue); |
1964 | if (skb) | 1964 | if (skb) |
1965 | amount=skb->len; | 1965 | amount = skb->len; |
1966 | } | 1966 | } |
1967 | spin_unlock(&sk->sk_receive_queue.lock); | 1967 | spin_unlock(&sk->sk_receive_queue.lock); |
1968 | err = put_user(amount, (int __user *)arg); | 1968 | err = put_user(amount, (int __user *)arg); |
@@ -2094,6 +2094,7 @@ struct unix_iter_state { | |||
2094 | struct seq_net_private p; | 2094 | struct seq_net_private p; |
2095 | int i; | 2095 | int i; |
2096 | }; | 2096 | }; |
2097 | |||
2097 | static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) | 2098 | static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) |
2098 | { | 2099 | { |
2099 | struct unix_iter_state *iter = seq->private; | 2100 | struct unix_iter_state *iter = seq->private; |
@@ -2110,7 +2111,6 @@ static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) | |||
2110 | return NULL; | 2111 | return NULL; |
2111 | } | 2112 | } |
2112 | 2113 | ||
2113 | |||
2114 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) | 2114 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) |
2115 | __acquires(unix_table_lock) | 2115 | __acquires(unix_table_lock) |
2116 | { | 2116 | { |
@@ -2190,7 +2190,6 @@ static const struct seq_operations unix_seq_ops = { | |||
2190 | .show = unix_seq_show, | 2190 | .show = unix_seq_show, |
2191 | }; | 2191 | }; |
2192 | 2192 | ||
2193 | |||
2194 | static int unix_seq_open(struct inode *inode, struct file *file) | 2193 | static int unix_seq_open(struct inode *inode, struct file *file) |
2195 | { | 2194 | { |
2196 | return seq_open_net(inode, file, &unix_seq_ops, | 2195 | return seq_open_net(inode, file, &unix_seq_ops, |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 6d4a9a8de5ef..5a0061d6b9bc 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -104,8 +104,8 @@ static struct sock *unix_get_socket(struct file *filp) | |||
104 | * Socket ? | 104 | * Socket ? |
105 | */ | 105 | */ |
106 | if (S_ISSOCK(inode->i_mode)) { | 106 | if (S_ISSOCK(inode->i_mode)) { |
107 | struct socket * sock = SOCKET_I(inode); | 107 | struct socket *sock = SOCKET_I(inode); |
108 | struct sock * s = sock->sk; | 108 | struct sock *s = sock->sk; |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * PF_UNIX ? | 111 | * PF_UNIX ? |
@@ -124,7 +124,7 @@ static struct sock *unix_get_socket(struct file *filp) | |||
124 | void unix_inflight(struct file *fp) | 124 | void unix_inflight(struct file *fp) |
125 | { | 125 | { |
126 | struct sock *s = unix_get_socket(fp); | 126 | struct sock *s = unix_get_socket(fp); |
127 | if(s) { | 127 | if (s) { |
128 | struct unix_sock *u = unix_sk(s); | 128 | struct unix_sock *u = unix_sk(s); |
129 | spin_lock(&unix_gc_lock); | 129 | spin_lock(&unix_gc_lock); |
130 | if (atomic_long_inc_return(&u->inflight) == 1) { | 130 | if (atomic_long_inc_return(&u->inflight) == 1) { |
@@ -141,7 +141,7 @@ void unix_inflight(struct file *fp) | |||
141 | void unix_notinflight(struct file *fp) | 141 | void unix_notinflight(struct file *fp) |
142 | { | 142 | { |
143 | struct sock *s = unix_get_socket(fp); | 143 | struct sock *s = unix_get_socket(fp); |
144 | if(s) { | 144 | if (s) { |
145 | struct unix_sock *u = unix_sk(s); | 145 | struct unix_sock *u = unix_sk(s); |
146 | spin_lock(&unix_gc_lock); | 146 | spin_lock(&unix_gc_lock); |
147 | BUG_ON(list_empty(&u->link)); | 147 | BUG_ON(list_empty(&u->link)); |
@@ -154,7 +154,7 @@ void unix_notinflight(struct file *fp) | |||
154 | 154 | ||
155 | static inline struct sk_buff *sock_queue_head(struct sock *sk) | 155 | static inline struct sk_buff *sock_queue_head(struct sock *sk) |
156 | { | 156 | { |
157 | return (struct sk_buff *) &sk->sk_receive_queue; | 157 | return (struct sk_buff *)&sk->sk_receive_queue; |
158 | } | 158 | } |
159 | 159 | ||
160 | #define receive_queue_for_each_skb(sk, next, skb) \ | 160 | #define receive_queue_for_each_skb(sk, next, skb) \ |
@@ -364,7 +364,7 @@ void unix_gc(void) | |||
364 | */ | 364 | */ |
365 | skb_queue_head_init(&hitlist); | 365 | skb_queue_head_init(&hitlist); |
366 | list_for_each_entry(u, &gc_candidates, link) | 366 | list_for_each_entry(u, &gc_candidates, link) |
367 | scan_children(&u->sk, inc_inflight, &hitlist); | 367 | scan_children(&u->sk, inc_inflight, &hitlist); |
368 | 368 | ||
369 | spin_unlock(&unix_gc_lock); | 369 | spin_unlock(&unix_gc_lock); |
370 | 370 | ||
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index 77513d7e35f2..83c093077ebc 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -21,7 +21,7 @@ static ctl_table unix_table[] = { | |||
21 | .data = &init_net.unx.sysctl_max_dgram_qlen, | 21 | .data = &init_net.unx.sysctl_max_dgram_qlen, |
22 | .maxlen = sizeof(int), | 22 | .maxlen = sizeof(int), |
23 | .mode = 0644, | 23 | .mode = 0644, |
24 | .proc_handler = &proc_dointvec | 24 | .proc_handler = proc_dointvec |
25 | }, | 25 | }, |
26 | { .ctl_name = 0 } | 26 | { .ctl_name = 0 } |
27 | }; | 27 | }; |
@@ -61,4 +61,3 @@ void unix_sysctl_unregister(struct net *net) | |||
61 | unregister_sysctl_table(net->unx.ctl); | 61 | unregister_sysctl_table(net->unx.ctl); |
62 | kfree(table); | 62 | kfree(table); |
63 | } | 63 | } |
64 | |||
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index 646c7121dbc0..ae7f2262dfb5 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
@@ -72,3 +72,13 @@ config WIRELESS_EXT_SYSFS | |||
72 | 72 | ||
73 | Say Y if you have programs using it, like old versions of | 73 | Say Y if you have programs using it, like old versions of |
74 | hal. | 74 | hal. |
75 | |||
76 | config LIB80211 | ||
77 | tristate "Common routines for IEEE802.11 drivers" | ||
78 | default n | ||
79 | help | ||
80 | This options enables a library of common routines used | ||
81 | by IEEE802.11 wireless LAN drivers. | ||
82 | |||
83 | Drivers should select this themselves if needed. Say Y if | ||
84 | you want this built into your kernel. | ||
diff --git a/net/wireless/Makefile b/net/wireless/Makefile index b9f943c45f3b..d2d848d445f2 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | obj-$(CONFIG_WIRELESS_EXT) += wext.o | 1 | obj-$(CONFIG_WIRELESS_EXT) += wext.o |
2 | obj-$(CONFIG_CFG80211) += cfg80211.o | 2 | obj-$(CONFIG_CFG80211) += cfg80211.o |
3 | obj-$(CONFIG_LIB80211) += lib80211.o | ||
3 | 4 | ||
4 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o | 5 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o |
5 | cfg80211-$(CONFIG_NL80211) += nl80211.o | 6 | cfg80211-$(CONFIG_NL80211) += nl80211.o |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 5031db7b275b..39e3d10fccde 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -236,8 +236,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv) | |||
236 | mutex_unlock(&cfg80211_drv_mutex); | 236 | mutex_unlock(&cfg80211_drv_mutex); |
237 | 237 | ||
238 | /* give it a proper name */ | 238 | /* give it a proper name */ |
239 | snprintf(drv->wiphy.dev.bus_id, BUS_ID_SIZE, | 239 | dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->idx); |
240 | PHY_NAME "%d", drv->idx); | ||
241 | 240 | ||
242 | mutex_init(&drv->mtx); | 241 | mutex_init(&drv->mtx); |
243 | mutex_init(&drv->devlist_mtx); | 242 | mutex_init(&drv->devlist_mtx); |
@@ -301,12 +300,10 @@ int wiphy_register(struct wiphy *wiphy) | |||
301 | /* check and set up bitrates */ | 300 | /* check and set up bitrates */ |
302 | ieee80211_set_bitrate_flags(wiphy); | 301 | ieee80211_set_bitrate_flags(wiphy); |
303 | 302 | ||
303 | mutex_lock(&cfg80211_drv_mutex); | ||
304 | |||
304 | /* set up regulatory info */ | 305 | /* set up regulatory info */ |
305 | mutex_lock(&cfg80211_reg_mutex); | ||
306 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_CORE); | 306 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_CORE); |
307 | mutex_unlock(&cfg80211_reg_mutex); | ||
308 | |||
309 | mutex_lock(&cfg80211_drv_mutex); | ||
310 | 307 | ||
311 | res = device_add(&drv->wiphy.dev); | 308 | res = device_add(&drv->wiphy.dev); |
312 | if (res) | 309 | if (res) |
diff --git a/net/wireless/lib80211.c b/net/wireless/lib80211.c new file mode 100644 index 000000000000..e71f7d085621 --- /dev/null +++ b/net/wireless/lib80211.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * lib80211 -- common bits for IEEE802.11 drivers | ||
3 | * | ||
4 | * Copyright(c) 2008 John W. Linville <linville@tuxdriver.com> | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/module.h> | ||
9 | #include <linux/ctype.h> | ||
10 | #include <linux/ieee80211.h> | ||
11 | |||
12 | #include <net/lib80211.h> | ||
13 | |||
14 | #define DRV_NAME "lib80211" | ||
15 | |||
16 | #define DRV_DESCRIPTION "common routines for IEEE802.11 drivers" | ||
17 | |||
18 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | ||
19 | MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>"); | ||
20 | MODULE_LICENSE("GPL"); | ||
21 | |||
22 | const char *print_ssid(char *buf, const char *ssid, u8 ssid_len) | ||
23 | { | ||
24 | const char *s = ssid; | ||
25 | char *d = buf; | ||
26 | |||
27 | ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN); | ||
28 | while (ssid_len--) { | ||
29 | if (isprint(*s)) { | ||
30 | *d++ = *s++; | ||
31 | continue; | ||
32 | } | ||
33 | |||
34 | *d++ = '\\'; | ||
35 | if (*s == '\0') | ||
36 | *d++ = '0'; | ||
37 | else if (*s == '\n') | ||
38 | *d++ = 'n'; | ||
39 | else if (*s == '\r') | ||
40 | *d++ = 'r'; | ||
41 | else if (*s == '\t') | ||
42 | *d++ = 't'; | ||
43 | else if (*s == '\\') | ||
44 | *d++ = '\\'; | ||
45 | else | ||
46 | d += snprintf(d, 3, "%03o", *s); | ||
47 | s++; | ||
48 | } | ||
49 | *d = '\0'; | ||
50 | return buf; | ||
51 | } | ||
52 | EXPORT_SYMBOL(print_ssid); | ||
53 | |||
54 | static int __init ieee80211_init(void) | ||
55 | { | ||
56 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION "\n"); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static void __exit ieee80211_exit(void) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | module_init(ieee80211_init); | ||
65 | module_exit(ieee80211_exit); | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 572793c8c7ab..e3e1494e769a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -58,6 +58,7 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
58 | [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, | 58 | [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, |
59 | [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, | 59 | [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, |
60 | .len = BUS_ID_SIZE-1 }, | 60 | .len = BUS_ID_SIZE-1 }, |
61 | [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, | ||
61 | 62 | ||
62 | [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, | 63 | [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, |
63 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, | 64 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, |
@@ -84,7 +85,7 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
84 | .len = NL80211_MAX_SUPP_RATES }, | 85 | .len = NL80211_MAX_SUPP_RATES }, |
85 | [NL80211_ATTR_STA_PLINK_ACTION] = { .type = NLA_U8 }, | 86 | [NL80211_ATTR_STA_PLINK_ACTION] = { .type = NLA_U8 }, |
86 | [NL80211_ATTR_STA_VLAN] = { .type = NLA_U32 }, | 87 | [NL80211_ATTR_STA_VLAN] = { .type = NLA_U32 }, |
87 | [NL80211_ATTR_MNTR_FLAGS] = { .type = NLA_NESTED }, | 88 | [NL80211_ATTR_MNTR_FLAGS] = { /* NLA_NESTED can't be empty */ }, |
88 | [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, | 89 | [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, |
89 | .len = IEEE80211_MAX_MESH_ID_LEN }, | 90 | .len = IEEE80211_MAX_MESH_ID_LEN }, |
90 | [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, | 91 | [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, |
@@ -95,6 +96,10 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
95 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, | 96 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, |
96 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, | 97 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, |
97 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, | 98 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, |
99 | [NL80211_ATTR_BSS_BASIC_RATES] = { .type = NLA_BINARY, | ||
100 | .len = NL80211_MAX_SUPP_RATES }, | ||
101 | |||
102 | [NL80211_ATTR_MESH_PARAMS] = { .type = NLA_NESTED }, | ||
98 | 103 | ||
99 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, | 104 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, |
100 | .len = NL80211_HT_CAPABILITY_LEN }, | 105 | .len = NL80211_HT_CAPABILITY_LEN }, |
@@ -157,6 +162,19 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
157 | if (!nl_band) | 162 | if (!nl_band) |
158 | goto nla_put_failure; | 163 | goto nla_put_failure; |
159 | 164 | ||
165 | /* add HT info */ | ||
166 | if (dev->wiphy.bands[band]->ht_cap.ht_supported) { | ||
167 | NLA_PUT(msg, NL80211_BAND_ATTR_HT_MCS_SET, | ||
168 | sizeof(dev->wiphy.bands[band]->ht_cap.mcs), | ||
169 | &dev->wiphy.bands[band]->ht_cap.mcs); | ||
170 | NLA_PUT_U16(msg, NL80211_BAND_ATTR_HT_CAPA, | ||
171 | dev->wiphy.bands[band]->ht_cap.cap); | ||
172 | NLA_PUT_U8(msg, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, | ||
173 | dev->wiphy.bands[band]->ht_cap.ampdu_factor); | ||
174 | NLA_PUT_U8(msg, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, | ||
175 | dev->wiphy.bands[band]->ht_cap.ampdu_density); | ||
176 | } | ||
177 | |||
160 | /* add frequencies */ | 178 | /* add frequencies */ |
161 | nl_freqs = nla_nest_start(msg, NL80211_BAND_ATTR_FREQS); | 179 | nl_freqs = nla_nest_start(msg, NL80211_BAND_ATTR_FREQS); |
162 | if (!nl_freqs) | 180 | if (!nl_freqs) |
@@ -269,20 +287,76 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
269 | return -ENOBUFS; | 287 | return -ENOBUFS; |
270 | } | 288 | } |
271 | 289 | ||
290 | static const struct nla_policy txq_params_policy[NL80211_TXQ_ATTR_MAX + 1] = { | ||
291 | [NL80211_TXQ_ATTR_QUEUE] = { .type = NLA_U8 }, | ||
292 | [NL80211_TXQ_ATTR_TXOP] = { .type = NLA_U16 }, | ||
293 | [NL80211_TXQ_ATTR_CWMIN] = { .type = NLA_U16 }, | ||
294 | [NL80211_TXQ_ATTR_CWMAX] = { .type = NLA_U16 }, | ||
295 | [NL80211_TXQ_ATTR_AIFS] = { .type = NLA_U8 }, | ||
296 | }; | ||
297 | |||
298 | static int parse_txq_params(struct nlattr *tb[], | ||
299 | struct ieee80211_txq_params *txq_params) | ||
300 | { | ||
301 | if (!tb[NL80211_TXQ_ATTR_QUEUE] || !tb[NL80211_TXQ_ATTR_TXOP] || | ||
302 | !tb[NL80211_TXQ_ATTR_CWMIN] || !tb[NL80211_TXQ_ATTR_CWMAX] || | ||
303 | !tb[NL80211_TXQ_ATTR_AIFS]) | ||
304 | return -EINVAL; | ||
305 | |||
306 | txq_params->queue = nla_get_u8(tb[NL80211_TXQ_ATTR_QUEUE]); | ||
307 | txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]); | ||
308 | txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]); | ||
309 | txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]); | ||
310 | txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]); | ||
311 | |||
312 | return 0; | ||
313 | } | ||
314 | |||
272 | static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | 315 | static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) |
273 | { | 316 | { |
274 | struct cfg80211_registered_device *rdev; | 317 | struct cfg80211_registered_device *rdev; |
275 | int result; | 318 | int result = 0, rem_txq_params = 0; |
276 | 319 | struct nlattr *nl_txq_params; | |
277 | if (!info->attrs[NL80211_ATTR_WIPHY_NAME]) | ||
278 | return -EINVAL; | ||
279 | 320 | ||
280 | rdev = cfg80211_get_dev_from_info(info); | 321 | rdev = cfg80211_get_dev_from_info(info); |
281 | if (IS_ERR(rdev)) | 322 | if (IS_ERR(rdev)) |
282 | return PTR_ERR(rdev); | 323 | return PTR_ERR(rdev); |
283 | 324 | ||
284 | result = cfg80211_dev_rename(rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME])); | 325 | if (info->attrs[NL80211_ATTR_WIPHY_NAME]) { |
326 | result = cfg80211_dev_rename( | ||
327 | rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME])); | ||
328 | if (result) | ||
329 | goto bad_res; | ||
330 | } | ||
331 | |||
332 | if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) { | ||
333 | struct ieee80211_txq_params txq_params; | ||
334 | struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1]; | ||
335 | |||
336 | if (!rdev->ops->set_txq_params) { | ||
337 | result = -EOPNOTSUPP; | ||
338 | goto bad_res; | ||
339 | } | ||
285 | 340 | ||
341 | nla_for_each_nested(nl_txq_params, | ||
342 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | ||
343 | rem_txq_params) { | ||
344 | nla_parse(tb, NL80211_TXQ_ATTR_MAX, | ||
345 | nla_data(nl_txq_params), | ||
346 | nla_len(nl_txq_params), | ||
347 | txq_params_policy); | ||
348 | result = parse_txq_params(tb, &txq_params); | ||
349 | if (result) | ||
350 | goto bad_res; | ||
351 | |||
352 | result = rdev->ops->set_txq_params(&rdev->wiphy, | ||
353 | &txq_params); | ||
354 | if (result) | ||
355 | goto bad_res; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | bad_res: | ||
286 | cfg80211_put_dev(rdev); | 360 | cfg80211_put_dev(rdev); |
287 | return result; | 361 | return result; |
288 | } | 362 | } |
@@ -1598,6 +1672,12 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) | |||
1598 | if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) | 1672 | if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) |
1599 | params.use_short_slot_time = | 1673 | params.use_short_slot_time = |
1600 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); | 1674 | nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); |
1675 | if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { | ||
1676 | params.basic_rates = | ||
1677 | nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | ||
1678 | params.basic_rates_len = | ||
1679 | nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | ||
1680 | } | ||
1601 | 1681 | ||
1602 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); | 1682 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); |
1603 | if (err) | 1683 | if (err) |
@@ -1680,11 +1760,188 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
1680 | return -EINVAL; | 1760 | return -EINVAL; |
1681 | #endif | 1761 | #endif |
1682 | mutex_lock(&cfg80211_drv_mutex); | 1762 | mutex_lock(&cfg80211_drv_mutex); |
1683 | r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data, NULL); | 1763 | r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data); |
1684 | mutex_unlock(&cfg80211_drv_mutex); | 1764 | mutex_unlock(&cfg80211_drv_mutex); |
1685 | return r; | 1765 | return r; |
1686 | } | 1766 | } |
1687 | 1767 | ||
1768 | static int nl80211_get_mesh_params(struct sk_buff *skb, | ||
1769 | struct genl_info *info) | ||
1770 | { | ||
1771 | struct cfg80211_registered_device *drv; | ||
1772 | struct mesh_config cur_params; | ||
1773 | int err; | ||
1774 | struct net_device *dev; | ||
1775 | void *hdr; | ||
1776 | struct nlattr *pinfoattr; | ||
1777 | struct sk_buff *msg; | ||
1778 | |||
1779 | /* Look up our device */ | ||
1780 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); | ||
1781 | if (err) | ||
1782 | return err; | ||
1783 | |||
1784 | /* Get the mesh params */ | ||
1785 | rtnl_lock(); | ||
1786 | err = drv->ops->get_mesh_params(&drv->wiphy, dev, &cur_params); | ||
1787 | rtnl_unlock(); | ||
1788 | if (err) | ||
1789 | goto out; | ||
1790 | |||
1791 | /* Draw up a netlink message to send back */ | ||
1792 | msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); | ||
1793 | if (!msg) { | ||
1794 | err = -ENOBUFS; | ||
1795 | goto out; | ||
1796 | } | ||
1797 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | ||
1798 | NL80211_CMD_GET_MESH_PARAMS); | ||
1799 | if (!hdr) | ||
1800 | goto nla_put_failure; | ||
1801 | pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_PARAMS); | ||
1802 | if (!pinfoattr) | ||
1803 | goto nla_put_failure; | ||
1804 | NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); | ||
1805 | NLA_PUT_U16(msg, NL80211_MESHCONF_RETRY_TIMEOUT, | ||
1806 | cur_params.dot11MeshRetryTimeout); | ||
1807 | NLA_PUT_U16(msg, NL80211_MESHCONF_CONFIRM_TIMEOUT, | ||
1808 | cur_params.dot11MeshConfirmTimeout); | ||
1809 | NLA_PUT_U16(msg, NL80211_MESHCONF_HOLDING_TIMEOUT, | ||
1810 | cur_params.dot11MeshHoldingTimeout); | ||
1811 | NLA_PUT_U16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, | ||
1812 | cur_params.dot11MeshMaxPeerLinks); | ||
1813 | NLA_PUT_U8(msg, NL80211_MESHCONF_MAX_RETRIES, | ||
1814 | cur_params.dot11MeshMaxRetries); | ||
1815 | NLA_PUT_U8(msg, NL80211_MESHCONF_TTL, | ||
1816 | cur_params.dot11MeshTTL); | ||
1817 | NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, | ||
1818 | cur_params.auto_open_plinks); | ||
1819 | NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, | ||
1820 | cur_params.dot11MeshHWMPmaxPREQretries); | ||
1821 | NLA_PUT_U32(msg, NL80211_MESHCONF_PATH_REFRESH_TIME, | ||
1822 | cur_params.path_refresh_time); | ||
1823 | NLA_PUT_U16(msg, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, | ||
1824 | cur_params.min_discovery_timeout); | ||
1825 | NLA_PUT_U32(msg, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, | ||
1826 | cur_params.dot11MeshHWMPactivePathTimeout); | ||
1827 | NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, | ||
1828 | cur_params.dot11MeshHWMPpreqMinInterval); | ||
1829 | NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | ||
1830 | cur_params.dot11MeshHWMPnetDiameterTraversalTime); | ||
1831 | nla_nest_end(msg, pinfoattr); | ||
1832 | genlmsg_end(msg, hdr); | ||
1833 | err = genlmsg_unicast(msg, info->snd_pid); | ||
1834 | goto out; | ||
1835 | |||
1836 | nla_put_failure: | ||
1837 | genlmsg_cancel(msg, hdr); | ||
1838 | err = -EMSGSIZE; | ||
1839 | out: | ||
1840 | /* Cleanup */ | ||
1841 | cfg80211_put_dev(drv); | ||
1842 | dev_put(dev); | ||
1843 | return err; | ||
1844 | } | ||
1845 | |||
1846 | #define FILL_IN_MESH_PARAM_IF_SET(table, cfg, param, mask, attr_num, nla_fn) \ | ||
1847 | do {\ | ||
1848 | if (table[attr_num]) {\ | ||
1849 | cfg.param = nla_fn(table[attr_num]); \ | ||
1850 | mask |= (1 << (attr_num - 1)); \ | ||
1851 | } \ | ||
1852 | } while (0);\ | ||
1853 | |||
1854 | static struct nla_policy | ||
1855 | nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] __read_mostly = { | ||
1856 | [NL80211_MESHCONF_RETRY_TIMEOUT] = { .type = NLA_U16 }, | ||
1857 | [NL80211_MESHCONF_CONFIRM_TIMEOUT] = { .type = NLA_U16 }, | ||
1858 | [NL80211_MESHCONF_HOLDING_TIMEOUT] = { .type = NLA_U16 }, | ||
1859 | [NL80211_MESHCONF_MAX_PEER_LINKS] = { .type = NLA_U16 }, | ||
1860 | [NL80211_MESHCONF_MAX_RETRIES] = { .type = NLA_U8 }, | ||
1861 | [NL80211_MESHCONF_TTL] = { .type = NLA_U8 }, | ||
1862 | [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 }, | ||
1863 | |||
1864 | [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 }, | ||
1865 | [NL80211_MESHCONF_PATH_REFRESH_TIME] = { .type = NLA_U32 }, | ||
1866 | [NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT] = { .type = NLA_U16 }, | ||
1867 | [NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT] = { .type = NLA_U32 }, | ||
1868 | [NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 }, | ||
1869 | [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 }, | ||
1870 | }; | ||
1871 | |||
1872 | static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info) | ||
1873 | { | ||
1874 | int err; | ||
1875 | u32 mask; | ||
1876 | struct cfg80211_registered_device *drv; | ||
1877 | struct net_device *dev; | ||
1878 | struct mesh_config cfg; | ||
1879 | struct nlattr *tb[NL80211_MESHCONF_ATTR_MAX + 1]; | ||
1880 | struct nlattr *parent_attr; | ||
1881 | |||
1882 | parent_attr = info->attrs[NL80211_ATTR_MESH_PARAMS]; | ||
1883 | if (!parent_attr) | ||
1884 | return -EINVAL; | ||
1885 | if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX, | ||
1886 | parent_attr, nl80211_meshconf_params_policy)) | ||
1887 | return -EINVAL; | ||
1888 | |||
1889 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); | ||
1890 | if (err) | ||
1891 | return err; | ||
1892 | |||
1893 | /* This makes sure that there aren't more than 32 mesh config | ||
1894 | * parameters (otherwise our bitfield scheme would not work.) */ | ||
1895 | BUILD_BUG_ON(NL80211_MESHCONF_ATTR_MAX > 32); | ||
1896 | |||
1897 | /* Fill in the params struct */ | ||
1898 | mask = 0; | ||
1899 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshRetryTimeout, | ||
1900 | mask, NL80211_MESHCONF_RETRY_TIMEOUT, nla_get_u16); | ||
1901 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConfirmTimeout, | ||
1902 | mask, NL80211_MESHCONF_CONFIRM_TIMEOUT, nla_get_u16); | ||
1903 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHoldingTimeout, | ||
1904 | mask, NL80211_MESHCONF_HOLDING_TIMEOUT, nla_get_u16); | ||
1905 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxPeerLinks, | ||
1906 | mask, NL80211_MESHCONF_MAX_PEER_LINKS, nla_get_u16); | ||
1907 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxRetries, | ||
1908 | mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8); | ||
1909 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL, | ||
1910 | mask, NL80211_MESHCONF_TTL, nla_get_u8); | ||
1911 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks, | ||
1912 | mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8); | ||
1913 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries, | ||
1914 | mask, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, | ||
1915 | nla_get_u8); | ||
1916 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, path_refresh_time, | ||
1917 | mask, NL80211_MESHCONF_PATH_REFRESH_TIME, nla_get_u32); | ||
1918 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, min_discovery_timeout, | ||
1919 | mask, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, | ||
1920 | nla_get_u16); | ||
1921 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathTimeout, | ||
1922 | mask, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, | ||
1923 | nla_get_u32); | ||
1924 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPpreqMinInterval, | ||
1925 | mask, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, | ||
1926 | nla_get_u16); | ||
1927 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | ||
1928 | dot11MeshHWMPnetDiameterTraversalTime, | ||
1929 | mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | ||
1930 | nla_get_u16); | ||
1931 | |||
1932 | /* Apply changes */ | ||
1933 | rtnl_lock(); | ||
1934 | err = drv->ops->set_mesh_params(&drv->wiphy, dev, &cfg, mask); | ||
1935 | rtnl_unlock(); | ||
1936 | |||
1937 | /* cleanup */ | ||
1938 | cfg80211_put_dev(drv); | ||
1939 | dev_put(dev); | ||
1940 | return err; | ||
1941 | } | ||
1942 | |||
1943 | #undef FILL_IN_MESH_PARAM_IF_SET | ||
1944 | |||
1688 | static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | 1945 | static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) |
1689 | { | 1946 | { |
1690 | struct nlattr *tb[NL80211_REG_RULE_ATTR_MAX + 1]; | 1947 | struct nlattr *tb[NL80211_REG_RULE_ATTR_MAX + 1]; |
@@ -1743,12 +2000,9 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
1743 | mutex_lock(&cfg80211_drv_mutex); | 2000 | mutex_lock(&cfg80211_drv_mutex); |
1744 | r = set_regdom(rd); | 2001 | r = set_regdom(rd); |
1745 | mutex_unlock(&cfg80211_drv_mutex); | 2002 | mutex_unlock(&cfg80211_drv_mutex); |
1746 | if (r) | ||
1747 | goto bad_reg; | ||
1748 | |||
1749 | return r; | 2003 | return r; |
1750 | 2004 | ||
1751 | bad_reg: | 2005 | bad_reg: |
1752 | kfree(rd); | 2006 | kfree(rd); |
1753 | return -EINVAL; | 2007 | return -EINVAL; |
1754 | } | 2008 | } |
@@ -1902,6 +2156,18 @@ static struct genl_ops nl80211_ops[] = { | |||
1902 | .policy = nl80211_policy, | 2156 | .policy = nl80211_policy, |
1903 | .flags = GENL_ADMIN_PERM, | 2157 | .flags = GENL_ADMIN_PERM, |
1904 | }, | 2158 | }, |
2159 | { | ||
2160 | .cmd = NL80211_CMD_GET_MESH_PARAMS, | ||
2161 | .doit = nl80211_get_mesh_params, | ||
2162 | .policy = nl80211_policy, | ||
2163 | /* can be retrieved by unprivileged users */ | ||
2164 | }, | ||
2165 | { | ||
2166 | .cmd = NL80211_CMD_SET_MESH_PARAMS, | ||
2167 | .doit = nl80211_set_mesh_params, | ||
2168 | .policy = nl80211_policy, | ||
2169 | .flags = GENL_ADMIN_PERM, | ||
2170 | }, | ||
1905 | }; | 2171 | }; |
1906 | 2172 | ||
1907 | /* multicast groups */ | 2173 | /* multicast groups */ |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 626dbb688499..4c7e39d466c4 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -42,17 +42,34 @@ | |||
42 | #include "core.h" | 42 | #include "core.h" |
43 | #include "reg.h" | 43 | #include "reg.h" |
44 | 44 | ||
45 | /* wiphy is set if this request's initiator is REGDOM_SET_BY_DRIVER */ | 45 | /** |
46 | * struct regulatory_request - receipt of last regulatory request | ||
47 | * | ||
48 | * @wiphy: this is set if this request's initiator is | ||
49 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | ||
50 | * can be used by the wireless core to deal with conflicts | ||
51 | * and potentially inform users of which devices specifically | ||
52 | * cased the conflicts. | ||
53 | * @initiator: indicates who sent this request, could be any of | ||
54 | * of those set in reg_set_by, %REGDOM_SET_BY_* | ||
55 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | ||
56 | * regulatory domain. We have a few special codes: | ||
57 | * 00 - World regulatory domain | ||
58 | * 99 - built by driver but a specific alpha2 cannot be determined | ||
59 | * 98 - result of an intersection between two regulatory domains | ||
60 | * @intersect: indicates whether the wireless core should intersect | ||
61 | * the requested regulatory domain with the presently set regulatory | ||
62 | * domain. | ||
63 | */ | ||
46 | struct regulatory_request { | 64 | struct regulatory_request { |
47 | struct list_head list; | ||
48 | struct wiphy *wiphy; | 65 | struct wiphy *wiphy; |
49 | int granted; | ||
50 | enum reg_set_by initiator; | 66 | enum reg_set_by initiator; |
51 | char alpha2[2]; | 67 | char alpha2[2]; |
68 | bool intersect; | ||
52 | }; | 69 | }; |
53 | 70 | ||
54 | static LIST_HEAD(regulatory_requests); | 71 | /* Receipt of information from last regulatory request */ |
55 | DEFINE_MUTEX(cfg80211_reg_mutex); | 72 | static struct regulatory_request *last_request; |
56 | 73 | ||
57 | /* To trigger userspace events */ | 74 | /* To trigger userspace events */ |
58 | static struct platform_device *reg_pdev; | 75 | static struct platform_device *reg_pdev; |
@@ -63,8 +80,6 @@ static u32 supported_bandwidths[] = { | |||
63 | MHZ_TO_KHZ(20), | 80 | MHZ_TO_KHZ(20), |
64 | }; | 81 | }; |
65 | 82 | ||
66 | static struct list_head regulatory_requests; | ||
67 | |||
68 | /* Central wireless core regulatory domains, we only need two, | 83 | /* Central wireless core regulatory domains, we only need two, |
69 | * the current one and a world regulatory domain in case we have no | 84 | * the current one and a world regulatory domain in case we have no |
70 | * information to give us an alpha2 */ | 85 | * information to give us an alpha2 */ |
@@ -204,7 +219,7 @@ static void reset_regdomains(void) | |||
204 | * core upon initialization */ | 219 | * core upon initialization */ |
205 | static void update_world_regdomain(const struct ieee80211_regdomain *rd) | 220 | static void update_world_regdomain(const struct ieee80211_regdomain *rd) |
206 | { | 221 | { |
207 | BUG_ON(list_empty(®ulatory_requests)); | 222 | BUG_ON(!last_request); |
208 | 223 | ||
209 | reset_regdomains(); | 224 | reset_regdomains(); |
210 | 225 | ||
@@ -300,121 +315,13 @@ static int call_crda(const char *alpha2) | |||
300 | return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, envp); | 315 | return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, envp); |
301 | } | 316 | } |
302 | 317 | ||
303 | /* This has the logic which determines when a new request | ||
304 | * should be ignored. */ | ||
305 | static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, | ||
306 | char *alpha2, struct ieee80211_regdomain *rd) | ||
307 | { | ||
308 | struct regulatory_request *last_request = NULL; | ||
309 | |||
310 | /* All initial requests are respected */ | ||
311 | if (list_empty(®ulatory_requests)) | ||
312 | return 0; | ||
313 | |||
314 | last_request = list_first_entry(®ulatory_requests, | ||
315 | struct regulatory_request, list); | ||
316 | |||
317 | switch (set_by) { | ||
318 | case REGDOM_SET_BY_INIT: | ||
319 | return -EINVAL; | ||
320 | case REGDOM_SET_BY_CORE: | ||
321 | /* Always respect new wireless core hints, should only | ||
322 | * come in for updating the world regulatory domain at init | ||
323 | * anyway */ | ||
324 | return 0; | ||
325 | case REGDOM_SET_BY_COUNTRY_IE: | ||
326 | if (last_request->initiator == set_by) { | ||
327 | if (last_request->wiphy != wiphy) { | ||
328 | /* Two cards with two APs claiming different | ||
329 | * different Country IE alpha2s! | ||
330 | * You're special!! */ | ||
331 | if (!alpha2_equal(last_request->alpha2, | ||
332 | cfg80211_regdomain->alpha2)) { | ||
333 | /* XXX: Deal with conflict, consider | ||
334 | * building a new one out of the | ||
335 | * intersection */ | ||
336 | WARN_ON(1); | ||
337 | return -EOPNOTSUPP; | ||
338 | } | ||
339 | return -EALREADY; | ||
340 | } | ||
341 | /* Two consecutive Country IE hints on the same wiphy */ | ||
342 | if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) | ||
343 | return 0; | ||
344 | return -EALREADY; | ||
345 | } | ||
346 | if (WARN_ON(!is_alpha2_set(alpha2) || !is_an_alpha2(alpha2)), | ||
347 | "Invalid Country IE regulatory hint passed " | ||
348 | "to the wireless core\n") | ||
349 | return -EINVAL; | ||
350 | /* We ignore Country IE hints for now, as we haven't yet | ||
351 | * added the dot11MultiDomainCapabilityEnabled flag | ||
352 | * for wiphys */ | ||
353 | return 1; | ||
354 | case REGDOM_SET_BY_DRIVER: | ||
355 | BUG_ON(!wiphy); | ||
356 | if (last_request->initiator == set_by) { | ||
357 | /* Two separate drivers hinting different things, | ||
358 | * this is possible if you have two devices present | ||
359 | * on a system with different EEPROM regulatory | ||
360 | * readings. XXX: Do intersection, we support only | ||
361 | * the first regulatory hint for now */ | ||
362 | if (last_request->wiphy != wiphy) | ||
363 | return -EALREADY; | ||
364 | if (rd) | ||
365 | return -EALREADY; | ||
366 | /* Driver should not be trying to hint different | ||
367 | * regulatory domains! */ | ||
368 | BUG_ON(!alpha2_equal(alpha2, | ||
369 | cfg80211_regdomain->alpha2)); | ||
370 | return -EALREADY; | ||
371 | } | ||
372 | if (last_request->initiator == REGDOM_SET_BY_CORE) | ||
373 | return 0; | ||
374 | /* XXX: Handle intersection, and add the | ||
375 | * dot11MultiDomainCapabilityEnabled flag to wiphy. For now | ||
376 | * we assume the driver has this set to false, following the | ||
377 | * 802.11d dot11MultiDomainCapabilityEnabled documentation */ | ||
378 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | ||
379 | return 0; | ||
380 | return 0; | ||
381 | case REGDOM_SET_BY_USER: | ||
382 | if (last_request->initiator == set_by || | ||
383 | last_request->initiator == REGDOM_SET_BY_CORE) | ||
384 | return 0; | ||
385 | /* Drivers can use their wiphy's reg_notifier() | ||
386 | * to override any information */ | ||
387 | if (last_request->initiator == REGDOM_SET_BY_DRIVER) | ||
388 | return 0; | ||
389 | /* XXX: Handle intersection */ | ||
390 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | ||
391 | return -EOPNOTSUPP; | ||
392 | return 0; | ||
393 | default: | ||
394 | return -EINVAL; | ||
395 | } | ||
396 | } | ||
397 | |||
398 | static bool __reg_is_valid_request(const char *alpha2, | ||
399 | struct regulatory_request **request) | ||
400 | { | ||
401 | struct regulatory_request *req; | ||
402 | if (list_empty(®ulatory_requests)) | ||
403 | return false; | ||
404 | list_for_each_entry(req, ®ulatory_requests, list) { | ||
405 | if (alpha2_equal(req->alpha2, alpha2)) { | ||
406 | *request = req; | ||
407 | return true; | ||
408 | } | ||
409 | } | ||
410 | return false; | ||
411 | } | ||
412 | |||
413 | /* Used by nl80211 before kmalloc'ing our regulatory domain */ | 318 | /* Used by nl80211 before kmalloc'ing our regulatory domain */ |
414 | bool reg_is_valid_request(const char *alpha2) | 319 | bool reg_is_valid_request(const char *alpha2) |
415 | { | 320 | { |
416 | struct regulatory_request *request = NULL; | 321 | if (!last_request) |
417 | return __reg_is_valid_request(alpha2, &request); | 322 | return false; |
323 | |||
324 | return alpha2_equal(last_request->alpha2, alpha2); | ||
418 | } | 325 | } |
419 | 326 | ||
420 | /* Sanity check on a regulatory rule */ | 327 | /* Sanity check on a regulatory rule */ |
@@ -431,7 +338,7 @@ static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule) | |||
431 | 338 | ||
432 | freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; | 339 | freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; |
433 | 340 | ||
434 | if (freq_range->max_bandwidth_khz > freq_diff) | 341 | if (freq_diff <= 0 || freq_range->max_bandwidth_khz > freq_diff) |
435 | return false; | 342 | return false; |
436 | 343 | ||
437 | return true; | 344 | return true; |
@@ -469,6 +376,143 @@ static u32 freq_max_bandwidth(const struct ieee80211_freq_range *freq_range, | |||
469 | return 0; | 376 | return 0; |
470 | } | 377 | } |
471 | 378 | ||
379 | /* Helper for regdom_intersect(), this does the real | ||
380 | * mathematical intersection fun */ | ||
381 | static int reg_rules_intersect( | ||
382 | const struct ieee80211_reg_rule *rule1, | ||
383 | const struct ieee80211_reg_rule *rule2, | ||
384 | struct ieee80211_reg_rule *intersected_rule) | ||
385 | { | ||
386 | const struct ieee80211_freq_range *freq_range1, *freq_range2; | ||
387 | struct ieee80211_freq_range *freq_range; | ||
388 | const struct ieee80211_power_rule *power_rule1, *power_rule2; | ||
389 | struct ieee80211_power_rule *power_rule; | ||
390 | u32 freq_diff; | ||
391 | |||
392 | freq_range1 = &rule1->freq_range; | ||
393 | freq_range2 = &rule2->freq_range; | ||
394 | freq_range = &intersected_rule->freq_range; | ||
395 | |||
396 | power_rule1 = &rule1->power_rule; | ||
397 | power_rule2 = &rule2->power_rule; | ||
398 | power_rule = &intersected_rule->power_rule; | ||
399 | |||
400 | freq_range->start_freq_khz = max(freq_range1->start_freq_khz, | ||
401 | freq_range2->start_freq_khz); | ||
402 | freq_range->end_freq_khz = min(freq_range1->end_freq_khz, | ||
403 | freq_range2->end_freq_khz); | ||
404 | freq_range->max_bandwidth_khz = min(freq_range1->max_bandwidth_khz, | ||
405 | freq_range2->max_bandwidth_khz); | ||
406 | |||
407 | freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; | ||
408 | if (freq_range->max_bandwidth_khz > freq_diff) | ||
409 | freq_range->max_bandwidth_khz = freq_diff; | ||
410 | |||
411 | power_rule->max_eirp = min(power_rule1->max_eirp, | ||
412 | power_rule2->max_eirp); | ||
413 | power_rule->max_antenna_gain = min(power_rule1->max_antenna_gain, | ||
414 | power_rule2->max_antenna_gain); | ||
415 | |||
416 | intersected_rule->flags = (rule1->flags | rule2->flags); | ||
417 | |||
418 | if (!is_valid_reg_rule(intersected_rule)) | ||
419 | return -EINVAL; | ||
420 | |||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * regdom_intersect - do the intersection between two regulatory domains | ||
426 | * @rd1: first regulatory domain | ||
427 | * @rd2: second regulatory domain | ||
428 | * | ||
429 | * Use this function to get the intersection between two regulatory domains. | ||
430 | * Once completed we will mark the alpha2 for the rd as intersected, "98", | ||
431 | * as no one single alpha2 can represent this regulatory domain. | ||
432 | * | ||
433 | * Returns a pointer to the regulatory domain structure which will hold the | ||
434 | * resulting intersection of rules between rd1 and rd2. We will | ||
435 | * kzalloc() this structure for you. | ||
436 | */ | ||
437 | static struct ieee80211_regdomain *regdom_intersect( | ||
438 | const struct ieee80211_regdomain *rd1, | ||
439 | const struct ieee80211_regdomain *rd2) | ||
440 | { | ||
441 | int r, size_of_regd; | ||
442 | unsigned int x, y; | ||
443 | unsigned int num_rules = 0, rule_idx = 0; | ||
444 | const struct ieee80211_reg_rule *rule1, *rule2; | ||
445 | struct ieee80211_reg_rule *intersected_rule; | ||
446 | struct ieee80211_regdomain *rd; | ||
447 | /* This is just a dummy holder to help us count */ | ||
448 | struct ieee80211_reg_rule irule; | ||
449 | |||
450 | /* Uses the stack temporarily for counter arithmetic */ | ||
451 | intersected_rule = &irule; | ||
452 | |||
453 | memset(intersected_rule, 0, sizeof(struct ieee80211_reg_rule)); | ||
454 | |||
455 | if (!rd1 || !rd2) | ||
456 | return NULL; | ||
457 | |||
458 | /* First we get a count of the rules we'll need, then we actually | ||
459 | * build them. This is to so we can malloc() and free() a | ||
460 | * regdomain once. The reason we use reg_rules_intersect() here | ||
461 | * is it will return -EINVAL if the rule computed makes no sense. | ||
462 | * All rules that do check out OK are valid. */ | ||
463 | |||
464 | for (x = 0; x < rd1->n_reg_rules; x++) { | ||
465 | rule1 = &rd1->reg_rules[x]; | ||
466 | for (y = 0; y < rd2->n_reg_rules; y++) { | ||
467 | rule2 = &rd2->reg_rules[y]; | ||
468 | if (!reg_rules_intersect(rule1, rule2, | ||
469 | intersected_rule)) | ||
470 | num_rules++; | ||
471 | memset(intersected_rule, 0, | ||
472 | sizeof(struct ieee80211_reg_rule)); | ||
473 | } | ||
474 | } | ||
475 | |||
476 | if (!num_rules) | ||
477 | return NULL; | ||
478 | |||
479 | size_of_regd = sizeof(struct ieee80211_regdomain) + | ||
480 | ((num_rules + 1) * sizeof(struct ieee80211_reg_rule)); | ||
481 | |||
482 | rd = kzalloc(size_of_regd, GFP_KERNEL); | ||
483 | if (!rd) | ||
484 | return NULL; | ||
485 | |||
486 | for (x = 0; x < rd1->n_reg_rules; x++) { | ||
487 | rule1 = &rd1->reg_rules[x]; | ||
488 | for (y = 0; y < rd2->n_reg_rules; y++) { | ||
489 | rule2 = &rd2->reg_rules[y]; | ||
490 | /* This time around instead of using the stack lets | ||
491 | * write to the target rule directly saving ourselves | ||
492 | * a memcpy() */ | ||
493 | intersected_rule = &rd->reg_rules[rule_idx]; | ||
494 | r = reg_rules_intersect(rule1, rule2, | ||
495 | intersected_rule); | ||
496 | /* No need to memset here the intersected rule here as | ||
497 | * we're not using the stack anymore */ | ||
498 | if (r) | ||
499 | continue; | ||
500 | rule_idx++; | ||
501 | } | ||
502 | } | ||
503 | |||
504 | if (rule_idx != num_rules) { | ||
505 | kfree(rd); | ||
506 | return NULL; | ||
507 | } | ||
508 | |||
509 | rd->n_reg_rules = num_rules; | ||
510 | rd->alpha2[0] = '9'; | ||
511 | rd->alpha2[1] = '8'; | ||
512 | |||
513 | return rd; | ||
514 | } | ||
515 | |||
472 | /* XXX: add support for the rest of enum nl80211_reg_rule_flags, we may | 516 | /* XXX: add support for the rest of enum nl80211_reg_rule_flags, we may |
473 | * want to just have the channel structure use these */ | 517 | * want to just have the channel structure use these */ |
474 | static u32 map_regdom_flags(u32 rd_flags) | 518 | static u32 map_regdom_flags(u32 rd_flags) |
@@ -578,22 +622,81 @@ void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby) | |||
578 | } | 622 | } |
579 | } | 623 | } |
580 | 624 | ||
625 | /* Return value which can be used by ignore_request() to indicate | ||
626 | * it has been determined we should intersect two regulatory domains */ | ||
627 | #define REG_INTERSECT 1 | ||
628 | |||
629 | /* This has the logic which determines when a new request | ||
630 | * should be ignored. */ | ||
631 | static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, | ||
632 | const char *alpha2) | ||
633 | { | ||
634 | /* All initial requests are respected */ | ||
635 | if (!last_request) | ||
636 | return 0; | ||
637 | |||
638 | switch (set_by) { | ||
639 | case REGDOM_SET_BY_INIT: | ||
640 | return -EINVAL; | ||
641 | case REGDOM_SET_BY_CORE: | ||
642 | /* | ||
643 | * Always respect new wireless core hints, should only happen | ||
644 | * when updating the world regulatory domain at init. | ||
645 | */ | ||
646 | return 0; | ||
647 | case REGDOM_SET_BY_COUNTRY_IE: | ||
648 | if (unlikely(!is_an_alpha2(alpha2))) | ||
649 | return -EINVAL; | ||
650 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) { | ||
651 | if (last_request->wiphy != wiphy) { | ||
652 | /* | ||
653 | * Two cards with two APs claiming different | ||
654 | * different Country IE alpha2s. We could | ||
655 | * intersect them, but that seems unlikely | ||
656 | * to be correct. Reject second one for now. | ||
657 | */ | ||
658 | if (!alpha2_equal(alpha2, | ||
659 | cfg80211_regdomain->alpha2)) | ||
660 | return -EOPNOTSUPP; | ||
661 | return -EALREADY; | ||
662 | } | ||
663 | /* Two consecutive Country IE hints on the same wiphy */ | ||
664 | if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) | ||
665 | return 0; | ||
666 | return -EALREADY; | ||
667 | } | ||
668 | /* | ||
669 | * Ignore Country IE hints for now, need to think about | ||
670 | * what we need to do to support multi-domain operation. | ||
671 | */ | ||
672 | return -EOPNOTSUPP; | ||
673 | case REGDOM_SET_BY_DRIVER: | ||
674 | if (last_request->initiator == REGDOM_SET_BY_DRIVER) | ||
675 | return -EALREADY; | ||
676 | return 0; | ||
677 | case REGDOM_SET_BY_USER: | ||
678 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | ||
679 | return REG_INTERSECT; | ||
680 | return 0; | ||
681 | } | ||
682 | |||
683 | return -EINVAL; | ||
684 | } | ||
685 | |||
581 | /* Caller must hold &cfg80211_drv_mutex */ | 686 | /* Caller must hold &cfg80211_drv_mutex */ |
582 | int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | 687 | int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, |
583 | const char *alpha2, struct ieee80211_regdomain *rd) | 688 | const char *alpha2) |
584 | { | 689 | { |
585 | struct regulatory_request *request; | 690 | struct regulatory_request *request; |
586 | char *rd_alpha2; | 691 | bool intersect = false; |
587 | int r = 0; | 692 | int r = 0; |
588 | 693 | ||
589 | r = ignore_request(wiphy, set_by, (char *) alpha2, rd); | 694 | r = ignore_request(wiphy, set_by, alpha2); |
590 | if (r) | ||
591 | return r; | ||
592 | 695 | ||
593 | if (rd) | 696 | if (r == REG_INTERSECT) |
594 | rd_alpha2 = rd->alpha2; | 697 | intersect = true; |
595 | else | 698 | else if (r) |
596 | rd_alpha2 = (char *) alpha2; | 699 | return r; |
597 | 700 | ||
598 | switch (set_by) { | 701 | switch (set_by) { |
599 | case REGDOM_SET_BY_CORE: | 702 | case REGDOM_SET_BY_CORE: |
@@ -601,18 +704,18 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | |||
601 | case REGDOM_SET_BY_DRIVER: | 704 | case REGDOM_SET_BY_DRIVER: |
602 | case REGDOM_SET_BY_USER: | 705 | case REGDOM_SET_BY_USER: |
603 | request = kzalloc(sizeof(struct regulatory_request), | 706 | request = kzalloc(sizeof(struct regulatory_request), |
604 | GFP_KERNEL); | 707 | GFP_KERNEL); |
605 | if (!request) | 708 | if (!request) |
606 | return -ENOMEM; | 709 | return -ENOMEM; |
607 | 710 | ||
608 | request->alpha2[0] = rd_alpha2[0]; | 711 | request->alpha2[0] = alpha2[0]; |
609 | request->alpha2[1] = rd_alpha2[1]; | 712 | request->alpha2[1] = alpha2[1]; |
610 | request->initiator = set_by; | 713 | request->initiator = set_by; |
611 | request->wiphy = wiphy; | 714 | request->wiphy = wiphy; |
715 | request->intersect = intersect; | ||
612 | 716 | ||
613 | list_add_tail(&request->list, ®ulatory_requests); | 717 | kfree(last_request); |
614 | if (rd) | 718 | last_request = request; |
615 | break; | ||
616 | r = call_crda(alpha2); | 719 | r = call_crda(alpha2); |
617 | #ifndef CONFIG_WIRELESS_OLD_REGULATORY | 720 | #ifndef CONFIG_WIRELESS_OLD_REGULATORY |
618 | if (r) | 721 | if (r) |
@@ -627,26 +730,13 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | |||
627 | return r; | 730 | return r; |
628 | } | 731 | } |
629 | 732 | ||
630 | /* If rd is not NULL and if this call fails the caller must free it */ | 733 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) |
631 | int regulatory_hint(struct wiphy *wiphy, const char *alpha2, | ||
632 | struct ieee80211_regdomain *rd) | ||
633 | { | 734 | { |
634 | int r; | 735 | BUG_ON(!alpha2); |
635 | BUG_ON(!rd && !alpha2); | ||
636 | 736 | ||
637 | mutex_lock(&cfg80211_drv_mutex); | 737 | mutex_lock(&cfg80211_drv_mutex); |
638 | 738 | __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2); | |
639 | r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, rd); | ||
640 | if (r || !rd) | ||
641 | goto unlock_and_exit; | ||
642 | |||
643 | /* If the driver passed a regulatory domain we skipped asking | ||
644 | * userspace for one so we can now go ahead and set it */ | ||
645 | r = set_regdom(rd); | ||
646 | |||
647 | unlock_and_exit: | ||
648 | mutex_unlock(&cfg80211_drv_mutex); | 739 | mutex_unlock(&cfg80211_drv_mutex); |
649 | return r; | ||
650 | } | 740 | } |
651 | EXPORT_SYMBOL(regulatory_hint); | 741 | EXPORT_SYMBOL(regulatory_hint); |
652 | 742 | ||
@@ -705,21 +795,21 @@ static void print_regdomain(const struct ieee80211_regdomain *rd) | |||
705 | print_rd_rules(rd); | 795 | print_rd_rules(rd); |
706 | } | 796 | } |
707 | 797 | ||
708 | void print_regdomain_info(const struct ieee80211_regdomain *rd) | 798 | static void print_regdomain_info(const struct ieee80211_regdomain *rd) |
709 | { | 799 | { |
710 | printk(KERN_INFO "cfg80211: Regulatory domain: %c%c\n", | 800 | printk(KERN_INFO "cfg80211: Regulatory domain: %c%c\n", |
711 | rd->alpha2[0], rd->alpha2[1]); | 801 | rd->alpha2[0], rd->alpha2[1]); |
712 | print_rd_rules(rd); | 802 | print_rd_rules(rd); |
713 | } | 803 | } |
714 | 804 | ||
805 | /* Takes ownership of rd only if it doesn't fail */ | ||
715 | static int __set_regdom(const struct ieee80211_regdomain *rd) | 806 | static int __set_regdom(const struct ieee80211_regdomain *rd) |
716 | { | 807 | { |
717 | struct regulatory_request *request = NULL; | 808 | const struct ieee80211_regdomain *intersected_rd = NULL; |
718 | |||
719 | /* Some basic sanity checks first */ | 809 | /* Some basic sanity checks first */ |
720 | 810 | ||
721 | if (is_world_regdom(rd->alpha2)) { | 811 | if (is_world_regdom(rd->alpha2)) { |
722 | if (WARN_ON(!__reg_is_valid_request(rd->alpha2, &request))) | 812 | if (WARN_ON(!reg_is_valid_request(rd->alpha2))) |
723 | return -EINVAL; | 813 | return -EINVAL; |
724 | update_world_regdomain(rd); | 814 | update_world_regdomain(rd); |
725 | return 0; | 815 | return 0; |
@@ -729,7 +819,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
729 | !is_unknown_alpha2(rd->alpha2)) | 819 | !is_unknown_alpha2(rd->alpha2)) |
730 | return -EINVAL; | 820 | return -EINVAL; |
731 | 821 | ||
732 | if (list_empty(®ulatory_requests)) | 822 | if (!last_request) |
733 | return -EINVAL; | 823 | return -EINVAL; |
734 | 824 | ||
735 | /* allow overriding the static definitions if CRDA is present */ | 825 | /* allow overriding the static definitions if CRDA is present */ |
@@ -742,13 +832,13 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
742 | * to review or adjust their own settings based on their own | 832 | * to review or adjust their own settings based on their own |
743 | * internal EEPROM data */ | 833 | * internal EEPROM data */ |
744 | 834 | ||
745 | if (WARN_ON(!__reg_is_valid_request(rd->alpha2, &request))) | 835 | if (WARN_ON(!reg_is_valid_request(rd->alpha2))) |
746 | return -EINVAL; | 836 | return -EINVAL; |
747 | 837 | ||
748 | reset_regdomains(); | 838 | reset_regdomains(); |
749 | 839 | ||
750 | /* Country IE parsing coming soon */ | 840 | /* Country IE parsing coming soon */ |
751 | switch (request->initiator) { | 841 | switch (last_request->initiator) { |
752 | case REGDOM_SET_BY_CORE: | 842 | case REGDOM_SET_BY_CORE: |
753 | case REGDOM_SET_BY_DRIVER: | 843 | case REGDOM_SET_BY_DRIVER: |
754 | case REGDOM_SET_BY_USER: | 844 | case REGDOM_SET_BY_USER: |
@@ -765,9 +855,16 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
765 | return -EOPNOTSUPP; | 855 | return -EOPNOTSUPP; |
766 | } | 856 | } |
767 | 857 | ||
858 | if (unlikely(last_request->intersect)) { | ||
859 | intersected_rd = regdom_intersect(rd, cfg80211_regdomain); | ||
860 | if (!intersected_rd) | ||
861 | return -EINVAL; | ||
862 | kfree(rd); | ||
863 | rd = intersected_rd; | ||
864 | } | ||
865 | |||
768 | /* Tada! */ | 866 | /* Tada! */ |
769 | cfg80211_regdomain = rd; | 867 | cfg80211_regdomain = rd; |
770 | request->granted = 1; | ||
771 | 868 | ||
772 | return 0; | 869 | return 0; |
773 | } | 870 | } |
@@ -775,46 +872,23 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
775 | 872 | ||
776 | /* Use this call to set the current regulatory domain. Conflicts with | 873 | /* Use this call to set the current regulatory domain. Conflicts with |
777 | * multiple drivers can be ironed out later. Caller must've already | 874 | * multiple drivers can be ironed out later. Caller must've already |
778 | * kmalloc'd the rd structure. If this calls fails you should kfree() | 875 | * kmalloc'd the rd structure. Caller must hold cfg80211_drv_mutex */ |
779 | * the passed rd. Caller must hold cfg80211_drv_mutex */ | ||
780 | int set_regdom(const struct ieee80211_regdomain *rd) | 876 | int set_regdom(const struct ieee80211_regdomain *rd) |
781 | { | 877 | { |
782 | struct regulatory_request *this_request = NULL, *prev_request = NULL; | ||
783 | int r; | 878 | int r; |
784 | 879 | ||
785 | if (!list_empty(®ulatory_requests)) | ||
786 | prev_request = list_first_entry(®ulatory_requests, | ||
787 | struct regulatory_request, list); | ||
788 | |||
789 | /* Note that this doesn't update the wiphys, this is done below */ | 880 | /* Note that this doesn't update the wiphys, this is done below */ |
790 | r = __set_regdom(rd); | 881 | r = __set_regdom(rd); |
791 | if (r) | 882 | if (r) { |
883 | kfree(rd); | ||
792 | return r; | 884 | return r; |
793 | |||
794 | BUG_ON((!__reg_is_valid_request(rd->alpha2, &this_request))); | ||
795 | |||
796 | /* The initial standard core update of the world regulatory domain, no | ||
797 | * need to keep that request info around if it didn't fail. */ | ||
798 | if (is_world_regdom(rd->alpha2) && | ||
799 | this_request->initiator == REGDOM_SET_BY_CORE && | ||
800 | this_request->granted) { | ||
801 | list_del(&this_request->list); | ||
802 | kfree(this_request); | ||
803 | this_request = NULL; | ||
804 | } | ||
805 | |||
806 | /* Remove old requests, we only leave behind the last one */ | ||
807 | if (prev_request) { | ||
808 | list_del(&prev_request->list); | ||
809 | kfree(prev_request); | ||
810 | prev_request = NULL; | ||
811 | } | 885 | } |
812 | 886 | ||
813 | /* This would make this whole thing pointless */ | 887 | /* This would make this whole thing pointless */ |
814 | BUG_ON(rd != cfg80211_regdomain); | 888 | BUG_ON(rd != cfg80211_regdomain); |
815 | 889 | ||
816 | /* update all wiphys now with the new established regulatory domain */ | 890 | /* update all wiphys now with the new established regulatory domain */ |
817 | update_all_wiphy_regulatory(this_request->initiator); | 891 | update_all_wiphy_regulatory(last_request->initiator); |
818 | 892 | ||
819 | print_regdomain(rd); | 893 | print_regdomain(rd); |
820 | 894 | ||
@@ -838,13 +912,13 @@ int regulatory_init(void) | |||
838 | * you have CRDA you get it updated, otherwise you get | 912 | * you have CRDA you get it updated, otherwise you get |
839 | * stuck with the static values. We ignore "EU" code as | 913 | * stuck with the static values. We ignore "EU" code as |
840 | * that is not a valid ISO / IEC 3166 alpha2 */ | 914 | * that is not a valid ISO / IEC 3166 alpha2 */ |
841 | if (ieee80211_regdom[0] != 'E' && ieee80211_regdom[1] != 'U') | 915 | if (ieee80211_regdom[0] != 'E' || ieee80211_regdom[1] != 'U') |
842 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, | 916 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, |
843 | ieee80211_regdom, NULL); | 917 | ieee80211_regdom); |
844 | #else | 918 | #else |
845 | cfg80211_regdomain = cfg80211_world_regdom; | 919 | cfg80211_regdomain = cfg80211_world_regdom; |
846 | 920 | ||
847 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00", NULL); | 921 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00"); |
848 | if (err) | 922 | if (err) |
849 | printk(KERN_ERR "cfg80211: calling CRDA failed - " | 923 | printk(KERN_ERR "cfg80211: calling CRDA failed - " |
850 | "unable to update world regulatory domain, " | 924 | "unable to update world regulatory domain, " |
@@ -856,16 +930,12 @@ int regulatory_init(void) | |||
856 | 930 | ||
857 | void regulatory_exit(void) | 931 | void regulatory_exit(void) |
858 | { | 932 | { |
859 | struct regulatory_request *req, *req_tmp; | ||
860 | |||
861 | mutex_lock(&cfg80211_drv_mutex); | 933 | mutex_lock(&cfg80211_drv_mutex); |
862 | 934 | ||
863 | reset_regdomains(); | 935 | reset_regdomains(); |
864 | 936 | ||
865 | list_for_each_entry_safe(req, req_tmp, ®ulatory_requests, list) { | 937 | kfree(last_request); |
866 | list_del(&req->list); | 938 | |
867 | kfree(req); | ||
868 | } | ||
869 | platform_device_unregister(reg_pdev); | 939 | platform_device_unregister(reg_pdev); |
870 | 940 | ||
871 | mutex_unlock(&cfg80211_drv_mutex); | 941 | mutex_unlock(&cfg80211_drv_mutex); |
diff --git a/net/wireless/reg.h b/net/wireless/reg.h index a33362872f3c..c9b6b6358bbe 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __NET_WIRELESS_REG_H | 1 | #ifndef __NET_WIRELESS_REG_H |
2 | #define __NET_WIRELESS_REG_H | 2 | #define __NET_WIRELESS_REG_H |
3 | 3 | ||
4 | extern struct mutex cfg80211_reg_mutex; | ||
5 | bool is_world_regdom(const char *alpha2); | 4 | bool is_world_regdom(const char *alpha2); |
6 | bool reg_is_valid_request(const char *alpha2); | 5 | bool reg_is_valid_request(const char *alpha2); |
7 | 6 | ||
@@ -10,4 +9,23 @@ void regulatory_exit(void); | |||
10 | 9 | ||
11 | int set_regdom(const struct ieee80211_regdomain *rd); | 10 | int set_regdom(const struct ieee80211_regdomain *rd); |
12 | 11 | ||
12 | /** | ||
13 | * __regulatory_hint - hint to the wireless core a regulatory domain | ||
14 | * @wiphy: if the hint comes from country information from an AP, this | ||
15 | * is required to be set to the wiphy that received the information | ||
16 | * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain | ||
17 | * should be in. | ||
18 | * | ||
19 | * The Wireless subsystem can use this function to hint to the wireless core | ||
20 | * what it believes should be the current regulatory domain by | ||
21 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
22 | * domain should be in. | ||
23 | * | ||
24 | * Returns zero if all went fine, %-EALREADY if a regulatory domain had | ||
25 | * already been set or other standard error codes. | ||
26 | * | ||
27 | */ | ||
28 | extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | ||
29 | const char *alpha2); | ||
30 | |||
13 | #endif /* __NET_WIRELESS_REG_H */ | 31 | #endif /* __NET_WIRELESS_REG_H */ |
diff --git a/net/wireless/util.c b/net/wireless/util.c index f54424693a38..e76cc28b0345 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -7,6 +7,25 @@ | |||
7 | #include <asm/bitops.h> | 7 | #include <asm/bitops.h> |
8 | #include "core.h" | 8 | #include "core.h" |
9 | 9 | ||
10 | struct ieee80211_rate * | ||
11 | ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | ||
12 | u64 basic_rates, int bitrate) | ||
13 | { | ||
14 | struct ieee80211_rate *result = &sband->bitrates[0]; | ||
15 | int i; | ||
16 | |||
17 | for (i = 0; i < sband->n_bitrates; i++) { | ||
18 | if (!(basic_rates & BIT(i))) | ||
19 | continue; | ||
20 | if (sband->bitrates[i].bitrate > bitrate) | ||
21 | continue; | ||
22 | result = &sband->bitrates[i]; | ||
23 | } | ||
24 | |||
25 | return result; | ||
26 | } | ||
27 | EXPORT_SYMBOL(ieee80211_get_response_rate); | ||
28 | |||
10 | int ieee80211_channel_to_frequency(int chan) | 29 | int ieee80211_channel_to_frequency(int chan) |
11 | { | 30 | { |
12 | if (chan < 14) | 31 | if (chan < 14) |
diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c index 6ebda25c24e9..a5d3416522de 100644 --- a/net/x25/sysctl_net_x25.c +++ b/net/x25/sysctl_net_x25.c | |||
@@ -24,8 +24,8 @@ static struct ctl_table x25_table[] = { | |||
24 | .data = &sysctl_x25_restart_request_timeout, | 24 | .data = &sysctl_x25_restart_request_timeout, |
25 | .maxlen = sizeof(int), | 25 | .maxlen = sizeof(int), |
26 | .mode = 0644, | 26 | .mode = 0644, |
27 | .proc_handler = &proc_dointvec_minmax, | 27 | .proc_handler = proc_dointvec_minmax, |
28 | .strategy = &sysctl_intvec, | 28 | .strategy = sysctl_intvec, |
29 | .extra1 = &min_timer, | 29 | .extra1 = &min_timer, |
30 | .extra2 = &max_timer, | 30 | .extra2 = &max_timer, |
31 | }, | 31 | }, |
@@ -35,8 +35,8 @@ static struct ctl_table x25_table[] = { | |||
35 | .data = &sysctl_x25_call_request_timeout, | 35 | .data = &sysctl_x25_call_request_timeout, |
36 | .maxlen = sizeof(int), | 36 | .maxlen = sizeof(int), |
37 | .mode = 0644, | 37 | .mode = 0644, |
38 | .proc_handler = &proc_dointvec_minmax, | 38 | .proc_handler = proc_dointvec_minmax, |
39 | .strategy = &sysctl_intvec, | 39 | .strategy = sysctl_intvec, |
40 | .extra1 = &min_timer, | 40 | .extra1 = &min_timer, |
41 | .extra2 = &max_timer, | 41 | .extra2 = &max_timer, |
42 | }, | 42 | }, |
@@ -46,8 +46,8 @@ static struct ctl_table x25_table[] = { | |||
46 | .data = &sysctl_x25_reset_request_timeout, | 46 | .data = &sysctl_x25_reset_request_timeout, |
47 | .maxlen = sizeof(int), | 47 | .maxlen = sizeof(int), |
48 | .mode = 0644, | 48 | .mode = 0644, |
49 | .proc_handler = &proc_dointvec_minmax, | 49 | .proc_handler = proc_dointvec_minmax, |
50 | .strategy = &sysctl_intvec, | 50 | .strategy = sysctl_intvec, |
51 | .extra1 = &min_timer, | 51 | .extra1 = &min_timer, |
52 | .extra2 = &max_timer, | 52 | .extra2 = &max_timer, |
53 | }, | 53 | }, |
@@ -57,8 +57,8 @@ static struct ctl_table x25_table[] = { | |||
57 | .data = &sysctl_x25_clear_request_timeout, | 57 | .data = &sysctl_x25_clear_request_timeout, |
58 | .maxlen = sizeof(int), | 58 | .maxlen = sizeof(int), |
59 | .mode = 0644, | 59 | .mode = 0644, |
60 | .proc_handler = &proc_dointvec_minmax, | 60 | .proc_handler = proc_dointvec_minmax, |
61 | .strategy = &sysctl_intvec, | 61 | .strategy = sysctl_intvec, |
62 | .extra1 = &min_timer, | 62 | .extra1 = &min_timer, |
63 | .extra2 = &max_timer, | 63 | .extra2 = &max_timer, |
64 | }, | 64 | }, |
@@ -68,8 +68,8 @@ static struct ctl_table x25_table[] = { | |||
68 | .data = &sysctl_x25_ack_holdback_timeout, | 68 | .data = &sysctl_x25_ack_holdback_timeout, |
69 | .maxlen = sizeof(int), | 69 | .maxlen = sizeof(int), |
70 | .mode = 0644, | 70 | .mode = 0644, |
71 | .proc_handler = &proc_dointvec_minmax, | 71 | .proc_handler = proc_dointvec_minmax, |
72 | .strategy = &sysctl_intvec, | 72 | .strategy = sysctl_intvec, |
73 | .extra1 = &min_timer, | 73 | .extra1 = &min_timer, |
74 | .extra2 = &max_timer, | 74 | .extra2 = &max_timer, |
75 | }, | 75 | }, |
@@ -79,7 +79,7 @@ static struct ctl_table x25_table[] = { | |||
79 | .data = &sysctl_x25_forward, | 79 | .data = &sysctl_x25_forward, |
80 | .maxlen = sizeof(int), | 80 | .maxlen = sizeof(int), |
81 | .mode = 0644, | 81 | .mode = 0644, |
82 | .proc_handler = &proc_dointvec, | 82 | .proc_handler = proc_dointvec, |
83 | }, | 83 | }, |
84 | { 0, }, | 84 | { 0, }, |
85 | }; | 85 | }; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 058f04f54b90..c546cf67801a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2381,9 +2381,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void | |||
2381 | } | 2381 | } |
2382 | 2382 | ||
2383 | static struct notifier_block xfrm_dev_notifier = { | 2383 | static struct notifier_block xfrm_dev_notifier = { |
2384 | xfrm_dev_event, | 2384 | .notifier_call = xfrm_dev_event, |
2385 | NULL, | ||
2386 | 0 | ||
2387 | }; | 2385 | }; |
2388 | 2386 | ||
2389 | #ifdef CONFIG_XFRM_STATISTICS | 2387 | #ifdef CONFIG_XFRM_STATISTICS |
@@ -2457,25 +2455,21 @@ static void xfrm_audit_common_policyinfo(struct xfrm_policy *xp, | |||
2457 | 2455 | ||
2458 | switch(sel->family) { | 2456 | switch(sel->family) { |
2459 | case AF_INET: | 2457 | case AF_INET: |
2460 | audit_log_format(audit_buf, " src=" NIPQUAD_FMT, | 2458 | audit_log_format(audit_buf, " src=%pI4", &sel->saddr.a4); |
2461 | NIPQUAD(sel->saddr.a4)); | ||
2462 | if (sel->prefixlen_s != 32) | 2459 | if (sel->prefixlen_s != 32) |
2463 | audit_log_format(audit_buf, " src_prefixlen=%d", | 2460 | audit_log_format(audit_buf, " src_prefixlen=%d", |
2464 | sel->prefixlen_s); | 2461 | sel->prefixlen_s); |
2465 | audit_log_format(audit_buf, " dst=" NIPQUAD_FMT, | 2462 | audit_log_format(audit_buf, " dst=%pI4", &sel->daddr.a4); |
2466 | NIPQUAD(sel->daddr.a4)); | ||
2467 | if (sel->prefixlen_d != 32) | 2463 | if (sel->prefixlen_d != 32) |
2468 | audit_log_format(audit_buf, " dst_prefixlen=%d", | 2464 | audit_log_format(audit_buf, " dst_prefixlen=%d", |
2469 | sel->prefixlen_d); | 2465 | sel->prefixlen_d); |
2470 | break; | 2466 | break; |
2471 | case AF_INET6: | 2467 | case AF_INET6: |
2472 | audit_log_format(audit_buf, " src=" NIP6_FMT, | 2468 | audit_log_format(audit_buf, " src=%pI6", sel->saddr.a6); |
2473 | NIP6(*(struct in6_addr *)sel->saddr.a6)); | ||
2474 | if (sel->prefixlen_s != 128) | 2469 | if (sel->prefixlen_s != 128) |
2475 | audit_log_format(audit_buf, " src_prefixlen=%d", | 2470 | audit_log_format(audit_buf, " src_prefixlen=%d", |
2476 | sel->prefixlen_s); | 2471 | sel->prefixlen_s); |
2477 | audit_log_format(audit_buf, " dst=" NIP6_FMT, | 2472 | audit_log_format(audit_buf, " dst=%pI6", sel->daddr.a6); |
2478 | NIP6(*(struct in6_addr *)sel->daddr.a6)); | ||
2479 | if (sel->prefixlen_d != 128) | 2473 | if (sel->prefixlen_d != 128) |
2480 | audit_log_format(audit_buf, " dst_prefixlen=%d", | 2474 | audit_log_format(audit_buf, " dst_prefixlen=%d", |
2481 | sel->prefixlen_d); | 2475 | sel->prefixlen_d); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 508337f97249..cd9d9171ded7 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -2109,16 +2109,12 @@ static void xfrm_audit_helper_sainfo(struct xfrm_state *x, | |||
2109 | 2109 | ||
2110 | switch(x->props.family) { | 2110 | switch(x->props.family) { |
2111 | case AF_INET: | 2111 | case AF_INET: |
2112 | audit_log_format(audit_buf, | 2112 | audit_log_format(audit_buf, " src=%pI4 dst=%pI4", |
2113 | " src=" NIPQUAD_FMT " dst=" NIPQUAD_FMT, | 2113 | &x->props.saddr.a4, &x->id.daddr.a4); |
2114 | NIPQUAD(x->props.saddr.a4), | ||
2115 | NIPQUAD(x->id.daddr.a4)); | ||
2116 | break; | 2114 | break; |
2117 | case AF_INET6: | 2115 | case AF_INET6: |
2118 | audit_log_format(audit_buf, | 2116 | audit_log_format(audit_buf, " src=%pI6 dst=%pI6", |
2119 | " src=" NIP6_FMT " dst=" NIP6_FMT, | 2117 | 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; | 2118 | break; |
2123 | } | 2119 | } |
2124 | 2120 | ||
@@ -2134,18 +2130,14 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family, | |||
2134 | switch (family) { | 2130 | switch (family) { |
2135 | case AF_INET: | 2131 | case AF_INET: |
2136 | iph4 = ip_hdr(skb); | 2132 | iph4 = ip_hdr(skb); |
2137 | audit_log_format(audit_buf, | 2133 | audit_log_format(audit_buf, " src=%pI4 dst=%pI4", |
2138 | " src=" NIPQUAD_FMT " dst=" NIPQUAD_FMT, | 2134 | &iph4->saddr, &iph4->daddr); |
2139 | NIPQUAD(iph4->saddr), | ||
2140 | NIPQUAD(iph4->daddr)); | ||
2141 | break; | 2135 | break; |
2142 | case AF_INET6: | 2136 | case AF_INET6: |
2143 | iph6 = ipv6_hdr(skb); | 2137 | iph6 = ipv6_hdr(skb); |
2144 | audit_log_format(audit_buf, | 2138 | audit_log_format(audit_buf, |
2145 | " src=" NIP6_FMT " dst=" NIP6_FMT | 2139 | " src=%pI6 dst=%pI6 flowlbl=0x%x%02x%02x", |
2146 | " flowlbl=0x%x%02x%02x", | 2140 | &iph6->saddr,&iph6->daddr, |
2147 | NIP6(iph6->saddr), | ||
2148 | NIP6(iph6->daddr), | ||
2149 | iph6->flow_lbl[0] & 0x0f, | 2141 | iph6->flow_lbl[0] & 0x0f, |
2150 | iph6->flow_lbl[1], | 2142 | iph6->flow_lbl[1], |
2151 | iph6->flow_lbl[2]); | 2143 | iph6->flow_lbl[2]); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index a278a6f3b991..ee15d5dd6544 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 | ||
2506 | static inline size_t xfrm_mapping_msgsize(void) | ||
2507 | { | ||
2508 | return NLMSG_ALIGN(sizeof(struct xfrm_user_mapping)); | ||
2509 | } | ||
2510 | |||
2511 | static 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 | |||
2536 | static 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 | |||
2506 | static struct xfrm_mgr netlink_mgr = { | 2557 | static 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 | ||
2516 | static int __init xfrm_user_init(void) | 2568 | static int __init xfrm_user_init(void) |