aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:23:21 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:23:21 -0400
commitce8c2293be47999584908069e78bf6d94beadc53 (patch)
treedfd6909e6866998d2103341b1e1af8c129d0cea8 /net
parent41e9d344bf52c57ec16648d08618b61d3f1d4bdc (diff)
parentee6a99b539a50b4e9398938a0a6d37f8bf911550 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (25 commits) [TG3]: Fix msi issue with kexec/kdump. [NET] XFRM: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. [NET] ROSE: Fix whitespace errors. [NET] RFKILL: Fix whitespace errors. [NET] PACKET: Fix whitespace errors. [NET] NETROM: Fix whitespace errors. [NET] NETFILTER: Fix whitespace errors. [NET] IPV4: Fix whitespace errors. [NET] DCCP: Fix whitespace errors. [NET] CORE: Fix whitespace errors. [NET] BLUETOOTH: Fix whitespace errors. [NET] AX25: Fix whitespace errors. [PATCH] mac80211: remove rtnl locking in ieee80211_sta.c [PATCH] mac80211: fix GCC warning on 64bit platforms [GENETLINK]: Dynamic multicast groups. [NETLIKN]: Allow removing multicast groups. ...
Diffstat (limited to 'net')
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/bluetooth/hci_core.c2
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dccp/ccids/lib/loss_interval.c2
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/mac80211/Makefile1
-rw-r--r--net/mac80211/debugfs_netdev.c9
-rw-r--r--net/mac80211/ieee80211.c7
-rw-r--r--net/mac80211/ieee80211_i.h5
-rw-r--r--net/mac80211/ieee80211_ioctl.c133
-rw-r--r--net/mac80211/ieee80211_sta.c6
-rw-r--r--net/mac80211/regdomain.c158
-rw-r--r--net/netfilter/nf_conntrack_standalone.c2
-rw-r--r--net/netfilter/nf_log.c2
-rw-r--r--net/netlink/af_netlink.c161
-rw-r--r--net/netlink/genetlink.c235
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rfkill/rfkill-input.c2
-rw-r--r--net/rfkill/rfkill.c2
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/rxrpc/af_rxrpc.c10
-rw-r--r--net/sctp/sm_statefuns.c2
-rw-r--r--net/sctp/socket.c4
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c2
-rw-r--r--net/tipc/socket.c12
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--net/xfrm/xfrm_state.c2
32 files changed, 560 insertions, 221 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index c83cf8432970..dae2a42d3d86 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1262,7 +1262,7 @@ static int __must_check ax25_connect(struct socket *sock,
1262 1262
1263 for (;;) { 1263 for (;;) {
1264 prepare_to_wait(sk->sk_sleep, &wait, 1264 prepare_to_wait(sk->sk_sleep, &wait,
1265 TASK_INTERRUPTIBLE); 1265 TASK_INTERRUPTIBLE);
1266 if (sk->sk_state != TCP_SYN_SENT) 1266 if (sk->sk_state != TCP_SYN_SENT)
1267 break; 1267 break;
1268 if (!signal_pending(current)) { 1268 if (!signal_pending(current)) {
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f6d867e0179f..63caa414945d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -982,7 +982,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
982 982
983 skb->dev = (void *) hdev; 983 skb->dev = (void *) hdev;
984 bt_cb(skb)->pkt_type = type; 984 bt_cb(skb)->pkt_type = type;
985 985
986 __reassembly(hdev, type) = skb; 986 __reassembly(hdev, type) = skb;
987 987
988 scb = (void *) skb->cb; 988 scb = (void *) skb->cb;
diff --git a/net/core/dev.c b/net/core/dev.c
index 6357f54c8ff7..38212c3f9971 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2629,7 +2629,7 @@ void __dev_set_rx_mode(struct net_device *dev)
2629 return; 2629 return;
2630 2630
2631 if (!netif_device_present(dev)) 2631 if (!netif_device_present(dev))
2632 return; 2632 return;
2633 2633
2634 if (dev->set_rx_mode) 2634 if (dev->set_rx_mode)
2635 dev->set_rx_mode(dev); 2635 dev->set_rx_mode(dev);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 864cbdf31ed7..06eccca8cb5d 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -98,7 +98,7 @@ int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
98} 98}
99 99
100int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr, 100int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
101 struct rtattr *rta, int len) 101 struct rtattr *rta, int len)
102{ 102{
103 if (RTA_PAYLOAD(rta) < len) 103 if (RTA_PAYLOAD(rta) < len)
104 return -1; 104 return -1;
diff --git a/net/core/sock.c b/net/core/sock.c
index 25d2557211c1..239a08a6ff24 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -230,7 +230,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
230 warned++; 230 warned++;
231 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " 231 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
232 "tries to set negative timeout\n", 232 "tries to set negative timeout\n",
233 current->comm, current->pid); 233 current->comm, current->pid);
234 return 0; 234 return 0;
235 } 235 }
236 *timeo_p = MAX_SCHEDULE_TIMEOUT; 236 *timeo_p = MAX_SCHEDULE_TIMEOUT;
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 515225f3a464..dd0fc992b042 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -227,7 +227,7 @@ void dccp_li_update_li(struct sock *sk,
227 struct list_head *li_hist_list, 227 struct list_head *li_hist_list,
228 struct list_head *hist_list, 228 struct list_head *hist_list,
229 struct timeval *last_feedback, u16 s, u32 bytes_recv, 229 struct timeval *last_feedback, u16 s, u32 bytes_recv,
230 u32 previous_x_recv, u64 seq_loss, u8 win_loss) 230 u32 previous_x_recv, u64 seq_loss, u8 win_loss)
231{ 231{
232 struct dccp_li_hist_entry *head; 232 struct dccp_li_hist_entry *head;
233 u64 seq_temp; 233 u64 seq_temp;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 2eb909be8041..eff6bce453ee 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -817,7 +817,7 @@ static void nl_fib_input(struct sock *sk, int len)
817static void nl_fib_lookup_init(void) 817static void nl_fib_lookup_init(void)
818{ 818{
819 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, NULL, 819 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, NULL,
820 THIS_MODULE); 820 THIS_MODULE);
821} 821}
822 822
823static void fib_disable_ip(struct net_device *dev, int force) 823static void fib_disable_ip(struct net_device *dev, int force)
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 9cb04df0054b..8c95cf09f87a 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -86,7 +86,7 @@ int ip_forward(struct sk_buff *skb)
86 goto sr_failed; 86 goto sr_failed;
87 87
88 if (unlikely(skb->len > dst_mtu(&rt->u.dst) && 88 if (unlikely(skb->len > dst_mtu(&rt->u.dst) &&
89 (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) { 89 (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) {
90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); 90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
92 htonl(dst_mtu(&rt->u.dst))); 92 htonl(dst_mtu(&rt->u.dst)));
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 20aea1595c4d..666d8a58d14a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1615,7 +1615,7 @@ u32 __tcp_select_window(struct sock *sk)
1615 if (window <= free_space - mss || window > free_space) 1615 if (window <= free_space - mss || window > free_space)
1616 window = (free_space/mss)*mss; 1616 window = (free_space/mss)*mss;
1617 else if (mss == full_space && 1617 else if (mss == full_space &&
1618 free_space > window + full_space/2) 1618 free_space > window + full_space/2)
1619 window = free_space; 1619 window = free_space;
1620 } 1620 }
1621 1621
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index e9738dad2d7c..a9c2d0787d4a 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -13,6 +13,7 @@ mac80211-objs := \
13 ieee80211_iface.o \ 13 ieee80211_iface.o \
14 ieee80211_rate.o \ 14 ieee80211_rate.o \
15 michael.o \ 15 michael.o \
16 regdomain.o \
16 tkip.o \ 17 tkip.o \
17 aes_ccm.o \ 18 aes_ccm.o \
18 wme.o \ 19 wme.o \
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index a3e01d76d503..799a9208c4b4 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -397,6 +397,8 @@ static int netdev_notify(struct notifier_block * nb,
397 void *ndev) 397 void *ndev)
398{ 398{
399 struct net_device *dev = ndev; 399 struct net_device *dev = ndev;
400 struct dentry *dir;
401 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
400 char buf[10+IFNAMSIZ]; 402 char buf[10+IFNAMSIZ];
401 403
402 if (state != NETDEV_CHANGENAME) 404 if (state != NETDEV_CHANGENAME)
@@ -408,10 +410,11 @@ static int netdev_notify(struct notifier_block * nb,
408 if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) 410 if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
409 return 0; 411 return 0;
410 412
411 /* TODO
412 sprintf(buf, "netdev:%s", dev->name); 413 sprintf(buf, "netdev:%s", dev->name);
413 debugfs_rename(IEEE80211_DEV_TO_SUB_IF(dev)->debugfsdir, buf); 414 dir = sdata->debugfsdir;
414 */ 415 if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
416 printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
417 "dir to %s\n", buf);
415 418
416 return 0; 419 return 0;
417} 420}
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 2ddf4ef4065e..c944b17d0fc0 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -4986,8 +4986,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
4986 * and we need some headroom for passing the frame to monitor 4986 * and we need some headroom for passing the frame to monitor
4987 * interfaces, but never both at the same time. 4987 * interfaces, but never both at the same time.
4988 */ 4988 */
4989 local->tx_headroom = max(local->hw.extra_tx_headroom, 4989 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
4990 sizeof(struct ieee80211_tx_status_rtap_hdr)); 4990 sizeof(struct ieee80211_tx_status_rtap_hdr));
4991 4991
4992 debugfs_hw_add(local); 4992 debugfs_hw_add(local);
4993 4993
@@ -5095,7 +5095,7 @@ int ieee80211_register_hwmode(struct ieee80211_hw *hw,
5095 } 5095 }
5096 5096
5097 if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED)) 5097 if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED))
5098 ieee80211_init_client(local->mdev); 5098 ieee80211_set_default_regdomain(mode);
5099 5099
5100 return 0; 5100 return 0;
5101} 5101}
@@ -5246,6 +5246,7 @@ static int __init ieee80211_init(void)
5246 } 5246 }
5247 5247
5248 ieee80211_debugfs_netdev_init(); 5248 ieee80211_debugfs_netdev_init();
5249 ieee80211_regdomain_init();
5249 5250
5250 return 0; 5251 return 0;
5251} 5252}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 055a2a912185..6f7bae7ef9c0 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -759,7 +759,6 @@ void ieee80211_update_default_wep_only(struct ieee80211_local *local);
759/* ieee80211_ioctl.c */ 759/* ieee80211_ioctl.c */
760int ieee80211_set_compression(struct ieee80211_local *local, 760int ieee80211_set_compression(struct ieee80211_local *local,
761 struct net_device *dev, struct sta_info *sta); 761 struct net_device *dev, struct sta_info *sta);
762int ieee80211_init_client(struct net_device *dev);
763int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq); 762int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq);
764/* ieee80211_sta.c */ 763/* ieee80211_sta.c */
765void ieee80211_sta_timer(unsigned long data); 764void ieee80211_sta_timer(unsigned long data);
@@ -798,6 +797,10 @@ void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
798int ieee80211_if_add_mgmt(struct ieee80211_local *local); 797int ieee80211_if_add_mgmt(struct ieee80211_local *local);
799void ieee80211_if_del_mgmt(struct ieee80211_local *local); 798void ieee80211_if_del_mgmt(struct ieee80211_local *local);
800 799
800/* regdomain.c */
801void ieee80211_regdomain_init(void);
802void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
803
801/* for wiphy privid */ 804/* for wiphy privid */
802extern void *mac80211_wiphy_privid; 805extern void *mac80211_wiphy_privid;
803 806
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 5918dd079e12..d0e1ab5589db 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -27,20 +27,6 @@
27#include "aes_ccm.h" 27#include "aes_ccm.h"
28#include "debugfs_key.h" 28#include "debugfs_key.h"
29 29
30static int ieee80211_regdom = 0x10; /* FCC */
31module_param(ieee80211_regdom, int, 0444);
32MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain; 64=MKK");
33
34/*
35 * If firmware is upgraded by the vendor, additional channels can be used based
36 * on the new Japanese regulatory rules. This is indicated by setting
37 * ieee80211_japan_5ghz module parameter to one when loading the 80211 kernel
38 * module.
39 */
40static int ieee80211_japan_5ghz /* = 0 */;
41module_param(ieee80211_japan_5ghz, int, 0444);
42MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz");
43
44static void ieee80211_set_hw_encryption(struct net_device *dev, 30static void ieee80211_set_hw_encryption(struct net_device *dev,
45 struct sta_info *sta, u8 addr[ETH_ALEN], 31 struct sta_info *sta, u8 addr[ETH_ALEN],
46 struct ieee80211_key *key) 32 struct ieee80211_key *key)
@@ -412,125 +398,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
412} 398}
413 399
414 400
415struct ieee80211_channel_range {
416 short start_freq;
417 short end_freq;
418 unsigned char power_level;
419 unsigned char antenna_max;
420};
421
422static const struct ieee80211_channel_range ieee80211_fcc_channels[] = {
423 { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */,
424 { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */,
425 { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */,
426 { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */,
427 { 0 }
428};
429
430static const struct ieee80211_channel_range ieee80211_mkk_channels[] = {
431 { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */,
432 { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */,
433 { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */,
434 { 0 }
435};
436
437
438static const struct ieee80211_channel_range *channel_range =
439 ieee80211_fcc_channels;
440
441
442static void ieee80211_unmask_channel(struct net_device *dev, int mode,
443 struct ieee80211_channel *chan)
444{
445 int i;
446
447 chan->flag = 0;
448
449 if (ieee80211_regdom == 64 &&
450 (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) {
451 /* Do not allow Turbo modes in Japan. */
452 return;
453 }
454
455 for (i = 0; channel_range[i].start_freq; i++) {
456 const struct ieee80211_channel_range *r = &channel_range[i];
457 if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) {
458 if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz &&
459 chan->freq >= 5260 && chan->freq <= 5320) {
460 /*
461 * Skip new channels in Japan since the
462 * firmware was not marked having been upgraded
463 * by the vendor.
464 */
465 continue;
466 }
467
468 if (ieee80211_regdom == 0x10 &&
469 (chan->freq == 5190 || chan->freq == 5210 ||
470 chan->freq == 5230)) {
471 /* Skip MKK channels when in FCC domain. */
472 continue;
473 }
474
475 chan->flag |= IEEE80211_CHAN_W_SCAN |
476 IEEE80211_CHAN_W_ACTIVE_SCAN |
477 IEEE80211_CHAN_W_IBSS;
478 chan->power_level = r->power_level;
479 chan->antenna_max = r->antenna_max;
480
481 if (ieee80211_regdom == 64 &&
482 (chan->freq == 5170 || chan->freq == 5190 ||
483 chan->freq == 5210 || chan->freq == 5230)) {
484 /*
485 * New regulatory rules in Japan have backwards
486 * compatibility with old channels in 5.15-5.25
487 * GHz band, but the station is not allowed to
488 * use active scan on these old channels.
489 */
490 chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN;
491 }
492
493 if (ieee80211_regdom == 64 &&
494 (chan->freq == 5260 || chan->freq == 5280 ||
495 chan->freq == 5300 || chan->freq == 5320)) {
496 /*
497 * IBSS is not allowed on 5.25-5.35 GHz band
498 * due to radar detection requirements.
499 */
500 chan->flag &= ~IEEE80211_CHAN_W_IBSS;
501 }
502
503 break;
504 }
505 }
506}
507
508
509static int ieee80211_unmask_channels(struct net_device *dev)
510{
511 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
512 struct ieee80211_hw_mode *mode;
513 int c;
514
515 list_for_each_entry(mode, &local->modes_list, list) {
516 for (c = 0; c < mode->num_channels; c++) {
517 ieee80211_unmask_channel(dev, mode->mode,
518 &mode->channels[c]);
519 }
520 }
521 return 0;
522}
523
524
525int ieee80211_init_client(struct net_device *dev)
526{
527 if (ieee80211_regdom == 0x40)
528 channel_range = ieee80211_mkk_channels;
529 ieee80211_unmask_channels(dev);
530 return 0;
531}
532
533
534static int ieee80211_ioctl_siwmode(struct net_device *dev, 401static int ieee80211_ioctl_siwmode(struct net_device *dev,
535 struct iw_request_info *info, 402 struct iw_request_info *info,
536 __u32 *mode, char *extra) 403 __u32 *mode, char *extra)
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 22b11786327a..7ba352e3ffe0 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -25,7 +25,6 @@
25#include <linux/wireless.h> 25#include <linux/wireless.h>
26#include <linux/random.h> 26#include <linux/random.h>
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/rtnetlink.h>
29#include <net/iw_handler.h> 28#include <net/iw_handler.h>
30#include <asm/types.h> 29#include <asm/types.h>
31 30
@@ -2106,12 +2105,9 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2106 struct ieee80211_sta_bss *bss, *selected = NULL; 2105 struct ieee80211_sta_bss *bss, *selected = NULL;
2107 int top_rssi = 0, freq; 2106 int top_rssi = 0, freq;
2108 2107
2109 rtnl_lock();
2110
2111 if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel && 2108 if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel &&
2112 !ifsta->auto_ssid_sel) { 2109 !ifsta->auto_ssid_sel) {
2113 ifsta->state = IEEE80211_AUTHENTICATE; 2110 ifsta->state = IEEE80211_AUTHENTICATE;
2114 rtnl_unlock();
2115 ieee80211_sta_reset_auth(dev, ifsta); 2111 ieee80211_sta_reset_auth(dev, ifsta);
2116 return 0; 2112 return 0;
2117 } 2113 }
@@ -2154,7 +2150,6 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2154 ieee80211_sta_set_bssid(dev, selected->bssid); 2150 ieee80211_sta_set_bssid(dev, selected->bssid);
2155 ieee80211_rx_bss_put(dev, selected); 2151 ieee80211_rx_bss_put(dev, selected);
2156 ifsta->state = IEEE80211_AUTHENTICATE; 2152 ifsta->state = IEEE80211_AUTHENTICATE;
2157 rtnl_unlock();
2158 ieee80211_sta_reset_auth(dev, ifsta); 2153 ieee80211_sta_reset_auth(dev, ifsta);
2159 return 0; 2154 return 0;
2160 } else { 2155 } else {
@@ -2165,7 +2160,6 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2165 } else 2160 } else
2166 ifsta->state = IEEE80211_DISABLED; 2161 ifsta->state = IEEE80211_DISABLED;
2167 } 2162 }
2168 rtnl_unlock();
2169 return -1; 2163 return -1;
2170} 2164}
2171 2165
diff --git a/net/mac80211/regdomain.c b/net/mac80211/regdomain.c
new file mode 100644
index 000000000000..b697a2afbb4b
--- /dev/null
+++ b/net/mac80211/regdomain.c
@@ -0,0 +1,158 @@
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10/*
11 * This regulatory domain control implementation is known to be incomplete
12 * and confusing. mac80211 regulatory domain control will be significantly
13 * reworked in the not-too-distant future.
14 *
15 * For now, drivers wishing to control which channels are and aren't available
16 * are advised as follows:
17 * - set the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag
18 * - continue to include *ALL* possible channels in the modes registered
19 * through ieee80211_register_hwmode()
20 * - for each allowable ieee80211_channel structure registered in the above
21 * call, set the flag member to some meaningful value such as
22 * IEEE80211_CHAN_W_SCAN | IEEE80211_CHAN_W_ACTIVE_SCAN |
23 * IEEE80211_CHAN_W_IBSS.
24 * - leave flag as 0 for non-allowable channels
25 *
26 * The usual implementation is for a driver to read a device EEPROM to
27 * determine which regulatory domain it should be operating under, then
28 * looking up the allowable channels in a driver-local table, then performing
29 * the above.
30 */
31
32#include <linux/module.h>
33#include <linux/netdevice.h>
34#include <net/mac80211.h>
35#include "ieee80211_i.h"
36
37static int ieee80211_regdom = 0x10; /* FCC */
38module_param(ieee80211_regdom, int, 0444);
39MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain; 64=MKK");
40
41/*
42 * If firmware is upgraded by the vendor, additional channels can be used based
43 * on the new Japanese regulatory rules. This is indicated by setting
44 * ieee80211_japan_5ghz module parameter to one when loading the 80211 kernel
45 * module.
46 */
47static int ieee80211_japan_5ghz /* = 0 */;
48module_param(ieee80211_japan_5ghz, int, 0444);
49MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz");
50
51
52struct ieee80211_channel_range {
53 short start_freq;
54 short end_freq;
55 unsigned char power_level;
56 unsigned char antenna_max;
57};
58
59static const struct ieee80211_channel_range ieee80211_fcc_channels[] = {
60 { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */,
61 { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */,
62 { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */,
63 { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */,
64 { 0 }
65};
66
67static const struct ieee80211_channel_range ieee80211_mkk_channels[] = {
68 { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */,
69 { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */,
70 { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */,
71 { 0 }
72};
73
74
75static const struct ieee80211_channel_range *channel_range =
76 ieee80211_fcc_channels;
77
78
79static void ieee80211_unmask_channel(int mode, struct ieee80211_channel *chan)
80{
81 int i;
82
83 chan->flag = 0;
84
85 if (ieee80211_regdom == 64 &&
86 (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) {
87 /* Do not allow Turbo modes in Japan. */
88 return;
89 }
90
91 for (i = 0; channel_range[i].start_freq; i++) {
92 const struct ieee80211_channel_range *r = &channel_range[i];
93 if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) {
94 if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz &&
95 chan->freq >= 5260 && chan->freq <= 5320) {
96 /*
97 * Skip new channels in Japan since the
98 * firmware was not marked having been upgraded
99 * by the vendor.
100 */
101 continue;
102 }
103
104 if (ieee80211_regdom == 0x10 &&
105 (chan->freq == 5190 || chan->freq == 5210 ||
106 chan->freq == 5230)) {
107 /* Skip MKK channels when in FCC domain. */
108 continue;
109 }
110
111 chan->flag |= IEEE80211_CHAN_W_SCAN |
112 IEEE80211_CHAN_W_ACTIVE_SCAN |
113 IEEE80211_CHAN_W_IBSS;
114 chan->power_level = r->power_level;
115 chan->antenna_max = r->antenna_max;
116
117 if (ieee80211_regdom == 64 &&
118 (chan->freq == 5170 || chan->freq == 5190 ||
119 chan->freq == 5210 || chan->freq == 5230)) {
120 /*
121 * New regulatory rules in Japan have backwards
122 * compatibility with old channels in 5.15-5.25
123 * GHz band, but the station is not allowed to
124 * use active scan on these old channels.
125 */
126 chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN;
127 }
128
129 if (ieee80211_regdom == 64 &&
130 (chan->freq == 5260 || chan->freq == 5280 ||
131 chan->freq == 5300 || chan->freq == 5320)) {
132 /*
133 * IBSS is not allowed on 5.25-5.35 GHz band
134 * due to radar detection requirements.
135 */
136 chan->flag &= ~IEEE80211_CHAN_W_IBSS;
137 }
138
139 break;
140 }
141 }
142}
143
144
145void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode)
146{
147 int c;
148 for (c = 0; c < mode->num_channels; c++)
149 ieee80211_unmask_channel(mode->mode, &mode->channels[c]);
150}
151
152
153void ieee80211_regdomain_init(void)
154{
155 if (ieee80211_regdom == 0x40)
156 channel_range = ieee80211_mkk_channels;
157}
158
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index fc847cc63be6..a4ce5e887997 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -181,7 +181,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
181 181
182 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use))) 182 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use)))
183 return -ENOSPC; 183 return -ENOSPC;
184 184
185 return 0; 185 return 0;
186} 186}
187 187
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 94985792b79a..d67c4fbf6031 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -9,7 +9,7 @@
9 9
10#include "nf_internals.h" 10#include "nf_internals.h"
11 11
12/* Internal logging interface, which relies on the real 12/* Internal logging interface, which relies on the real
13 LOG target modules */ 13 LOG target modules */
14 14
15#define NF_LOG_PREFIXLEN 128 15#define NF_LOG_PREFIXLEN 128
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 641cfbc278d8..5681ce3aebca 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -62,6 +62,7 @@
62#include <net/netlink.h> 62#include <net/netlink.h>
63 63
64#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) 64#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
65#define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
65 66
66struct netlink_sock { 67struct netlink_sock {
67 /* struct sock has to be the first member of netlink_sock */ 68 /* struct sock has to be the first member of netlink_sock */
@@ -314,10 +315,12 @@ netlink_update_listeners(struct sock *sk)
314 unsigned long mask; 315 unsigned long mask;
315 unsigned int i; 316 unsigned int i;
316 317
317 for (i = 0; i < NLGRPSZ(tbl->groups)/sizeof(unsigned long); i++) { 318 for (i = 0; i < NLGRPLONGS(tbl->groups); i++) {
318 mask = 0; 319 mask = 0;
319 sk_for_each_bound(sk, node, &tbl->mc_list) 320 sk_for_each_bound(sk, node, &tbl->mc_list) {
320 mask |= nlk_sk(sk)->groups[i]; 321 if (i < NLGRPLONGS(nlk_sk(sk)->ngroups))
322 mask |= nlk_sk(sk)->groups[i];
323 }
321 tbl->listeners[i] = mask; 324 tbl->listeners[i] = mask;
322 } 325 }
323 /* this function is only called with the netlink table "grabbed", which 326 /* this function is only called with the netlink table "grabbed", which
@@ -555,26 +558,37 @@ netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
555 nlk->subscriptions = subscriptions; 558 nlk->subscriptions = subscriptions;
556} 559}
557 560
558static int netlink_alloc_groups(struct sock *sk) 561static int netlink_realloc_groups(struct sock *sk)
559{ 562{
560 struct netlink_sock *nlk = nlk_sk(sk); 563 struct netlink_sock *nlk = nlk_sk(sk);
561 unsigned int groups; 564 unsigned int groups;
565 unsigned long *new_groups;
562 int err = 0; 566 int err = 0;
563 567
564 netlink_lock_table(); 568 netlink_table_grab();
569
565 groups = nl_table[sk->sk_protocol].groups; 570 groups = nl_table[sk->sk_protocol].groups;
566 if (!nl_table[sk->sk_protocol].registered) 571 if (!nl_table[sk->sk_protocol].registered) {
567 err = -ENOENT; 572 err = -ENOENT;
568 netlink_unlock_table(); 573 goto out_unlock;
574 }
569 575
570 if (err) 576 if (nlk->ngroups >= groups)
571 return err; 577 goto out_unlock;
572 578
573 nlk->groups = kzalloc(NLGRPSZ(groups), GFP_KERNEL); 579 new_groups = krealloc(nlk->groups, NLGRPSZ(groups), GFP_ATOMIC);
574 if (nlk->groups == NULL) 580 if (new_groups == NULL) {
575 return -ENOMEM; 581 err = -ENOMEM;
582 goto out_unlock;
583 }
584 memset((char*)new_groups + NLGRPSZ(nlk->ngroups), 0,
585 NLGRPSZ(groups) - NLGRPSZ(nlk->ngroups));
586
587 nlk->groups = new_groups;
576 nlk->ngroups = groups; 588 nlk->ngroups = groups;
577 return 0; 589 out_unlock:
590 netlink_table_ungrab();
591 return err;
578} 592}
579 593
580static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len) 594static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
@@ -591,11 +605,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len
591 if (nladdr->nl_groups) { 605 if (nladdr->nl_groups) {
592 if (!netlink_capable(sock, NL_NONROOT_RECV)) 606 if (!netlink_capable(sock, NL_NONROOT_RECV))
593 return -EPERM; 607 return -EPERM;
594 if (nlk->groups == NULL) { 608 err = netlink_realloc_groups(sk);
595 err = netlink_alloc_groups(sk); 609 if (err)
596 if (err) 610 return err;
597 return err;
598 }
599 } 611 }
600 612
601 if (nlk->pid) { 613 if (nlk->pid) {
@@ -839,10 +851,18 @@ retry:
839int netlink_has_listeners(struct sock *sk, unsigned int group) 851int netlink_has_listeners(struct sock *sk, unsigned int group)
840{ 852{
841 int res = 0; 853 int res = 0;
854 unsigned long *listeners;
842 855
843 BUG_ON(!(nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET)); 856 BUG_ON(!(nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET));
857
858 rcu_read_lock();
859 listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners);
860
844 if (group - 1 < nl_table[sk->sk_protocol].groups) 861 if (group - 1 < nl_table[sk->sk_protocol].groups)
845 res = test_bit(group - 1, nl_table[sk->sk_protocol].listeners); 862 res = test_bit(group - 1, listeners);
863
864 rcu_read_unlock();
865
846 return res; 866 return res;
847} 867}
848EXPORT_SYMBOL_GPL(netlink_has_listeners); 868EXPORT_SYMBOL_GPL(netlink_has_listeners);
@@ -1007,6 +1027,23 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
1007 read_unlock(&nl_table_lock); 1027 read_unlock(&nl_table_lock);
1008} 1028}
1009 1029
1030/* must be called with netlink table grabbed */
1031static void netlink_update_socket_mc(struct netlink_sock *nlk,
1032 unsigned int group,
1033 int is_new)
1034{
1035 int old, new = !!is_new, subscriptions;
1036
1037 old = test_bit(group - 1, nlk->groups);
1038 subscriptions = nlk->subscriptions - old + new;
1039 if (new)
1040 __set_bit(group - 1, nlk->groups);
1041 else
1042 __clear_bit(group - 1, nlk->groups);
1043 netlink_update_subscriptions(&nlk->sk, subscriptions);
1044 netlink_update_listeners(&nlk->sk);
1045}
1046
1010static int netlink_setsockopt(struct socket *sock, int level, int optname, 1047static int netlink_setsockopt(struct socket *sock, int level, int optname,
1011 char __user *optval, int optlen) 1048 char __user *optval, int optlen)
1012{ 1049{
@@ -1032,27 +1069,16 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
1032 break; 1069 break;
1033 case NETLINK_ADD_MEMBERSHIP: 1070 case NETLINK_ADD_MEMBERSHIP:
1034 case NETLINK_DROP_MEMBERSHIP: { 1071 case NETLINK_DROP_MEMBERSHIP: {
1035 unsigned int subscriptions;
1036 int old, new = optname == NETLINK_ADD_MEMBERSHIP ? 1 : 0;
1037
1038 if (!netlink_capable(sock, NL_NONROOT_RECV)) 1072 if (!netlink_capable(sock, NL_NONROOT_RECV))
1039 return -EPERM; 1073 return -EPERM;
1040 if (nlk->groups == NULL) { 1074 err = netlink_realloc_groups(sk);
1041 err = netlink_alloc_groups(sk); 1075 if (err)
1042 if (err) 1076 return err;
1043 return err;
1044 }
1045 if (!val || val - 1 >= nlk->ngroups) 1077 if (!val || val - 1 >= nlk->ngroups)
1046 return -EINVAL; 1078 return -EINVAL;
1047 netlink_table_grab(); 1079 netlink_table_grab();
1048 old = test_bit(val - 1, nlk->groups); 1080 netlink_update_socket_mc(nlk, val,
1049 subscriptions = nlk->subscriptions - old + new; 1081 optname == NETLINK_ADD_MEMBERSHIP);
1050 if (new)
1051 __set_bit(val - 1, nlk->groups);
1052 else
1053 __clear_bit(val - 1, nlk->groups);
1054 netlink_update_subscriptions(sk, subscriptions);
1055 netlink_update_listeners(sk);
1056 netlink_table_ungrab(); 1082 netlink_table_ungrab();
1057 err = 0; 1083 err = 0;
1058 break; 1084 break;
@@ -1328,6 +1354,71 @@ out_sock_release:
1328 return NULL; 1354 return NULL;
1329} 1355}
1330 1356
1357/**
1358 * netlink_change_ngroups - change number of multicast groups
1359 *
1360 * This changes the number of multicast groups that are available
1361 * on a certain netlink family. Note that it is not possible to
1362 * change the number of groups to below 32. Also note that it does
1363 * not implicitly call netlink_clear_multicast_users() when the
1364 * number of groups is reduced.
1365 *
1366 * @sk: The kernel netlink socket, as returned by netlink_kernel_create().
1367 * @groups: The new number of groups.
1368 */
1369int netlink_change_ngroups(struct sock *sk, unsigned int groups)
1370{
1371 unsigned long *listeners, *old = NULL;
1372 struct netlink_table *tbl = &nl_table[sk->sk_protocol];
1373 int err = 0;
1374
1375 if (groups < 32)
1376 groups = 32;
1377
1378 netlink_table_grab();
1379 if (NLGRPSZ(tbl->groups) < NLGRPSZ(groups)) {
1380 listeners = kzalloc(NLGRPSZ(groups), GFP_ATOMIC);
1381 if (!listeners) {
1382 err = -ENOMEM;
1383 goto out_ungrab;
1384 }
1385 old = tbl->listeners;
1386 memcpy(listeners, old, NLGRPSZ(tbl->groups));
1387 rcu_assign_pointer(tbl->listeners, listeners);
1388 }
1389 tbl->groups = groups;
1390
1391 out_ungrab:
1392 netlink_table_ungrab();
1393 synchronize_rcu();
1394 kfree(old);
1395 return err;
1396}
1397EXPORT_SYMBOL(netlink_change_ngroups);
1398
1399/**
1400 * netlink_clear_multicast_users - kick off multicast listeners
1401 *
1402 * This function removes all listeners from the given group.
1403 * @ksk: The kernel netlink socket, as returned by
1404 * netlink_kernel_create().
1405 * @group: The multicast group to clear.
1406 */
1407void netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
1408{
1409 struct sock *sk;
1410 struct hlist_node *node;
1411 struct netlink_table *tbl = &nl_table[ksk->sk_protocol];
1412
1413 netlink_table_grab();
1414
1415 sk_for_each_bound(sk, node, &tbl->mc_list)
1416 netlink_update_socket_mc(nlk_sk(sk), group, 0);
1417
1418 netlink_table_ungrab();
1419}
1420EXPORT_SYMBOL(netlink_clear_multicast_users);
1421
1331void netlink_set_nonroot(int protocol, unsigned int flags) 1422void netlink_set_nonroot(int protocol, unsigned int flags)
1332{ 1423{
1333 if ((unsigned int)protocol < MAX_LINKS) 1424 if ((unsigned int)protocol < MAX_LINKS)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index b9ab62f938d0..e146531faf1d 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Authors: Jamal Hadi Salim 4 * Authors: Jamal Hadi Salim
5 * Thomas Graf <tgraf@suug.ch> 5 * Thomas Graf <tgraf@suug.ch>
6 * Johannes Berg <johannes@sipsolutions.net>
6 */ 7 */
7 8
8#include <linux/module.h> 9#include <linux/module.h>
@@ -13,6 +14,7 @@
13#include <linux/string.h> 14#include <linux/string.h>
14#include <linux/skbuff.h> 15#include <linux/skbuff.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/bitmap.h>
16#include <net/sock.h> 18#include <net/sock.h>
17#include <net/genetlink.h> 19#include <net/genetlink.h>
18 20
@@ -42,6 +44,16 @@ static void genl_unlock(void)
42#define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1) 44#define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1)
43 45
44static struct list_head family_ht[GENL_FAM_TAB_SIZE]; 46static struct list_head family_ht[GENL_FAM_TAB_SIZE];
47/*
48 * Bitmap of multicast groups that are currently in use.
49 *
50 * To avoid an allocation at boot of just one unsigned long,
51 * declare it global instead.
52 * Bit 0 is marked as already used since group 0 is invalid.
53 */
54static unsigned long mc_group_start = 0x1;
55static unsigned long *mc_groups = &mc_group_start;
56static unsigned long mc_groups_longs = 1;
45 57
46static int genl_ctrl_event(int event, void *data); 58static int genl_ctrl_event(int event, void *data);
47 59
@@ -116,6 +128,114 @@ static inline u16 genl_generate_id(void)
116 return id_gen_idx; 128 return id_gen_idx;
117} 129}
118 130
131static struct genl_multicast_group notify_grp;
132
133/**
134 * genl_register_mc_group - register a multicast group
135 *
136 * Registers the specified multicast group and notifies userspace
137 * about the new group.
138 *
139 * Returns 0 on success or a negative error code.
140 *
141 * @family: The generic netlink family the group shall be registered for.
142 * @grp: The group to register, must have a name.
143 */
144int genl_register_mc_group(struct genl_family *family,
145 struct genl_multicast_group *grp)
146{
147 int id;
148 unsigned long *new_groups;
149 int err;
150
151 BUG_ON(grp->name[0] == '\0');
152
153 genl_lock();
154
155 /* special-case our own group */
156 if (grp == &notify_grp)
157 id = GENL_ID_CTRL;
158 else
159 id = find_first_zero_bit(mc_groups,
160 mc_groups_longs * BITS_PER_LONG);
161
162
163 if (id >= mc_groups_longs * BITS_PER_LONG) {
164 size_t nlen = (mc_groups_longs + 1) * sizeof(unsigned long);
165
166 if (mc_groups == &mc_group_start) {
167 new_groups = kzalloc(nlen, GFP_KERNEL);
168 if (!new_groups) {
169 err = -ENOMEM;
170 goto out;
171 }
172 mc_groups = new_groups;
173 *mc_groups = mc_group_start;
174 } else {
175 new_groups = krealloc(mc_groups, nlen, GFP_KERNEL);
176 if (!new_groups) {
177 err = -ENOMEM;
178 goto out;
179 }
180 mc_groups = new_groups;
181 mc_groups[mc_groups_longs] = 0;
182 }
183 mc_groups_longs++;
184 }
185
186 err = netlink_change_ngroups(genl_sock,
187 sizeof(unsigned long) * NETLINK_GENERIC);
188 if (err)
189 goto out;
190
191 grp->id = id;
192 set_bit(id, mc_groups);
193 list_add_tail(&grp->list, &family->mcast_groups);
194 grp->family = family;
195
196 genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, grp);
197 out:
198 genl_unlock();
199 return 0;
200}
201EXPORT_SYMBOL(genl_register_mc_group);
202
203/**
204 * genl_unregister_mc_group - unregister a multicast group
205 *
206 * Unregisters the specified multicast group and notifies userspace
207 * about it. All current listeners on the group are removed.
208 *
209 * Note: It is not necessary to unregister all multicast groups before
210 * unregistering the family, unregistering the family will cause
211 * all assigned multicast groups to be unregistered automatically.
212 *
213 * @family: Generic netlink family the group belongs to.
214 * @grp: The group to unregister, must have been registered successfully
215 * previously.
216 */
217void genl_unregister_mc_group(struct genl_family *family,
218 struct genl_multicast_group *grp)
219{
220 BUG_ON(grp->family != family);
221 genl_lock();
222 netlink_clear_multicast_users(genl_sock, grp->id);
223 clear_bit(grp->id, mc_groups);
224 list_del(&grp->list);
225 genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
226 grp->id = 0;
227 grp->family = NULL;
228 genl_unlock();
229}
230
231static void genl_unregister_mc_groups(struct genl_family *family)
232{
233 struct genl_multicast_group *grp, *tmp;
234
235 list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list)
236 genl_unregister_mc_group(family, grp);
237}
238
119/** 239/**
120 * genl_register_ops - register generic netlink operations 240 * genl_register_ops - register generic netlink operations
121 * @family: generic netlink family 241 * @family: generic netlink family
@@ -216,6 +336,7 @@ int genl_register_family(struct genl_family *family)
216 goto errout; 336 goto errout;
217 337
218 INIT_LIST_HEAD(&family->ops_list); 338 INIT_LIST_HEAD(&family->ops_list);
339 INIT_LIST_HEAD(&family->mcast_groups);
219 340
220 genl_lock(); 341 genl_lock();
221 342
@@ -275,6 +396,8 @@ int genl_unregister_family(struct genl_family *family)
275{ 396{
276 struct genl_family *rc; 397 struct genl_family *rc;
277 398
399 genl_unregister_mc_groups(family);
400
278 genl_lock(); 401 genl_lock();
279 402
280 list_for_each_entry(rc, genl_family_chain(family->id), family_list) { 403 list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
@@ -410,6 +533,67 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
410 nla_nest_end(skb, nla_ops); 533 nla_nest_end(skb, nla_ops);
411 } 534 }
412 535
536 if (!list_empty(&family->mcast_groups)) {
537 struct genl_multicast_group *grp;
538 struct nlattr *nla_grps;
539 int idx = 1;
540
541 nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS);
542 if (nla_grps == NULL)
543 goto nla_put_failure;
544
545 list_for_each_entry(grp, &family->mcast_groups, list) {
546 struct nlattr *nest;
547
548 nest = nla_nest_start(skb, idx++);
549 if (nest == NULL)
550 goto nla_put_failure;
551
552 NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id);
553 NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME,
554 grp->name);
555
556 nla_nest_end(skb, nest);
557 }
558 nla_nest_end(skb, nla_grps);
559 }
560
561 return genlmsg_end(skb, hdr);
562
563nla_put_failure:
564 return genlmsg_cancel(skb, hdr);
565}
566
567static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid,
568 u32 seq, u32 flags, struct sk_buff *skb,
569 u8 cmd)
570{
571 void *hdr;
572 struct nlattr *nla_grps;
573 struct nlattr *nest;
574
575 hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd);
576 if (hdr == NULL)
577 return -1;
578
579 NLA_PUT_STRING(skb, CTRL_ATTR_FAMILY_NAME, grp->family->name);
580 NLA_PUT_U16(skb, CTRL_ATTR_FAMILY_ID, grp->family->id);
581
582 nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS);
583 if (nla_grps == NULL)
584 goto nla_put_failure;
585
586 nest = nla_nest_start(skb, 1);
587 if (nest == NULL)
588 goto nla_put_failure;
589
590 NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id);
591 NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME,
592 grp->name);
593
594 nla_nest_end(skb, nest);
595 nla_nest_end(skb, nla_grps);
596
413 return genlmsg_end(skb, hdr); 597 return genlmsg_end(skb, hdr);
414 598
415nla_put_failure: 599nla_put_failure:
@@ -453,8 +637,8 @@ errout:
453 return skb->len; 637 return skb->len;
454} 638}
455 639
456static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid, 640static struct sk_buff *ctrl_build_family_msg(struct genl_family *family,
457 int seq, u8 cmd) 641 u32 pid, int seq, u8 cmd)
458{ 642{
459 struct sk_buff *skb; 643 struct sk_buff *skb;
460 int err; 644 int err;
@@ -472,6 +656,25 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
472 return skb; 656 return skb;
473} 657}
474 658
659static struct sk_buff *ctrl_build_mcgrp_msg(struct genl_multicast_group *grp,
660 u32 pid, int seq, u8 cmd)
661{
662 struct sk_buff *skb;
663 int err;
664
665 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
666 if (skb == NULL)
667 return ERR_PTR(-ENOBUFS);
668
669 err = ctrl_fill_mcgrp_info(grp, pid, seq, 0, skb, cmd);
670 if (err < 0) {
671 nlmsg_free(skb);
672 return ERR_PTR(err);
673 }
674
675 return skb;
676}
677
475static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = { 678static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = {
476 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 }, 679 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
477 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING, 680 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
@@ -501,8 +704,8 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
501 goto errout; 704 goto errout;
502 } 705 }
503 706
504 msg = ctrl_build_msg(res, info->snd_pid, info->snd_seq, 707 msg = ctrl_build_family_msg(res, info->snd_pid, info->snd_seq,
505 CTRL_CMD_NEWFAMILY); 708 CTRL_CMD_NEWFAMILY);
506 if (IS_ERR(msg)) { 709 if (IS_ERR(msg)) {
507 err = PTR_ERR(msg); 710 err = PTR_ERR(msg);
508 goto errout; 711 goto errout;
@@ -523,7 +726,15 @@ static int genl_ctrl_event(int event, void *data)
523 switch (event) { 726 switch (event) {
524 case CTRL_CMD_NEWFAMILY: 727 case CTRL_CMD_NEWFAMILY:
525 case CTRL_CMD_DELFAMILY: 728 case CTRL_CMD_DELFAMILY:
526 msg = ctrl_build_msg(data, 0, 0, event); 729 msg = ctrl_build_family_msg(data, 0, 0, event);
730 if (IS_ERR(msg))
731 return PTR_ERR(msg);
732
733 genlmsg_multicast(msg, 0, GENL_ID_CTRL, GFP_KERNEL);
734 break;
735 case CTRL_CMD_NEWMCAST_GRP:
736 case CTRL_CMD_DELMCAST_GRP:
737 msg = ctrl_build_mcgrp_msg(data, 0, 0, event);
527 if (IS_ERR(msg)) 738 if (IS_ERR(msg))
528 return PTR_ERR(msg); 739 return PTR_ERR(msg);
529 740
@@ -541,6 +752,10 @@ static struct genl_ops genl_ctrl_ops = {
541 .policy = ctrl_policy, 752 .policy = ctrl_policy,
542}; 753};
543 754
755static struct genl_multicast_group notify_grp = {
756 .name = "notify",
757};
758
544static int __init genl_init(void) 759static int __init genl_init(void)
545{ 760{
546 int i, err; 761 int i, err;
@@ -557,11 +772,17 @@ static int __init genl_init(void)
557 goto errout_register; 772 goto errout_register;
558 773
559 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); 774 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV);
560 genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID, 775
561 genl_rcv, NULL, THIS_MODULE); 776 /* we'll bump the group number right afterwards */
777 genl_sock = netlink_kernel_create(NETLINK_GENERIC, 0, genl_rcv,
778 NULL, THIS_MODULE);
562 if (genl_sock == NULL) 779 if (genl_sock == NULL)
563 panic("GENL: Cannot initialize generic netlink\n"); 780 panic("GENL: Cannot initialize generic netlink\n");
564 781
782 err = genl_register_mc_group(&genl_ctrl, &notify_grp);
783 if (err < 0)
784 goto errout_register;
785
565 return 0; 786 return 0;
566 787
567errout_register: 788errout_register:
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 5d66490dd290..dc9273295a38 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -720,7 +720,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr,
720 720
721 for (;;) { 721 for (;;) {
722 prepare_to_wait(sk->sk_sleep, &wait, 722 prepare_to_wait(sk->sk_sleep, &wait,
723 TASK_INTERRUPTIBLE); 723 TASK_INTERRUPTIBLE);
724 if (sk->sk_state != TCP_SYN_SENT) 724 if (sk->sk_state != TCP_SYN_SENT)
725 break; 725 break;
726 if (!signal_pending(current)) { 726 if (!signal_pending(current)) {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 7c27bd389b7e..1322d62b5d97 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -108,7 +108,7 @@ Outgoing, dev->hard_header!=NULL
108Incoming, dev->hard_header==NULL 108Incoming, dev->hard_header==NULL
109 mac_header -> UNKNOWN position. It is very likely, that it points to ll 109 mac_header -> UNKNOWN position. It is very likely, that it points to ll
110 header. PPP makes it, that is wrong, because introduce 110 header. PPP makes it, that is wrong, because introduce
111 assymetry between rx and tx paths. 111 assymetry between rx and tx paths.
112 data -> data 112 data -> data
113 113
114Outgoing, dev->hard_header==NULL 114Outgoing, dev->hard_header==NULL
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index 230e35c59786..9f746be58854 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -83,7 +83,7 @@ static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
83static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH); 83static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH);
84 84
85static void rfkill_event(struct input_handle *handle, unsigned int type, 85static void rfkill_event(struct input_handle *handle, unsigned int type,
86 unsigned int code, int down) 86 unsigned int code, int down)
87{ 87{
88 if (type == EV_KEY && down == 1) { 88 if (type == EV_KEY && down == 1) {
89 switch (code) { 89 switch (code) {
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index f3986d498b40..db3395bfbcfa 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -187,7 +187,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
187static struct device_attribute rfkill_dev_attrs[] = { 187static struct device_attribute rfkill_dev_attrs[] = {
188 __ATTR(name, S_IRUGO, rfkill_name_show, NULL), 188 __ATTR(name, S_IRUGO, rfkill_name_show, NULL),
189 __ATTR(type, S_IRUGO, rfkill_type_show, NULL), 189 __ATTR(type, S_IRUGO, rfkill_type_show, NULL),
190 __ATTR(state, S_IRUGO, rfkill_state_show, rfkill_state_store), 190 __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store),
191 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), 191 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store),
192 __ATTR_NULL 192 __ATTR_NULL
193}; 193};
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index f4d3aba00800..976c3cc86a29 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -816,7 +816,7 @@ rose_try_next_neigh:
816 816
817 for (;;) { 817 for (;;) {
818 prepare_to_wait(sk->sk_sleep, &wait, 818 prepare_to_wait(sk->sk_sleep, &wait,
819 TASK_INTERRUPTIBLE); 819 TASK_INTERRUPTIBLE);
820 if (sk->sk_state != TCP_SYN_SENT) 820 if (sk->sk_state != TCP_SYN_SENT)
821 break; 821 break;
822 if (!signal_pending(current)) { 822 if (!signal_pending(current)) {
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 2c57df9c131b..46f6d572ad2d 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -805,26 +805,26 @@ static int __init af_rxrpc_init(void)
805 } 805 }
806 806
807 ret = proto_register(&rxrpc_proto, 1); 807 ret = proto_register(&rxrpc_proto, 1);
808 if (ret < 0) { 808 if (ret < 0) {
809 printk(KERN_CRIT "RxRPC: Cannot register protocol\n"); 809 printk(KERN_CRIT "RxRPC: Cannot register protocol\n");
810 goto error_proto; 810 goto error_proto;
811 } 811 }
812 812
813 ret = sock_register(&rxrpc_family_ops); 813 ret = sock_register(&rxrpc_family_ops);
814 if (ret < 0) { 814 if (ret < 0) {
815 printk(KERN_CRIT "RxRPC: Cannot register socket family\n"); 815 printk(KERN_CRIT "RxRPC: Cannot register socket family\n");
816 goto error_sock; 816 goto error_sock;
817 } 817 }
818 818
819 ret = register_key_type(&key_type_rxrpc); 819 ret = register_key_type(&key_type_rxrpc);
820 if (ret < 0) { 820 if (ret < 0) {
821 printk(KERN_CRIT "RxRPC: Cannot register client key type\n"); 821 printk(KERN_CRIT "RxRPC: Cannot register client key type\n");
822 goto error_key_type; 822 goto error_key_type;
823 } 823 }
824 824
825 ret = register_key_type(&key_type_rxrpc_s); 825 ret = register_key_type(&key_type_rxrpc_s);
826 if (ret < 0) { 826 if (ret < 0) {
827 printk(KERN_CRIT "RxRPC: Cannot register server key type\n"); 827 printk(KERN_CRIT "RxRPC: Cannot register server key type\n");
828 goto error_key_type_s; 828 goto error_key_type_s;
829 } 829 }
830 830
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f02ce3dddb7b..fd2dfdd7d7fd 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1779,7 +1779,7 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep,
1779 SCTP_COMM_UP, 0, 1779 SCTP_COMM_UP, 0,
1780 asoc->c.sinit_num_ostreams, 1780 asoc->c.sinit_num_ostreams,
1781 asoc->c.sinit_max_instreams, 1781 asoc->c.sinit_max_instreams,
1782 NULL, GFP_ATOMIC); 1782 NULL, GFP_ATOMIC);
1783 if (!ev) 1783 if (!ev)
1784 goto nomem; 1784 goto nomem;
1785 1785
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b1917f68723c..ee88f2ea5101 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4803,7 +4803,7 @@ static int sctp_getsockopt_partial_delivery_point(struct sock *sk, int len,
4803 char __user *optval, 4803 char __user *optval,
4804 int __user *optlen) 4804 int __user *optlen)
4805{ 4805{
4806 u32 val; 4806 u32 val;
4807 4807
4808 if (len < sizeof(u32)) 4808 if (len < sizeof(u32))
4809 return -EINVAL; 4809 return -EINVAL;
@@ -4827,7 +4827,7 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
4827 char __user *optval, 4827 char __user *optval,
4828 int __user *optlen) 4828 int __user *optlen)
4829{ 4829{
4830 int val; 4830 int val;
4831 4831
4832 if (len < sizeof(int)) 4832 if (len < sizeof(int))
4833 return -EINVAL; 4833 return -EINVAL;
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index f441aa0b26dc..bfb6a29633dd 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -67,7 +67,7 @@ krb5_encrypt(
67 67
68 if (crypto_blkcipher_ivsize(tfm) > 16) { 68 if (crypto_blkcipher_ivsize(tfm) > 16) {
69 dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n", 69 dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n",
70 crypto_blkcipher_ivsize(tfm)); 70 crypto_blkcipher_ivsize(tfm));
71 goto out; 71 goto out;
72 } 72 }
73 73
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 4a8f37f48764..84110172031e 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1629,8 +1629,8 @@ static struct proto_ops msg_ops = {
1629 .getsockopt = getsockopt, 1629 .getsockopt = getsockopt,
1630 .sendmsg = send_msg, 1630 .sendmsg = send_msg,
1631 .recvmsg = recv_msg, 1631 .recvmsg = recv_msg,
1632 .mmap = sock_no_mmap, 1632 .mmap = sock_no_mmap,
1633 .sendpage = sock_no_sendpage 1633 .sendpage = sock_no_sendpage
1634}; 1634};
1635 1635
1636static struct proto_ops packet_ops = { 1636static struct proto_ops packet_ops = {
@@ -1650,8 +1650,8 @@ static struct proto_ops packet_ops = {
1650 .getsockopt = getsockopt, 1650 .getsockopt = getsockopt,
1651 .sendmsg = send_packet, 1651 .sendmsg = send_packet,
1652 .recvmsg = recv_msg, 1652 .recvmsg = recv_msg,
1653 .mmap = sock_no_mmap, 1653 .mmap = sock_no_mmap,
1654 .sendpage = sock_no_sendpage 1654 .sendpage = sock_no_sendpage
1655}; 1655};
1656 1656
1657static struct proto_ops stream_ops = { 1657static struct proto_ops stream_ops = {
@@ -1671,8 +1671,8 @@ static struct proto_ops stream_ops = {
1671 .getsockopt = getsockopt, 1671 .getsockopt = getsockopt,
1672 .sendmsg = send_stream, 1672 .sendmsg = send_stream,
1673 .recvmsg = recv_stream, 1673 .recvmsg = recv_stream,
1674 .mmap = sock_no_mmap, 1674 .mmap = sock_no_mmap,
1675 .sendpage = sock_no_sendpage 1675 .sendpage = sock_no_sendpage
1676}; 1676};
1677 1677
1678static struct net_proto_family tipc_family_ops = { 1678static struct net_proto_family tipc_family_ops = {
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b48f06fc9fd9..cfaf17c8851e 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -857,7 +857,7 @@ xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
857 pol, NULL); 857 pol, NULL);
858 return err; 858 return err;
859 } 859 }
860 } 860 }
861 for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) { 861 for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) {
862 hlist_for_each_entry(pol, entry, 862 hlist_for_each_entry(pol, entry,
863 xfrm_policy_bydst[dir].table + i, 863 xfrm_policy_bydst[dir].table + i,
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index e070c3f938fb..38f90ca75b1e 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -407,7 +407,7 @@ xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
407 xfrm_audit_log(audit_info->loginuid, 407 xfrm_audit_log(audit_info->loginuid,
408 audit_info->secid, 408 audit_info->secid,
409 AUDIT_MAC_IPSEC_DELSA, 409 AUDIT_MAC_IPSEC_DELSA,
410 0, NULL, x); 410 0, NULL, x);
411 411
412 return err; 412 return err;
413 } 413 }