aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-08-07 04:55:03 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-08-07 04:55:03 -0400
commit4fb8af10d0fd09372d52966b76922b9e82bbc950 (patch)
treed240e4d40357583e3f3eb228dccf20122a5b31ed /net
parentf44f82e8a20b98558486eb14497b2f71c78fa325 (diff)
parent64a99d2a8c3ed5c4e39f3ae1cc682aa8fd3977fc (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
Diffstat (limited to 'net')
-rw-r--r--net/Kconfig7
-rw-r--r--net/atm/mpc.c22
-rw-r--r--net/ax25/sysctl_net_ax25.c14
-rw-r--r--net/bridge/br_device.c9
-rw-r--r--net/bridge/br_if.c3
-rw-r--r--net/bridge/br_netfilter.c63
-rw-r--r--net/bridge/br_private.h6
-rw-r--r--net/bridge/br_stp.c25
-rw-r--r--net/core/dev.c37
-rw-r--r--net/core/neighbour.c13
-rw-r--r--net/core/netpoll.c1
-rw-r--r--net/core/pktgen.c17
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/dccp/dccp.h2
-rw-r--r--net/dccp/ipv4.c9
-rw-r--r--net/dccp/ipv6.c16
-rw-r--r--net/dccp/output.c53
-rw-r--r--net/dccp/timer.c20
-rw-r--r--net/ipv4/ipcomp.c4
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c5
-rw-r--r--net/ipv4/netfilter/ipt_recent.c2
-rw-r--r--net/ipv4/proc.c2
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/sysctl_net_ipv4.c1
-rw-r--r--net/ipv4/tcp_ipv4.c14
-rw-r--r--net/ipv6/datagram.c2
-rw-r--r--net/ipv6/ip6_output.c6
-rw-r--r--net/ipv6/ipcomp6.c4
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/proc.c1
-rw-r--r--net/ipv6/syncookies.c22
-rw-r--r--net/ipv6/tcp_ipv6.c33
-rw-r--r--net/mac80211/cfg.c103
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/main.c17
-rw-r--r--net/mac80211/mlme.c48
-rw-r--r--net/mac80211/tx.c72
-rw-r--r--net/mac80211/util.c1
-rw-r--r--net/mac80211/wep.c4
-rw-r--r--net/mac80211/wme.c9
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c29
-rw-r--r--net/netfilter/xt_hashlimit.c4
-rw-r--r--net/rfkill/rfkill-input.c54
-rw-r--r--net/rfkill/rfkill.c77
-rw-r--r--net/sched/sch_api.c57
-rw-r--r--net/sched/sch_atm.c14
-rw-r--r--net/sched/sch_cbq.c27
-rw-r--r--net/sched/sch_dsmark.c10
-rw-r--r--net/sched/sch_generic.c26
-rw-r--r--net/sched/sch_hfsc.c12
-rw-r--r--net/sched/sch_htb.c24
-rw-r--r--net/sched/sch_netem.c5
-rw-r--r--net/sched/sch_prio.c14
-rw-r--r--net/sched/sch_red.c2
-rw-r--r--net/sched/sch_sfq.c8
-rw-r--r--net/sched/sch_tbf.c3
-rw-r--r--net/sched/sch_teql.c9
-rw-r--r--net/sctp/ipv6.c8
-rw-r--r--net/sctp/output.c6
-rw-r--r--net/sctp/protocol.c9
-rw-r--r--net/sunrpc/svc.c3
-rw-r--r--net/wireless/nl80211.c275
62 files changed, 808 insertions, 546 deletions
diff --git a/net/Kconfig b/net/Kconfig
index b98668751749..7612cc8c337c 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -2,9 +2,7 @@
2# Network configuration 2# Network configuration
3# 3#
4 4
5menu "Networking" 5menuconfig NET
6
7config NET
8 bool "Networking support" 6 bool "Networking support"
9 ---help--- 7 ---help---
10 Unless you really know what you are doing, you should say Y here. 8 Unless you really know what you are doing, you should say Y here.
@@ -22,7 +20,6 @@ config NET
22 recommended to read the NET-HOWTO, available from 20 recommended to read the NET-HOWTO, available from
23 <http://www.tldp.org/docs.html#howto>. 21 <http://www.tldp.org/docs.html#howto>.
24 22
25# Make sure that all config symbols are dependent on NET
26if NET 23if NET
27 24
28menu "Networking options" 25menu "Networking options"
@@ -252,5 +249,3 @@ source "net/rfkill/Kconfig"
252source "net/9p/Kconfig" 249source "net/9p/Kconfig"
253 250
254endif # if NET 251endif # if NET
255endmenu # Networking
256
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 4fccaa1e07be..11b16d16661c 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -62,11 +62,13 @@ static void MPOA_cache_impos_rcvd(struct k_message *msg, struct mpoa_client *mpc
62static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); 62static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc);
63static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); 63static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc);
64 64
65static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac, 65static const uint8_t *copy_macs(struct mpoa_client *mpc,
66 uint8_t *tlvs, uint8_t mps_macs, uint8_t device_type); 66 const uint8_t *router_mac,
67 const uint8_t *tlvs, uint8_t mps_macs,
68 uint8_t device_type);
67static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry); 69static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry);
68 70
69static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc); 71static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc);
70static void mpoad_close(struct atm_vcc *vcc); 72static void mpoad_close(struct atm_vcc *vcc);
71static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb); 73static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb);
72 74
@@ -351,12 +353,12 @@ static const char *mpoa_device_type_string(char type)
351 * lec sees a TLV it uses the pointer to call this function. 353 * lec sees a TLV it uses the pointer to call this function.
352 * 354 *
353 */ 355 */
354static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr, 356static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr,
355 uint8_t *tlvs, uint32_t sizeoftlvs) 357 const u8 *tlvs, u32 sizeoftlvs)
356{ 358{
357 uint32_t type; 359 uint32_t type;
358 uint8_t length, mpoa_device_type, number_of_mps_macs; 360 uint8_t length, mpoa_device_type, number_of_mps_macs;
359 uint8_t *end_of_tlvs; 361 const uint8_t *end_of_tlvs;
360 struct mpoa_client *mpc; 362 struct mpoa_client *mpc;
361 363
362 mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ 364 mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */
@@ -430,8 +432,10 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
430 * plus the possible MAC address(es) to mpc->mps_macs. 432 * plus the possible MAC address(es) to mpc->mps_macs.
431 * For a freshly allocated MPOA client mpc->mps_macs == 0. 433 * For a freshly allocated MPOA client mpc->mps_macs == 0.
432 */ 434 */
433static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac, 435static const uint8_t *copy_macs(struct mpoa_client *mpc,
434 uint8_t *tlvs, uint8_t mps_macs, uint8_t device_type) 436 const uint8_t *router_mac,
437 const uint8_t *tlvs, uint8_t mps_macs,
438 uint8_t device_type)
435{ 439{
436 int num_macs; 440 int num_macs;
437 num_macs = (mps_macs > 1) ? mps_macs : 1; 441 num_macs = (mps_macs > 1) ? mps_macs : 1;
@@ -811,7 +815,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
811 return arg; 815 return arg;
812} 816}
813 817
814static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc) 818static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc)
815{ 819{
816 struct k_message mesg; 820 struct k_message mesg;
817 821
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index f597987b2424..f288fc4aef9b 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -36,6 +36,7 @@ static struct ctl_path ax25_path[] = {
36 { .procname = "ax25", .ctl_name = NET_AX25, }, 36 { .procname = "ax25", .ctl_name = NET_AX25, },
37 { } 37 { }
38}; 38};
39
39static const ctl_table ax25_param_table[] = { 40static const ctl_table ax25_param_table[] = {
40 { 41 {
41 .ctl_name = NET_AX25_IP_DEFAULT_MODE, 42 .ctl_name = NET_AX25_IP_DEFAULT_MODE,
@@ -167,6 +168,7 @@ static const ctl_table ax25_param_table[] = {
167 .extra1 = &min_proto, 168 .extra1 = &min_proto,
168 .extra2 = &max_proto 169 .extra2 = &max_proto
169 }, 170 },
171#ifdef CONFIG_AX25_DAMA_SLAVE
170 { 172 {
171 .ctl_name = NET_AX25_DAMA_SLAVE_TIMEOUT, 173 .ctl_name = NET_AX25_DAMA_SLAVE_TIMEOUT,
172 .procname = "dama_slave_timeout", 174 .procname = "dama_slave_timeout",
@@ -177,6 +179,8 @@ static const ctl_table ax25_param_table[] = {
177 .extra1 = &min_ds_timeout, 179 .extra1 = &min_ds_timeout,
178 .extra2 = &max_ds_timeout 180 .extra2 = &max_ds_timeout
179 }, 181 },
182#endif
183
180 { .ctl_name = 0 } /* that's all, folks! */ 184 { .ctl_name = 0 } /* that's all, folks! */
181}; 185};
182 186
@@ -210,16 +214,6 @@ void ax25_register_sysctl(void)
210 ax25_table[n].procname = ax25_dev->dev->name; 214 ax25_table[n].procname = ax25_dev->dev->name;
211 ax25_table[n].mode = 0555; 215 ax25_table[n].mode = 0555;
212 216
213#ifndef CONFIG_AX25_DAMA_SLAVE
214 /*
215 * We do not wish to have a representation of this parameter
216 * in /proc/sys/ when configured *not* to include the
217 * AX.25 DAMA slave code, do we?
218 */
219
220 child[AX25_VALUES_DS_TIMEOUT].procname = NULL;
221#endif
222
223 child[AX25_MAX_VALUES].ctl_name = 0; /* just in case... */ 217 child[AX25_MAX_VALUES].ctl_name = 0; /* just in case... */
224 218
225 for (k = 0; k < AX25_MAX_VALUES; k++) 219 for (k = 0; k < AX25_MAX_VALUES; k++)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index d9449df7cad5..9b58d70b0e7d 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -68,10 +68,17 @@ static int br_dev_stop(struct net_device *dev)
68 68
69static int br_change_mtu(struct net_device *dev, int new_mtu) 69static int br_change_mtu(struct net_device *dev, int new_mtu)
70{ 70{
71 if (new_mtu < 68 || new_mtu > br_min_mtu(netdev_priv(dev))) 71 struct net_bridge *br = netdev_priv(dev);
72 if (new_mtu < 68 || new_mtu > br_min_mtu(br))
72 return -EINVAL; 73 return -EINVAL;
73 74
74 dev->mtu = new_mtu; 75 dev->mtu = new_mtu;
76
77#ifdef CONFIG_BRIDGE_NETFILTER
78 /* remember the MTU in the rtable for PMTU */
79 br->fake_rtable.u.dst.metrics[RTAX_MTU - 1] = new_mtu;
80#endif
81
75 return 0; 82 return 0;
76} 83}
77 84
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index a072ea5ca6f5..63c18aacde8c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -202,6 +202,9 @@ static struct net_device *new_bridge_dev(const char *name)
202 br->topology_change = 0; 202 br->topology_change = 0;
203 br->topology_change_detected = 0; 203 br->topology_change_detected = 0;
204 br->ageing_time = 300 * HZ; 204 br->ageing_time = 300 * HZ;
205
206 br_netfilter_rtable_init(br);
207
205 INIT_LIST_HEAD(&br->age_list); 208 INIT_LIST_HEAD(&br->age_list);
206 209
207 br_stp_timer_init(br); 210 br_stp_timer_init(br);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index bb90cd7bace3..6a9a6cd74b1e 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -101,33 +101,30 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
101 pppoe_proto(skb) == htons(PPP_IPV6) && \ 101 pppoe_proto(skb) == htons(PPP_IPV6) && \
102 brnf_filter_pppoe_tagged) 102 brnf_filter_pppoe_tagged)
103 103
104/* We need these fake structures to make netfilter happy -- 104/*
105 * lots of places assume that skb->dst != NULL, which isn't 105 * Initialize bogus route table used to keep netfilter happy.
106 * all that unreasonable.
107 *
108 * Currently, we fill in the PMTU entry because netfilter 106 * Currently, we fill in the PMTU entry because netfilter
109 * refragmentation needs it, and the rt_flags entry because 107 * refragmentation needs it, and the rt_flags entry because
110 * ipt_REJECT needs it. Future netfilter modules might 108 * ipt_REJECT needs it. Future netfilter modules might
111 * require us to fill additional fields. */ 109 * require us to fill additional fields.
112static struct net_device __fake_net_device = { 110 */
113 .hard_header_len = ETH_HLEN, 111void br_netfilter_rtable_init(struct net_bridge *br)
114#ifdef CONFIG_NET_NS 112{
115 .nd_net = &init_net, 113 struct rtable *rt = &br->fake_rtable;
116#endif
117};
118 114
119static struct rtable __fake_rtable = { 115 atomic_set(&rt->u.dst.__refcnt, 1);
120 .u = { 116 rt->u.dst.dev = br->dev;
121 .dst = { 117 rt->u.dst.path = &rt->u.dst;
122 .__refcnt = ATOMIC_INIT(1), 118 rt->u.dst.metrics[RTAX_MTU - 1] = 1500;
123 .dev = &__fake_net_device, 119 rt->u.dst.flags = DST_NOXFRM;
124 .path = &__fake_rtable.u.dst, 120}
125 .metrics = {[RTAX_MTU - 1] = 1500}, 121
126 .flags = DST_NOXFRM, 122static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)
127 } 123{
128 }, 124 struct net_bridge_port *port = rcu_dereference(dev->br_port);
129 .rt_flags = 0, 125
130}; 126 return port ? &port->br->fake_rtable : NULL;
127}
131 128
132static inline struct net_device *bridge_parent(const struct net_device *dev) 129static inline struct net_device *bridge_parent(const struct net_device *dev)
133{ 130{
@@ -226,8 +223,12 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
226 } 223 }
227 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 224 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
228 225
229 skb->rtable = &__fake_rtable; 226 skb->rtable = bridge_parent_rtable(nf_bridge->physindev);
230 dst_hold(&__fake_rtable.u.dst); 227 if (!skb->rtable) {
228 kfree_skb(skb);
229 return 0;
230 }
231 dst_hold(&skb->rtable->u.dst);
231 232
232 skb->dev = nf_bridge->physindev; 233 skb->dev = nf_bridge->physindev;
233 nf_bridge_push_encap_header(skb); 234 nf_bridge_push_encap_header(skb);
@@ -391,8 +392,12 @@ bridged_dnat:
391 skb->pkt_type = PACKET_HOST; 392 skb->pkt_type = PACKET_HOST;
392 } 393 }
393 } else { 394 } else {
394 skb->rtable = &__fake_rtable; 395 skb->rtable = bridge_parent_rtable(nf_bridge->physindev);
395 dst_hold(&__fake_rtable.u.dst); 396 if (!skb->rtable) {
397 kfree_skb(skb);
398 return 0;
399 }
400 dst_hold(&skb->rtable->u.dst);
396 } 401 }
397 402
398 skb->dev = nf_bridge->physindev; 403 skb->dev = nf_bridge->physindev;
@@ -611,8 +616,8 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb,
611 const struct net_device *out, 616 const struct net_device *out,
612 int (*okfn)(struct sk_buff *)) 617 int (*okfn)(struct sk_buff *))
613{ 618{
614 if (skb->rtable == &__fake_rtable) { 619 if (skb->rtable && skb->rtable == bridge_parent_rtable(in)) {
615 dst_release(&__fake_rtable.u.dst); 620 dst_release(&skb->rtable->u.dst);
616 skb->rtable = NULL; 621 skb->rtable = NULL;
617 } 622 }
618 623
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 815ed38925b2..c3dc18ddc043 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/if_bridge.h> 17#include <linux/if_bridge.h>
18#include <net/route.h>
18 19
19#define BR_HASH_BITS 8 20#define BR_HASH_BITS 8
20#define BR_HASH_SIZE (1 << BR_HASH_BITS) 21#define BR_HASH_SIZE (1 << BR_HASH_BITS)
@@ -92,6 +93,9 @@ struct net_bridge
92 struct hlist_head hash[BR_HASH_SIZE]; 93 struct hlist_head hash[BR_HASH_SIZE];
93 struct list_head age_list; 94 struct list_head age_list;
94 unsigned long feature_mask; 95 unsigned long feature_mask;
96#ifdef CONFIG_BRIDGE_NETFILTER
97 struct rtable fake_rtable;
98#endif
95 unsigned long flags; 99 unsigned long flags;
96#define BR_SET_MAC_ADDR 0x00000001 100#define BR_SET_MAC_ADDR 0x00000001
97 101
@@ -197,9 +201,11 @@ extern int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __us
197#ifdef CONFIG_BRIDGE_NETFILTER 201#ifdef CONFIG_BRIDGE_NETFILTER
198extern int br_netfilter_init(void); 202extern int br_netfilter_init(void);
199extern void br_netfilter_fini(void); 203extern void br_netfilter_fini(void);
204extern void br_netfilter_rtable_init(struct net_bridge *);
200#else 205#else
201#define br_netfilter_init() (0) 206#define br_netfilter_init() (0)
202#define br_netfilter_fini() do { } while(0) 207#define br_netfilter_fini() do { } while(0)
208#define br_netfilter_rtable_init(x)
203#endif 209#endif
204 210
205/* br_stp.c */ 211/* br_stp.c */
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 921bbe5cb94a..6e63ec3f1fcf 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -368,14 +368,25 @@ static void br_make_blocking(struct net_bridge_port *p)
368/* called under bridge lock */ 368/* called under bridge lock */
369static void br_make_forwarding(struct net_bridge_port *p) 369static void br_make_forwarding(struct net_bridge_port *p)
370{ 370{
371 if (p->state == BR_STATE_BLOCKING) { 371 struct net_bridge *br = p->br;
372 if (p->br->stp_enabled == BR_KERNEL_STP)
373 p->state = BR_STATE_LISTENING;
374 else
375 p->state = BR_STATE_LEARNING;
376 372
377 br_log_state(p); 373 if (p->state != BR_STATE_BLOCKING)
378 mod_timer(&p->forward_delay_timer, jiffies + p->br->forward_delay); } 374 return;
375
376 if (br->forward_delay == 0) {
377 p->state = BR_STATE_FORWARDING;
378 br_topology_change_detection(br);
379 del_timer(&p->forward_delay_timer);
380 }
381 else if (p->br->stp_enabled == BR_KERNEL_STP)
382 p->state = BR_STATE_LISTENING;
383 else
384 p->state = BR_STATE_LEARNING;
385
386 br_log_state(p);
387
388 if (br->forward_delay != 0)
389 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay);
379} 390}
380 391
381/* called under bridge lock */ 392/* called under bridge lock */
diff --git a/net/core/dev.c b/net/core/dev.c
index 8d13a9b9f1df..01993ad74e76 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1796,7 +1796,7 @@ gso:
1796 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS); 1796 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS);
1797#endif 1797#endif
1798 if (q->enqueue) { 1798 if (q->enqueue) {
1799 spinlock_t *root_lock = qdisc_root_lock(q); 1799 spinlock_t *root_lock = qdisc_lock(q);
1800 1800
1801 spin_lock(root_lock); 1801 spin_lock(root_lock);
1802 1802
@@ -1805,7 +1805,6 @@ gso:
1805 1805
1806 spin_unlock(root_lock); 1806 spin_unlock(root_lock);
1807 1807
1808 rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
1809 goto out; 1808 goto out;
1810 } 1809 }
1811 1810
@@ -1909,7 +1908,6 @@ int netif_rx(struct sk_buff *skb)
1909 if (queue->input_pkt_queue.qlen <= netdev_max_backlog) { 1908 if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {
1910 if (queue->input_pkt_queue.qlen) { 1909 if (queue->input_pkt_queue.qlen) {
1911enqueue: 1910enqueue:
1912 dev_hold(skb->dev);
1913 __skb_queue_tail(&queue->input_pkt_queue, skb); 1911 __skb_queue_tail(&queue->input_pkt_queue, skb);
1914 local_irq_restore(flags); 1912 local_irq_restore(flags);
1915 return NET_RX_SUCCESS; 1913 return NET_RX_SUCCESS;
@@ -1995,7 +1993,7 @@ static void net_tx_action(struct softirq_action *h)
1995 smp_mb__before_clear_bit(); 1993 smp_mb__before_clear_bit();
1996 clear_bit(__QDISC_STATE_SCHED, &q->state); 1994 clear_bit(__QDISC_STATE_SCHED, &q->state);
1997 1995
1998 root_lock = qdisc_root_lock(q); 1996 root_lock = qdisc_lock(q);
1999 if (spin_trylock(root_lock)) { 1997 if (spin_trylock(root_lock)) {
2000 qdisc_run(q); 1998 qdisc_run(q);
2001 spin_unlock(root_lock); 1999 spin_unlock(root_lock);
@@ -2100,7 +2098,7 @@ static int ing_filter(struct sk_buff *skb)
2100 rxq = &dev->rx_queue; 2098 rxq = &dev->rx_queue;
2101 2099
2102 q = rxq->qdisc; 2100 q = rxq->qdisc;
2103 if (q) { 2101 if (q != &noop_qdisc) {
2104 spin_lock(qdisc_lock(q)); 2102 spin_lock(qdisc_lock(q));
2105 result = qdisc_enqueue_root(skb, q); 2103 result = qdisc_enqueue_root(skb, q);
2106 spin_unlock(qdisc_lock(q)); 2104 spin_unlock(qdisc_lock(q));
@@ -2113,7 +2111,7 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb,
2113 struct packet_type **pt_prev, 2111 struct packet_type **pt_prev,
2114 int *ret, struct net_device *orig_dev) 2112 int *ret, struct net_device *orig_dev)
2115{ 2113{
2116 if (!skb->dev->rx_queue.qdisc) 2114 if (skb->dev->rx_queue.qdisc == &noop_qdisc)
2117 goto out; 2115 goto out;
2118 2116
2119 if (*pt_prev) { 2117 if (*pt_prev) {
@@ -2270,6 +2268,20 @@ out:
2270 return ret; 2268 return ret;
2271} 2269}
2272 2270
2271/* Network device is going away, flush any packets still pending */
2272static void flush_backlog(void *arg)
2273{
2274 struct net_device *dev = arg;
2275 struct softnet_data *queue = &__get_cpu_var(softnet_data);
2276 struct sk_buff *skb, *tmp;
2277
2278 skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp)
2279 if (skb->dev == dev) {
2280 __skb_unlink(skb, &queue->input_pkt_queue);
2281 kfree_skb(skb);
2282 }
2283}
2284
2273static int process_backlog(struct napi_struct *napi, int quota) 2285static int process_backlog(struct napi_struct *napi, int quota)
2274{ 2286{
2275 int work = 0; 2287 int work = 0;
@@ -2279,7 +2291,6 @@ static int process_backlog(struct napi_struct *napi, int quota)
2279 napi->weight = weight_p; 2291 napi->weight = weight_p;
2280 do { 2292 do {
2281 struct sk_buff *skb; 2293 struct sk_buff *skb;
2282 struct net_device *dev;
2283 2294
2284 local_irq_disable(); 2295 local_irq_disable();
2285 skb = __skb_dequeue(&queue->input_pkt_queue); 2296 skb = __skb_dequeue(&queue->input_pkt_queue);
@@ -2288,14 +2299,9 @@ static int process_backlog(struct napi_struct *napi, int quota)
2288 local_irq_enable(); 2299 local_irq_enable();
2289 break; 2300 break;
2290 } 2301 }
2291
2292 local_irq_enable(); 2302 local_irq_enable();
2293 2303
2294 dev = skb->dev;
2295
2296 netif_receive_skb(skb); 2304 netif_receive_skb(skb);
2297
2298 dev_put(dev);
2299 } while (++work < quota && jiffies == start_time); 2305 } while (++work < quota && jiffies == start_time);
2300 2306
2301 return work; 2307 return work;
@@ -3988,6 +3994,10 @@ int register_netdevice(struct net_device *dev)
3988 } 3994 }
3989 } 3995 }
3990 3996
3997 /* Enable software GSO if SG is supported. */
3998 if (dev->features & NETIF_F_SG)
3999 dev->features |= NETIF_F_GSO;
4000
3991 netdev_initialize_kobject(dev); 4001 netdev_initialize_kobject(dev);
3992 ret = netdev_register_kobject(dev); 4002 ret = netdev_register_kobject(dev);
3993 if (ret) 4003 if (ret)
@@ -4165,6 +4175,8 @@ void netdev_run_todo(void)
4165 4175
4166 dev->reg_state = NETREG_UNREGISTERED; 4176 dev->reg_state = NETREG_UNREGISTERED;
4167 4177
4178 on_each_cpu(flush_backlog, dev, 1);
4179
4168 netdev_wait_allrefs(dev); 4180 netdev_wait_allrefs(dev);
4169 4181
4170 /* paranoia */ 4182 /* paranoia */
@@ -4200,6 +4212,7 @@ static void netdev_init_queues(struct net_device *dev)
4200{ 4212{
4201 netdev_init_one_queue(dev, &dev->rx_queue, NULL); 4213 netdev_init_one_queue(dev, &dev->rx_queue, NULL);
4202 netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL); 4214 netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL);
4215 spin_lock_init(&dev->tx_global_lock);
4203} 4216}
4204 4217
4205/** 4218/**
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index f62c8af85d38..9d92e41826e7 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2281,6 +2281,7 @@ static struct neighbour *neigh_get_idx(struct seq_file *seq, loff_t *pos)
2281 struct neighbour *n = neigh_get_first(seq); 2281 struct neighbour *n = neigh_get_first(seq);
2282 2282
2283 if (n) { 2283 if (n) {
2284 --(*pos);
2284 while (*pos) { 2285 while (*pos) {
2285 n = neigh_get_next(seq, n, pos); 2286 n = neigh_get_next(seq, n, pos);
2286 if (!n) 2287 if (!n)
@@ -2341,6 +2342,7 @@ static struct pneigh_entry *pneigh_get_idx(struct seq_file *seq, loff_t *pos)
2341 struct pneigh_entry *pn = pneigh_get_first(seq); 2342 struct pneigh_entry *pn = pneigh_get_first(seq);
2342 2343
2343 if (pn) { 2344 if (pn) {
2345 --(*pos);
2344 while (*pos) { 2346 while (*pos) {
2345 pn = pneigh_get_next(seq, pn, pos); 2347 pn = pneigh_get_next(seq, pn, pos);
2346 if (!pn) 2348 if (!pn)
@@ -2354,10 +2356,11 @@ static void *neigh_get_idx_any(struct seq_file *seq, loff_t *pos)
2354{ 2356{
2355 struct neigh_seq_state *state = seq->private; 2357 struct neigh_seq_state *state = seq->private;
2356 void *rc; 2358 void *rc;
2359 loff_t idxpos = *pos;
2357 2360
2358 rc = neigh_get_idx(seq, pos); 2361 rc = neigh_get_idx(seq, &idxpos);
2359 if (!rc && !(state->flags & NEIGH_SEQ_NEIGH_ONLY)) 2362 if (!rc && !(state->flags & NEIGH_SEQ_NEIGH_ONLY))
2360 rc = pneigh_get_idx(seq, pos); 2363 rc = pneigh_get_idx(seq, &idxpos);
2361 2364
2362 return rc; 2365 return rc;
2363} 2366}
@@ -2366,7 +2369,6 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl
2366 __acquires(tbl->lock) 2369 __acquires(tbl->lock)
2367{ 2370{
2368 struct neigh_seq_state *state = seq->private; 2371 struct neigh_seq_state *state = seq->private;
2369 loff_t pos_minus_one;
2370 2372
2371 state->tbl = tbl; 2373 state->tbl = tbl;
2372 state->bucket = 0; 2374 state->bucket = 0;
@@ -2374,8 +2376,7 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl
2374 2376
2375 read_lock_bh(&tbl->lock); 2377 read_lock_bh(&tbl->lock);
2376 2378
2377 pos_minus_one = *pos - 1; 2379 return *pos ? neigh_get_idx_any(seq, pos) : SEQ_START_TOKEN;
2378 return *pos ? neigh_get_idx_any(seq, &pos_minus_one) : SEQ_START_TOKEN;
2379} 2380}
2380EXPORT_SYMBOL(neigh_seq_start); 2381EXPORT_SYMBOL(neigh_seq_start);
2381 2382
@@ -2385,7 +2386,7 @@ void *neigh_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2385 void *rc; 2386 void *rc;
2386 2387
2387 if (v == SEQ_START_TOKEN) { 2388 if (v == SEQ_START_TOKEN) {
2388 rc = neigh_get_idx(seq, pos); 2389 rc = neigh_get_first(seq);
2389 goto out; 2390 goto out;
2390 } 2391 }
2391 2392
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index c12720895ecf..6c7af390be0a 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -70,6 +70,7 @@ static void queue_process(struct work_struct *work)
70 local_irq_save(flags); 70 local_irq_save(flags);
71 __netif_tx_lock(txq, smp_processor_id()); 71 __netif_tx_lock(txq, smp_processor_id());
72 if (netif_tx_queue_stopped(txq) || 72 if (netif_tx_queue_stopped(txq) ||
73 netif_tx_queue_frozen(txq) ||
73 dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) { 74 dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) {
74 skb_queue_head(&npinfo->txq, skb); 75 skb_queue_head(&npinfo->txq, skb);
75 __netif_tx_unlock(txq); 76 __netif_tx_unlock(txq);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index c7d484f7e1c4..2498cdaf8cbe 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2085,15 +2085,19 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
2085 if (pkt_dev->flows[flow].count >= pkt_dev->lflow) { 2085 if (pkt_dev->flows[flow].count >= pkt_dev->lflow) {
2086 /* reset time */ 2086 /* reset time */
2087 pkt_dev->flows[flow].count = 0; 2087 pkt_dev->flows[flow].count = 0;
2088 pkt_dev->flows[flow].flags = 0;
2088 pkt_dev->curfl += 1; 2089 pkt_dev->curfl += 1;
2089 if (pkt_dev->curfl >= pkt_dev->cflows) 2090 if (pkt_dev->curfl >= pkt_dev->cflows)
2090 pkt_dev->curfl = 0; /*reset */ 2091 pkt_dev->curfl = 0; /*reset */
2091 } 2092 }
2092 } else { 2093 } else {
2093 flow = random32() % pkt_dev->cflows; 2094 flow = random32() % pkt_dev->cflows;
2095 pkt_dev->curfl = flow;
2094 2096
2095 if (pkt_dev->flows[flow].count > pkt_dev->lflow) 2097 if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
2096 pkt_dev->flows[flow].count = 0; 2098 pkt_dev->flows[flow].count = 0;
2099 pkt_dev->flows[flow].flags = 0;
2100 }
2097 } 2101 }
2098 2102
2099 return pkt_dev->curfl; 2103 return pkt_dev->curfl;
@@ -2162,7 +2166,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
2162 mc = random32() % pkt_dev->src_mac_count; 2166 mc = random32() % pkt_dev->src_mac_count;
2163 else { 2167 else {
2164 mc = pkt_dev->cur_src_mac_offset++; 2168 mc = pkt_dev->cur_src_mac_offset++;
2165 if (pkt_dev->cur_src_mac_offset > 2169 if (pkt_dev->cur_src_mac_offset >=
2166 pkt_dev->src_mac_count) 2170 pkt_dev->src_mac_count)
2167 pkt_dev->cur_src_mac_offset = 0; 2171 pkt_dev->cur_src_mac_offset = 0;
2168 } 2172 }
@@ -2189,7 +2193,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
2189 2193
2190 else { 2194 else {
2191 mc = pkt_dev->cur_dst_mac_offset++; 2195 mc = pkt_dev->cur_dst_mac_offset++;
2192 if (pkt_dev->cur_dst_mac_offset > 2196 if (pkt_dev->cur_dst_mac_offset >=
2193 pkt_dev->dst_mac_count) { 2197 pkt_dev->dst_mac_count) {
2194 pkt_dev->cur_dst_mac_offset = 0; 2198 pkt_dev->cur_dst_mac_offset = 0;
2195 } 2199 }
@@ -3305,6 +3309,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3305 3309
3306 txq = netdev_get_tx_queue(odev, queue_map); 3310 txq = netdev_get_tx_queue(odev, queue_map);
3307 if (netif_tx_queue_stopped(txq) || 3311 if (netif_tx_queue_stopped(txq) ||
3312 netif_tx_queue_frozen(txq) ||
3308 need_resched()) { 3313 need_resched()) {
3309 idle_start = getCurUs(); 3314 idle_start = getCurUs();
3310 3315
@@ -3320,7 +3325,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3320 3325
3321 pkt_dev->idle_acc += getCurUs() - idle_start; 3326 pkt_dev->idle_acc += getCurUs() - idle_start;
3322 3327
3323 if (netif_tx_queue_stopped(txq)) { 3328 if (netif_tx_queue_stopped(txq) ||
3329 netif_tx_queue_frozen(txq)) {
3324 pkt_dev->next_tx_us = getCurUs(); /* TODO */ 3330 pkt_dev->next_tx_us = getCurUs(); /* TODO */
3325 pkt_dev->next_tx_ns = 0; 3331 pkt_dev->next_tx_ns = 0;
3326 goto out; /* Try the next interface */ 3332 goto out; /* Try the next interface */
@@ -3352,7 +3358,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3352 txq = netdev_get_tx_queue(odev, queue_map); 3358 txq = netdev_get_tx_queue(odev, queue_map);
3353 3359
3354 __netif_tx_lock_bh(txq); 3360 __netif_tx_lock_bh(txq);
3355 if (!netif_tx_queue_stopped(txq)) { 3361 if (!netif_tx_queue_stopped(txq) &&
3362 !netif_tx_queue_frozen(txq)) {
3356 3363
3357 atomic_inc(&(pkt_dev->skb->users)); 3364 atomic_inc(&(pkt_dev->skb->users));
3358 retry_now: 3365 retry_now:
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4e0c92274189..84640172d65d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -485,6 +485,9 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
485 C(head); 485 C(head);
486 C(data); 486 C(data);
487 C(truesize); 487 C(truesize);
488#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
489 C(do_not_encrypt);
490#endif
488 atomic_set(&n->users, 1); 491 atomic_set(&n->users, 1);
489 492
490 atomic_inc(&(skb_shinfo(skb)->dataref)); 493 atomic_inc(&(skb_shinfo(skb)->dataref));
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 743d85fcd651..1c2e3ec2eb57 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -226,7 +226,7 @@ static inline void dccp_csum_outgoing(struct sk_buff *skb)
226 226
227extern void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); 227extern void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
228 228
229extern int dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb); 229extern int dccp_retransmit_skb(struct sock *sk);
230 230
231extern void dccp_send_ack(struct sock *sk); 231extern void dccp_send_ack(struct sock *sk);
232extern void dccp_reqsk_send_ack(struct sk_buff *sk, struct request_sock *rsk); 232extern void dccp_reqsk_send_ack(struct sk_buff *sk, struct request_sock *rsk);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index a835b88237cb..882c5c4de69e 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -196,8 +196,8 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
196static void dccp_v4_err(struct sk_buff *skb, u32 info) 196static void dccp_v4_err(struct sk_buff *skb, u32 info)
197{ 197{
198 const struct iphdr *iph = (struct iphdr *)skb->data; 198 const struct iphdr *iph = (struct iphdr *)skb->data;
199 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + 199 const u8 offset = iph->ihl << 2;
200 (iph->ihl << 2)); 200 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
201 struct dccp_sock *dp; 201 struct dccp_sock *dp;
202 struct inet_sock *inet; 202 struct inet_sock *inet;
203 const int type = icmp_hdr(skb)->type; 203 const int type = icmp_hdr(skb)->type;
@@ -207,7 +207,8 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
207 int err; 207 int err;
208 struct net *net = dev_net(skb->dev); 208 struct net *net = dev_net(skb->dev);
209 209
210 if (skb->len < (iph->ihl << 2) + 8) { 210 if (skb->len < offset + sizeof(*dh) ||
211 skb->len < offset + __dccp_basic_hdr_len(dh)) {
211 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); 212 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
212 return; 213 return;
213 } 214 }
@@ -238,7 +239,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
238 dp = dccp_sk(sk); 239 dp = dccp_sk(sk);
239 seq = dccp_hdr_seq(dh); 240 seq = dccp_hdr_seq(dh);
240 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) && 241 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
241 !between48(seq, dp->dccps_swl, dp->dccps_swh)) { 242 !between48(seq, dp->dccps_awl, dp->dccps_awh)) {
242 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); 243 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
243 goto out; 244 goto out;
244 } 245 }
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index da509127e00c..5e1ee0da2c40 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -89,12 +89,19 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
89{ 89{
90 struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data; 90 struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data;
91 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); 91 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
92 struct dccp_sock *dp;
92 struct ipv6_pinfo *np; 93 struct ipv6_pinfo *np;
93 struct sock *sk; 94 struct sock *sk;
94 int err; 95 int err;
95 __u64 seq; 96 __u64 seq;
96 struct net *net = dev_net(skb->dev); 97 struct net *net = dev_net(skb->dev);
97 98
99 if (skb->len < offset + sizeof(*dh) ||
100 skb->len < offset + __dccp_basic_hdr_len(dh)) {
101 ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
102 return;
103 }
104
98 sk = inet6_lookup(net, &dccp_hashinfo, 105 sk = inet6_lookup(net, &dccp_hashinfo,
99 &hdr->daddr, dh->dccph_dport, 106 &hdr->daddr, dh->dccph_dport,
100 &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); 107 &hdr->saddr, dh->dccph_sport, inet6_iif(skb));
@@ -116,6 +123,14 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
116 if (sk->sk_state == DCCP_CLOSED) 123 if (sk->sk_state == DCCP_CLOSED)
117 goto out; 124 goto out;
118 125
126 dp = dccp_sk(sk);
127 seq = dccp_hdr_seq(dh);
128 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
129 !between48(seq, dp->dccps_awl, dp->dccps_awh)) {
130 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
131 goto out;
132 }
133
119 np = inet6_sk(sk); 134 np = inet6_sk(sk);
120 135
121 if (type == ICMPV6_PKT_TOOBIG) { 136 if (type == ICMPV6_PKT_TOOBIG) {
@@ -168,7 +183,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
168 183
169 icmpv6_err_convert(type, code, &err); 184 icmpv6_err_convert(type, code, &err);
170 185
171 seq = dccp_hdr_seq(dh);
172 /* Might be for an request_sock */ 186 /* Might be for an request_sock */
173 switch (sk->sk_state) { 187 switch (sk->sk_state) {
174 struct request_sock *req, **prev; 188 struct request_sock *req, **prev;
diff --git a/net/dccp/output.c b/net/dccp/output.c
index fe20068c5d8e..d06945c7d3df 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -53,8 +53,11 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
53 dccp_packet_hdr_len(dcb->dccpd_type); 53 dccp_packet_hdr_len(dcb->dccpd_type);
54 int err, set_ack = 1; 54 int err, set_ack = 1;
55 u64 ackno = dp->dccps_gsr; 55 u64 ackno = dp->dccps_gsr;
56 56 /*
57 dccp_inc_seqno(&dp->dccps_gss); 57 * Increment GSS here already in case the option code needs it.
58 * Update GSS for real only if option processing below succeeds.
59 */
60 dcb->dccpd_seq = ADD48(dp->dccps_gss, 1);
58 61
59 switch (dcb->dccpd_type) { 62 switch (dcb->dccpd_type) {
60 case DCCP_PKT_DATA: 63 case DCCP_PKT_DATA:
@@ -66,6 +69,9 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
66 69
67 case DCCP_PKT_REQUEST: 70 case DCCP_PKT_REQUEST:
68 set_ack = 0; 71 set_ack = 0;
72 /* Use ISS on the first (non-retransmitted) Request. */
73 if (icsk->icsk_retransmits == 0)
74 dcb->dccpd_seq = dp->dccps_iss;
69 /* fall through */ 75 /* fall through */
70 76
71 case DCCP_PKT_SYNC: 77 case DCCP_PKT_SYNC:
@@ -84,8 +90,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
84 break; 90 break;
85 } 91 }
86 92
87 dcb->dccpd_seq = dp->dccps_gss;
88
89 if (dccp_insert_options(sk, skb)) { 93 if (dccp_insert_options(sk, skb)) {
90 kfree_skb(skb); 94 kfree_skb(skb);
91 return -EPROTO; 95 return -EPROTO;
@@ -103,7 +107,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
103 /* XXX For now we're using only 48 bits sequence numbers */ 107 /* XXX For now we're using only 48 bits sequence numbers */
104 dh->dccph_x = 1; 108 dh->dccph_x = 1;
105 109
106 dp->dccps_awh = dp->dccps_gss; 110 dccp_update_gss(sk, dcb->dccpd_seq);
107 dccp_hdr_set_seq(dh, dp->dccps_gss); 111 dccp_hdr_set_seq(dh, dp->dccps_gss);
108 if (set_ack) 112 if (set_ack)
109 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), ackno); 113 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), ackno);
@@ -112,6 +116,11 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
112 case DCCP_PKT_REQUEST: 116 case DCCP_PKT_REQUEST:
113 dccp_hdr_request(skb)->dccph_req_service = 117 dccp_hdr_request(skb)->dccph_req_service =
114 dp->dccps_service; 118 dp->dccps_service;
119 /*
120 * Limit Ack window to ISS <= P.ackno <= GSS, so that
121 * only Responses to Requests we sent are considered.
122 */
123 dp->dccps_awl = dp->dccps_iss;
115 break; 124 break;
116 case DCCP_PKT_RESET: 125 case DCCP_PKT_RESET:
117 dccp_hdr_reset(skb)->dccph_reset_code = 126 dccp_hdr_reset(skb)->dccph_reset_code =
@@ -284,14 +293,26 @@ void dccp_write_xmit(struct sock *sk, int block)
284 } 293 }
285} 294}
286 295
287int dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb) 296/**
297 * dccp_retransmit_skb - Retransmit Request, Close, or CloseReq packets
298 * There are only four retransmittable packet types in DCCP:
299 * - Request in client-REQUEST state (sec. 8.1.1),
300 * - CloseReq in server-CLOSEREQ state (sec. 8.3),
301 * - Close in node-CLOSING state (sec. 8.3),
302 * - Acks in client-PARTOPEN state (sec. 8.1.5, handled by dccp_delack_timer()).
303 * This function expects sk->sk_send_head to contain the original skb.
304 */
305int dccp_retransmit_skb(struct sock *sk)
288{ 306{
307 WARN_ON(sk->sk_send_head == NULL);
308
289 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk) != 0) 309 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk) != 0)
290 return -EHOSTUNREACH; /* Routing failure or similar. */ 310 return -EHOSTUNREACH; /* Routing failure or similar. */
291 311
292 return dccp_transmit_skb(sk, (skb_cloned(skb) ? 312 /* this count is used to distinguish original and retransmitted skb */
293 pskb_copy(skb, GFP_ATOMIC): 313 inet_csk(sk)->icsk_retransmits++;
294 skb_clone(skb, GFP_ATOMIC))); 314
315 return dccp_transmit_skb(sk, skb_clone(sk->sk_send_head, GFP_ATOMIC));
295} 316}
296 317
297struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, 318struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
@@ -437,19 +458,7 @@ static inline void dccp_connect_init(struct sock *sk)
437 458
438 dccp_sync_mss(sk, dst_mtu(dst)); 459 dccp_sync_mss(sk, dst_mtu(dst));
439 460
440 /* 461 /* Initialise GAR as per 8.5; AWL/AWH are set in dccp_transmit_skb() */
441 * SWL and AWL are initially adjusted so that they are not less than
442 * the initial Sequence Numbers received and sent, respectively:
443 * SWL := max(GSR + 1 - floor(W/4), ISR),
444 * AWL := max(GSS - W' + 1, ISS).
445 * These adjustments MUST be applied only at the beginning of the
446 * connection.
447 */
448 dccp_update_gss(sk, dp->dccps_iss);
449 dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss));
450
451 /* S.GAR - greatest valid acknowledgement number received on a non-Sync;
452 * initialized to S.ISS (sec. 8.5) */
453 dp->dccps_gar = dp->dccps_iss; 462 dp->dccps_gar = dp->dccps_iss;
454 463
455 icsk->icsk_retransmits = 0; 464 icsk->icsk_retransmits = 0;
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index 6a5b961b6f5c..54b3c7e9e016 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -99,21 +99,11 @@ static void dccp_retransmit_timer(struct sock *sk)
99 } 99 }
100 100
101 /* 101 /*
102 * sk->sk_send_head has to have one skb with
103 * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP
104 * packet types. The only packets eligible for retransmission are:
105 * -- Requests in client-REQUEST state (sec. 8.1.1)
106 * -- Acks in client-PARTOPEN state (sec. 8.1.5)
107 * -- CloseReq in server-CLOSEREQ state (sec. 8.3)
108 * -- Close in node-CLOSING state (sec. 8.3) */
109 WARN_ON(sk->sk_send_head == NULL);
110
111 /*
112 * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was 102 * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was
113 * sent, no need to retransmit, this sock is dead. 103 * sent, no need to retransmit, this sock is dead.
114 */ 104 */
115 if (dccp_write_timeout(sk)) 105 if (dccp_write_timeout(sk))
116 goto out; 106 return;
117 107
118 /* 108 /*
119 * We want to know the number of packets retransmitted, not the 109 * We want to know the number of packets retransmitted, not the
@@ -122,30 +112,28 @@ static void dccp_retransmit_timer(struct sock *sk)
122 if (icsk->icsk_retransmits == 0) 112 if (icsk->icsk_retransmits == 0)
123 DCCP_INC_STATS_BH(DCCP_MIB_TIMEOUTS); 113 DCCP_INC_STATS_BH(DCCP_MIB_TIMEOUTS);
124 114
125 if (dccp_retransmit_skb(sk, sk->sk_send_head) < 0) { 115 if (dccp_retransmit_skb(sk) != 0) {
126 /* 116 /*
127 * Retransmission failed because of local congestion, 117 * Retransmission failed because of local congestion,
128 * do not backoff. 118 * do not backoff.
129 */ 119 */
130 if (icsk->icsk_retransmits == 0) 120 if (--icsk->icsk_retransmits == 0)
131 icsk->icsk_retransmits = 1; 121 icsk->icsk_retransmits = 1;
132 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, 122 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
133 min(icsk->icsk_rto, 123 min(icsk->icsk_rto,
134 TCP_RESOURCE_PROBE_INTERVAL), 124 TCP_RESOURCE_PROBE_INTERVAL),
135 DCCP_RTO_MAX); 125 DCCP_RTO_MAX);
136 goto out; 126 return;
137 } 127 }
138 128
139backoff: 129backoff:
140 icsk->icsk_backoff++; 130 icsk->icsk_backoff++;
141 icsk->icsk_retransmits++;
142 131
143 icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX); 132 icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX);
144 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, 133 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto,
145 DCCP_RTO_MAX); 134 DCCP_RTO_MAX);
146 if (icsk->icsk_retransmits > sysctl_dccp_retries1) 135 if (icsk->icsk_retransmits > sysctl_dccp_retries1)
147 __sk_dst_reset(sk); 136 __sk_dst_reset(sk);
148out:;
149} 137}
150 138
151static void dccp_write_timer(unsigned long data) 139static void dccp_write_timer(unsigned long data)
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index a42b64d040c4..38ccb6dfb02e 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -104,9 +104,7 @@ out:
104 104
105static int ipcomp4_init_state(struct xfrm_state *x) 105static int ipcomp4_init_state(struct xfrm_state *x)
106{ 106{
107 int err; 107 int err = -EINVAL;
108 struct ipcomp_data *ipcd;
109 struct xfrm_algo_desc *calg_desc;
110 108
111 x->props.header_len = 0; 109 x->props.header_len = 0;
112 switch (x->props.mode) { 110 switch (x->props.mode) {
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 1819ad7ab910..fafe8ebb4c55 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -475,11 +475,10 @@ static void arp_print(struct arp_payload *payload)
475#define HBUFFERLEN 30 475#define HBUFFERLEN 30
476 char hbuffer[HBUFFERLEN]; 476 char hbuffer[HBUFFERLEN];
477 int j,k; 477 int j,k;
478 const char hexbuf[]= "0123456789abcdef";
479 478
480 for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) { 479 for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) {
481 hbuffer[k++]=hexbuf[(payload->src_hw[j]>>4)&15]; 480 hbuffer[k++] = hex_asc_hi(payload->src_hw[j]);
482 hbuffer[k++]=hexbuf[payload->src_hw[j]&15]; 481 hbuffer[k++] = hex_asc_lo(payload->src_hw[j]);
483 hbuffer[k++]=':'; 482 hbuffer[k++]=':';
484 } 483 }
485 hbuffer[--k]='\0'; 484 hbuffer[--k]='\0';
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 21cb053f5d7d..3974d7cae5c0 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -305,10 +305,10 @@ static void recent_mt_destroy(const struct xt_match *match, void *matchinfo)
305 spin_lock_bh(&recent_lock); 305 spin_lock_bh(&recent_lock);
306 list_del(&t->list); 306 list_del(&t->list);
307 spin_unlock_bh(&recent_lock); 307 spin_unlock_bh(&recent_lock);
308 recent_table_flush(t);
309#ifdef CONFIG_PROC_FS 308#ifdef CONFIG_PROC_FS
310 remove_proc_entry(t->name, proc_dir); 309 remove_proc_entry(t->name, proc_dir);
311#endif 310#endif
311 recent_table_flush(t);
312 kfree(t); 312 kfree(t);
313 } 313 }
314 mutex_unlock(&recent_mutex); 314 mutex_unlock(&recent_mutex);
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 834356ea99df..8f5a403f6f6b 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -232,6 +232,8 @@ static const struct snmp_mib snmp4_net_list[] = {
232 SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD), 232 SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD),
233 SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO), 233 SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO),
234 SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS), 234 SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS),
235 SNMP_MIB_ITEM("TCPMD5NotFound", LINUX_MIB_TCPMD5NOTFOUND),
236 SNMP_MIB_ITEM("TCPMD5Unexpected", LINUX_MIB_TCPMD5UNEXPECTED),
235 SNMP_MIB_SENTINEL 237 SNMP_MIB_SENTINEL
236}; 238};
237 239
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 380d6474cf66..1bfa078ddbd0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3216,14 +3216,18 @@ int __init ip_rt_init(void)
3216 return rc; 3216 return rc;
3217} 3217}
3218 3218
3219#ifdef CONFIG_SYSCTL
3219/* 3220/*
3220 * We really need to sanitize the damn ipv4 init order, then all 3221 * We really need to sanitize the damn ipv4 init order, then all
3221 * this nonsense will go away. 3222 * this nonsense will go away.
3222 */ 3223 */
3223void __init ip_static_sysctl_init(void) 3224void __init ip_static_sysctl_init(void)
3224{ 3225{
3226#ifdef CONFIG_SYSCTL
3225 register_sysctl_paths(ipv4_route_path, ipv4_route_table); 3227 register_sysctl_paths(ipv4_route_path, ipv4_route_table);
3228#endif
3226} 3229}
3230#endif
3227 3231
3228EXPORT_SYMBOL(__ip_select_ident); 3232EXPORT_SYMBOL(__ip_select_ident);
3229EXPORT_SYMBOL(ip_route_input); 3233EXPORT_SYMBOL(ip_route_input);
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 770d827f5ab8..e0689fd7b798 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -232,6 +232,7 @@ static struct ctl_table ipv4_table[] = {
232 .mode = 0644, 232 .mode = 0644,
233 .proc_handler = &ipv4_doint_and_flush, 233 .proc_handler = &ipv4_doint_and_flush,
234 .strategy = &ipv4_doint_and_flush_strategy, 234 .strategy = &ipv4_doint_and_flush_strategy,
235 .extra2 = &init_net,
235 }, 236 },
236 { 237 {
237 .ctl_name = NET_IPV4_NO_PMTU_DISC, 238 .ctl_name = NET_IPV4_NO_PMTU_DISC,
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a2b06d0cc26b..91a8cfddf1c4 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -655,8 +655,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
655 rep.th.doff = arg.iov[0].iov_len/4; 655 rep.th.doff = arg.iov[0].iov_len/4;
656 656
657 tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset], 657 tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset],
658 key, ip_hdr(skb)->daddr, 658 key, ip_hdr(skb)->saddr,
659 ip_hdr(skb)->saddr, &rep.th); 659 ip_hdr(skb)->daddr, &rep.th);
660 } 660 }
661#endif 661#endif
662 arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, 662 arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
@@ -1116,18 +1116,12 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb)
1116 return 0; 1116 return 0;
1117 1117
1118 if (hash_expected && !hash_location) { 1118 if (hash_expected && !hash_location) {
1119 LIMIT_NETDEBUG(KERN_INFO "MD5 Hash expected but NOT found " 1119 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
1120 "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
1121 NIPQUAD(iph->saddr), ntohs(th->source),
1122 NIPQUAD(iph->daddr), ntohs(th->dest));
1123 return 1; 1120 return 1;
1124 } 1121 }
1125 1122
1126 if (!hash_expected && hash_location) { 1123 if (!hash_expected && hash_location) {
1127 LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found " 1124 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
1128 "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
1129 NIPQUAD(iph->saddr), ntohs(th->source),
1130 NIPQUAD(iph->daddr), ntohs(th->dest));
1131 return 1; 1125 return 1;
1132 } 1126 }
1133 1127
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index f7b535dec860..410046a8cc91 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -732,7 +732,7 @@ int datagram_send_ctl(struct net *net,
732 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n", 732 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n",
733 cmsg->cmsg_type); 733 cmsg->cmsg_type);
734 err = -EINVAL; 734 err = -EINVAL;
735 break; 735 goto exit_f;
736 } 736 }
737 } 737 }
738 738
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 6811901e6b1e..a4402de425d9 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -236,6 +236,10 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
236 skb_reset_network_header(skb); 236 skb_reset_network_header(skb);
237 hdr = ipv6_hdr(skb); 237 hdr = ipv6_hdr(skb);
238 238
239 /* Allow local fragmentation. */
240 if (ipfragok)
241 skb->local_df = 1;
242
239 /* 243 /*
240 * Fill in the IPv6 header 244 * Fill in the IPv6 header
241 */ 245 */
@@ -265,7 +269,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
265 skb->mark = sk->sk_mark; 269 skb->mark = sk->sk_mark;
266 270
267 mtu = dst_mtu(dst); 271 mtu = dst_mtu(dst);
268 if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) { 272 if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) {
269 IP6_INC_STATS(ip6_dst_idev(skb->dst), 273 IP6_INC_STATS(ip6_dst_idev(skb->dst),
270 IPSTATS_MIB_OUTREQUESTS); 274 IPSTATS_MIB_OUTREQUESTS);
271 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, 275 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 0cfcea42153a..4545e4306862 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -134,9 +134,7 @@ out:
134 134
135static int ipcomp6_init_state(struct xfrm_state *x) 135static int ipcomp6_init_state(struct xfrm_state *x)
136{ 136{
137 int err; 137 int err = -EINVAL;
138 struct ipcomp_data *ipcd;
139 struct xfrm_algo_desc *calg_desc;
140 138
141 x->props.header_len = 0; 139 x->props.header_len = 0;
142 switch (x->props.mode) { 140 switch (x->props.mode) {
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index ea33b26512c2..741cfcd96f88 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -346,6 +346,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
346 */ 346 */
347 if (optlen == 0) 347 if (optlen == 0)
348 optval = NULL; 348 optval = NULL;
349 else if (optval == NULL)
350 goto e_inval;
349 else if (optlen < sizeof(struct ipv6_opt_hdr) || 351 else if (optlen < sizeof(struct ipv6_opt_hdr) ||
350 optlen & 0x7 || optlen > 8 * 255) 352 optlen & 0x7 || optlen > 8 * 255)
351 goto e_inval; 353 goto e_inval;
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index f82f6074cf85..0179b66864f1 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -286,7 +286,6 @@ proc_net_fail:
286 286
287void ipv6_misc_proc_exit(void) 287void ipv6_misc_proc_exit(void)
288{ 288{
289 proc_net_remove(&init_net, "sockstat6");
290 proc_net_remove(&init_net, "dev_snmp6"); 289 proc_net_remove(&init_net, "dev_snmp6");
291 proc_net_remove(&init_net, "snmp6"); 290 proc_net_remove(&init_net, "snmp6");
292 unregister_pernet_subsys(&ipv6_proc_ops); 291 unregister_pernet_subsys(&ipv6_proc_ops);
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index a46badd1082d..ec394cf5a19b 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -199,10 +199,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
199 ireq6 = inet6_rsk(req); 199 ireq6 = inet6_rsk(req);
200 treq = tcp_rsk(req); 200 treq = tcp_rsk(req);
201 201
202 if (security_inet_conn_request(sk, skb, req)) { 202 if (security_inet_conn_request(sk, skb, req))
203 reqsk_free(req); 203 goto out_free;
204 goto out;
205 }
206 204
207 req->mss = mss; 205 req->mss = mss;
208 ireq->rmt_port = th->source; 206 ireq->rmt_port = th->source;
@@ -255,14 +253,13 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
255 fl.fl_ip_dport = inet_rsk(req)->rmt_port; 253 fl.fl_ip_dport = inet_rsk(req)->rmt_port;
256 fl.fl_ip_sport = inet_sk(sk)->sport; 254 fl.fl_ip_sport = inet_sk(sk)->sport;
257 security_req_classify_flow(req, &fl); 255 security_req_classify_flow(req, &fl);
258 if (ip6_dst_lookup(sk, &dst, &fl)) { 256 if (ip6_dst_lookup(sk, &dst, &fl))
259 reqsk_free(req); 257 goto out_free;
260 goto out; 258
261 }
262 if (final_p) 259 if (final_p)
263 ipv6_addr_copy(&fl.fl6_dst, final_p); 260 ipv6_addr_copy(&fl.fl6_dst, final_p);
264 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0) 261 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0)
265 goto out; 262 goto out_free;
266 } 263 }
267 264
268 req->window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW); 265 req->window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);
@@ -273,7 +270,10 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
273 ireq->rcv_wscale = rcv_wscale; 270 ireq->rcv_wscale = rcv_wscale;
274 271
275 ret = get_cookie_sock(sk, skb, req, dst); 272 ret = get_cookie_sock(sk, skb, req, dst);
276 273out:
277out: return ret; 274 return ret;
275out_free:
276 reqsk_free(req);
277 return NULL;
278} 278}
279 279
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index cff778b23a7f..78185a409212 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -748,7 +748,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
748 ipv6_addr_copy(&bp->saddr, saddr); 748 ipv6_addr_copy(&bp->saddr, saddr);
749 ipv6_addr_copy(&bp->daddr, daddr); 749 ipv6_addr_copy(&bp->daddr, daddr);
750 bp->protocol = cpu_to_be32(IPPROTO_TCP); 750 bp->protocol = cpu_to_be32(IPPROTO_TCP);
751 bp->len = cpu_to_be16(nbytes); 751 bp->len = cpu_to_be32(nbytes);
752 752
753 sg_init_one(&sg, bp, sizeof(*bp)); 753 sg_init_one(&sg, bp, sizeof(*bp));
754 return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp)); 754 return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp));
@@ -849,28 +849,17 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
849 hash_expected = tcp_v6_md5_do_lookup(sk, &ip6h->saddr); 849 hash_expected = tcp_v6_md5_do_lookup(sk, &ip6h->saddr);
850 hash_location = tcp_parse_md5sig_option(th); 850 hash_location = tcp_parse_md5sig_option(th);
851 851
852 /* do we have a hash as expected? */ 852 /* We've parsed the options - do we have a hash? */
853 if (!hash_expected) { 853 if (!hash_expected && !hash_location)
854 if (!hash_location) 854 return 0;
855 return 0; 855
856 if (net_ratelimit()) { 856 if (hash_expected && !hash_location) {
857 printk(KERN_INFO "MD5 Hash NOT expected but found " 857 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
858 "(" NIP6_FMT ", %u)->"
859 "(" NIP6_FMT ", %u)\n",
860 NIP6(ip6h->saddr), ntohs(th->source),
861 NIP6(ip6h->daddr), ntohs(th->dest));
862 }
863 return 1; 858 return 1;
864 } 859 }
865 860
866 if (!hash_location) { 861 if (!hash_expected && hash_location) {
867 if (net_ratelimit()) { 862 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
868 printk(KERN_INFO "MD5 Hash expected but NOT found "
869 "(" NIP6_FMT ", %u)->"
870 "(" NIP6_FMT ", %u)\n",
871 NIP6(ip6h->saddr), ntohs(th->source),
872 NIP6(ip6h->daddr), ntohs(th->dest));
873 }
874 return 1; 863 return 1;
875 } 864 }
876 865
@@ -1105,8 +1094,8 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
1105 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 1094 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1106 (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); 1095 (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
1107 tcp_v6_md5_hash_hdr((__u8 *)topt, key, 1096 tcp_v6_md5_hash_hdr((__u8 *)topt, key,
1108 &ipv6_hdr(skb)->daddr, 1097 &ipv6_hdr(skb)->saddr,
1109 &ipv6_hdr(skb)->saddr, t1); 1098 &ipv6_hdr(skb)->daddr, t1);
1110 } 1099 }
1111#endif 1100#endif
1112 1101
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8e7ba0e62cf5..297c257864c7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -81,6 +81,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
81 enum nl80211_iftype type, u32 *flags, 81 enum nl80211_iftype type, u32 *flags,
82 struct vif_params *params) 82 struct vif_params *params)
83{ 83{
84 struct ieee80211_local *local = wiphy_priv(wiphy);
84 struct net_device *dev; 85 struct net_device *dev;
85 enum ieee80211_if_types itype; 86 enum ieee80211_if_types itype;
86 struct ieee80211_sub_if_data *sdata; 87 struct ieee80211_sub_if_data *sdata;
@@ -95,6 +96,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
95 if (itype == IEEE80211_IF_TYPE_INVALID) 96 if (itype == IEEE80211_IF_TYPE_INVALID)
96 return -EINVAL; 97 return -EINVAL;
97 98
99 if (dev == local->mdev)
100 return -EOPNOTSUPP;
101
98 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 102 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
99 103
100 ret = ieee80211_if_change_type(sdata, itype); 104 ret = ieee80211_if_change_type(sdata, itype);
@@ -117,12 +121,16 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
117 u8 key_idx, u8 *mac_addr, 121 u8 key_idx, u8 *mac_addr,
118 struct key_params *params) 122 struct key_params *params)
119{ 123{
124 struct ieee80211_local *local = wiphy_priv(wiphy);
120 struct ieee80211_sub_if_data *sdata; 125 struct ieee80211_sub_if_data *sdata;
121 struct sta_info *sta = NULL; 126 struct sta_info *sta = NULL;
122 enum ieee80211_key_alg alg; 127 enum ieee80211_key_alg alg;
123 struct ieee80211_key *key; 128 struct ieee80211_key *key;
124 int err; 129 int err;
125 130
131 if (dev == local->mdev)
132 return -EOPNOTSUPP;
133
126 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 134 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
127 135
128 switch (params->cipher) { 136 switch (params->cipher) {
@@ -167,10 +175,14 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
167static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, 175static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
168 u8 key_idx, u8 *mac_addr) 176 u8 key_idx, u8 *mac_addr)
169{ 177{
178 struct ieee80211_local *local = wiphy_priv(wiphy);
170 struct ieee80211_sub_if_data *sdata; 179 struct ieee80211_sub_if_data *sdata;
171 struct sta_info *sta; 180 struct sta_info *sta;
172 int ret; 181 int ret;
173 182
183 if (dev == local->mdev)
184 return -EOPNOTSUPP;
185
174 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 186 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
175 187
176 rcu_read_lock(); 188 rcu_read_lock();
@@ -211,7 +223,8 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
211 void (*callback)(void *cookie, 223 void (*callback)(void *cookie,
212 struct key_params *params)) 224 struct key_params *params))
213{ 225{
214 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 226 struct ieee80211_local *local = wiphy_priv(wiphy);
227 struct ieee80211_sub_if_data *sdata;
215 struct sta_info *sta = NULL; 228 struct sta_info *sta = NULL;
216 u8 seq[6] = {0}; 229 u8 seq[6] = {0};
217 struct key_params params; 230 struct key_params params;
@@ -220,6 +233,11 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
220 u16 iv16; 233 u16 iv16;
221 int err = -ENOENT; 234 int err = -ENOENT;
222 235
236 if (dev == local->mdev)
237 return -EOPNOTSUPP;
238
239 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
240
223 rcu_read_lock(); 241 rcu_read_lock();
224 242
225 if (mac_addr) { 243 if (mac_addr) {
@@ -293,8 +311,12 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
293 struct net_device *dev, 311 struct net_device *dev,
294 u8 key_idx) 312 u8 key_idx)
295{ 313{
314 struct ieee80211_local *local = wiphy_priv(wiphy);
296 struct ieee80211_sub_if_data *sdata; 315 struct ieee80211_sub_if_data *sdata;
297 316
317 if (dev == local->mdev)
318 return -EOPNOTSUPP;
319
298 rcu_read_lock(); 320 rcu_read_lock();
299 321
300 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 322 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -475,9 +497,15 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
475static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 497static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
476 struct beacon_parameters *params) 498 struct beacon_parameters *params)
477{ 499{
478 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 500 struct ieee80211_local *local = wiphy_priv(wiphy);
501 struct ieee80211_sub_if_data *sdata;
479 struct beacon_data *old; 502 struct beacon_data *old;
480 503
504 if (dev == local->mdev)
505 return -EOPNOTSUPP;
506
507 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
508
481 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 509 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
482 return -EINVAL; 510 return -EINVAL;
483 511
@@ -492,9 +520,15 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
492static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, 520static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
493 struct beacon_parameters *params) 521 struct beacon_parameters *params)
494{ 522{
495 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 523 struct ieee80211_local *local = wiphy_priv(wiphy);
524 struct ieee80211_sub_if_data *sdata;
496 struct beacon_data *old; 525 struct beacon_data *old;
497 526
527 if (dev == local->mdev)
528 return -EOPNOTSUPP;
529
530 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
531
498 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 532 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
499 return -EINVAL; 533 return -EINVAL;
500 534
@@ -508,9 +542,15 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
508 542
509static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) 543static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
510{ 544{
511 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 545 struct ieee80211_local *local = wiphy_priv(wiphy);
546 struct ieee80211_sub_if_data *sdata;
512 struct beacon_data *old; 547 struct beacon_data *old;
513 548
549 if (dev == local->mdev)
550 return -EOPNOTSUPP;
551
552 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
553
514 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 554 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
515 return -EINVAL; 555 return -EINVAL;
516 556
@@ -646,11 +686,14 @@ static void sta_apply_parameters(struct ieee80211_local *local,
646static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, 686static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
647 u8 *mac, struct station_parameters *params) 687 u8 *mac, struct station_parameters *params)
648{ 688{
649 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 689 struct ieee80211_local *local = wiphy_priv(wiphy);
650 struct sta_info *sta; 690 struct sta_info *sta;
651 struct ieee80211_sub_if_data *sdata; 691 struct ieee80211_sub_if_data *sdata;
652 int err; 692 int err;
653 693
694 if (dev == local->mdev || params->vlan == local->mdev)
695 return -EOPNOTSUPP;
696
654 /* Prevent a race with changing the rate control algorithm */ 697 /* Prevent a race with changing the rate control algorithm */
655 if (!netif_running(dev)) 698 if (!netif_running(dev))
656 return -ENETDOWN; 699 return -ENETDOWN;
@@ -701,10 +744,15 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
701static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, 744static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
702 u8 *mac) 745 u8 *mac)
703{ 746{
704 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 747 struct ieee80211_local *local = wiphy_priv(wiphy);
705 struct ieee80211_local *local = sdata->local; 748 struct ieee80211_sub_if_data *sdata;
706 struct sta_info *sta; 749 struct sta_info *sta;
707 750
751 if (dev == local->mdev)
752 return -EOPNOTSUPP;
753
754 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
755
708 if (mac) { 756 if (mac) {
709 rcu_read_lock(); 757 rcu_read_lock();
710 758
@@ -730,10 +778,13 @@ static int ieee80211_change_station(struct wiphy *wiphy,
730 u8 *mac, 778 u8 *mac,
731 struct station_parameters *params) 779 struct station_parameters *params)
732{ 780{
733 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 781 struct ieee80211_local *local = wiphy_priv(wiphy);
734 struct sta_info *sta; 782 struct sta_info *sta;
735 struct ieee80211_sub_if_data *vlansdata; 783 struct ieee80211_sub_if_data *vlansdata;
736 784
785 if (dev == local->mdev || params->vlan == local->mdev)
786 return -EOPNOTSUPP;
787
737 rcu_read_lock(); 788 rcu_read_lock();
738 789
739 /* XXX: get sta belonging to dev */ 790 /* XXX: get sta belonging to dev */
@@ -752,7 +803,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
752 return -EINVAL; 803 return -EINVAL;
753 } 804 }
754 805
755 sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 806 sta->sdata = vlansdata;
756 ieee80211_send_layer2_update(sta); 807 ieee80211_send_layer2_update(sta);
757 } 808 }
758 809
@@ -767,15 +818,20 @@ static int ieee80211_change_station(struct wiphy *wiphy,
767static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, 818static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
768 u8 *dst, u8 *next_hop) 819 u8 *dst, u8 *next_hop)
769{ 820{
770 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 821 struct ieee80211_local *local = wiphy_priv(wiphy);
771 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 822 struct ieee80211_sub_if_data *sdata;
772 struct mesh_path *mpath; 823 struct mesh_path *mpath;
773 struct sta_info *sta; 824 struct sta_info *sta;
774 int err; 825 int err;
775 826
827 if (dev == local->mdev)
828 return -EOPNOTSUPP;
829
776 if (!netif_running(dev)) 830 if (!netif_running(dev))
777 return -ENETDOWN; 831 return -ENETDOWN;
778 832
833 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
834
779 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 835 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
780 return -ENOTSUPP; 836 return -ENOTSUPP;
781 837
@@ -817,14 +873,19 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
817 struct net_device *dev, 873 struct net_device *dev,
818 u8 *dst, u8 *next_hop) 874 u8 *dst, u8 *next_hop)
819{ 875{
820 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 876 struct ieee80211_local *local = wiphy_priv(wiphy);
821 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 877 struct ieee80211_sub_if_data *sdata;
822 struct mesh_path *mpath; 878 struct mesh_path *mpath;
823 struct sta_info *sta; 879 struct sta_info *sta;
824 880
881 if (dev == local->mdev)
882 return -EOPNOTSUPP;
883
825 if (!netif_running(dev)) 884 if (!netif_running(dev))
826 return -ENETDOWN; 885 return -ENETDOWN;
827 886
887 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
888
828 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 889 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
829 return -ENOTSUPP; 890 return -ENOTSUPP;
830 891
@@ -891,9 +952,15 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
891 u8 *dst, u8 *next_hop, struct mpath_info *pinfo) 952 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
892 953
893{ 954{
894 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 955 struct ieee80211_local *local = wiphy_priv(wiphy);
956 struct ieee80211_sub_if_data *sdata;
895 struct mesh_path *mpath; 957 struct mesh_path *mpath;
896 958
959 if (dev == local->mdev)
960 return -EOPNOTSUPP;
961
962 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
963
897 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 964 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
898 return -ENOTSUPP; 965 return -ENOTSUPP;
899 966
@@ -913,9 +980,15 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
913 int idx, u8 *dst, u8 *next_hop, 980 int idx, u8 *dst, u8 *next_hop,
914 struct mpath_info *pinfo) 981 struct mpath_info *pinfo)
915{ 982{
916 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 983 struct ieee80211_local *local = wiphy_priv(wiphy);
984 struct ieee80211_sub_if_data *sdata;
917 struct mesh_path *mpath; 985 struct mesh_path *mpath;
918 986
987 if (dev == local->mdev)
988 return -EOPNOTSUPP;
989
990 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
991
919 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 992 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
920 return -ENOTSUPP; 993 return -ENOTSUPP;
921 994
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a4f9a832722a..ec59345af65b 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -82,6 +82,7 @@ struct ieee80211_sta_bss {
82 82
83 u8 bssid[ETH_ALEN]; 83 u8 bssid[ETH_ALEN];
84 u8 ssid[IEEE80211_MAX_SSID_LEN]; 84 u8 ssid[IEEE80211_MAX_SSID_LEN];
85 u8 dtim_period;
85 u16 capability; /* host byte order */ 86 u16 capability; /* host byte order */
86 enum ieee80211_band band; 87 enum ieee80211_band band;
87 int freq; 88 int freq;
@@ -586,6 +587,7 @@ struct ieee80211_local {
586 struct timer_list sta_cleanup; 587 struct timer_list sta_cleanup;
587 588
588 unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 589 unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
590 unsigned long queues_pending_run[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
589 struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES]; 591 struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES];
590 struct tasklet_struct tx_pending_tasklet; 592 struct tasklet_struct tx_pending_tasklet;
591 593
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index f1a83d450ea0..0c02c471bca2 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1233,18 +1233,12 @@ static void ieee80211_tasklet_handler(unsigned long data)
1233/* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to 1233/* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to
1234 * make a prepared TX frame (one that has been given to hw) to look like brand 1234 * make a prepared TX frame (one that has been given to hw) to look like brand
1235 * new IEEE 802.11 frame that is ready to go through TX processing again. 1235 * new IEEE 802.11 frame that is ready to go through TX processing again.
1236 * Also, tx_packet_data in cb is restored from tx_control. */ 1236 */
1237static void ieee80211_remove_tx_extra(struct ieee80211_local *local, 1237static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
1238 struct ieee80211_key *key, 1238 struct ieee80211_key *key,
1239 struct sk_buff *skb) 1239 struct sk_buff *skb)
1240{ 1240{
1241 int hdrlen, iv_len, mic_len; 1241 int hdrlen, iv_len, mic_len;
1242 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1243
1244 info->flags &= IEEE80211_TX_CTL_REQ_TX_STATUS |
1245 IEEE80211_TX_CTL_DO_NOT_ENCRYPT |
1246 IEEE80211_TX_CTL_REQUEUE |
1247 IEEE80211_TX_CTL_EAPOL_FRAME;
1248 1242
1249 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1243 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
1250 1244
@@ -1695,6 +1689,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1695 if (local->hw.conf.beacon_int < 10) 1689 if (local->hw.conf.beacon_int < 10)
1696 local->hw.conf.beacon_int = 100; 1690 local->hw.conf.beacon_int = 100;
1697 1691
1692 if (local->hw.max_listen_interval == 0)
1693 local->hw.max_listen_interval = 1;
1694
1695 local->hw.conf.listen_interval = local->hw.max_listen_interval;
1696
1698 local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | 1697 local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
1699 IEEE80211_HW_SIGNAL_DB | 1698 IEEE80211_HW_SIGNAL_DB |
1700 IEEE80211_HW_SIGNAL_DBM) ? 1699 IEEE80211_HW_SIGNAL_DBM) ?
@@ -1731,8 +1730,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1731 result = ieee80211_wep_init(local); 1730 result = ieee80211_wep_init(local);
1732 1731
1733 if (result < 0) { 1732 if (result < 0) {
1734 printk(KERN_DEBUG "%s: Failed to initialize wep\n", 1733 printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n",
1735 wiphy_name(local->hw.wiphy)); 1734 wiphy_name(local->hw.wiphy), result);
1736 goto fail_wep; 1735 goto fail_wep;
1737 } 1736 }
1738 1737
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d7c371e36bf0..e1d11c9b6729 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -551,6 +551,7 @@ static void ieee80211_set_associated(struct net_device *dev,
551 /* set timing information */ 551 /* set timing information */
552 sdata->bss_conf.beacon_int = bss->beacon_int; 552 sdata->bss_conf.beacon_int = bss->beacon_int;
553 sdata->bss_conf.timestamp = bss->timestamp; 553 sdata->bss_conf.timestamp = bss->timestamp;
554 sdata->bss_conf.dtim_period = bss->dtim_period;
554 555
555 changed |= ieee80211_handle_bss_capability(sdata, bss); 556 changed |= ieee80211_handle_bss_capability(sdata, bss);
556 557
@@ -606,7 +607,6 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
606 int encrypt) 607 int encrypt)
607{ 608{
608 struct ieee80211_sub_if_data *sdata; 609 struct ieee80211_sub_if_data *sdata;
609 struct ieee80211_tx_info *info;
610 610
611 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 611 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
612 skb->dev = sdata->local->mdev; 612 skb->dev = sdata->local->mdev;
@@ -614,11 +614,8 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
614 skb_set_network_header(skb, 0); 614 skb_set_network_header(skb, 0);
615 skb_set_transport_header(skb, 0); 615 skb_set_transport_header(skb, 0);
616 616
617 info = IEEE80211_SKB_CB(skb); 617 skb->iif = sdata->dev->ifindex;
618 memset(info, 0, sizeof(struct ieee80211_tx_info)); 618 skb->do_not_encrypt = !encrypt;
619 info->control.ifindex = sdata->dev->ifindex;
620 if (!encrypt)
621 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
622 619
623 dev_queue_xmit(skb); 620 dev_queue_xmit(skb);
624} 621}
@@ -777,7 +774,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
777 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, 774 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
778 IEEE80211_STYPE_REASSOC_REQ); 775 IEEE80211_STYPE_REASSOC_REQ);
779 mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); 776 mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab);
780 mgmt->u.reassoc_req.listen_interval = cpu_to_le16(1); 777 mgmt->u.reassoc_req.listen_interval =
778 cpu_to_le16(local->hw.conf.listen_interval);
781 memcpy(mgmt->u.reassoc_req.current_ap, ifsta->prev_bssid, 779 memcpy(mgmt->u.reassoc_req.current_ap, ifsta->prev_bssid,
782 ETH_ALEN); 780 ETH_ALEN);
783 } else { 781 } else {
@@ -785,7 +783,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
785 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, 783 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
786 IEEE80211_STYPE_ASSOC_REQ); 784 IEEE80211_STYPE_ASSOC_REQ);
787 mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); 785 mgmt->u.assoc_req.capab_info = cpu_to_le16(capab);
788 mgmt->u.assoc_req.listen_interval = cpu_to_le16(1); 786 mgmt->u.reassoc_req.listen_interval =
787 cpu_to_le16(local->hw.conf.listen_interval);
789 } 788 }
790 789
791 /* SSID */ 790 /* SSID */
@@ -2692,6 +2691,16 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2692 bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int); 2691 bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int);
2693 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); 2692 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info);
2694 2693
2694 if (elems->tim) {
2695 struct ieee80211_tim_ie *tim_ie =
2696 (struct ieee80211_tim_ie *)elems->tim;
2697 bss->dtim_period = tim_ie->dtim_period;
2698 }
2699
2700 /* set default value for buggy APs */
2701 if (!elems->tim || bss->dtim_period == 0)
2702 bss->dtim_period = 1;
2703
2695 bss->supp_rates_len = 0; 2704 bss->supp_rates_len = 0;
2696 if (elems->supp_rates) { 2705 if (elems->supp_rates) {
2697 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; 2706 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len;
@@ -3303,6 +3312,7 @@ void ieee80211_start_mesh(struct net_device *dev)
3303 ifsta = &sdata->u.sta; 3312 ifsta = &sdata->u.sta;
3304 ifsta->state = IEEE80211_MESH_UP; 3313 ifsta->state = IEEE80211_MESH_UP;
3305 ieee80211_sta_timer((unsigned long)sdata); 3314 ieee80211_sta_timer((unsigned long)sdata);
3315 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
3306} 3316}
3307#endif 3317#endif
3308 3318
@@ -3653,11 +3663,21 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
3653 "%s\n", print_mac(mac, bssid), 3663 "%s\n", print_mac(mac, bssid),
3654 print_mac(mac2, ifsta->bssid)); 3664 print_mac(mac2, ifsta->bssid));
3655#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 3665#endif /* CONFIG_MAC80211_IBSS_DEBUG */
3656 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && 3666
3657 (bss = ieee80211_rx_bss_get(dev, bssid, 3667 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
3658 local->hw.conf.channel->center_freq,
3659 ifsta->ssid, ifsta->ssid_len))) {
3660 int ret; 3668 int ret;
3669 int search_freq;
3670
3671 if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL)
3672 search_freq = bss->freq;
3673 else
3674 search_freq = local->hw.conf.channel->center_freq;
3675
3676 bss = ieee80211_rx_bss_get(dev, bssid, search_freq,
3677 ifsta->ssid, ifsta->ssid_len);
3678 if (!bss)
3679 goto dont_join;
3680
3661 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" 3681 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s"
3662 " based on configured SSID\n", 3682 " based on configured SSID\n",
3663 dev->name, print_mac(mac, bssid)); 3683 dev->name, print_mac(mac, bssid));
@@ -3665,6 +3685,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
3665 ieee80211_rx_bss_put(local, bss); 3685 ieee80211_rx_bss_put(local, bss);
3666 return ret; 3686 return ret;
3667 } 3687 }
3688
3689dont_join:
3668#ifdef CONFIG_MAC80211_IBSS_DEBUG 3690#ifdef CONFIG_MAC80211_IBSS_DEBUG
3669 printk(KERN_DEBUG " did not try to join ibss\n"); 3691 printk(KERN_DEBUG " did not try to join ibss\n");
3670#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 3692#endif /* CONFIG_MAC80211_IBSS_DEBUG */
@@ -3898,7 +3920,7 @@ done:
3898 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 3920 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
3899 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 3921 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
3900 if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || 3922 if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
3901 (!ifsta->state == IEEE80211_IBSS_JOINED && 3923 (!(ifsta->state == IEEE80211_IBSS_JOINED) &&
3902 !ieee80211_sta_active_ibss(dev))) 3924 !ieee80211_sta_active_ibss(dev)))
3903 ieee80211_sta_find_ibss(dev, ifsta); 3925 ieee80211_sta_find_ibss(dev, ifsta);
3904 } 3926 }
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0fbadd8b983c..771ec68b848d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -305,7 +305,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
305 rcu_read_unlock(); 305 rcu_read_unlock();
306 306
307 local->total_ps_buffered = total; 307 local->total_ps_buffered = total;
308#ifdef MAC80211_VERBOSE_PS_DEBUG 308#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
309 printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", 309 printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n",
310 wiphy_name(local->hw.wiphy), purged); 310 wiphy_name(local->hw.wiphy), purged);
311#endif 311#endif
@@ -342,7 +342,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
342 purge_old_ps_buffers(tx->local); 342 purge_old_ps_buffers(tx->local);
343 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= 343 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >=
344 AP_MAX_BC_BUFFER) { 344 AP_MAX_BC_BUFFER) {
345#ifdef MAC80211_VERBOSE_PS_DEBUG 345#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
346 if (net_ratelimit()) { 346 if (net_ratelimit()) {
347 printk(KERN_DEBUG "%s: BC TX buffer full - " 347 printk(KERN_DEBUG "%s: BC TX buffer full - "
348 "dropping the oldest frame\n", 348 "dropping the oldest frame\n",
@@ -389,7 +389,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
389 purge_old_ps_buffers(tx->local); 389 purge_old_ps_buffers(tx->local);
390 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { 390 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
391 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); 391 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
392#ifdef MAC80211_VERBOSE_PS_DEBUG 392#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
393 if (net_ratelimit()) { 393 if (net_ratelimit()) {
394 printk(KERN_DEBUG "%s: STA %s TX " 394 printk(KERN_DEBUG "%s: STA %s TX "
395 "buffer full - dropping oldest frame\n", 395 "buffer full - dropping oldest frame\n",
@@ -439,14 +439,14 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
439 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 439 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
440 u16 fc = tx->fc; 440 u16 fc = tx->fc;
441 441
442 if (unlikely(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) 442 if (unlikely(tx->skb->do_not_encrypt))
443 tx->key = NULL; 443 tx->key = NULL;
444 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 444 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
445 tx->key = key; 445 tx->key = key;
446 else if ((key = rcu_dereference(tx->sdata->default_key))) 446 else if ((key = rcu_dereference(tx->sdata->default_key)))
447 tx->key = key; 447 tx->key = key;
448 else if (tx->sdata->drop_unencrypted && 448 else if (tx->sdata->drop_unencrypted &&
449 !(info->flags & IEEE80211_TX_CTL_EAPOL_FRAME) && 449 (tx->skb->protocol != cpu_to_be16(ETH_P_PAE)) &&
450 !(info->flags & IEEE80211_TX_CTL_INJECTED)) { 450 !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
451 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 451 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
452 return TX_DROP; 452 return TX_DROP;
@@ -476,7 +476,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
476 } 476 }
477 477
478 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 478 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
479 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 479 tx->skb->do_not_encrypt = 1;
480 480
481 return TX_CONTINUE; 481 return TX_CONTINUE;
482} 482}
@@ -732,6 +732,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
732 memcpy(skb_put(frag, copylen), pos, copylen); 732 memcpy(skb_put(frag, copylen), pos, copylen);
733 memcpy(frag->cb, first->cb, sizeof(frag->cb)); 733 memcpy(frag->cb, first->cb, sizeof(frag->cb));
734 skb_copy_queue_mapping(frag, first); 734 skb_copy_queue_mapping(frag, first);
735 frag->do_not_encrypt = first->do_not_encrypt;
735 736
736 pos += copylen; 737 pos += copylen;
737 left -= copylen; 738 left -= copylen;
@@ -852,7 +853,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
852 853
853 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 854 sband = tx->local->hw.wiphy->bands[tx->channel->band];
854 855
855 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 856 skb->do_not_encrypt = 1;
856 info->flags |= IEEE80211_TX_CTL_INJECTED; 857 info->flags |= IEEE80211_TX_CTL_INJECTED;
857 tx->flags &= ~IEEE80211_TX_FRAGMENTED; 858 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
858 859
@@ -925,8 +926,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
925 skb_trim(skb, skb->len - FCS_LEN); 926 skb_trim(skb, skb->len - FCS_LEN);
926 } 927 }
927 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) 928 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
928 info->flags &= 929 tx->skb->do_not_encrypt = 0;
929 ~IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
930 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 930 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
931 tx->flags |= IEEE80211_TX_FRAGMENTED; 931 tx->flags |= IEEE80211_TX_FRAGMENTED;
932 break; 932 break;
@@ -1042,10 +1042,9 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1042 struct sk_buff *skb, 1042 struct sk_buff *skb,
1043 struct net_device *mdev) 1043 struct net_device *mdev)
1044{ 1044{
1045 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1046 struct net_device *dev; 1045 struct net_device *dev;
1047 1046
1048 dev = dev_get_by_index(&init_net, info->control.ifindex); 1047 dev = dev_get_by_index(&init_net, skb->iif);
1049 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { 1048 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) {
1050 dev_put(dev); 1049 dev_put(dev);
1051 dev = NULL; 1050 dev = NULL;
@@ -1061,13 +1060,14 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1061static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, 1060static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1062 struct ieee80211_tx_data *tx) 1061 struct ieee80211_tx_data *tx)
1063{ 1062{
1064 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1063 struct ieee80211_tx_info *info;
1065 int ret, i; 1064 int ret, i;
1066 1065
1067 if (netif_subqueue_stopped(local->mdev, skb))
1068 return IEEE80211_TX_AGAIN;
1069
1070 if (skb) { 1066 if (skb) {
1067 if (netif_subqueue_stopped(local->mdev, skb))
1068 return IEEE80211_TX_AGAIN;
1069 info = IEEE80211_SKB_CB(skb);
1070
1071 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1071 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1072 "TX to low-level driver", skb); 1072 "TX to low-level driver", skb);
1073 ret = local->ops->tx(local_to_hw(local), skb); 1073 ret = local->ops->tx(local_to_hw(local), skb);
@@ -1216,6 +1216,7 @@ retry:
1216 1216
1217 if (ret == IEEE80211_TX_FRAG_AGAIN) 1217 if (ret == IEEE80211_TX_FRAG_AGAIN)
1218 skb = NULL; 1218 skb = NULL;
1219
1219 set_bit(queue, local->queues_pending); 1220 set_bit(queue, local->queues_pending);
1220 smp_mb(); 1221 smp_mb();
1221 /* 1222 /*
@@ -1306,8 +1307,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1306 bool may_encrypt; 1307 bool may_encrypt;
1307 int ret; 1308 int ret;
1308 1309
1309 if (info->control.ifindex) 1310 if (skb->iif)
1310 odev = dev_get_by_index(&init_net, info->control.ifindex); 1311 odev = dev_get_by_index(&init_net, skb->iif);
1311 if (unlikely(odev && !is_ieee80211_device(odev, dev))) { 1312 if (unlikely(odev && !is_ieee80211_device(odev, dev))) {
1312 dev_put(odev); 1313 dev_put(odev);
1313 odev = NULL; 1314 odev = NULL;
@@ -1321,9 +1322,13 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1321 return 0; 1322 return 0;
1322 } 1323 }
1323 1324
1325 memset(info, 0, sizeof(*info));
1326
1327 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1328
1324 osdata = IEEE80211_DEV_TO_SUB_IF(odev); 1329 osdata = IEEE80211_DEV_TO_SUB_IF(odev);
1325 1330
1326 may_encrypt = !(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT); 1331 may_encrypt = !skb->do_not_encrypt;
1327 1332
1328 headroom = osdata->local->tx_headroom; 1333 headroom = osdata->local->tx_headroom;
1329 if (may_encrypt) 1334 if (may_encrypt)
@@ -1348,7 +1353,6 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1348 struct net_device *dev) 1353 struct net_device *dev)
1349{ 1354{
1350 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1355 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1351 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1352 struct ieee80211_radiotap_header *prthdr = 1356 struct ieee80211_radiotap_header *prthdr =
1353 (struct ieee80211_radiotap_header *)skb->data; 1357 (struct ieee80211_radiotap_header *)skb->data;
1354 u16 len_rthdr; 1358 u16 len_rthdr;
@@ -1371,11 +1375,11 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1371 skb->dev = local->mdev; 1375 skb->dev = local->mdev;
1372 1376
1373 /* needed because we set skb device to master */ 1377 /* needed because we set skb device to master */
1374 info->control.ifindex = dev->ifindex; 1378 skb->iif = dev->ifindex;
1375 1379
1376 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 1380 /* sometimes we do encrypt injected frames, will be fixed
1377 /* Interfaces should always request a status report */ 1381 * up in radiotap parser if not wanted */
1378 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; 1382 skb->do_not_encrypt = 0;
1379 1383
1380 /* 1384 /*
1381 * fix up the pointers accounting for the radiotap 1385 * fix up the pointers accounting for the radiotap
@@ -1419,7 +1423,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1419 struct net_device *dev) 1423 struct net_device *dev)
1420{ 1424{
1421 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1425 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1422 struct ieee80211_tx_info *info;
1423 struct ieee80211_sub_if_data *sdata; 1426 struct ieee80211_sub_if_data *sdata;
1424 int ret = 1, head_need; 1427 int ret = 1, head_need;
1425 u16 ethertype, hdrlen, meshhdrlen = 0; 1428 u16 ethertype, hdrlen, meshhdrlen = 0;
@@ -1645,14 +1648,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1645 nh_pos += hdrlen; 1648 nh_pos += hdrlen;
1646 h_pos += hdrlen; 1649 h_pos += hdrlen;
1647 1650
1648 info = IEEE80211_SKB_CB(skb); 1651 skb->iif = dev->ifindex;
1649 memset(info, 0, sizeof(*info));
1650 info->control.ifindex = dev->ifindex;
1651 if (ethertype == ETH_P_PAE)
1652 info->flags |= IEEE80211_TX_CTL_EAPOL_FRAME;
1653
1654 /* Interfaces should always request a status report */
1655 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1656 1652
1657 skb->dev = local->mdev; 1653 skb->dev = local->mdev;
1658 dev->stats.tx_packets++; 1654 dev->stats.tx_packets++;
@@ -1714,14 +1710,19 @@ void ieee80211_tx_pending(unsigned long data)
1714 netif_tx_lock_bh(dev); 1710 netif_tx_lock_bh(dev);
1715 for (i = 0; i < ieee80211_num_regular_queues(&local->hw); i++) { 1711 for (i = 0; i < ieee80211_num_regular_queues(&local->hw); i++) {
1716 /* Check that this queue is ok */ 1712 /* Check that this queue is ok */
1717 if (__netif_subqueue_stopped(local->mdev, i)) 1713 if (__netif_subqueue_stopped(local->mdev, i) &&
1714 !test_bit(i, local->queues_pending_run))
1718 continue; 1715 continue;
1719 1716
1720 if (!test_bit(i, local->queues_pending)) { 1717 if (!test_bit(i, local->queues_pending)) {
1718 clear_bit(i, local->queues_pending_run);
1721 ieee80211_wake_queue(&local->hw, i); 1719 ieee80211_wake_queue(&local->hw, i);
1722 continue; 1720 continue;
1723 } 1721 }
1724 1722
1723 clear_bit(i, local->queues_pending_run);
1724 netif_start_subqueue(local->mdev, i);
1725
1725 store = &local->pending_packet[i]; 1726 store = &local->pending_packet[i];
1726 tx.extra_frag = store->extra_frag; 1727 tx.extra_frag = store->extra_frag;
1727 tx.num_extra_frag = store->num_extra_frag; 1728 tx.num_extra_frag = store->num_extra_frag;
@@ -1922,6 +1923,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1922 1923
1923 info = IEEE80211_SKB_CB(skb); 1924 info = IEEE80211_SKB_CB(skb);
1924 1925
1926 skb->do_not_encrypt = 1;
1927
1925 info->band = band; 1928 info->band = band;
1926 rate_control_get_rate(local->mdev, sband, skb, &rsel); 1929 rate_control_get_rate(local->mdev, sband, skb, &rsel);
1927 1930
@@ -1931,7 +1934,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1931 "no rate found\n", 1934 "no rate found\n",
1932 wiphy_name(local->hw.wiphy)); 1935 wiphy_name(local->hw.wiphy));
1933 } 1936 }
1934 dev_kfree_skb(skb); 1937 dev_kfree_skb_any(skb);
1935 skb = NULL; 1938 skb = NULL;
1936 goto out; 1939 goto out;
1937 } 1940 }
@@ -1940,7 +1943,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1940 info->tx_rate_idx = rsel.rate_idx; 1943 info->tx_rate_idx = rsel.rate_idx;
1941 1944
1942 info->flags |= IEEE80211_TX_CTL_NO_ACK; 1945 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1943 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
1944 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; 1946 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1945 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; 1947 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
1946 if (sdata->bss_conf.use_short_preamble && 1948 if (sdata->bss_conf.use_short_preamble &&
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 19f85e1b3695..0d463c80c404 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -361,6 +361,7 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue)
361 struct ieee80211_local *local = hw_to_local(hw); 361 struct ieee80211_local *local = hw_to_local(hw);
362 362
363 if (test_bit(queue, local->queues_pending)) { 363 if (test_bit(queue, local->queues_pending)) {
364 set_bit(queue, local->queues_pending_run);
364 tasklet_schedule(&local->tx_pending_tasklet); 365 tasklet_schedule(&local->tx_pending_tasklet);
365 } else { 366 } else {
366 netif_wake_subqueue(local->mdev, queue); 367 netif_wake_subqueue(local->mdev, queue);
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 872d2fcd1a5b..5c2bf0a3d4db 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -31,13 +31,13 @@ int ieee80211_wep_init(struct ieee80211_local *local)
31 local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, 31 local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
32 CRYPTO_ALG_ASYNC); 32 CRYPTO_ALG_ASYNC);
33 if (IS_ERR(local->wep_tx_tfm)) 33 if (IS_ERR(local->wep_tx_tfm))
34 return -ENOMEM; 34 return PTR_ERR(local->wep_tx_tfm);
35 35
36 local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, 36 local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
37 CRYPTO_ALG_ASYNC); 37 CRYPTO_ALG_ASYNC);
38 if (IS_ERR(local->wep_rx_tfm)) { 38 if (IS_ERR(local->wep_rx_tfm)) {
39 crypto_free_blkcipher(local->wep_tx_tfm); 39 crypto_free_blkcipher(local->wep_tx_tfm);
40 return -ENOMEM; 40 return PTR_ERR(local->wep_rx_tfm);
41 } 41 }
42 42
43 return 0; 43 return 0;
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 07edda0b8a5c..4310e2f65661 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -188,6 +188,9 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
188{ 188{
189 int i; 189 int i;
190 190
191 /* XXX: currently broken due to cb/requeue use */
192 return -EPERM;
193
191 /* prepare the filter and save it for the SW queue 194 /* prepare the filter and save it for the SW queue
192 * matching the received HW queue */ 195 * matching the received HW queue */
193 196
@@ -238,12 +241,14 @@ void ieee80211_ht_agg_queue_remove(struct ieee80211_local *local,
238 } else { 241 } else {
239 struct netdev_queue *txq; 242 struct netdev_queue *txq;
240 spinlock_t *root_lock; 243 spinlock_t *root_lock;
244 struct Qdisc *q;
241 245
242 txq = netdev_get_tx_queue(local->mdev, agg_queue); 246 txq = netdev_get_tx_queue(local->mdev, agg_queue);
243 root_lock = qdisc_root_lock(txq->qdisc); 247 q = rcu_dereference(txq->qdisc);
248 root_lock = qdisc_lock(q);
244 249
245 spin_lock_bh(root_lock); 250 spin_lock_bh(root_lock);
246 qdisc_reset(txq->qdisc); 251 qdisc_reset(q);
247 spin_unlock_bh(root_lock); 252 spin_unlock_bh(root_lock);
248 } 253 }
249} 254}
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 420a10d8eb1e..6f61261888ef 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -67,7 +67,8 @@ static const char *const tcp_conntrack_names[] = {
67/* RFC1122 says the R2 limit should be at least 100 seconds. 67/* RFC1122 says the R2 limit should be at least 100 seconds.
68 Linux uses 15 packets as limit, which corresponds 68 Linux uses 15 packets as limit, which corresponds
69 to ~13-30min depending on RTO. */ 69 to ~13-30min depending on RTO. */
70static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS; 70static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS;
71static unsigned int nf_ct_tcp_timeout_unacknowledged __read_mostly = 5 MINS;
71 72
72static unsigned int tcp_timeouts[TCP_CONNTRACK_MAX] __read_mostly = { 73static unsigned int tcp_timeouts[TCP_CONNTRACK_MAX] __read_mostly = {
73 [TCP_CONNTRACK_SYN_SENT] = 2 MINS, 74 [TCP_CONNTRACK_SYN_SENT] = 2 MINS,
@@ -625,8 +626,10 @@ static bool tcp_in_window(const struct nf_conn *ct,
625 swin = win + (sack - ack); 626 swin = win + (sack - ack);
626 if (sender->td_maxwin < swin) 627 if (sender->td_maxwin < swin)
627 sender->td_maxwin = swin; 628 sender->td_maxwin = swin;
628 if (after(end, sender->td_end)) 629 if (after(end, sender->td_end)) {
629 sender->td_end = end; 630 sender->td_end = end;
631 sender->flags |= IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED;
632 }
630 /* 633 /*
631 * Update receiver data. 634 * Update receiver data.
632 */ 635 */
@@ -637,6 +640,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
637 if (win == 0) 640 if (win == 0)
638 receiver->td_maxend++; 641 receiver->td_maxend++;
639 } 642 }
643 if (ack == receiver->td_end)
644 receiver->flags &= ~IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED;
640 645
641 /* 646 /*
642 * Check retransmissions. 647 * Check retransmissions.
@@ -951,9 +956,16 @@ static int tcp_packet(struct nf_conn *ct,
951 if (old_state != new_state 956 if (old_state != new_state
952 && new_state == TCP_CONNTRACK_FIN_WAIT) 957 && new_state == TCP_CONNTRACK_FIN_WAIT)
953 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT; 958 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
954 timeout = ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans 959
955 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans 960 if (ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans &&
956 ? nf_ct_tcp_timeout_max_retrans : tcp_timeouts[new_state]; 961 tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans)
962 timeout = nf_ct_tcp_timeout_max_retrans;
963 else if ((ct->proto.tcp.seen[0].flags | ct->proto.tcp.seen[1].flags) &
964 IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED &&
965 tcp_timeouts[new_state] > nf_ct_tcp_timeout_unacknowledged)
966 timeout = nf_ct_tcp_timeout_unacknowledged;
967 else
968 timeout = tcp_timeouts[new_state];
957 write_unlock_bh(&tcp_lock); 969 write_unlock_bh(&tcp_lock);
958 970
959 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb); 971 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
@@ -1236,6 +1248,13 @@ static struct ctl_table tcp_sysctl_table[] = {
1236 .proc_handler = &proc_dointvec_jiffies, 1248 .proc_handler = &proc_dointvec_jiffies,
1237 }, 1249 },
1238 { 1250 {
1251 .procname = "nf_conntrack_tcp_timeout_unacknowledged",
1252 .data = &nf_ct_tcp_timeout_unacknowledged,
1253 .maxlen = sizeof(unsigned int),
1254 .mode = 0644,
1255 .proc_handler = &proc_dointvec_jiffies,
1256 },
1257 {
1239 .ctl_name = NET_NF_CONNTRACK_TCP_LOOSE, 1258 .ctl_name = NET_NF_CONNTRACK_TCP_LOOSE,
1240 .procname = "nf_conntrack_tcp_loose", 1259 .procname = "nf_conntrack_tcp_loose",
1241 .data = &nf_ct_tcp_loose, 1260 .data = &nf_ct_tcp_loose,
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 6809af542a2c..d9418a267812 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -367,9 +367,7 @@ static void htable_gc(unsigned long htlong)
367 367
368static void htable_destroy(struct xt_hashlimit_htable *hinfo) 368static void htable_destroy(struct xt_hashlimit_htable *hinfo)
369{ 369{
370 /* remove timer, if it is pending */ 370 del_timer_sync(&hinfo->timer);
371 if (timer_pending(&hinfo->timer))
372 del_timer(&hinfo->timer);
373 371
374 /* remove proc entry */ 372 /* remove proc entry */
375 remove_proc_entry(hinfo->pde->name, 373 remove_proc_entry(hinfo->pde->name,
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index 8aa822730145..e5b69556bb5b 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -109,6 +109,25 @@ static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB);
109static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX); 109static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX);
110static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN); 110static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN);
111 111
112static void rfkill_schedule_evsw_rfkillall(int state)
113{
114 /* EVERY radio type. state != 0 means radios ON */
115 /* handle EPO (emergency power off) through shortcut */
116 if (state) {
117 rfkill_schedule_set(&rfkill_wwan,
118 RFKILL_STATE_UNBLOCKED);
119 rfkill_schedule_set(&rfkill_wimax,
120 RFKILL_STATE_UNBLOCKED);
121 rfkill_schedule_set(&rfkill_uwb,
122 RFKILL_STATE_UNBLOCKED);
123 rfkill_schedule_set(&rfkill_bt,
124 RFKILL_STATE_UNBLOCKED);
125 rfkill_schedule_set(&rfkill_wlan,
126 RFKILL_STATE_UNBLOCKED);
127 } else
128 rfkill_schedule_epo();
129}
130
112static void rfkill_event(struct input_handle *handle, unsigned int type, 131static void rfkill_event(struct input_handle *handle, unsigned int type,
113 unsigned int code, int data) 132 unsigned int code, int data)
114{ 133{
@@ -132,21 +151,7 @@ static void rfkill_event(struct input_handle *handle, unsigned int type,
132 } else if (type == EV_SW) { 151 } else if (type == EV_SW) {
133 switch (code) { 152 switch (code) {
134 case SW_RFKILL_ALL: 153 case SW_RFKILL_ALL:
135 /* EVERY radio type. data != 0 means radios ON */ 154 rfkill_schedule_evsw_rfkillall(data);
136 /* handle EPO (emergency power off) through shortcut */
137 if (data) {
138 rfkill_schedule_set(&rfkill_wwan,
139 RFKILL_STATE_UNBLOCKED);
140 rfkill_schedule_set(&rfkill_wimax,
141 RFKILL_STATE_UNBLOCKED);
142 rfkill_schedule_set(&rfkill_uwb,
143 RFKILL_STATE_UNBLOCKED);
144 rfkill_schedule_set(&rfkill_bt,
145 RFKILL_STATE_UNBLOCKED);
146 rfkill_schedule_set(&rfkill_wlan,
147 RFKILL_STATE_UNBLOCKED);
148 } else
149 rfkill_schedule_epo();
150 break; 155 break;
151 default: 156 default:
152 break; 157 break;
@@ -168,6 +173,7 @@ static int rfkill_connect(struct input_handler *handler, struct input_dev *dev,
168 handle->handler = handler; 173 handle->handler = handler;
169 handle->name = "rfkill"; 174 handle->name = "rfkill";
170 175
176 /* causes rfkill_start() to be called */
171 error = input_register_handle(handle); 177 error = input_register_handle(handle);
172 if (error) 178 if (error)
173 goto err_free_handle; 179 goto err_free_handle;
@@ -185,6 +191,23 @@ static int rfkill_connect(struct input_handler *handler, struct input_dev *dev,
185 return error; 191 return error;
186} 192}
187 193
194static void rfkill_start(struct input_handle *handle)
195{
196 /* Take event_lock to guard against configuration changes, we
197 * should be able to deal with concurrency with rfkill_event()
198 * just fine (which event_lock will also avoid). */
199 spin_lock_irq(&handle->dev->event_lock);
200
201 if (test_bit(EV_SW, handle->dev->evbit)) {
202 if (test_bit(SW_RFKILL_ALL, handle->dev->swbit))
203 rfkill_schedule_evsw_rfkillall(test_bit(SW_RFKILL_ALL,
204 handle->dev->sw));
205 /* add resync for further EV_SW events here */
206 }
207
208 spin_unlock_irq(&handle->dev->event_lock);
209}
210
188static void rfkill_disconnect(struct input_handle *handle) 211static void rfkill_disconnect(struct input_handle *handle)
189{ 212{
190 input_close_device(handle); 213 input_close_device(handle);
@@ -225,6 +248,7 @@ static struct input_handler rfkill_handler = {
225 .event = rfkill_event, 248 .event = rfkill_event,
226 .connect = rfkill_connect, 249 .connect = rfkill_connect,
227 .disconnect = rfkill_disconnect, 250 .disconnect = rfkill_disconnect,
251 .start = rfkill_start,
228 .name = "rfkill", 252 .name = "rfkill",
229 .id_table = rfkill_ids, 253 .id_table = rfkill_ids,
230}; 254};
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 7a560b785097..d2d45655cd1a 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -105,6 +105,16 @@ static void rfkill_led_trigger(struct rfkill *rfkill,
105#endif /* CONFIG_RFKILL_LEDS */ 105#endif /* CONFIG_RFKILL_LEDS */
106} 106}
107 107
108#ifdef CONFIG_RFKILL_LEDS
109static void rfkill_led_trigger_activate(struct led_classdev *led)
110{
111 struct rfkill *rfkill = container_of(led->trigger,
112 struct rfkill, led_trigger);
113
114 rfkill_led_trigger(rfkill, rfkill->state);
115}
116#endif /* CONFIG_RFKILL_LEDS */
117
108static void notify_rfkill_state_change(struct rfkill *rfkill) 118static void notify_rfkill_state_change(struct rfkill *rfkill)
109{ 119{
110 blocking_notifier_call_chain(&rfkill_notifier_list, 120 blocking_notifier_call_chain(&rfkill_notifier_list,
@@ -130,7 +140,6 @@ static void update_rfkill_state(struct rfkill *rfkill)
130 140
131/** 141/**
132 * rfkill_toggle_radio - wrapper for toggle_radio hook 142 * rfkill_toggle_radio - wrapper for toggle_radio hook
133 *
134 * @rfkill: the rfkill struct to use 143 * @rfkill: the rfkill struct to use
135 * @force: calls toggle_radio even if cache says it is not needed, 144 * @force: calls toggle_radio even if cache says it is not needed,
136 * and also makes sure notifications of the state will be 145 * and also makes sure notifications of the state will be
@@ -141,8 +150,8 @@ static void update_rfkill_state(struct rfkill *rfkill)
141 * calls and handling all the red tape such as issuing notifications 150 * calls and handling all the red tape such as issuing notifications
142 * if the call is successful. 151 * if the call is successful.
143 * 152 *
144 * Note that @force cannot override a (possibly cached) state of 153 * Note that the @force parameter cannot override a (possibly cached)
145 * RFKILL_STATE_HARD_BLOCKED. Any device making use of 154 * state of RFKILL_STATE_HARD_BLOCKED. Any device making use of
146 * RFKILL_STATE_HARD_BLOCKED implements either get_state() or 155 * RFKILL_STATE_HARD_BLOCKED implements either get_state() or
147 * rfkill_force_state(), so the cache either is bypassed or valid. 156 * rfkill_force_state(), so the cache either is bypassed or valid.
148 * 157 *
@@ -150,7 +159,7 @@ static void update_rfkill_state(struct rfkill *rfkill)
150 * even if the radio is in RFKILL_STATE_HARD_BLOCKED state, so as to 159 * even if the radio is in RFKILL_STATE_HARD_BLOCKED state, so as to
151 * give the driver a hint that it should double-BLOCK the transmitter. 160 * give the driver a hint that it should double-BLOCK the transmitter.
152 * 161 *
153 * Caller must have aquired rfkill_mutex. 162 * Caller must have acquired rfkill->mutex.
154 */ 163 */
155static int rfkill_toggle_radio(struct rfkill *rfkill, 164static int rfkill_toggle_radio(struct rfkill *rfkill,
156 enum rfkill_state state, 165 enum rfkill_state state,
@@ -200,12 +209,12 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
200 209
201/** 210/**
202 * rfkill_switch_all - Toggle state of all switches of given type 211 * rfkill_switch_all - Toggle state of all switches of given type
203 * @type: type of interfaces to be affeceted 212 * @type: type of interfaces to be affected
204 * @state: the new state 213 * @state: the new state
205 * 214 *
206 * This function toggles state of all switches of given type unless 215 * This function toggles the state of all switches of given type,
207 * a specific switch is claimed by userspace in which case it is 216 * unless a specific switch is claimed by userspace (in which case,
208 * left alone. 217 * that switch is left alone).
209 */ 218 */
210void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) 219void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
211{ 220{
@@ -216,8 +225,11 @@ void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
216 rfkill_states[type] = state; 225 rfkill_states[type] = state;
217 226
218 list_for_each_entry(rfkill, &rfkill_list, node) { 227 list_for_each_entry(rfkill, &rfkill_list, node) {
219 if ((!rfkill->user_claim) && (rfkill->type == type)) 228 if ((!rfkill->user_claim) && (rfkill->type == type)) {
229 mutex_lock(&rfkill->mutex);
220 rfkill_toggle_radio(rfkill, state, 0); 230 rfkill_toggle_radio(rfkill, state, 0);
231 mutex_unlock(&rfkill->mutex);
232 }
221 } 233 }
222 234
223 mutex_unlock(&rfkill_mutex); 235 mutex_unlock(&rfkill_mutex);
@@ -228,7 +240,7 @@ EXPORT_SYMBOL(rfkill_switch_all);
228 * rfkill_epo - emergency power off all transmitters 240 * rfkill_epo - emergency power off all transmitters
229 * 241 *
230 * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring 242 * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring
231 * everything in its path but rfkill_mutex. 243 * everything in its path but rfkill_mutex and rfkill->mutex.
232 */ 244 */
233void rfkill_epo(void) 245void rfkill_epo(void)
234{ 246{
@@ -236,7 +248,9 @@ void rfkill_epo(void)
236 248
237 mutex_lock(&rfkill_mutex); 249 mutex_lock(&rfkill_mutex);
238 list_for_each_entry(rfkill, &rfkill_list, node) { 250 list_for_each_entry(rfkill, &rfkill_list, node) {
251 mutex_lock(&rfkill->mutex);
239 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1); 252 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
253 mutex_unlock(&rfkill->mutex);
240 } 254 }
241 mutex_unlock(&rfkill_mutex); 255 mutex_unlock(&rfkill_mutex);
242} 256}
@@ -252,7 +266,12 @@ EXPORT_SYMBOL_GPL(rfkill_epo);
252 * a notification by the firmware/hardware of the current *real* 266 * a notification by the firmware/hardware of the current *real*
253 * state of the radio rfkill switch. 267 * state of the radio rfkill switch.
254 * 268 *
255 * It may not be called from an atomic context. 269 * Devices which are subject to external changes on their rfkill
270 * state (such as those caused by a hardware rfkill line) MUST
271 * have their driver arrange to call rfkill_force_state() as soon
272 * as possible after such a change.
273 *
274 * This function may not be called from an atomic context.
256 */ 275 */
257int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state) 276int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state)
258{ 277{
@@ -367,6 +386,9 @@ static ssize_t rfkill_claim_store(struct device *dev,
367 if (!capable(CAP_NET_ADMIN)) 386 if (!capable(CAP_NET_ADMIN))
368 return -EPERM; 387 return -EPERM;
369 388
389 if (rfkill->user_claim_unsupported)
390 return -EOPNOTSUPP;
391
370 /* 392 /*
371 * Take the global lock to make sure the kernel is not in 393 * Take the global lock to make sure the kernel is not in
372 * the middle of rfkill_switch_all 394 * the middle of rfkill_switch_all
@@ -375,19 +397,17 @@ static ssize_t rfkill_claim_store(struct device *dev,
375 if (error) 397 if (error)
376 return error; 398 return error;
377 399
378 if (rfkill->user_claim_unsupported) {
379 error = -EOPNOTSUPP;
380 goto out_unlock;
381 }
382 if (rfkill->user_claim != claim) { 400 if (rfkill->user_claim != claim) {
383 if (!claim) 401 if (!claim) {
402 mutex_lock(&rfkill->mutex);
384 rfkill_toggle_radio(rfkill, 403 rfkill_toggle_radio(rfkill,
385 rfkill_states[rfkill->type], 404 rfkill_states[rfkill->type],
386 0); 405 0);
406 mutex_unlock(&rfkill->mutex);
407 }
387 rfkill->user_claim = claim; 408 rfkill->user_claim = claim;
388 } 409 }
389 410
390out_unlock:
391 mutex_unlock(&rfkill_mutex); 411 mutex_unlock(&rfkill_mutex);
392 412
393 return error ? error : count; 413 return error ? error : count;
@@ -516,8 +536,11 @@ static void rfkill_remove_switch(struct rfkill *rfkill)
516{ 536{
517 mutex_lock(&rfkill_mutex); 537 mutex_lock(&rfkill_mutex);
518 list_del_init(&rfkill->node); 538 list_del_init(&rfkill->node);
519 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
520 mutex_unlock(&rfkill_mutex); 539 mutex_unlock(&rfkill_mutex);
540
541 mutex_lock(&rfkill->mutex);
542 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
543 mutex_unlock(&rfkill->mutex);
521} 544}
522 545
523/** 546/**
@@ -526,9 +549,10 @@ static void rfkill_remove_switch(struct rfkill *rfkill)
526 * @type: type of the switch (RFKILL_TYPE_*) 549 * @type: type of the switch (RFKILL_TYPE_*)
527 * 550 *
528 * This function should be called by the network driver when it needs 551 * This function should be called by the network driver when it needs
529 * rfkill structure. Once the structure is allocated the driver shoud 552 * rfkill structure. Once the structure is allocated the driver should
530 * finish its initialization by setting name, private data, enable_radio 553 * finish its initialization by setting the name, private data, enable_radio
531 * and disable_radio methods and then register it with rfkill_register(). 554 * and disable_radio methods and then register it with rfkill_register().
555 *
532 * NOTE: If registration fails the structure shoudl be freed by calling 556 * NOTE: If registration fails the structure shoudl be freed by calling
533 * rfkill_free() otherwise rfkill_unregister() should be used. 557 * rfkill_free() otherwise rfkill_unregister() should be used.
534 */ 558 */
@@ -560,7 +584,7 @@ EXPORT_SYMBOL(rfkill_allocate);
560 * rfkill_free - Mark rfkill structure for deletion 584 * rfkill_free - Mark rfkill structure for deletion
561 * @rfkill: rfkill structure to be destroyed 585 * @rfkill: rfkill structure to be destroyed
562 * 586 *
563 * Decrements reference count of rfkill structure so it is destroyed. 587 * Decrements reference count of the rfkill structure so it is destroyed.
564 * Note that rfkill_free() should _not_ be called after rfkill_unregister(). 588 * Note that rfkill_free() should _not_ be called after rfkill_unregister().
565 */ 589 */
566void rfkill_free(struct rfkill *rfkill) 590void rfkill_free(struct rfkill *rfkill)
@@ -575,7 +599,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
575#ifdef CONFIG_RFKILL_LEDS 599#ifdef CONFIG_RFKILL_LEDS
576 int error; 600 int error;
577 601
578 rfkill->led_trigger.name = rfkill->dev.bus_id; 602 if (!rfkill->led_trigger.name)
603 rfkill->led_trigger.name = rfkill->dev.bus_id;
604 if (!rfkill->led_trigger.activate)
605 rfkill->led_trigger.activate = rfkill_led_trigger_activate;
579 error = led_trigger_register(&rfkill->led_trigger); 606 error = led_trigger_register(&rfkill->led_trigger);
580 if (error) 607 if (error)
581 rfkill->led_trigger.name = NULL; 608 rfkill->led_trigger.name = NULL;
@@ -585,8 +612,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
585static void rfkill_led_trigger_unregister(struct rfkill *rfkill) 612static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
586{ 613{
587#ifdef CONFIG_RFKILL_LEDS 614#ifdef CONFIG_RFKILL_LEDS
588 if (rfkill->led_trigger.name) 615 if (rfkill->led_trigger.name) {
589 led_trigger_unregister(&rfkill->led_trigger); 616 led_trigger_unregister(&rfkill->led_trigger);
617 rfkill->led_trigger.name = NULL;
618 }
590#endif 619#endif
591} 620}
592 621
@@ -622,8 +651,8 @@ int rfkill_register(struct rfkill *rfkill)
622 651
623 error = device_add(dev); 652 error = device_add(dev);
624 if (error) { 653 if (error) {
625 rfkill_led_trigger_unregister(rfkill);
626 rfkill_remove_switch(rfkill); 654 rfkill_remove_switch(rfkill);
655 rfkill_led_trigger_unregister(rfkill);
627 return error; 656 return error;
628 } 657 }
629 658
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index b0601642e227..4840aff47256 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -572,44 +572,21 @@ static u32 qdisc_alloc_handle(struct net_device *dev)
572static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, 572static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
573 struct Qdisc *qdisc) 573 struct Qdisc *qdisc)
574{ 574{
575 struct Qdisc *oqdisc = dev_queue->qdisc_sleeping;
575 spinlock_t *root_lock; 576 spinlock_t *root_lock;
576 struct Qdisc *oqdisc;
577 int ingress;
578
579 ingress = 0;
580 if (qdisc && qdisc->flags&TCQ_F_INGRESS)
581 ingress = 1;
582
583 if (ingress) {
584 oqdisc = dev_queue->qdisc;
585 } else {
586 oqdisc = dev_queue->qdisc_sleeping;
587 }
588 577
589 root_lock = qdisc_root_lock(oqdisc); 578 root_lock = qdisc_root_lock(oqdisc);
590 spin_lock_bh(root_lock); 579 spin_lock_bh(root_lock);
591 580
592 if (ingress) { 581 /* Prune old scheduler */
593 /* Prune old scheduler */ 582 if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1)
594 if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1) { 583 qdisc_reset(oqdisc);
595 /* delete */
596 qdisc_reset(oqdisc);
597 dev_queue->qdisc = NULL;
598 } else { /* new */
599 dev_queue->qdisc = qdisc;
600 }
601 584
602 } else { 585 /* ... and graft new one */
603 /* Prune old scheduler */ 586 if (qdisc == NULL)
604 if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1) 587 qdisc = &noop_qdisc;
605 qdisc_reset(oqdisc); 588 dev_queue->qdisc_sleeping = qdisc;
606 589 dev_queue->qdisc = &noop_qdisc;
607 /* ... and graft new one */
608 if (qdisc == NULL)
609 qdisc = &noop_qdisc;
610 dev_queue->qdisc_sleeping = qdisc;
611 dev_queue->qdisc = &noop_qdisc;
612 }
613 590
614 spin_unlock_bh(root_lock); 591 spin_unlock_bh(root_lock);
615 592
@@ -678,7 +655,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
678 655
679 ingress = 0; 656 ingress = 0;
680 num_q = dev->num_tx_queues; 657 num_q = dev->num_tx_queues;
681 if (q && q->flags & TCQ_F_INGRESS) { 658 if ((q && q->flags & TCQ_F_INGRESS) ||
659 (new && new->flags & TCQ_F_INGRESS)) {
682 num_q = 1; 660 num_q = 1;
683 ingress = 1; 661 ingress = 1;
684 } 662 }
@@ -692,13 +670,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
692 if (!ingress) 670 if (!ingress)
693 dev_queue = netdev_get_tx_queue(dev, i); 671 dev_queue = netdev_get_tx_queue(dev, i);
694 672
695 if (ingress) { 673 old = dev_graft_qdisc(dev_queue, new);
696 old = dev_graft_qdisc(dev_queue, q); 674 if (new && i > 0)
697 } else { 675 atomic_inc(&new->refcnt);
698 old = dev_graft_qdisc(dev_queue, new); 676
699 if (new && i > 0)
700 atomic_inc(&new->refcnt);
701 }
702 notify_and_destroy(skb, n, classid, old, new); 677 notify_and_destroy(skb, n, classid, old, new);
703 } 678 }
704 679
@@ -817,7 +792,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
817 goto err_out3; 792 goto err_out3;
818 } 793 }
819 } 794 }
820 if (parent) 795 if (parent && !(sch->flags & TCQ_F_INGRESS))
821 list_add_tail(&sch->list, &dev_queue->qdisc->list); 796 list_add_tail(&sch->list, &dev_queue->qdisc->list);
822 797
823 return sch; 798 return sch;
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 6b517b9dac5b..43d37256c15e 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -415,7 +415,7 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
415 case TC_ACT_QUEUED: 415 case TC_ACT_QUEUED:
416 case TC_ACT_STOLEN: 416 case TC_ACT_STOLEN:
417 kfree_skb(skb); 417 kfree_skb(skb);
418 return NET_XMIT_SUCCESS; 418 return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
419 case TC_ACT_SHOT: 419 case TC_ACT_SHOT:
420 kfree_skb(skb); 420 kfree_skb(skb);
421 goto drop; 421 goto drop;
@@ -432,9 +432,11 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
432 ret = qdisc_enqueue(skb, flow->q); 432 ret = qdisc_enqueue(skb, flow->q);
433 if (ret != 0) { 433 if (ret != 0) {
434drop: __maybe_unused 434drop: __maybe_unused
435 sch->qstats.drops++; 435 if (net_xmit_drop_count(ret)) {
436 if (flow) 436 sch->qstats.drops++;
437 flow->qstats.drops++; 437 if (flow)
438 flow->qstats.drops++;
439 }
438 return ret; 440 return ret;
439 } 441 }
440 sch->bstats.bytes += qdisc_pkt_len(skb); 442 sch->bstats.bytes += qdisc_pkt_len(skb);
@@ -455,7 +457,7 @@ drop: __maybe_unused
455 return 0; 457 return 0;
456 } 458 }
457 tasklet_schedule(&p->task); 459 tasklet_schedule(&p->task);
458 return NET_XMIT_BYPASS; 460 return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
459} 461}
460 462
461/* 463/*
@@ -530,7 +532,7 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch)
530 if (!ret) { 532 if (!ret) {
531 sch->q.qlen++; 533 sch->q.qlen++;
532 sch->qstats.requeues++; 534 sch->qstats.requeues++;
533 } else { 535 } else if (net_xmit_drop_count(ret)) {
534 sch->qstats.drops++; 536 sch->qstats.drops++;
535 p->link.qstats.drops++; 537 p->link.qstats.drops++;
536 } 538 }
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 14954bf4a683..4e261ce62f48 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -230,7 +230,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
230 (cl = cbq_class_lookup(q, prio)) != NULL) 230 (cl = cbq_class_lookup(q, prio)) != NULL)
231 return cl; 231 return cl;
232 232
233 *qerr = NET_XMIT_BYPASS; 233 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
234 for (;;) { 234 for (;;) {
235 int result = 0; 235 int result = 0;
236 defmap = head->defaults; 236 defmap = head->defaults;
@@ -256,7 +256,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
256 switch (result) { 256 switch (result) {
257 case TC_ACT_QUEUED: 257 case TC_ACT_QUEUED:
258 case TC_ACT_STOLEN: 258 case TC_ACT_STOLEN:
259 *qerr = NET_XMIT_SUCCESS; 259 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
260 case TC_ACT_SHOT: 260 case TC_ACT_SHOT:
261 return NULL; 261 return NULL;
262 case TC_ACT_RECLASSIFY: 262 case TC_ACT_RECLASSIFY:
@@ -377,7 +377,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
377 q->rx_class = cl; 377 q->rx_class = cl;
378#endif 378#endif
379 if (cl == NULL) { 379 if (cl == NULL) {
380 if (ret == NET_XMIT_BYPASS) 380 if (ret & __NET_XMIT_BYPASS)
381 sch->qstats.drops++; 381 sch->qstats.drops++;
382 kfree_skb(skb); 382 kfree_skb(skb);
383 return ret; 383 return ret;
@@ -397,9 +397,11 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
397 return ret; 397 return ret;
398 } 398 }
399 399
400 sch->qstats.drops++; 400 if (net_xmit_drop_count(ret)) {
401 cbq_mark_toplevel(q, cl); 401 sch->qstats.drops++;
402 cl->qstats.drops++; 402 cbq_mark_toplevel(q, cl);
403 cl->qstats.drops++;
404 }
403 return ret; 405 return ret;
404} 406}
405 407
@@ -430,8 +432,10 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
430 cbq_activate_class(cl); 432 cbq_activate_class(cl);
431 return 0; 433 return 0;
432 } 434 }
433 sch->qstats.drops++; 435 if (net_xmit_drop_count(ret)) {
434 cl->qstats.drops++; 436 sch->qstats.drops++;
437 cl->qstats.drops++;
438 }
435 return ret; 439 return ret;
436} 440}
437 441
@@ -664,13 +668,15 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
664 q->rx_class = NULL; 668 q->rx_class = NULL;
665 669
666 if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) { 670 if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) {
671 int ret;
667 672
668 cbq_mark_toplevel(q, cl); 673 cbq_mark_toplevel(q, cl);
669 674
670 q->rx_class = cl; 675 q->rx_class = cl;
671 cl->q->__parent = sch; 676 cl->q->__parent = sch;
672 677
673 if (qdisc_enqueue(skb, cl->q) == 0) { 678 ret = qdisc_enqueue(skb, cl->q);
679 if (ret == NET_XMIT_SUCCESS) {
674 sch->q.qlen++; 680 sch->q.qlen++;
675 sch->bstats.packets++; 681 sch->bstats.packets++;
676 sch->bstats.bytes += qdisc_pkt_len(skb); 682 sch->bstats.bytes += qdisc_pkt_len(skb);
@@ -678,7 +684,8 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
678 cbq_activate_class(cl); 684 cbq_activate_class(cl);
679 return 0; 685 return 0;
680 } 686 }
681 sch->qstats.drops++; 687 if (net_xmit_drop_count(ret))
688 sch->qstats.drops++;
682 return 0; 689 return 0;
683 } 690 }
684 691
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index a935676987e2..edd1298f85f6 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -236,7 +236,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
236 case TC_ACT_QUEUED: 236 case TC_ACT_QUEUED:
237 case TC_ACT_STOLEN: 237 case TC_ACT_STOLEN:
238 kfree_skb(skb); 238 kfree_skb(skb);
239 return NET_XMIT_SUCCESS; 239 return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
240 240
241 case TC_ACT_SHOT: 241 case TC_ACT_SHOT:
242 goto drop; 242 goto drop;
@@ -254,7 +254,8 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
254 254
255 err = qdisc_enqueue(skb, p->q); 255 err = qdisc_enqueue(skb, p->q);
256 if (err != NET_XMIT_SUCCESS) { 256 if (err != NET_XMIT_SUCCESS) {
257 sch->qstats.drops++; 257 if (net_xmit_drop_count(err))
258 sch->qstats.drops++;
258 return err; 259 return err;
259 } 260 }
260 261
@@ -267,7 +268,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
267drop: 268drop:
268 kfree_skb(skb); 269 kfree_skb(skb);
269 sch->qstats.drops++; 270 sch->qstats.drops++;
270 return NET_XMIT_BYPASS; 271 return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
271} 272}
272 273
273static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) 274static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
@@ -321,7 +322,8 @@ static int dsmark_requeue(struct sk_buff *skb, struct Qdisc *sch)
321 322
322 err = p->q->ops->requeue(skb, p->q); 323 err = p->q->ops->requeue(skb, p->q);
323 if (err != NET_XMIT_SUCCESS) { 324 if (err != NET_XMIT_SUCCESS) {
324 sch->qstats.drops++; 325 if (net_xmit_drop_count(err))
326 sch->qstats.drops++;
325 return err; 327 return err;
326 } 328 }
327 329
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index fd2a6cadb115..7cf83b37459d 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -29,7 +29,7 @@
29/* Main transmission queue. */ 29/* Main transmission queue. */
30 30
31/* Modifications to data participating in scheduling must be protected with 31/* Modifications to data participating in scheduling must be protected with
32 * qdisc_root_lock(qdisc) spinlock. 32 * qdisc_lock(qdisc) spinlock.
33 * 33 *
34 * The idea is the following: 34 * The idea is the following:
35 * - enqueue, dequeue are serialized via qdisc root lock 35 * - enqueue, dequeue are serialized via qdisc root lock
@@ -126,7 +126,7 @@ static inline int qdisc_restart(struct Qdisc *q)
126 if (unlikely((skb = dequeue_skb(q)) == NULL)) 126 if (unlikely((skb = dequeue_skb(q)) == NULL))
127 return 0; 127 return 0;
128 128
129 root_lock = qdisc_root_lock(q); 129 root_lock = qdisc_lock(q);
130 130
131 /* And release qdisc */ 131 /* And release qdisc */
132 spin_unlock(root_lock); 132 spin_unlock(root_lock);
@@ -135,7 +135,8 @@ static inline int qdisc_restart(struct Qdisc *q)
135 txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); 135 txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
136 136
137 HARD_TX_LOCK(dev, txq, smp_processor_id()); 137 HARD_TX_LOCK(dev, txq, smp_processor_id());
138 if (!netif_subqueue_stopped(dev, skb)) 138 if (!netif_tx_queue_stopped(txq) &&
139 !netif_tx_queue_frozen(txq))
139 ret = dev_hard_start_xmit(skb, dev, txq); 140 ret = dev_hard_start_xmit(skb, dev, txq);
140 HARD_TX_UNLOCK(dev, txq); 141 HARD_TX_UNLOCK(dev, txq);
141 142
@@ -162,7 +163,8 @@ static inline int qdisc_restart(struct Qdisc *q)
162 break; 163 break;
163 } 164 }
164 165
165 if (ret && netif_tx_queue_stopped(txq)) 166 if (ret && (netif_tx_queue_stopped(txq) ||
167 netif_tx_queue_frozen(txq)))
166 ret = 0; 168 ret = 0;
167 169
168 return ret; 170 return ret;
@@ -505,7 +507,7 @@ errout:
505} 507}
506EXPORT_SYMBOL(qdisc_create_dflt); 508EXPORT_SYMBOL(qdisc_create_dflt);
507 509
508/* Under qdisc_root_lock(qdisc) and BH! */ 510/* Under qdisc_lock(qdisc) and BH! */
509 511
510void qdisc_reset(struct Qdisc *qdisc) 512void qdisc_reset(struct Qdisc *qdisc)
511{ 513{
@@ -541,7 +543,7 @@ static void __qdisc_destroy(struct rcu_head *head)
541 kfree((char *) qdisc - qdisc->padded); 543 kfree((char *) qdisc - qdisc->padded);
542} 544}
543 545
544/* Under qdisc_root_lock(qdisc) and BH! */ 546/* Under qdisc_lock(qdisc) and BH! */
545 547
546void qdisc_destroy(struct Qdisc *qdisc) 548void qdisc_destroy(struct Qdisc *qdisc)
547{ 549{
@@ -596,7 +598,7 @@ static void transition_one_qdisc(struct net_device *dev,
596 int *need_watchdog_p = _need_watchdog; 598 int *need_watchdog_p = _need_watchdog;
597 599
598 rcu_assign_pointer(dev_queue->qdisc, new_qdisc); 600 rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
599 if (new_qdisc != &noqueue_qdisc) 601 if (need_watchdog_p && new_qdisc != &noqueue_qdisc)
600 *need_watchdog_p = 1; 602 *need_watchdog_p = 1;
601} 603}
602 604
@@ -619,6 +621,7 @@ void dev_activate(struct net_device *dev)
619 621
620 need_watchdog = 0; 622 need_watchdog = 0;
621 netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog); 623 netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog);
624 transition_one_qdisc(dev, &dev->rx_queue, NULL);
622 625
623 if (need_watchdog) { 626 if (need_watchdog) {
624 dev->trans_start = jiffies; 627 dev->trans_start = jiffies;
@@ -656,7 +659,7 @@ static bool some_qdisc_is_running(struct net_device *dev, int lock)
656 659
657 dev_queue = netdev_get_tx_queue(dev, i); 660 dev_queue = netdev_get_tx_queue(dev, i);
658 q = dev_queue->qdisc; 661 q = dev_queue->qdisc;
659 root_lock = qdisc_root_lock(q); 662 root_lock = qdisc_lock(q);
660 663
661 if (lock) 664 if (lock)
662 spin_lock_bh(root_lock); 665 spin_lock_bh(root_lock);
@@ -677,6 +680,7 @@ void dev_deactivate(struct net_device *dev)
677 bool running; 680 bool running;
678 681
679 netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc); 682 netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc);
683 dev_deactivate_queue(dev, &dev->rx_queue, &noop_qdisc);
680 684
681 dev_watchdog_down(dev); 685 dev_watchdog_down(dev);
682 686
@@ -718,7 +722,7 @@ static void dev_init_scheduler_queue(struct net_device *dev,
718void dev_init_scheduler(struct net_device *dev) 722void dev_init_scheduler(struct net_device *dev)
719{ 723{
720 netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc); 724 netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc);
721 dev_init_scheduler_queue(dev, &dev->rx_queue, NULL); 725 dev_init_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc);
722 726
723 setup_timer(&dev->watchdog_timer, dev_watchdog, (unsigned long)dev); 727 setup_timer(&dev->watchdog_timer, dev_watchdog, (unsigned long)dev);
724} 728}
@@ -731,7 +735,7 @@ static void shutdown_scheduler_queue(struct net_device *dev,
731 struct Qdisc *qdisc_default = _qdisc_default; 735 struct Qdisc *qdisc_default = _qdisc_default;
732 736
733 if (qdisc) { 737 if (qdisc) {
734 spinlock_t *root_lock = qdisc_root_lock(qdisc); 738 spinlock_t *root_lock = qdisc_lock(qdisc);
735 739
736 dev_queue->qdisc = qdisc_default; 740 dev_queue->qdisc = qdisc_default;
737 dev_queue->qdisc_sleeping = qdisc_default; 741 dev_queue->qdisc_sleeping = qdisc_default;
@@ -745,6 +749,6 @@ static void shutdown_scheduler_queue(struct net_device *dev,
745void dev_shutdown(struct net_device *dev) 749void dev_shutdown(struct net_device *dev)
746{ 750{
747 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); 751 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
748 shutdown_scheduler_queue(dev, &dev->rx_queue, NULL); 752 shutdown_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc);
749 WARN_ON(timer_pending(&dev->watchdog_timer)); 753 WARN_ON(timer_pending(&dev->watchdog_timer));
750} 754}
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 0ae7d19dcba8..c2b8d9cce3d2 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1159,14 +1159,14 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
1159 if (cl->level == 0) 1159 if (cl->level == 0)
1160 return cl; 1160 return cl;
1161 1161
1162 *qerr = NET_XMIT_BYPASS; 1162 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
1163 tcf = q->root.filter_list; 1163 tcf = q->root.filter_list;
1164 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 1164 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
1165#ifdef CONFIG_NET_CLS_ACT 1165#ifdef CONFIG_NET_CLS_ACT
1166 switch (result) { 1166 switch (result) {
1167 case TC_ACT_QUEUED: 1167 case TC_ACT_QUEUED:
1168 case TC_ACT_STOLEN: 1168 case TC_ACT_STOLEN:
1169 *qerr = NET_XMIT_SUCCESS; 1169 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
1170 case TC_ACT_SHOT: 1170 case TC_ACT_SHOT:
1171 return NULL; 1171 return NULL;
1172 } 1172 }
@@ -1578,7 +1578,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1578 1578
1579 cl = hfsc_classify(skb, sch, &err); 1579 cl = hfsc_classify(skb, sch, &err);
1580 if (cl == NULL) { 1580 if (cl == NULL) {
1581 if (err == NET_XMIT_BYPASS) 1581 if (err & __NET_XMIT_BYPASS)
1582 sch->qstats.drops++; 1582 sch->qstats.drops++;
1583 kfree_skb(skb); 1583 kfree_skb(skb);
1584 return err; 1584 return err;
@@ -1586,8 +1586,10 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1586 1586
1587 err = qdisc_enqueue(skb, cl->qdisc); 1587 err = qdisc_enqueue(skb, cl->qdisc);
1588 if (unlikely(err != NET_XMIT_SUCCESS)) { 1588 if (unlikely(err != NET_XMIT_SUCCESS)) {
1589 cl->qstats.drops++; 1589 if (net_xmit_drop_count(err)) {
1590 sch->qstats.drops++; 1590 cl->qstats.drops++;
1591 sch->qstats.drops++;
1592 }
1591 return err; 1593 return err;
1592 } 1594 }
1593 1595
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 75a40951c4f2..be35422711a3 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -214,14 +214,14 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
214 if ((cl = htb_find(skb->priority, sch)) != NULL && cl->level == 0) 214 if ((cl = htb_find(skb->priority, sch)) != NULL && cl->level == 0)
215 return cl; 215 return cl;
216 216
217 *qerr = NET_XMIT_BYPASS; 217 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
218 tcf = q->filter_list; 218 tcf = q->filter_list;
219 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 219 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
220#ifdef CONFIG_NET_CLS_ACT 220#ifdef CONFIG_NET_CLS_ACT
221 switch (result) { 221 switch (result) {
222 case TC_ACT_QUEUED: 222 case TC_ACT_QUEUED:
223 case TC_ACT_STOLEN: 223 case TC_ACT_STOLEN:
224 *qerr = NET_XMIT_SUCCESS; 224 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
225 case TC_ACT_SHOT: 225 case TC_ACT_SHOT:
226 return NULL; 226 return NULL;
227 } 227 }
@@ -567,14 +567,16 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
567 } 567 }
568#ifdef CONFIG_NET_CLS_ACT 568#ifdef CONFIG_NET_CLS_ACT
569 } else if (!cl) { 569 } else if (!cl) {
570 if (ret == NET_XMIT_BYPASS) 570 if (ret & __NET_XMIT_BYPASS)
571 sch->qstats.drops++; 571 sch->qstats.drops++;
572 kfree_skb(skb); 572 kfree_skb(skb);
573 return ret; 573 return ret;
574#endif 574#endif
575 } else if (qdisc_enqueue(skb, cl->un.leaf.q) != NET_XMIT_SUCCESS) { 575 } else if ((ret = qdisc_enqueue(skb, cl->un.leaf.q)) != NET_XMIT_SUCCESS) {
576 sch->qstats.drops++; 576 if (net_xmit_drop_count(ret)) {
577 cl->qstats.drops++; 577 sch->qstats.drops++;
578 cl->qstats.drops++;
579 }
578 return NET_XMIT_DROP; 580 return NET_XMIT_DROP;
579 } else { 581 } else {
580 cl->bstats.packets += 582 cl->bstats.packets +=
@@ -610,15 +612,17 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
610 } 612 }
611#ifdef CONFIG_NET_CLS_ACT 613#ifdef CONFIG_NET_CLS_ACT
612 } else if (!cl) { 614 } else if (!cl) {
613 if (ret == NET_XMIT_BYPASS) 615 if (ret & __NET_XMIT_BYPASS)
614 sch->qstats.drops++; 616 sch->qstats.drops++;
615 kfree_skb(skb); 617 kfree_skb(skb);
616 return ret; 618 return ret;
617#endif 619#endif
618 } else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) != 620 } else if ((ret = cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q)) !=
619 NET_XMIT_SUCCESS) { 621 NET_XMIT_SUCCESS) {
620 sch->qstats.drops++; 622 if (net_xmit_drop_count(ret)) {
621 cl->qstats.drops++; 623 sch->qstats.drops++;
624 cl->qstats.drops++;
625 }
622 return NET_XMIT_DROP; 626 return NET_XMIT_DROP;
623 } else 627 } else
624 htb_activate(q, cl); 628 htb_activate(q, cl);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index a59085700678..fb0294d0b55e 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -176,7 +176,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
176 if (count == 0) { 176 if (count == 0) {
177 sch->qstats.drops++; 177 sch->qstats.drops++;
178 kfree_skb(skb); 178 kfree_skb(skb);
179 return NET_XMIT_BYPASS; 179 return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
180 } 180 }
181 181
182 skb_orphan(skb); 182 skb_orphan(skb);
@@ -240,8 +240,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
240 sch->q.qlen++; 240 sch->q.qlen++;
241 sch->bstats.bytes += qdisc_pkt_len(skb); 241 sch->bstats.bytes += qdisc_pkt_len(skb);
242 sch->bstats.packets++; 242 sch->bstats.packets++;
243 } else 243 } else if (net_xmit_drop_count(ret)) {
244 sch->qstats.drops++; 244 sch->qstats.drops++;
245 }
245 246
246 pr_debug("netem: enqueue ret %d\n", ret); 247 pr_debug("netem: enqueue ret %d\n", ret);
247 return ret; 248 return ret;
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index f849243eb095..eac197610edf 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -38,14 +38,14 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
38 struct tcf_result res; 38 struct tcf_result res;
39 int err; 39 int err;
40 40
41 *qerr = NET_XMIT_BYPASS; 41 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
42 if (TC_H_MAJ(skb->priority) != sch->handle) { 42 if (TC_H_MAJ(skb->priority) != sch->handle) {
43 err = tc_classify(skb, q->filter_list, &res); 43 err = tc_classify(skb, q->filter_list, &res);
44#ifdef CONFIG_NET_CLS_ACT 44#ifdef CONFIG_NET_CLS_ACT
45 switch (err) { 45 switch (err) {
46 case TC_ACT_STOLEN: 46 case TC_ACT_STOLEN:
47 case TC_ACT_QUEUED: 47 case TC_ACT_QUEUED:
48 *qerr = NET_XMIT_SUCCESS; 48 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
49 case TC_ACT_SHOT: 49 case TC_ACT_SHOT:
50 return NULL; 50 return NULL;
51 } 51 }
@@ -74,7 +74,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
74#ifdef CONFIG_NET_CLS_ACT 74#ifdef CONFIG_NET_CLS_ACT
75 if (qdisc == NULL) { 75 if (qdisc == NULL) {
76 76
77 if (ret == NET_XMIT_BYPASS) 77 if (ret & __NET_XMIT_BYPASS)
78 sch->qstats.drops++; 78 sch->qstats.drops++;
79 kfree_skb(skb); 79 kfree_skb(skb);
80 return ret; 80 return ret;
@@ -88,7 +88,8 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
88 sch->q.qlen++; 88 sch->q.qlen++;
89 return NET_XMIT_SUCCESS; 89 return NET_XMIT_SUCCESS;
90 } 90 }
91 sch->qstats.drops++; 91 if (net_xmit_drop_count(ret))
92 sch->qstats.drops++;
92 return ret; 93 return ret;
93} 94}
94 95
@@ -102,7 +103,7 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
102 qdisc = prio_classify(skb, sch, &ret); 103 qdisc = prio_classify(skb, sch, &ret);
103#ifdef CONFIG_NET_CLS_ACT 104#ifdef CONFIG_NET_CLS_ACT
104 if (qdisc == NULL) { 105 if (qdisc == NULL) {
105 if (ret == NET_XMIT_BYPASS) 106 if (ret & __NET_XMIT_BYPASS)
106 sch->qstats.drops++; 107 sch->qstats.drops++;
107 kfree_skb(skb); 108 kfree_skb(skb);
108 return ret; 109 return ret;
@@ -114,7 +115,8 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
114 sch->qstats.requeues++; 115 sch->qstats.requeues++;
115 return 0; 116 return 0;
116 } 117 }
117 sch->qstats.drops++; 118 if (net_xmit_drop_count(ret))
119 sch->qstats.drops++;
118 return NET_XMIT_DROP; 120 return NET_XMIT_DROP;
119} 121}
120 122
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 3f2d1d7f3bbd..5da05839e225 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -97,7 +97,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
97 sch->bstats.bytes += qdisc_pkt_len(skb); 97 sch->bstats.bytes += qdisc_pkt_len(skb);
98 sch->bstats.packets++; 98 sch->bstats.packets++;
99 sch->q.qlen++; 99 sch->q.qlen++;
100 } else { 100 } else if (net_xmit_drop_count(ret)) {
101 q->stats.pdrop++; 101 q->stats.pdrop++;
102 sch->qstats.drops++; 102 sch->qstats.drops++;
103 } 103 }
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 8589da666568..6e041d10dbdb 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -171,14 +171,14 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
171 if (!q->filter_list) 171 if (!q->filter_list)
172 return sfq_hash(q, skb) + 1; 172 return sfq_hash(q, skb) + 1;
173 173
174 *qerr = NET_XMIT_BYPASS; 174 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
175 result = tc_classify(skb, q->filter_list, &res); 175 result = tc_classify(skb, q->filter_list, &res);
176 if (result >= 0) { 176 if (result >= 0) {
177#ifdef CONFIG_NET_CLS_ACT 177#ifdef CONFIG_NET_CLS_ACT
178 switch (result) { 178 switch (result) {
179 case TC_ACT_STOLEN: 179 case TC_ACT_STOLEN:
180 case TC_ACT_QUEUED: 180 case TC_ACT_QUEUED:
181 *qerr = NET_XMIT_SUCCESS; 181 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
182 case TC_ACT_SHOT: 182 case TC_ACT_SHOT:
183 return 0; 183 return 0;
184 } 184 }
@@ -285,7 +285,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
285 285
286 hash = sfq_classify(skb, sch, &ret); 286 hash = sfq_classify(skb, sch, &ret);
287 if (hash == 0) { 287 if (hash == 0) {
288 if (ret == NET_XMIT_BYPASS) 288 if (ret & __NET_XMIT_BYPASS)
289 sch->qstats.drops++; 289 sch->qstats.drops++;
290 kfree_skb(skb); 290 kfree_skb(skb);
291 return ret; 291 return ret;
@@ -339,7 +339,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc *sch)
339 339
340 hash = sfq_classify(skb, sch, &ret); 340 hash = sfq_classify(skb, sch, &ret);
341 if (hash == 0) { 341 if (hash == 0) {
342 if (ret == NET_XMIT_BYPASS) 342 if (ret & __NET_XMIT_BYPASS)
343 sch->qstats.drops++; 343 sch->qstats.drops++;
344 kfree_skb(skb); 344 kfree_skb(skb);
345 return ret; 345 return ret;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index b296672f7632..7d3b7ff3bf07 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -135,7 +135,8 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
135 135
136 ret = qdisc_enqueue(skb, q->qdisc); 136 ret = qdisc_enqueue(skb, q->qdisc);
137 if (ret != 0) { 137 if (ret != 0) {
138 sch->qstats.drops++; 138 if (net_xmit_drop_count(ret))
139 sch->qstats.drops++;
139 return ret; 140 return ret;
140 } 141 }
141 142
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 537223642b6e..2c35c678563b 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -305,10 +305,11 @@ restart:
305 305
306 switch (teql_resolve(skb, skb_res, slave)) { 306 switch (teql_resolve(skb, skb_res, slave)) {
307 case 0: 307 case 0:
308 if (netif_tx_trylock(slave)) { 308 if (__netif_tx_trylock(slave_txq)) {
309 if (!__netif_subqueue_stopped(slave, subq) && 309 if (!netif_tx_queue_stopped(slave_txq) &&
310 !netif_tx_queue_frozen(slave_txq) &&
310 slave->hard_start_xmit(skb, slave) == 0) { 311 slave->hard_start_xmit(skb, slave) == 0) {
311 netif_tx_unlock(slave); 312 __netif_tx_unlock(slave_txq);
312 master->slaves = NEXT_SLAVE(q); 313 master->slaves = NEXT_SLAVE(q);
313 netif_wake_queue(dev); 314 netif_wake_queue(dev);
314 master->stats.tx_packets++; 315 master->stats.tx_packets++;
@@ -316,7 +317,7 @@ restart:
316 qdisc_pkt_len(skb); 317 qdisc_pkt_len(skb);
317 return 0; 318 return 0;
318 } 319 }
319 netif_tx_unlock(slave); 320 __netif_tx_unlock(slave_txq);
320 } 321 }
321 if (netif_queue_stopped(dev)) 322 if (netif_queue_stopped(dev))
322 busy = 1; 323 busy = 1;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index a238d6834b33..483a01d0740a 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -195,8 +195,7 @@ out:
195} 195}
196 196
197/* Based on tcp_v6_xmit() in tcp_ipv6.c. */ 197/* Based on tcp_v6_xmit() in tcp_ipv6.c. */
198static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport, 198static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
199 int ipfragok)
200{ 199{
201 struct sock *sk = skb->sk; 200 struct sock *sk = skb->sk;
202 struct ipv6_pinfo *np = inet6_sk(sk); 201 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -231,7 +230,10 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
231 230
232 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 231 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
233 232
234 return ip6_xmit(sk, skb, &fl, np->opt, ipfragok); 233 if (!(transport->param_flags & SPP_PMTUD_ENABLE))
234 skb->local_df = 1;
235
236 return ip6_xmit(sk, skb, &fl, np->opt, 0);
235} 237}
236 238
237/* Returns the dst cache entry for the given source and destination ip 239/* Returns the dst cache entry for the given source and destination ip
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 45684646b1db..0dc4a7dfb234 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -586,10 +586,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
586 SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n", 586 SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n",
587 nskb->len); 587 nskb->len);
588 588
589 if (tp->param_flags & SPP_PMTUD_ENABLE) 589 nskb->local_df = packet->ipfragok;
590 (*tp->af_specific->sctp_xmit)(nskb, tp, packet->ipfragok); 590 (*tp->af_specific->sctp_xmit)(nskb, tp);
591 else
592 (*tp->af_specific->sctp_xmit)(nskb, tp, 1);
593 591
594out: 592out:
595 packet->size = packet->overhead; 593 packet->size = packet->overhead;
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index a6e0818bcff5..0b65354aaf64 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -862,16 +862,21 @@ static int sctp_inet_supported_addrs(const struct sctp_sock *opt,
862 862
863/* Wrapper routine that calls the ip transmit routine. */ 863/* Wrapper routine that calls the ip transmit routine. */
864static inline int sctp_v4_xmit(struct sk_buff *skb, 864static inline int sctp_v4_xmit(struct sk_buff *skb,
865 struct sctp_transport *transport, int ipfragok) 865 struct sctp_transport *transport)
866{ 866{
867 struct inet_sock *inet = inet_sk(skb->sk);
868
867 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " 869 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, "
868 "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", 870 "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n",
869 __func__, skb, skb->len, 871 __func__, skb, skb->len,
870 NIPQUAD(skb->rtable->rt_src), 872 NIPQUAD(skb->rtable->rt_src),
871 NIPQUAD(skb->rtable->rt_dst)); 873 NIPQUAD(skb->rtable->rt_dst));
872 874
875 inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ?
876 IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
877
873 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 878 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
874 return ip_queue_xmit(skb, ipfragok); 879 return ip_queue_xmit(skb, 0);
875} 880}
876 881
877static struct sctp_af sctp_af_inet; 882static struct sctp_af sctp_af_inet;
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 835d27413083..5a32cb7c4bb4 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -310,8 +310,7 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
310 switch (m->mode) { 310 switch (m->mode) {
311 case SVC_POOL_PERCPU: 311 case SVC_POOL_PERCPU:
312 { 312 {
313 cpumask_of_cpu_ptr(cpumask, node); 313 set_cpus_allowed_ptr(task, &cpumask_of_cpu(node));
314 set_cpus_allowed_ptr(task, cpumask);
315 break; 314 break;
316 } 315 }
317 case SVC_POOL_PERNODE: 316 case SVC_POOL_PERNODE:
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b7fefffd2d0d..59eb2cf42e5f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -29,16 +29,16 @@ static struct genl_family nl80211_fam = {
29}; 29};
30 30
31/* internal helper: get drv and dev */ 31/* internal helper: get drv and dev */
32static int get_drv_dev_by_info_ifindex(struct genl_info *info, 32static int get_drv_dev_by_info_ifindex(struct nlattr **attrs,
33 struct cfg80211_registered_device **drv, 33 struct cfg80211_registered_device **drv,
34 struct net_device **dev) 34 struct net_device **dev)
35{ 35{
36 int ifindex; 36 int ifindex;
37 37
38 if (!info->attrs[NL80211_ATTR_IFINDEX]) 38 if (!attrs[NL80211_ATTR_IFINDEX])
39 return -EINVAL; 39 return -EINVAL;
40 40
41 ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); 41 ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
42 *dev = dev_get_by_index(&init_net, ifindex); 42 *dev = dev_get_by_index(&init_net, ifindex);
43 if (!*dev) 43 if (!*dev)
44 return -ENODEV; 44 return -ENODEV;
@@ -291,21 +291,31 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
291 291
292 mutex_lock(&cfg80211_drv_mutex); 292 mutex_lock(&cfg80211_drv_mutex);
293 list_for_each_entry(dev, &cfg80211_drv_list, list) { 293 list_for_each_entry(dev, &cfg80211_drv_list, list) {
294 if (++wp_idx < wp_start) 294 if (wp_idx < wp_start) {
295 wp_idx++;
295 continue; 296 continue;
297 }
296 if_idx = 0; 298 if_idx = 0;
297 299
298 mutex_lock(&dev->devlist_mtx); 300 mutex_lock(&dev->devlist_mtx);
299 list_for_each_entry(wdev, &dev->netdev_list, list) { 301 list_for_each_entry(wdev, &dev->netdev_list, list) {
300 if (++if_idx < if_start) 302 if (if_idx < if_start) {
303 if_idx++;
301 continue; 304 continue;
305 }
302 if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid, 306 if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid,
303 cb->nlh->nlmsg_seq, NLM_F_MULTI, 307 cb->nlh->nlmsg_seq, NLM_F_MULTI,
304 wdev->netdev) < 0) 308 wdev->netdev) < 0) {
305 break; 309 mutex_unlock(&dev->devlist_mtx);
310 goto out;
311 }
312 if_idx++;
306 } 313 }
307 mutex_unlock(&dev->devlist_mtx); 314 mutex_unlock(&dev->devlist_mtx);
315
316 wp_idx++;
308 } 317 }
318 out:
309 mutex_unlock(&cfg80211_drv_mutex); 319 mutex_unlock(&cfg80211_drv_mutex);
310 320
311 cb->args[0] = wp_idx; 321 cb->args[0] = wp_idx;
@@ -321,7 +331,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
321 struct net_device *netdev; 331 struct net_device *netdev;
322 int err; 332 int err;
323 333
324 err = get_drv_dev_by_info_ifindex(info, &dev, &netdev); 334 err = get_drv_dev_by_info_ifindex(info->attrs, &dev, &netdev);
325 if (err) 335 if (err)
326 return err; 336 return err;
327 337
@@ -392,7 +402,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
392 } else 402 } else
393 return -EINVAL; 403 return -EINVAL;
394 404
395 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 405 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
396 if (err) 406 if (err)
397 return err; 407 return err;
398 ifindex = dev->ifindex; 408 ifindex = dev->ifindex;
@@ -477,7 +487,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
477 int ifindex, err; 487 int ifindex, err;
478 struct net_device *dev; 488 struct net_device *dev;
479 489
480 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 490 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
481 if (err) 491 if (err)
482 return err; 492 return err;
483 ifindex = dev->ifindex; 493 ifindex = dev->ifindex;
@@ -545,7 +555,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
545 if (info->attrs[NL80211_ATTR_MAC]) 555 if (info->attrs[NL80211_ATTR_MAC])
546 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 556 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
547 557
548 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 558 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
549 if (err) 559 if (err)
550 return err; 560 return err;
551 561
@@ -618,7 +628,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
618 if (!info->attrs[NL80211_ATTR_KEY_DEFAULT]) 628 if (!info->attrs[NL80211_ATTR_KEY_DEFAULT])
619 return -EINVAL; 629 return -EINVAL;
620 630
621 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 631 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
622 if (err) 632 if (err)
623 return err; 633 return err;
624 634
@@ -699,7 +709,7 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
699 return -EINVAL; 709 return -EINVAL;
700 } 710 }
701 711
702 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 712 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
703 if (err) 713 if (err)
704 return err; 714 return err;
705 715
@@ -735,7 +745,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
735 if (info->attrs[NL80211_ATTR_MAC]) 745 if (info->attrs[NL80211_ATTR_MAC])
736 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 746 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
737 747
738 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 748 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
739 if (err) 749 if (err)
740 return err; 750 return err;
741 751
@@ -764,7 +774,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)
764 struct beacon_parameters params; 774 struct beacon_parameters params;
765 int haveinfo = 0; 775 int haveinfo = 0;
766 776
767 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 777 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
768 if (err) 778 if (err)
769 return err; 779 return err;
770 780
@@ -843,7 +853,7 @@ static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info)
843 int err; 853 int err;
844 struct net_device *dev; 854 struct net_device *dev;
845 855
846 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 856 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
847 if (err) 857 if (err)
848 return err; 858 return err;
849 859
@@ -937,67 +947,78 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
937} 947}
938 948
939static int nl80211_dump_station(struct sk_buff *skb, 949static int nl80211_dump_station(struct sk_buff *skb,
940 struct netlink_callback *cb) 950 struct netlink_callback *cb)
941{ 951{
942 int wp_idx = 0;
943 int if_idx = 0;
944 int sta_idx = cb->args[2];
945 int wp_start = cb->args[0];
946 int if_start = cb->args[1];
947 struct station_info sinfo; 952 struct station_info sinfo;
948 struct cfg80211_registered_device *dev; 953 struct cfg80211_registered_device *dev;
949 struct wireless_dev *wdev; 954 struct net_device *netdev;
950 u8 mac_addr[ETH_ALEN]; 955 u8 mac_addr[ETH_ALEN];
956 int ifidx = cb->args[0];
957 int sta_idx = cb->args[1];
951 int err; 958 int err;
952 int exit = 0;
953 959
954 /* TODO: filter by device */ 960 if (!ifidx) {
955 mutex_lock(&cfg80211_drv_mutex); 961 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
956 list_for_each_entry(dev, &cfg80211_drv_list, list) { 962 nl80211_fam.attrbuf, nl80211_fam.maxattr,
957 if (exit) 963 nl80211_policy);
964 if (err)
965 return err;
966
967 if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
968 return -EINVAL;
969
970 ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
971 if (!ifidx)
972 return -EINVAL;
973 }
974
975 netdev = dev_get_by_index(&init_net, ifidx);
976 if (!netdev)
977 return -ENODEV;
978
979 dev = cfg80211_get_dev_from_ifindex(ifidx);
980 if (IS_ERR(dev)) {
981 err = PTR_ERR(dev);
982 goto out_put_netdev;
983 }
984
985 if (!dev->ops->dump_station) {
986 err = -ENOSYS;
987 goto out_err;
988 }
989
990 rtnl_lock();
991
992 while (1) {
993 err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
994 mac_addr, &sinfo);
995 if (err == -ENOENT)
958 break; 996 break;
959 if (++wp_idx < wp_start) 997 if (err)
960 continue; 998 goto out_err_rtnl;
961 if_idx = 0;
962 999
963 mutex_lock(&dev->devlist_mtx); 1000 if (nl80211_send_station(skb,
964 list_for_each_entry(wdev, &dev->netdev_list, list) { 1001 NETLINK_CB(cb->skb).pid,
965 if (exit) 1002 cb->nlh->nlmsg_seq, NLM_F_MULTI,
966 break; 1003 netdev, mac_addr,
967 if (++if_idx < if_start) 1004 &sinfo) < 0)
968 continue; 1005 goto out;
969 if (!dev->ops->dump_station)
970 continue;
971 1006
972 for (;; ++sta_idx) { 1007 sta_idx++;
973 rtnl_lock();
974 err = dev->ops->dump_station(&dev->wiphy,
975 wdev->netdev, sta_idx, mac_addr,
976 &sinfo);
977 rtnl_unlock();
978 if (err) {
979 sta_idx = 0;
980 break;
981 }
982 if (nl80211_send_station(skb,
983 NETLINK_CB(cb->skb).pid,
984 cb->nlh->nlmsg_seq, NLM_F_MULTI,
985 wdev->netdev, mac_addr,
986 &sinfo) < 0) {
987 exit = 1;
988 break;
989 }
990 }
991 }
992 mutex_unlock(&dev->devlist_mtx);
993 } 1008 }
994 mutex_unlock(&cfg80211_drv_mutex);
995 1009
996 cb->args[0] = wp_idx;
997 cb->args[1] = if_idx;
998 cb->args[2] = sta_idx;
999 1010
1000 return skb->len; 1011 out:
1012 cb->args[1] = sta_idx;
1013 err = skb->len;
1014 out_err_rtnl:
1015 rtnl_unlock();
1016 out_err:
1017 cfg80211_put_dev(dev);
1018 out_put_netdev:
1019 dev_put(netdev);
1020
1021 return err;
1001} 1022}
1002 1023
1003static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) 1024static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
@@ -1016,7 +1037,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
1016 1037
1017 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 1038 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
1018 1039
1019 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1040 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1020 if (err) 1041 if (err)
1021 return err; 1042 return err;
1022 1043
@@ -1112,7 +1133,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
1112 params.plink_action = 1133 params.plink_action =
1113 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); 1134 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]);
1114 1135
1115 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1136 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1116 if (err) 1137 if (err)
1117 return err; 1138 return err;
1118 1139
@@ -1172,7 +1193,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
1172 &params.station_flags)) 1193 &params.station_flags))
1173 return -EINVAL; 1194 return -EINVAL;
1174 1195
1175 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1196 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1176 if (err) 1197 if (err)
1177 return err; 1198 return err;
1178 1199
@@ -1207,7 +1228,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
1207 if (info->attrs[NL80211_ATTR_MAC]) 1228 if (info->attrs[NL80211_ATTR_MAC])
1208 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 1229 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
1209 1230
1210 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1231 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1211 if (err) 1232 if (err)
1212 return err; 1233 return err;
1213 1234
@@ -1277,68 +1298,78 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq,
1277} 1298}
1278 1299
1279static int nl80211_dump_mpath(struct sk_buff *skb, 1300static int nl80211_dump_mpath(struct sk_buff *skb,
1280 struct netlink_callback *cb) 1301 struct netlink_callback *cb)
1281{ 1302{
1282 int wp_idx = 0;
1283 int if_idx = 0;
1284 int sta_idx = cb->args[2];
1285 int wp_start = cb->args[0];
1286 int if_start = cb->args[1];
1287 struct mpath_info pinfo; 1303 struct mpath_info pinfo;
1288 struct cfg80211_registered_device *dev; 1304 struct cfg80211_registered_device *dev;
1289 struct wireless_dev *wdev; 1305 struct net_device *netdev;
1290 u8 dst[ETH_ALEN]; 1306 u8 dst[ETH_ALEN];
1291 u8 next_hop[ETH_ALEN]; 1307 u8 next_hop[ETH_ALEN];
1308 int ifidx = cb->args[0];
1309 int path_idx = cb->args[1];
1292 int err; 1310 int err;
1293 int exit = 0;
1294 1311
1295 /* TODO: filter by device */ 1312 if (!ifidx) {
1296 mutex_lock(&cfg80211_drv_mutex); 1313 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
1297 list_for_each_entry(dev, &cfg80211_drv_list, list) { 1314 nl80211_fam.attrbuf, nl80211_fam.maxattr,
1298 if (exit) 1315 nl80211_policy);
1316 if (err)
1317 return err;
1318
1319 if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
1320 return -EINVAL;
1321
1322 ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
1323 if (!ifidx)
1324 return -EINVAL;
1325 }
1326
1327 netdev = dev_get_by_index(&init_net, ifidx);
1328 if (!netdev)
1329 return -ENODEV;
1330
1331 dev = cfg80211_get_dev_from_ifindex(ifidx);
1332 if (IS_ERR(dev)) {
1333 err = PTR_ERR(dev);
1334 goto out_put_netdev;
1335 }
1336
1337 if (!dev->ops->dump_mpath) {
1338 err = -ENOSYS;
1339 goto out_err;
1340 }
1341
1342 rtnl_lock();
1343
1344 while (1) {
1345 err = dev->ops->dump_mpath(&dev->wiphy, netdev, path_idx,
1346 dst, next_hop, &pinfo);
1347 if (err == -ENOENT)
1299 break; 1348 break;
1300 if (++wp_idx < wp_start) 1349 if (err)
1301 continue; 1350 goto out_err_rtnl;
1302 if_idx = 0;
1303 1351
1304 mutex_lock(&dev->devlist_mtx); 1352 if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid,
1305 list_for_each_entry(wdev, &dev->netdev_list, list) { 1353 cb->nlh->nlmsg_seq, NLM_F_MULTI,
1306 if (exit) 1354 netdev, dst, next_hop,
1307 break; 1355 &pinfo) < 0)
1308 if (++if_idx < if_start) 1356 goto out;
1309 continue;
1310 if (!dev->ops->dump_mpath)
1311 continue;
1312 1357
1313 for (;; ++sta_idx) { 1358 path_idx++;
1314 rtnl_lock();
1315 err = dev->ops->dump_mpath(&dev->wiphy,
1316 wdev->netdev, sta_idx, dst,
1317 next_hop, &pinfo);
1318 rtnl_unlock();
1319 if (err) {
1320 sta_idx = 0;
1321 break;
1322 }
1323 if (nl80211_send_mpath(skb,
1324 NETLINK_CB(cb->skb).pid,
1325 cb->nlh->nlmsg_seq, NLM_F_MULTI,
1326 wdev->netdev, dst, next_hop,
1327 &pinfo) < 0) {
1328 exit = 1;
1329 break;
1330 }
1331 }
1332 }
1333 mutex_unlock(&dev->devlist_mtx);
1334 } 1359 }
1335 mutex_unlock(&cfg80211_drv_mutex);
1336 1360
1337 cb->args[0] = wp_idx;
1338 cb->args[1] = if_idx;
1339 cb->args[2] = sta_idx;
1340 1361
1341 return skb->len; 1362 out:
1363 cb->args[1] = path_idx;
1364 err = skb->len;
1365 out_err_rtnl:
1366 rtnl_unlock();
1367 out_err:
1368 cfg80211_put_dev(dev);
1369 out_put_netdev:
1370 dev_put(netdev);
1371
1372 return err;
1342} 1373}
1343 1374
1344static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) 1375static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
@@ -1358,7 +1389,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
1358 1389
1359 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1390 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1360 1391
1361 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1392 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1362 if (err) 1393 if (err)
1363 return err; 1394 return err;
1364 1395
@@ -1411,7 +1442,7 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
1411 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1442 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1412 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); 1443 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]);
1413 1444
1414 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1445 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1415 if (err) 1446 if (err)
1416 return err; 1447 return err;
1417 1448
@@ -1446,7 +1477,7 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
1446 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1477 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1447 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); 1478 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]);
1448 1479
1449 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1480 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1450 if (err) 1481 if (err)
1451 return err; 1482 return err;
1452 1483
@@ -1475,7 +1506,7 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
1475 if (info->attrs[NL80211_ATTR_MAC]) 1506 if (info->attrs[NL80211_ATTR_MAC])
1476 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1507 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1477 1508
1478 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1509 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1479 if (err) 1510 if (err)
1480 return err; 1511 return err;
1481 1512