diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-11 02:59:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-11 02:59:21 -0400 |
commit | cf206bffbb7542df54043fad9898113172af99d8 (patch) | |
tree | c7e7ca9a93443b888f98a0c07e74751a1aa3c947 /net | |
parent | c1955a3d4762e7a9bf84035eb3c4886a900f0d15 (diff) | |
parent | 796aadeb1b2db9b5d463946766c5bbfd7717158c (diff) |
Merge branch 'linus' into sched/clock
Diffstat (limited to 'net')
71 files changed, 1066 insertions, 751 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 | ||
5 | menu "Networking" | 5 | menuconfig NET |
6 | |||
7 | config 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 | ||
26 | if NET | 23 | if NET |
27 | 24 | ||
28 | menu "Networking options" | 25 | menu "Networking options" |
@@ -252,5 +249,3 @@ source "net/rfkill/Kconfig" | |||
252 | source "net/9p/Kconfig" | 249 | source "net/9p/Kconfig" |
253 | 250 | ||
254 | endif # if NET | 251 | endif # if NET |
255 | endmenu # 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 | |||
62 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); | 62 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); |
63 | static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); | 63 | static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); |
64 | 64 | ||
65 | static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac, | 65 | static 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); | ||
67 | static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry); | 69 | static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry); |
68 | 70 | ||
69 | static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc); | 71 | static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc); |
70 | static void mpoad_close(struct atm_vcc *vcc); | 72 | static void mpoad_close(struct atm_vcc *vcc); |
71 | static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb); | 73 | static 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 | */ |
354 | static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr, | 356 | static 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 | */ |
433 | static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac, | 435 | static 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 | ||
814 | static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc) | 818 | static 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 | |||
39 | static const ctl_table ax25_param_table[] = { | 40 | static 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/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 021172c0e666..12bba6207a8d 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -57,7 +57,10 @@ | |||
57 | #define BT_DBG(D...) | 57 | #define BT_DBG(D...) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #define VERSION "1.2" | 60 | #define VERSION "1.3" |
61 | |||
62 | static int compress_src = 1; | ||
63 | static int compress_dst = 1; | ||
61 | 64 | ||
62 | static LIST_HEAD(bnep_session_list); | 65 | static LIST_HEAD(bnep_session_list); |
63 | static DECLARE_RWSEM(bnep_session_sem); | 66 | static DECLARE_RWSEM(bnep_session_sem); |
@@ -418,10 +421,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb) | |||
418 | iv[il++] = (struct kvec) { &type, 1 }; | 421 | iv[il++] = (struct kvec) { &type, 1 }; |
419 | len++; | 422 | len++; |
420 | 423 | ||
421 | if (!compare_ether_addr(eh->h_dest, s->eh.h_source)) | 424 | if (compress_src && !compare_ether_addr(eh->h_dest, s->eh.h_source)) |
422 | type |= 0x01; | 425 | type |= 0x01; |
423 | 426 | ||
424 | if (!compare_ether_addr(eh->h_source, s->eh.h_dest)) | 427 | if (compress_dst && !compare_ether_addr(eh->h_source, s->eh.h_dest)) |
425 | type |= 0x02; | 428 | type |= 0x02; |
426 | 429 | ||
427 | if (type) | 430 | if (type) |
@@ -727,6 +730,12 @@ static void __exit bnep_exit(void) | |||
727 | module_init(bnep_init); | 730 | module_init(bnep_init); |
728 | module_exit(bnep_exit); | 731 | module_exit(bnep_exit); |
729 | 732 | ||
733 | module_param(compress_src, bool, 0644); | ||
734 | MODULE_PARM_DESC(compress_src, "Compress sources headers"); | ||
735 | |||
736 | module_param(compress_dst, bool, 0644); | ||
737 | MODULE_PARM_DESC(compress_dst, "Compress destination headers"); | ||
738 | |||
730 | MODULE_AUTHOR("David Libault <david.libault@inventel.fr>, Maxim Krasnyansky <maxk@qualcomm.com>"); | 739 | MODULE_AUTHOR("David Libault <david.libault@inventel.fr>, Maxim Krasnyansky <maxk@qualcomm.com>"); |
731 | MODULE_DESCRIPTION("Bluetooth BNEP ver " VERSION); | 740 | MODULE_DESCRIPTION("Bluetooth BNEP ver " VERSION); |
732 | MODULE_VERSION(VERSION); | 741 | MODULE_VERSION(VERSION); |
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 | ||
69 | static int br_change_mtu(struct net_device *dev, int new_mtu) | 69 | static 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. |
112 | static struct net_device __fake_net_device = { | 110 | */ |
113 | .hard_header_len = ETH_HLEN, | 111 | void 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 | ||
119 | static 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, | 122 | static 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 | ||
132 | static inline struct net_device *bridge_parent(const struct net_device *dev) | 129 | static 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 |
198 | extern int br_netfilter_init(void); | 202 | extern int br_netfilter_init(void); |
199 | extern void br_netfilter_fini(void); | 203 | extern void br_netfilter_fini(void); |
204 | extern 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 */ |
369 | static void br_make_forwarding(struct net_bridge_port *p) | 369 | static 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..600bb23c4c2e 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) { |
1911 | enqueue: | 1910 | enqueue: |
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; |
@@ -1941,22 +1939,6 @@ int netif_rx_ni(struct sk_buff *skb) | |||
1941 | 1939 | ||
1942 | EXPORT_SYMBOL(netif_rx_ni); | 1940 | EXPORT_SYMBOL(netif_rx_ni); |
1943 | 1941 | ||
1944 | static inline struct net_device *skb_bond(struct sk_buff *skb) | ||
1945 | { | ||
1946 | struct net_device *dev = skb->dev; | ||
1947 | |||
1948 | if (dev->master) { | ||
1949 | if (skb_bond_should_drop(skb)) { | ||
1950 | kfree_skb(skb); | ||
1951 | return NULL; | ||
1952 | } | ||
1953 | skb->dev = dev->master; | ||
1954 | } | ||
1955 | |||
1956 | return dev; | ||
1957 | } | ||
1958 | |||
1959 | |||
1960 | static void net_tx_action(struct softirq_action *h) | 1942 | static void net_tx_action(struct softirq_action *h) |
1961 | { | 1943 | { |
1962 | struct softnet_data *sd = &__get_cpu_var(softnet_data); | 1944 | struct softnet_data *sd = &__get_cpu_var(softnet_data); |
@@ -1995,7 +1977,7 @@ static void net_tx_action(struct softirq_action *h) | |||
1995 | smp_mb__before_clear_bit(); | 1977 | smp_mb__before_clear_bit(); |
1996 | clear_bit(__QDISC_STATE_SCHED, &q->state); | 1978 | clear_bit(__QDISC_STATE_SCHED, &q->state); |
1997 | 1979 | ||
1998 | root_lock = qdisc_root_lock(q); | 1980 | root_lock = qdisc_lock(q); |
1999 | if (spin_trylock(root_lock)) { | 1981 | if (spin_trylock(root_lock)) { |
2000 | qdisc_run(q); | 1982 | qdisc_run(q); |
2001 | spin_unlock(root_lock); | 1983 | spin_unlock(root_lock); |
@@ -2100,7 +2082,7 @@ static int ing_filter(struct sk_buff *skb) | |||
2100 | rxq = &dev->rx_queue; | 2082 | rxq = &dev->rx_queue; |
2101 | 2083 | ||
2102 | q = rxq->qdisc; | 2084 | q = rxq->qdisc; |
2103 | if (q) { | 2085 | if (q != &noop_qdisc) { |
2104 | spin_lock(qdisc_lock(q)); | 2086 | spin_lock(qdisc_lock(q)); |
2105 | result = qdisc_enqueue_root(skb, q); | 2087 | result = qdisc_enqueue_root(skb, q); |
2106 | spin_unlock(qdisc_lock(q)); | 2088 | spin_unlock(qdisc_lock(q)); |
@@ -2113,7 +2095,7 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb, | |||
2113 | struct packet_type **pt_prev, | 2095 | struct packet_type **pt_prev, |
2114 | int *ret, struct net_device *orig_dev) | 2096 | int *ret, struct net_device *orig_dev) |
2115 | { | 2097 | { |
2116 | if (!skb->dev->rx_queue.qdisc) | 2098 | if (skb->dev->rx_queue.qdisc == &noop_qdisc) |
2117 | goto out; | 2099 | goto out; |
2118 | 2100 | ||
2119 | if (*pt_prev) { | 2101 | if (*pt_prev) { |
@@ -2183,6 +2165,7 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2183 | { | 2165 | { |
2184 | struct packet_type *ptype, *pt_prev; | 2166 | struct packet_type *ptype, *pt_prev; |
2185 | struct net_device *orig_dev; | 2167 | struct net_device *orig_dev; |
2168 | struct net_device *null_or_orig; | ||
2186 | int ret = NET_RX_DROP; | 2169 | int ret = NET_RX_DROP; |
2187 | __be16 type; | 2170 | __be16 type; |
2188 | 2171 | ||
@@ -2196,10 +2179,14 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2196 | if (!skb->iif) | 2179 | if (!skb->iif) |
2197 | skb->iif = skb->dev->ifindex; | 2180 | skb->iif = skb->dev->ifindex; |
2198 | 2181 | ||
2199 | orig_dev = skb_bond(skb); | 2182 | null_or_orig = NULL; |
2200 | 2183 | orig_dev = skb->dev; | |
2201 | if (!orig_dev) | 2184 | if (orig_dev->master) { |
2202 | return NET_RX_DROP; | 2185 | if (skb_bond_should_drop(skb)) |
2186 | null_or_orig = orig_dev; /* deliver only exact match */ | ||
2187 | else | ||
2188 | skb->dev = orig_dev->master; | ||
2189 | } | ||
2203 | 2190 | ||
2204 | __get_cpu_var(netdev_rx_stat).total++; | 2191 | __get_cpu_var(netdev_rx_stat).total++; |
2205 | 2192 | ||
@@ -2223,7 +2210,8 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2223 | #endif | 2210 | #endif |
2224 | 2211 | ||
2225 | list_for_each_entry_rcu(ptype, &ptype_all, list) { | 2212 | list_for_each_entry_rcu(ptype, &ptype_all, list) { |
2226 | if (!ptype->dev || ptype->dev == skb->dev) { | 2213 | if (ptype->dev == null_or_orig || ptype->dev == skb->dev || |
2214 | ptype->dev == orig_dev) { | ||
2227 | if (pt_prev) | 2215 | if (pt_prev) |
2228 | ret = deliver_skb(skb, pt_prev, orig_dev); | 2216 | ret = deliver_skb(skb, pt_prev, orig_dev); |
2229 | pt_prev = ptype; | 2217 | pt_prev = ptype; |
@@ -2248,7 +2236,8 @@ ncls: | |||
2248 | list_for_each_entry_rcu(ptype, | 2236 | list_for_each_entry_rcu(ptype, |
2249 | &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) { | 2237 | &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) { |
2250 | if (ptype->type == type && | 2238 | if (ptype->type == type && |
2251 | (!ptype->dev || ptype->dev == skb->dev)) { | 2239 | (ptype->dev == null_or_orig || ptype->dev == skb->dev || |
2240 | ptype->dev == orig_dev)) { | ||
2252 | if (pt_prev) | 2241 | if (pt_prev) |
2253 | ret = deliver_skb(skb, pt_prev, orig_dev); | 2242 | ret = deliver_skb(skb, pt_prev, orig_dev); |
2254 | pt_prev = ptype; | 2243 | pt_prev = ptype; |
@@ -2270,6 +2259,20 @@ out: | |||
2270 | return ret; | 2259 | return ret; |
2271 | } | 2260 | } |
2272 | 2261 | ||
2262 | /* Network device is going away, flush any packets still pending */ | ||
2263 | static void flush_backlog(void *arg) | ||
2264 | { | ||
2265 | struct net_device *dev = arg; | ||
2266 | struct softnet_data *queue = &__get_cpu_var(softnet_data); | ||
2267 | struct sk_buff *skb, *tmp; | ||
2268 | |||
2269 | skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp) | ||
2270 | if (skb->dev == dev) { | ||
2271 | __skb_unlink(skb, &queue->input_pkt_queue); | ||
2272 | kfree_skb(skb); | ||
2273 | } | ||
2274 | } | ||
2275 | |||
2273 | static int process_backlog(struct napi_struct *napi, int quota) | 2276 | static int process_backlog(struct napi_struct *napi, int quota) |
2274 | { | 2277 | { |
2275 | int work = 0; | 2278 | int work = 0; |
@@ -2279,7 +2282,6 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
2279 | napi->weight = weight_p; | 2282 | napi->weight = weight_p; |
2280 | do { | 2283 | do { |
2281 | struct sk_buff *skb; | 2284 | struct sk_buff *skb; |
2282 | struct net_device *dev; | ||
2283 | 2285 | ||
2284 | local_irq_disable(); | 2286 | local_irq_disable(); |
2285 | skb = __skb_dequeue(&queue->input_pkt_queue); | 2287 | skb = __skb_dequeue(&queue->input_pkt_queue); |
@@ -2288,14 +2290,9 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
2288 | local_irq_enable(); | 2290 | local_irq_enable(); |
2289 | break; | 2291 | break; |
2290 | } | 2292 | } |
2291 | |||
2292 | local_irq_enable(); | 2293 | local_irq_enable(); |
2293 | 2294 | ||
2294 | dev = skb->dev; | ||
2295 | |||
2296 | netif_receive_skb(skb); | 2295 | netif_receive_skb(skb); |
2297 | |||
2298 | dev_put(dev); | ||
2299 | } while (++work < quota && jiffies == start_time); | 2296 | } while (++work < quota && jiffies == start_time); |
2300 | 2297 | ||
2301 | return work; | 2298 | return work; |
@@ -3988,6 +3985,10 @@ int register_netdevice(struct net_device *dev) | |||
3988 | } | 3985 | } |
3989 | } | 3986 | } |
3990 | 3987 | ||
3988 | /* Enable software GSO if SG is supported. */ | ||
3989 | if (dev->features & NETIF_F_SG) | ||
3990 | dev->features |= NETIF_F_GSO; | ||
3991 | |||
3991 | netdev_initialize_kobject(dev); | 3992 | netdev_initialize_kobject(dev); |
3992 | ret = netdev_register_kobject(dev); | 3993 | ret = netdev_register_kobject(dev); |
3993 | if (ret) | 3994 | if (ret) |
@@ -4165,6 +4166,8 @@ void netdev_run_todo(void) | |||
4165 | 4166 | ||
4166 | dev->reg_state = NETREG_UNREGISTERED; | 4167 | dev->reg_state = NETREG_UNREGISTERED; |
4167 | 4168 | ||
4169 | on_each_cpu(flush_backlog, dev, 1); | ||
4170 | |||
4168 | netdev_wait_allrefs(dev); | 4171 | netdev_wait_allrefs(dev); |
4169 | 4172 | ||
4170 | /* paranoia */ | 4173 | /* paranoia */ |
@@ -4200,6 +4203,7 @@ static void netdev_init_queues(struct net_device *dev) | |||
4200 | { | 4203 | { |
4201 | netdev_init_one_queue(dev, &dev->rx_queue, NULL); | 4204 | netdev_init_one_queue(dev, &dev->rx_queue, NULL); |
4202 | netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL); | 4205 | netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL); |
4206 | spin_lock_init(&dev->tx_global_lock); | ||
4203 | } | 4207 | } |
4204 | 4208 | ||
4205 | /** | 4209 | /** |
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 | } |
2380 | EXPORT_SYMBOL(neigh_seq_start); | 2381 | EXPORT_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..526236453908 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -168,7 +168,7 @@ | |||
168 | #include <asm/div64.h> /* do_div */ | 168 | #include <asm/div64.h> /* do_div */ |
169 | #include <asm/timex.h> | 169 | #include <asm/timex.h> |
170 | 170 | ||
171 | #define VERSION "pktgen v2.69: Packet Generator for packet performance testing.\n" | 171 | #define VERSION "pktgen v2.70: Packet Generator for packet performance testing.\n" |
172 | 172 | ||
173 | #define IP_NAME_SZ 32 | 173 | #define IP_NAME_SZ 32 |
174 | #define MAX_MPLS_LABELS 16 /* This is the max label stack depth */ | 174 | #define MAX_MPLS_LABELS 16 /* This is the max label stack depth */ |
@@ -189,6 +189,7 @@ | |||
189 | #define F_FLOW_SEQ (1<<11) /* Sequential flows */ | 189 | #define F_FLOW_SEQ (1<<11) /* Sequential flows */ |
190 | #define F_IPSEC_ON (1<<12) /* ipsec on for flows */ | 190 | #define F_IPSEC_ON (1<<12) /* ipsec on for flows */ |
191 | #define F_QUEUE_MAP_RND (1<<13) /* queue map Random */ | 191 | #define F_QUEUE_MAP_RND (1<<13) /* queue map Random */ |
192 | #define F_QUEUE_MAP_CPU (1<<14) /* queue map mirrors smp_processor_id() */ | ||
192 | 193 | ||
193 | /* Thread control flag bits */ | 194 | /* Thread control flag bits */ |
194 | #define T_TERMINATE (1<<0) | 195 | #define T_TERMINATE (1<<0) |
@@ -621,6 +622,9 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
621 | if (pkt_dev->flags & F_QUEUE_MAP_RND) | 622 | if (pkt_dev->flags & F_QUEUE_MAP_RND) |
622 | seq_printf(seq, "QUEUE_MAP_RND "); | 623 | seq_printf(seq, "QUEUE_MAP_RND "); |
623 | 624 | ||
625 | if (pkt_dev->flags & F_QUEUE_MAP_CPU) | ||
626 | seq_printf(seq, "QUEUE_MAP_CPU "); | ||
627 | |||
624 | if (pkt_dev->cflows) { | 628 | if (pkt_dev->cflows) { |
625 | if (pkt_dev->flags & F_FLOW_SEQ) | 629 | if (pkt_dev->flags & F_FLOW_SEQ) |
626 | seq_printf(seq, "FLOW_SEQ "); /*in sequence flows*/ | 630 | seq_printf(seq, "FLOW_SEQ "); /*in sequence flows*/ |
@@ -1134,6 +1138,12 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1134 | 1138 | ||
1135 | else if (strcmp(f, "!QUEUE_MAP_RND") == 0) | 1139 | else if (strcmp(f, "!QUEUE_MAP_RND") == 0) |
1136 | pkt_dev->flags &= ~F_QUEUE_MAP_RND; | 1140 | pkt_dev->flags &= ~F_QUEUE_MAP_RND; |
1141 | |||
1142 | else if (strcmp(f, "QUEUE_MAP_CPU") == 0) | ||
1143 | pkt_dev->flags |= F_QUEUE_MAP_CPU; | ||
1144 | |||
1145 | else if (strcmp(f, "!QUEUE_MAP_CPU") == 0) | ||
1146 | pkt_dev->flags &= ~F_QUEUE_MAP_CPU; | ||
1137 | #ifdef CONFIG_XFRM | 1147 | #ifdef CONFIG_XFRM |
1138 | else if (strcmp(f, "IPSEC") == 0) | 1148 | else if (strcmp(f, "IPSEC") == 0) |
1139 | pkt_dev->flags |= F_IPSEC_ON; | 1149 | pkt_dev->flags |= F_IPSEC_ON; |
@@ -1895,6 +1905,23 @@ static int pktgen_device_event(struct notifier_block *unused, | |||
1895 | return NOTIFY_DONE; | 1905 | return NOTIFY_DONE; |
1896 | } | 1906 | } |
1897 | 1907 | ||
1908 | static struct net_device *pktgen_dev_get_by_name(struct pktgen_dev *pkt_dev, const char *ifname) | ||
1909 | { | ||
1910 | char b[IFNAMSIZ+5]; | ||
1911 | int i = 0; | ||
1912 | |||
1913 | for(i=0; ifname[i] != '@'; i++) { | ||
1914 | if(i == IFNAMSIZ) | ||
1915 | break; | ||
1916 | |||
1917 | b[i] = ifname[i]; | ||
1918 | } | ||
1919 | b[i] = 0; | ||
1920 | |||
1921 | return dev_get_by_name(&init_net, b); | ||
1922 | } | ||
1923 | |||
1924 | |||
1898 | /* Associate pktgen_dev with a device. */ | 1925 | /* Associate pktgen_dev with a device. */ |
1899 | 1926 | ||
1900 | static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname) | 1927 | static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname) |
@@ -1908,7 +1935,7 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname) | |||
1908 | pkt_dev->odev = NULL; | 1935 | pkt_dev->odev = NULL; |
1909 | } | 1936 | } |
1910 | 1937 | ||
1911 | odev = dev_get_by_name(&init_net, ifname); | 1938 | odev = pktgen_dev_get_by_name(pkt_dev, ifname); |
1912 | if (!odev) { | 1939 | if (!odev) { |
1913 | printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname); | 1940 | printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname); |
1914 | return -ENODEV; | 1941 | return -ENODEV; |
@@ -2085,15 +2112,19 @@ static inline int f_pick(struct pktgen_dev *pkt_dev) | |||
2085 | if (pkt_dev->flows[flow].count >= pkt_dev->lflow) { | 2112 | if (pkt_dev->flows[flow].count >= pkt_dev->lflow) { |
2086 | /* reset time */ | 2113 | /* reset time */ |
2087 | pkt_dev->flows[flow].count = 0; | 2114 | pkt_dev->flows[flow].count = 0; |
2115 | pkt_dev->flows[flow].flags = 0; | ||
2088 | pkt_dev->curfl += 1; | 2116 | pkt_dev->curfl += 1; |
2089 | if (pkt_dev->curfl >= pkt_dev->cflows) | 2117 | if (pkt_dev->curfl >= pkt_dev->cflows) |
2090 | pkt_dev->curfl = 0; /*reset */ | 2118 | pkt_dev->curfl = 0; /*reset */ |
2091 | } | 2119 | } |
2092 | } else { | 2120 | } else { |
2093 | flow = random32() % pkt_dev->cflows; | 2121 | flow = random32() % pkt_dev->cflows; |
2122 | pkt_dev->curfl = flow; | ||
2094 | 2123 | ||
2095 | if (pkt_dev->flows[flow].count > pkt_dev->lflow) | 2124 | if (pkt_dev->flows[flow].count > pkt_dev->lflow) { |
2096 | pkt_dev->flows[flow].count = 0; | 2125 | pkt_dev->flows[flow].count = 0; |
2126 | pkt_dev->flows[flow].flags = 0; | ||
2127 | } | ||
2097 | } | 2128 | } |
2098 | 2129 | ||
2099 | return pkt_dev->curfl; | 2130 | return pkt_dev->curfl; |
@@ -2125,7 +2156,11 @@ static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow) | |||
2125 | #endif | 2156 | #endif |
2126 | static void set_cur_queue_map(struct pktgen_dev *pkt_dev) | 2157 | static void set_cur_queue_map(struct pktgen_dev *pkt_dev) |
2127 | { | 2158 | { |
2128 | if (pkt_dev->queue_map_min < pkt_dev->queue_map_max) { | 2159 | |
2160 | if (pkt_dev->flags & F_QUEUE_MAP_CPU) | ||
2161 | pkt_dev->cur_queue_map = smp_processor_id(); | ||
2162 | |||
2163 | else if (pkt_dev->queue_map_min < pkt_dev->queue_map_max) { | ||
2129 | __u16 t; | 2164 | __u16 t; |
2130 | if (pkt_dev->flags & F_QUEUE_MAP_RND) { | 2165 | if (pkt_dev->flags & F_QUEUE_MAP_RND) { |
2131 | t = random32() % | 2166 | t = random32() % |
@@ -2162,7 +2197,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
2162 | mc = random32() % pkt_dev->src_mac_count; | 2197 | mc = random32() % pkt_dev->src_mac_count; |
2163 | else { | 2198 | else { |
2164 | mc = pkt_dev->cur_src_mac_offset++; | 2199 | mc = pkt_dev->cur_src_mac_offset++; |
2165 | if (pkt_dev->cur_src_mac_offset > | 2200 | if (pkt_dev->cur_src_mac_offset >= |
2166 | pkt_dev->src_mac_count) | 2201 | pkt_dev->src_mac_count) |
2167 | pkt_dev->cur_src_mac_offset = 0; | 2202 | pkt_dev->cur_src_mac_offset = 0; |
2168 | } | 2203 | } |
@@ -2189,7 +2224,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
2189 | 2224 | ||
2190 | else { | 2225 | else { |
2191 | mc = pkt_dev->cur_dst_mac_offset++; | 2226 | mc = pkt_dev->cur_dst_mac_offset++; |
2192 | if (pkt_dev->cur_dst_mac_offset > | 2227 | if (pkt_dev->cur_dst_mac_offset >= |
2193 | pkt_dev->dst_mac_count) { | 2228 | pkt_dev->dst_mac_count) { |
2194 | pkt_dev->cur_dst_mac_offset = 0; | 2229 | pkt_dev->cur_dst_mac_offset = 0; |
2195 | } | 2230 | } |
@@ -3305,6 +3340,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3305 | 3340 | ||
3306 | txq = netdev_get_tx_queue(odev, queue_map); | 3341 | txq = netdev_get_tx_queue(odev, queue_map); |
3307 | if (netif_tx_queue_stopped(txq) || | 3342 | if (netif_tx_queue_stopped(txq) || |
3343 | netif_tx_queue_frozen(txq) || | ||
3308 | need_resched()) { | 3344 | need_resched()) { |
3309 | idle_start = getCurUs(); | 3345 | idle_start = getCurUs(); |
3310 | 3346 | ||
@@ -3320,7 +3356,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3320 | 3356 | ||
3321 | pkt_dev->idle_acc += getCurUs() - idle_start; | 3357 | pkt_dev->idle_acc += getCurUs() - idle_start; |
3322 | 3358 | ||
3323 | if (netif_tx_queue_stopped(txq)) { | 3359 | if (netif_tx_queue_stopped(txq) || |
3360 | netif_tx_queue_frozen(txq)) { | ||
3324 | pkt_dev->next_tx_us = getCurUs(); /* TODO */ | 3361 | pkt_dev->next_tx_us = getCurUs(); /* TODO */ |
3325 | pkt_dev->next_tx_ns = 0; | 3362 | pkt_dev->next_tx_ns = 0; |
3326 | goto out; /* Try the next interface */ | 3363 | goto out; /* Try the next interface */ |
@@ -3352,7 +3389,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3352 | txq = netdev_get_tx_queue(odev, queue_map); | 3389 | txq = netdev_get_tx_queue(odev, queue_map); |
3353 | 3390 | ||
3354 | __netif_tx_lock_bh(txq); | 3391 | __netif_tx_lock_bh(txq); |
3355 | if (!netif_tx_queue_stopped(txq)) { | 3392 | if (!netif_tx_queue_stopped(txq) && |
3393 | !netif_tx_queue_frozen(txq)) { | ||
3356 | 3394 | ||
3357 | atomic_inc(&(pkt_dev->skb->users)); | 3395 | atomic_inc(&(pkt_dev->skb->users)); |
3358 | retry_now: | 3396 | 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 1c2e3ec2eb57..b4bc6e095a0e 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -229,7 +229,8 @@ extern void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); | |||
229 | extern int dccp_retransmit_skb(struct sock *sk); | 229 | extern int dccp_retransmit_skb(struct sock *sk); |
230 | 230 | ||
231 | extern void dccp_send_ack(struct sock *sk); | 231 | extern void dccp_send_ack(struct sock *sk); |
232 | extern void dccp_reqsk_send_ack(struct sk_buff *sk, struct request_sock *rsk); | 232 | extern void dccp_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, |
233 | struct request_sock *rsk); | ||
233 | 234 | ||
234 | extern void dccp_send_sync(struct sock *sk, const u64 seq, | 235 | extern void dccp_send_sync(struct sock *sk, const u64 seq, |
235 | const enum dccp_pkt_type pkt_type); | 236 | const enum dccp_pkt_type pkt_type); |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 66dca5bba858..b2804e2d1b8c 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -296,7 +296,8 @@ int dccp_child_process(struct sock *parent, struct sock *child, | |||
296 | 296 | ||
297 | EXPORT_SYMBOL_GPL(dccp_child_process); | 297 | EXPORT_SYMBOL_GPL(dccp_child_process); |
298 | 298 | ||
299 | void dccp_reqsk_send_ack(struct sk_buff *skb, struct request_sock *rsk) | 299 | void dccp_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, |
300 | struct request_sock *rsk) | ||
300 | { | 301 | { |
301 | DCCP_BUG("DCCP-ACK packets are never sent in LISTEN/RESPOND state"); | 302 | DCCP_BUG("DCCP-ACK packets are never sent in LISTEN/RESPOND state"); |
302 | } | 303 | } |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 4e73e5708e70..21515d4c49eb 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -575,7 +575,7 @@ static int esp_init_state(struct xfrm_state *x) | |||
575 | crypto_aead_ivsize(aead); | 575 | crypto_aead_ivsize(aead); |
576 | if (x->props.mode == XFRM_MODE_TUNNEL) | 576 | if (x->props.mode == XFRM_MODE_TUNNEL) |
577 | x->props.header_len += sizeof(struct iphdr); | 577 | x->props.header_len += sizeof(struct iphdr); |
578 | else if (x->props.mode == XFRM_MODE_BEET) | 578 | else if (x->props.mode == XFRM_MODE_BEET && x->sel.family != AF_INET6) |
579 | x->props.header_len += IPV4_BEET_PHMAXLEN; | 579 | x->props.header_len += IPV4_BEET_PHMAXLEN; |
580 | if (x->encap) { | 580 | if (x->encap) { |
581 | struct xfrm_encap_tmpl *encap = x->encap; | 581 | struct xfrm_encap_tmpl *encap = x->encap; |
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..16fc6f454a31 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1509,14 +1509,14 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1509 | 1509 | ||
1510 | /* BSD 4.2 compatibility hack :-( */ | 1510 | /* BSD 4.2 compatibility hack :-( */ |
1511 | if (mtu == 0 && | 1511 | if (mtu == 0 && |
1512 | old_mtu >= dst_metric(&rth->u.dst, RTAX_MTU) && | 1512 | old_mtu >= dst_mtu(&rth->u.dst) && |
1513 | old_mtu >= 68 + (iph->ihl << 2)) | 1513 | old_mtu >= 68 + (iph->ihl << 2)) |
1514 | old_mtu -= iph->ihl << 2; | 1514 | old_mtu -= iph->ihl << 2; |
1515 | 1515 | ||
1516 | mtu = guess_mtu(old_mtu); | 1516 | mtu = guess_mtu(old_mtu); |
1517 | } | 1517 | } |
1518 | if (mtu <= dst_metric(&rth->u.dst, RTAX_MTU)) { | 1518 | if (mtu <= dst_mtu(&rth->u.dst)) { |
1519 | if (mtu < dst_metric(&rth->u.dst, RTAX_MTU)) { | 1519 | if (mtu < dst_mtu(&rth->u.dst)) { |
1520 | dst_confirm(&rth->u.dst); | 1520 | dst_confirm(&rth->u.dst); |
1521 | if (mtu < ip_rt_min_pmtu) { | 1521 | if (mtu < ip_rt_min_pmtu) { |
1522 | mtu = ip_rt_min_pmtu; | 1522 | mtu = ip_rt_min_pmtu; |
@@ -1538,7 +1538,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1538 | 1538 | ||
1539 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | 1539 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) |
1540 | { | 1540 | { |
1541 | if (dst_metric(dst, RTAX_MTU) > mtu && mtu >= 68 && | 1541 | if (dst_mtu(dst) > mtu && mtu >= 68 && |
1542 | !(dst_metric_locked(dst, RTAX_MTU))) { | 1542 | !(dst_metric_locked(dst, RTAX_MTU))) { |
1543 | if (mtu < ip_rt_min_pmtu) { | 1543 | if (mtu < ip_rt_min_pmtu) { |
1544 | mtu = ip_rt_min_pmtu; | 1544 | mtu = ip_rt_min_pmtu; |
@@ -1667,7 +1667,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1667 | 1667 | ||
1668 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) | 1668 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) |
1669 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = sysctl_ip_default_ttl; | 1669 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = sysctl_ip_default_ttl; |
1670 | if (dst_metric(&rt->u.dst, RTAX_MTU) > IP_MAX_MTU) | 1670 | if (dst_mtu(&rt->u.dst) > IP_MAX_MTU) |
1671 | rt->u.dst.metrics[RTAX_MTU-1] = IP_MAX_MTU; | 1671 | rt->u.dst.metrics[RTAX_MTU-1] = IP_MAX_MTU; |
1672 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) == 0) | 1672 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) == 0) |
1673 | rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, rt->u.dst.dev->mtu - 40, | 1673 | rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, rt->u.dst.dev->mtu - 40, |
@@ -3216,6 +3216,7 @@ 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. |
@@ -3224,6 +3225,7 @@ void __init ip_static_sysctl_init(void) | |||
3224 | { | 3225 | { |
3225 | register_sysctl_paths(ipv4_route_path, ipv4_route_table); | 3226 | register_sysctl_paths(ipv4_route_path, ipv4_route_table); |
3226 | } | 3227 | } |
3228 | #endif | ||
3227 | 3229 | ||
3228 | EXPORT_SYMBOL(__ip_select_ident); | 3230 | EXPORT_SYMBOL(__ip_select_ident); |
3229 | EXPORT_SYMBOL(ip_route_input); | 3231 | EXPORT_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..44c1e934824b 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, |
@@ -687,14 +687,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
687 | inet_twsk_put(tw); | 687 | inet_twsk_put(tw); |
688 | } | 688 | } |
689 | 689 | ||
690 | static void tcp_v4_reqsk_send_ack(struct sk_buff *skb, | 690 | static void tcp_v4_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, |
691 | struct request_sock *req) | 691 | struct request_sock *req) |
692 | { | 692 | { |
693 | tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, | 693 | tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, |
694 | tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, | 694 | tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, |
695 | req->ts_recent, | 695 | req->ts_recent, |
696 | 0, | 696 | 0, |
697 | tcp_v4_md5_do_lookup(skb->sk, ip_hdr(skb)->daddr)); | 697 | tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->daddr)); |
698 | } | 698 | } |
699 | 699 | ||
700 | /* | 700 | /* |
@@ -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/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 204c42162660..f976fc57892c 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -609,7 +609,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
609 | tcp_rsk(req)->rcv_isn + 1, tcp_rsk(req)->rcv_isn + 1 + req->rcv_wnd)) { | 609 | tcp_rsk(req)->rcv_isn + 1, tcp_rsk(req)->rcv_isn + 1 + req->rcv_wnd)) { |
610 | /* Out of window: send ACK and drop. */ | 610 | /* Out of window: send ACK and drop. */ |
611 | if (!(flg & TCP_FLAG_RST)) | 611 | if (!(flg & TCP_FLAG_RST)) |
612 | req->rsk_ops->send_ack(skb, req); | 612 | req->rsk_ops->send_ack(sk, skb, req); |
613 | if (paws_reject) | 613 | if (paws_reject) |
614 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED); | 614 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED); |
615 | return NULL; | 615 | return NULL; |
@@ -618,89 +618,87 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
618 | /* In sequence, PAWS is OK. */ | 618 | /* In sequence, PAWS is OK. */ |
619 | 619 | ||
620 | if (tmp_opt.saw_tstamp && !after(TCP_SKB_CB(skb)->seq, tcp_rsk(req)->rcv_isn + 1)) | 620 | if (tmp_opt.saw_tstamp && !after(TCP_SKB_CB(skb)->seq, tcp_rsk(req)->rcv_isn + 1)) |
621 | req->ts_recent = tmp_opt.rcv_tsval; | 621 | req->ts_recent = tmp_opt.rcv_tsval; |
622 | 622 | ||
623 | if (TCP_SKB_CB(skb)->seq == tcp_rsk(req)->rcv_isn) { | 623 | if (TCP_SKB_CB(skb)->seq == tcp_rsk(req)->rcv_isn) { |
624 | /* Truncate SYN, it is out of window starting | 624 | /* Truncate SYN, it is out of window starting |
625 | at tcp_rsk(req)->rcv_isn + 1. */ | 625 | at tcp_rsk(req)->rcv_isn + 1. */ |
626 | flg &= ~TCP_FLAG_SYN; | 626 | flg &= ~TCP_FLAG_SYN; |
627 | } | 627 | } |
628 | 628 | ||
629 | /* RFC793: "second check the RST bit" and | 629 | /* RFC793: "second check the RST bit" and |
630 | * "fourth, check the SYN bit" | 630 | * "fourth, check the SYN bit" |
631 | */ | 631 | */ |
632 | if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) { | 632 | if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) { |
633 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_ATTEMPTFAILS); | 633 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_ATTEMPTFAILS); |
634 | goto embryonic_reset; | 634 | goto embryonic_reset; |
635 | } | 635 | } |
636 | 636 | ||
637 | /* ACK sequence verified above, just make sure ACK is | 637 | /* ACK sequence verified above, just make sure ACK is |
638 | * set. If ACK not set, just silently drop the packet. | 638 | * set. If ACK not set, just silently drop the packet. |
639 | */ | 639 | */ |
640 | if (!(flg & TCP_FLAG_ACK)) | 640 | if (!(flg & TCP_FLAG_ACK)) |
641 | return NULL; | 641 | return NULL; |
642 | |||
643 | /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */ | ||
644 | if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && | ||
645 | TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { | ||
646 | inet_rsk(req)->acked = 1; | ||
647 | return NULL; | ||
648 | } | ||
649 | 642 | ||
650 | /* OK, ACK is valid, create big socket and | 643 | /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */ |
651 | * feed this segment to it. It will repeat all | 644 | if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && |
652 | * the tests. THIS SEGMENT MUST MOVE SOCKET TO | 645 | TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { |
653 | * ESTABLISHED STATE. If it will be dropped after | 646 | inet_rsk(req)->acked = 1; |
654 | * socket is created, wait for troubles. | 647 | return NULL; |
655 | */ | 648 | } |
656 | child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, | 649 | |
657 | req, NULL); | 650 | /* OK, ACK is valid, create big socket and |
658 | if (child == NULL) | 651 | * feed this segment to it. It will repeat all |
659 | goto listen_overflow; | 652 | * the tests. THIS SEGMENT MUST MOVE SOCKET TO |
653 | * ESTABLISHED STATE. If it will be dropped after | ||
654 | * socket is created, wait for troubles. | ||
655 | */ | ||
656 | child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL); | ||
657 | if (child == NULL) | ||
658 | goto listen_overflow; | ||
660 | #ifdef CONFIG_TCP_MD5SIG | 659 | #ifdef CONFIG_TCP_MD5SIG |
661 | else { | 660 | else { |
662 | /* Copy over the MD5 key from the original socket */ | 661 | /* Copy over the MD5 key from the original socket */ |
663 | struct tcp_md5sig_key *key; | 662 | struct tcp_md5sig_key *key; |
664 | struct tcp_sock *tp = tcp_sk(sk); | 663 | struct tcp_sock *tp = tcp_sk(sk); |
665 | key = tp->af_specific->md5_lookup(sk, child); | 664 | key = tp->af_specific->md5_lookup(sk, child); |
666 | if (key != NULL) { | 665 | if (key != NULL) { |
667 | /* | 666 | /* |
668 | * We're using one, so create a matching key on the | 667 | * We're using one, so create a matching key on the |
669 | * newsk structure. If we fail to get memory then we | 668 | * newsk structure. If we fail to get memory then we |
670 | * end up not copying the key across. Shucks. | 669 | * end up not copying the key across. Shucks. |
671 | */ | 670 | */ |
672 | char *newkey = kmemdup(key->key, key->keylen, | 671 | char *newkey = kmemdup(key->key, key->keylen, |
673 | GFP_ATOMIC); | 672 | GFP_ATOMIC); |
674 | if (newkey) { | 673 | if (newkey) { |
675 | if (!tcp_alloc_md5sig_pool()) | 674 | if (!tcp_alloc_md5sig_pool()) |
676 | BUG(); | 675 | BUG(); |
677 | tp->af_specific->md5_add(child, child, | 676 | tp->af_specific->md5_add(child, child, newkey, |
678 | newkey, | 677 | key->keylen); |
679 | key->keylen); | ||
680 | } | ||
681 | } | 678 | } |
682 | } | 679 | } |
680 | } | ||
683 | #endif | 681 | #endif |
684 | 682 | ||
685 | inet_csk_reqsk_queue_unlink(sk, req, prev); | 683 | inet_csk_reqsk_queue_unlink(sk, req, prev); |
686 | inet_csk_reqsk_queue_removed(sk, req); | 684 | inet_csk_reqsk_queue_removed(sk, req); |
687 | 685 | ||
688 | inet_csk_reqsk_queue_add(sk, req, child); | 686 | inet_csk_reqsk_queue_add(sk, req, child); |
689 | return child; | 687 | return child; |
690 | 688 | ||
691 | listen_overflow: | 689 | listen_overflow: |
692 | if (!sysctl_tcp_abort_on_overflow) { | 690 | if (!sysctl_tcp_abort_on_overflow) { |
693 | inet_rsk(req)->acked = 1; | 691 | inet_rsk(req)->acked = 1; |
694 | return NULL; | 692 | return NULL; |
695 | } | 693 | } |
696 | 694 | ||
697 | embryonic_reset: | 695 | embryonic_reset: |
698 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_EMBRYONICRSTS); | 696 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_EMBRYONICRSTS); |
699 | if (!(flg & TCP_FLAG_RST)) | 697 | if (!(flg & TCP_FLAG_RST)) |
700 | req->rsk_ops->send_reset(sk, skb); | 698 | req->rsk_ops->send_reset(sk, skb); |
701 | 699 | ||
702 | inet_csk_reqsk_queue_drop(sk, req, prev); | 700 | inet_csk_reqsk_queue_drop(sk, req, prev); |
703 | return NULL; | 701 | return NULL; |
704 | } | 702 | } |
705 | 703 | ||
706 | /* | 704 | /* |
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c index 9c798abce736..63418185f524 100644 --- a/net/ipv4/xfrm4_mode_beet.c +++ b/net/ipv4/xfrm4_mode_beet.c | |||
@@ -47,8 +47,10 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
47 | if (unlikely(optlen)) | 47 | if (unlikely(optlen)) |
48 | hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); | 48 | hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); |
49 | 49 | ||
50 | skb_set_network_header(skb, IPV4_BEET_PHMAXLEN - x->props.header_len - | 50 | skb_set_network_header(skb, -x->props.header_len - |
51 | hdrlen); | 51 | hdrlen + (XFRM_MODE_SKB_CB(skb)->ihl - sizeof(*top_iph))); |
52 | if (x->sel.family != AF_INET6) | ||
53 | skb->network_header += IPV4_BEET_PHMAXLEN; | ||
52 | skb->mac_header = skb->network_header + | 54 | skb->mac_header = skb->network_header + |
53 | offsetof(struct iphdr, protocol); | 55 | offsetof(struct iphdr, protocol); |
54 | skb->transport_header = skb->network_header + sizeof(*top_iph); | 56 | skb->transport_header = skb->network_header + sizeof(*top_iph); |
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/esp6.c b/net/ipv6/esp6.c index c6bb4c6d24b3..b181b08fb761 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -521,6 +521,10 @@ static int esp6_init_state(struct xfrm_state *x) | |||
521 | crypto_aead_ivsize(aead); | 521 | crypto_aead_ivsize(aead); |
522 | switch (x->props.mode) { | 522 | switch (x->props.mode) { |
523 | case XFRM_MODE_BEET: | 523 | case XFRM_MODE_BEET: |
524 | if (x->sel.family != AF_INET6) | ||
525 | x->props.header_len += IPV4_BEET_PHMAXLEN + | ||
526 | (sizeof(struct ipv6hdr) - sizeof(struct iphdr)); | ||
527 | break; | ||
524 | case XFRM_MODE_TRANSPORT: | 528 | case XFRM_MODE_TRANSPORT: |
525 | break; | 529 | break; |
526 | case XFRM_MODE_TUNNEL: | 530 | case XFRM_MODE_TUNNEL: |
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/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 | ||
287 | void ipv6_misc_proc_exit(void) | 287 | void 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/route.c b/net/ipv6/route.c index 86540b24b27c..5a3e87e4b18f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1249,7 +1249,7 @@ install_route: | |||
1249 | 1249 | ||
1250 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) | 1250 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) |
1251 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; | 1251 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; |
1252 | if (!dst_metric(&rt->u.dst, RTAX_MTU)) | 1252 | if (!dst_mtu(&rt->u.dst)) |
1253 | rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); | 1253 | rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); |
1254 | if (!dst_metric(&rt->u.dst, RTAX_ADVMSS)) | 1254 | if (!dst_metric(&rt->u.dst, RTAX_ADVMSS)) |
1255 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(net, dst_mtu(&rt->u.dst)); | 1255 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(net, dst_mtu(&rt->u.dst)); |
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 | 273 | out: | |
277 | out: return ret; | 274 | return ret; |
275 | out_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..5b90b369ccb2 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -69,7 +69,8 @@ | |||
69 | #include <linux/scatterlist.h> | 69 | #include <linux/scatterlist.h> |
70 | 70 | ||
71 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); | 71 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); |
72 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); | 72 | static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, |
73 | struct request_sock *req); | ||
73 | 74 | ||
74 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); | 75 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); |
75 | 76 | ||
@@ -748,7 +749,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
748 | ipv6_addr_copy(&bp->saddr, saddr); | 749 | ipv6_addr_copy(&bp->saddr, saddr); |
749 | ipv6_addr_copy(&bp->daddr, daddr); | 750 | ipv6_addr_copy(&bp->daddr, daddr); |
750 | bp->protocol = cpu_to_be32(IPPROTO_TCP); | 751 | bp->protocol = cpu_to_be32(IPPROTO_TCP); |
751 | bp->len = cpu_to_be16(nbytes); | 752 | bp->len = cpu_to_be32(nbytes); |
752 | 753 | ||
753 | sg_init_one(&sg, bp, sizeof(*bp)); | 754 | sg_init_one(&sg, bp, sizeof(*bp)); |
754 | return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp)); | 755 | return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp)); |
@@ -849,28 +850,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); | 850 | hash_expected = tcp_v6_md5_do_lookup(sk, &ip6h->saddr); |
850 | hash_location = tcp_parse_md5sig_option(th); | 851 | hash_location = tcp_parse_md5sig_option(th); |
851 | 852 | ||
852 | /* do we have a hash as expected? */ | 853 | /* We've parsed the options - do we have a hash? */ |
853 | if (!hash_expected) { | 854 | if (!hash_expected && !hash_location) |
854 | if (!hash_location) | 855 | return 0; |
855 | return 0; | 856 | |
856 | if (net_ratelimit()) { | 857 | if (hash_expected && !hash_location) { |
857 | printk(KERN_INFO "MD5 Hash NOT expected but found " | 858 | 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; | 859 | return 1; |
864 | } | 860 | } |
865 | 861 | ||
866 | if (!hash_location) { | 862 | if (!hash_expected && hash_location) { |
867 | if (net_ratelimit()) { | 863 | 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; | 864 | return 1; |
875 | } | 865 | } |
876 | 866 | ||
@@ -1105,8 +1095,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) | | 1095 | *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | |
1106 | (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); | 1096 | (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); |
1107 | tcp_v6_md5_hash_hdr((__u8 *)topt, key, | 1097 | tcp_v6_md5_hash_hdr((__u8 *)topt, key, |
1108 | &ipv6_hdr(skb)->daddr, | 1098 | &ipv6_hdr(skb)->saddr, |
1109 | &ipv6_hdr(skb)->saddr, t1); | 1099 | &ipv6_hdr(skb)->daddr, t1); |
1110 | } | 1100 | } |
1111 | #endif | 1101 | #endif |
1112 | 1102 | ||
@@ -1149,10 +1139,11 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
1149 | inet_twsk_put(tw); | 1139 | inet_twsk_put(tw); |
1150 | } | 1140 | } |
1151 | 1141 | ||
1152 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) | 1142 | static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, |
1143 | struct request_sock *req) | ||
1153 | { | 1144 | { |
1154 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent, | 1145 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent, |
1155 | tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr)); | 1146 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr)); |
1156 | } | 1147 | } |
1157 | 1148 | ||
1158 | 1149 | ||
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c index d6ce400f585f..bbd48b101bae 100644 --- a/net/ipv6/xfrm6_mode_beet.c +++ b/net/ipv6/xfrm6_mode_beet.c | |||
@@ -40,16 +40,39 @@ static void xfrm6_beet_make_header(struct sk_buff *skb) | |||
40 | static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) | 40 | static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) |
41 | { | 41 | { |
42 | struct ipv6hdr *top_iph; | 42 | struct ipv6hdr *top_iph; |
43 | 43 | struct ip_beet_phdr *ph; | |
44 | skb_set_network_header(skb, -x->props.header_len); | 44 | struct iphdr *iphv4; |
45 | int optlen, hdr_len; | ||
46 | |||
47 | iphv4 = ip_hdr(skb); | ||
48 | hdr_len = 0; | ||
49 | optlen = XFRM_MODE_SKB_CB(skb)->optlen; | ||
50 | if (unlikely(optlen)) | ||
51 | hdr_len += IPV4_BEET_PHMAXLEN - (optlen & 4); | ||
52 | |||
53 | skb_set_network_header(skb, -x->props.header_len - hdr_len); | ||
54 | if (x->sel.family != AF_INET6) | ||
55 | skb->network_header += IPV4_BEET_PHMAXLEN; | ||
45 | skb->mac_header = skb->network_header + | 56 | skb->mac_header = skb->network_header + |
46 | offsetof(struct ipv6hdr, nexthdr); | 57 | offsetof(struct ipv6hdr, nexthdr); |
47 | skb->transport_header = skb->network_header + sizeof(*top_iph); | 58 | skb->transport_header = skb->network_header + sizeof(*top_iph); |
48 | __skb_pull(skb, XFRM_MODE_SKB_CB(skb)->ihl); | 59 | ph = (struct ip_beet_phdr *)__skb_pull(skb, XFRM_MODE_SKB_CB(skb)->ihl-hdr_len); |
49 | 60 | ||
50 | xfrm6_beet_make_header(skb); | 61 | xfrm6_beet_make_header(skb); |
51 | 62 | ||
52 | top_iph = ipv6_hdr(skb); | 63 | top_iph = ipv6_hdr(skb); |
64 | if (unlikely(optlen)) { | ||
65 | |||
66 | BUG_ON(optlen < 0); | ||
67 | |||
68 | ph->padlen = 4 - (optlen & 4); | ||
69 | ph->hdrlen = optlen / 8; | ||
70 | ph->nexthdr = top_iph->nexthdr; | ||
71 | if (ph->padlen) | ||
72 | memset(ph + 1, IPOPT_NOP, ph->padlen); | ||
73 | |||
74 | top_iph->nexthdr = IPPROTO_BEETPH; | ||
75 | } | ||
53 | 76 | ||
54 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); | 77 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); |
55 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); | 78 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); |
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, | |||
167 | static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | 175 | static 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, | |||
475 | static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, | 497 | static 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, | |||
492 | static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, | 520 | static 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 | ||
509 | static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) | 543 | static 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, | |||
646 | static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | 686 | static 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, | |||
701 | static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, | 744 | static 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, | |||
767 | static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | 818 | static 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..aa5a191598c9 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -245,10 +245,13 @@ static int ieee80211_open(struct net_device *dev) | |||
245 | case IEEE80211_IF_TYPE_AP: | 245 | case IEEE80211_IF_TYPE_AP: |
246 | sdata->bss = &sdata->u.ap; | 246 | sdata->bss = &sdata->u.ap; |
247 | break; | 247 | break; |
248 | case IEEE80211_IF_TYPE_MESH_POINT: | ||
249 | /* mesh ifaces must set allmulti to forward mcast traffic */ | ||
250 | atomic_inc(&local->iff_allmultis); | ||
251 | break; | ||
248 | case IEEE80211_IF_TYPE_STA: | 252 | case IEEE80211_IF_TYPE_STA: |
249 | case IEEE80211_IF_TYPE_MNTR: | 253 | case IEEE80211_IF_TYPE_MNTR: |
250 | case IEEE80211_IF_TYPE_IBSS: | 254 | case IEEE80211_IF_TYPE_IBSS: |
251 | case IEEE80211_IF_TYPE_MESH_POINT: | ||
252 | /* no special treatment */ | 255 | /* no special treatment */ |
253 | break; | 256 | break; |
254 | case IEEE80211_IF_TYPE_INVALID: | 257 | case IEEE80211_IF_TYPE_INVALID: |
@@ -495,6 +498,9 @@ static int ieee80211_stop(struct net_device *dev) | |||
495 | netif_addr_unlock_bh(local->mdev); | 498 | netif_addr_unlock_bh(local->mdev); |
496 | break; | 499 | break; |
497 | case IEEE80211_IF_TYPE_MESH_POINT: | 500 | case IEEE80211_IF_TYPE_MESH_POINT: |
501 | /* allmulti is always set on mesh ifaces */ | ||
502 | atomic_dec(&local->iff_allmultis); | ||
503 | /* fall through */ | ||
498 | case IEEE80211_IF_TYPE_STA: | 504 | case IEEE80211_IF_TYPE_STA: |
499 | case IEEE80211_IF_TYPE_IBSS: | 505 | case IEEE80211_IF_TYPE_IBSS: |
500 | sdata->u.sta.state = IEEE80211_DISABLED; | 506 | sdata->u.sta.state = IEEE80211_DISABLED; |
@@ -1233,18 +1239,12 @@ static void ieee80211_tasklet_handler(unsigned long data) | |||
1233 | /* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to | 1239 | /* 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 | 1240 | * 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. | 1241 | * 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. */ | 1242 | */ |
1237 | static void ieee80211_remove_tx_extra(struct ieee80211_local *local, | 1243 | static void ieee80211_remove_tx_extra(struct ieee80211_local *local, |
1238 | struct ieee80211_key *key, | 1244 | struct ieee80211_key *key, |
1239 | struct sk_buff *skb) | 1245 | struct sk_buff *skb) |
1240 | { | 1246 | { |
1241 | int hdrlen, iv_len, mic_len; | 1247 | 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 | 1248 | ||
1249 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1249 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
1250 | 1250 | ||
@@ -1695,6 +1695,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
1695 | if (local->hw.conf.beacon_int < 10) | 1695 | if (local->hw.conf.beacon_int < 10) |
1696 | local->hw.conf.beacon_int = 100; | 1696 | local->hw.conf.beacon_int = 100; |
1697 | 1697 | ||
1698 | if (local->hw.max_listen_interval == 0) | ||
1699 | local->hw.max_listen_interval = 1; | ||
1700 | |||
1701 | local->hw.conf.listen_interval = local->hw.max_listen_interval; | ||
1702 | |||
1698 | local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | | 1703 | local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | |
1699 | IEEE80211_HW_SIGNAL_DB | | 1704 | IEEE80211_HW_SIGNAL_DB | |
1700 | IEEE80211_HW_SIGNAL_DBM) ? | 1705 | IEEE80211_HW_SIGNAL_DBM) ? |
@@ -1731,8 +1736,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
1731 | result = ieee80211_wep_init(local); | 1736 | result = ieee80211_wep_init(local); |
1732 | 1737 | ||
1733 | if (result < 0) { | 1738 | if (result < 0) { |
1734 | printk(KERN_DEBUG "%s: Failed to initialize wep\n", | 1739 | printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n", |
1735 | wiphy_name(local->hw.wiphy)); | 1740 | wiphy_name(local->hw.wiphy), result); |
1736 | goto fail_wep; | 1741 | goto fail_wep; |
1737 | } | 1742 | } |
1738 | 1743 | ||
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 669eafafe497..7495fbb0d211 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -214,8 +214,7 @@ void ieee80211s_stop(void); | |||
214 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); | 214 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); |
215 | 215 | ||
216 | /* Mesh paths */ | 216 | /* Mesh paths */ |
217 | int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb, | 217 | int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev); |
218 | struct net_device *dev); | ||
219 | void mesh_path_start_discovery(struct net_device *dev); | 218 | void mesh_path_start_discovery(struct net_device *dev); |
220 | struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev); | 219 | struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev); |
221 | struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev); | 220 | struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev); |
@@ -286,6 +285,4 @@ static inline void mesh_path_activate(struct mesh_path *mpath) | |||
286 | #define mesh_allocated 0 | 285 | #define mesh_allocated 0 |
287 | #endif | 286 | #endif |
288 | 287 | ||
289 | #define MESH_PREQ(skb) (skb->cb + 30) | ||
290 | |||
291 | #endif /* IEEE80211S_H */ | 288 | #endif /* IEEE80211S_H */ |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 7fa149e230e6..08aca446ca01 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -758,29 +758,30 @@ enddiscovery: | |||
758 | /** | 758 | /** |
759 | * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame | 759 | * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame |
760 | * | 760 | * |
761 | * @next_hop: output argument for next hop address | 761 | * @skb: 802.11 frame to be sent |
762 | * @skb: frame to be sent | ||
763 | * @dev: network device the frame will be sent through | 762 | * @dev: network device the frame will be sent through |
763 | * @fwd_frame: true if this frame was originally from a different host | ||
764 | * | 764 | * |
765 | * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is | 765 | * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is |
766 | * found, the function will start a path discovery and queue the frame so it is | 766 | * found, the function will start a path discovery and queue the frame so it is |
767 | * sent when the path is resolved. This means the caller must not free the skb | 767 | * sent when the path is resolved. This means the caller must not free the skb |
768 | * in this case. | 768 | * in this case. |
769 | */ | 769 | */ |
770 | int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb, | 770 | int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev) |
771 | struct net_device *dev) | ||
772 | { | 771 | { |
773 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 772 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
774 | struct sk_buff *skb_to_free = NULL; | 773 | struct sk_buff *skb_to_free = NULL; |
775 | struct mesh_path *mpath; | 774 | struct mesh_path *mpath; |
775 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
776 | u8 *dst_addr = hdr->addr3; | ||
776 | int err = 0; | 777 | int err = 0; |
777 | 778 | ||
778 | rcu_read_lock(); | 779 | rcu_read_lock(); |
779 | mpath = mesh_path_lookup(skb->data, dev); | 780 | mpath = mesh_path_lookup(dst_addr, dev); |
780 | 781 | ||
781 | if (!mpath) { | 782 | if (!mpath) { |
782 | mesh_path_add(skb->data, dev); | 783 | mesh_path_add(dst_addr, dev); |
783 | mpath = mesh_path_lookup(skb->data, dev); | 784 | mpath = mesh_path_lookup(dst_addr, dev); |
784 | if (!mpath) { | 785 | if (!mpath) { |
785 | dev_kfree_skb(skb); | 786 | dev_kfree_skb(skb); |
786 | sdata->u.sta.mshstats.dropped_frames_no_route++; | 787 | sdata->u.sta.mshstats.dropped_frames_no_route++; |
@@ -792,13 +793,13 @@ int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb, | |||
792 | if (mpath->flags & MESH_PATH_ACTIVE) { | 793 | if (mpath->flags & MESH_PATH_ACTIVE) { |
793 | if (time_after(jiffies, mpath->exp_time - | 794 | if (time_after(jiffies, mpath->exp_time - |
794 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) | 795 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) |
795 | && skb->pkt_type != PACKET_OTHERHOST | 796 | && !memcmp(dev->dev_addr, hdr->addr4, ETH_ALEN) |
796 | && !(mpath->flags & MESH_PATH_RESOLVING) | 797 | && !(mpath->flags & MESH_PATH_RESOLVING) |
797 | && !(mpath->flags & MESH_PATH_FIXED)) { | 798 | && !(mpath->flags & MESH_PATH_FIXED)) { |
798 | mesh_queue_preq(mpath, | 799 | mesh_queue_preq(mpath, |
799 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 800 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); |
800 | } | 801 | } |
801 | memcpy(next_hop, mpath->next_hop->addr, | 802 | memcpy(hdr->addr1, mpath->next_hop->addr, |
802 | ETH_ALEN); | 803 | ETH_ALEN); |
803 | } else { | 804 | } else { |
804 | if (!(mpath->flags & MESH_PATH_RESOLVING)) { | 805 | if (!(mpath->flags & MESH_PATH_RESOLVING)) { |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 5f88a2e6ee50..838ee60492ad 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -388,18 +388,15 @@ void mesh_path_tx_pending(struct mesh_path *mpath) | |||
388 | void mesh_path_discard_frame(struct sk_buff *skb, struct net_device *dev) | 388 | void mesh_path_discard_frame(struct sk_buff *skb, struct net_device *dev) |
389 | { | 389 | { |
390 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 390 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
391 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
391 | struct mesh_path *mpath; | 392 | struct mesh_path *mpath; |
392 | u32 dsn = 0; | 393 | u32 dsn = 0; |
393 | 394 | ||
394 | if (skb->pkt_type == PACKET_OTHERHOST) { | 395 | if (memcmp(hdr->addr4, dev->dev_addr, ETH_ALEN) != 0) { |
395 | struct ieee80211s_hdr *prev_meshhdr; | ||
396 | int mshhdrlen; | ||
397 | u8 *ra, *da; | 396 | u8 *ra, *da; |
398 | 397 | ||
399 | prev_meshhdr = ((struct ieee80211s_hdr *)skb->cb); | 398 | da = hdr->addr3; |
400 | mshhdrlen = ieee80211_get_mesh_hdrlen(prev_meshhdr); | 399 | ra = hdr->addr2; |
401 | da = skb->data; | ||
402 | ra = MESH_PREQ(skb); | ||
403 | mpath = mesh_path_lookup(da, dev); | 400 | mpath = mesh_path_lookup(da, dev); |
404 | if (mpath) | 401 | if (mpath) |
405 | dsn = ++mpath->dsn; | 402 | dsn = ++mpath->dsn; |
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 | |||
3689 | dont_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/rx.c b/net/mac80211/rx.c index 6d9ae67c27ca..6db854505193 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1109,20 +1109,9 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1109 | 1109 | ||
1110 | hdrlen = ieee80211_get_hdrlen(fc); | 1110 | hdrlen = ieee80211_get_hdrlen(fc); |
1111 | 1111 | ||
1112 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | 1112 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
1113 | int meshhdrlen = ieee80211_get_mesh_hdrlen( | 1113 | hdrlen += ieee80211_get_mesh_hdrlen( |
1114 | (struct ieee80211s_hdr *) (skb->data + hdrlen)); | 1114 | (struct ieee80211s_hdr *) (skb->data + hdrlen)); |
1115 | /* Copy on cb: | ||
1116 | * - mesh header: to be used for mesh forwarding | ||
1117 | * decision. It will also be used as mesh header template at | ||
1118 | * tx.c:ieee80211_subif_start_xmit() if interface | ||
1119 | * type is mesh and skb->pkt_type == PACKET_OTHERHOST | ||
1120 | * - ta: to be used if a RERR needs to be sent. | ||
1121 | */ | ||
1122 | memcpy(skb->cb, skb->data + hdrlen, meshhdrlen); | ||
1123 | memcpy(MESH_PREQ(skb), hdr->addr2, ETH_ALEN); | ||
1124 | hdrlen += meshhdrlen; | ||
1125 | } | ||
1126 | 1115 | ||
1127 | /* convert IEEE 802.11 header + possible LLC headers into Ethernet | 1116 | /* convert IEEE 802.11 header + possible LLC headers into Ethernet |
1128 | * header | 1117 | * header |
@@ -1269,38 +1258,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1269 | } | 1258 | } |
1270 | } | 1259 | } |
1271 | 1260 | ||
1272 | /* Mesh forwarding */ | ||
1273 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | ||
1274 | u8 *mesh_ttl = &((struct ieee80211s_hdr *)skb->cb)->ttl; | ||
1275 | (*mesh_ttl)--; | ||
1276 | |||
1277 | if (is_multicast_ether_addr(skb->data)) { | ||
1278 | if (*mesh_ttl > 0) { | ||
1279 | xmit_skb = skb_copy(skb, GFP_ATOMIC); | ||
1280 | if (xmit_skb) | ||
1281 | xmit_skb->pkt_type = PACKET_OTHERHOST; | ||
1282 | else if (net_ratelimit()) | ||
1283 | printk(KERN_DEBUG "%s: failed to clone " | ||
1284 | "multicast frame\n", dev->name); | ||
1285 | } else | ||
1286 | IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.sta, | ||
1287 | dropped_frames_ttl); | ||
1288 | } else if (skb->pkt_type != PACKET_OTHERHOST && | ||
1289 | compare_ether_addr(dev->dev_addr, skb->data) != 0) { | ||
1290 | if (*mesh_ttl == 0) { | ||
1291 | IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.sta, | ||
1292 | dropped_frames_ttl); | ||
1293 | dev_kfree_skb(skb); | ||
1294 | skb = NULL; | ||
1295 | } else { | ||
1296 | xmit_skb = skb; | ||
1297 | xmit_skb->pkt_type = PACKET_OTHERHOST; | ||
1298 | if (!(dev->flags & IFF_PROMISC)) | ||
1299 | skb = NULL; | ||
1300 | } | ||
1301 | } | ||
1302 | } | ||
1303 | |||
1304 | if (skb) { | 1261 | if (skb) { |
1305 | /* deliver to local stack */ | 1262 | /* deliver to local stack */ |
1306 | skb->protocol = eth_type_trans(skb, dev); | 1263 | skb->protocol = eth_type_trans(skb, dev); |
@@ -1431,6 +1388,63 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1431 | } | 1388 | } |
1432 | 1389 | ||
1433 | static ieee80211_rx_result debug_noinline | 1390 | static ieee80211_rx_result debug_noinline |
1391 | ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | ||
1392 | { | ||
1393 | struct ieee80211_hdr *hdr; | ||
1394 | struct ieee80211s_hdr *mesh_hdr; | ||
1395 | unsigned int hdrlen; | ||
1396 | struct sk_buff *skb = rx->skb, *fwd_skb; | ||
1397 | |||
1398 | hdr = (struct ieee80211_hdr *) skb->data; | ||
1399 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
1400 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | ||
1401 | |||
1402 | if (!ieee80211_is_data(hdr->frame_control)) | ||
1403 | return RX_CONTINUE; | ||
1404 | |||
1405 | if (!mesh_hdr->ttl) | ||
1406 | /* illegal frame */ | ||
1407 | return RX_DROP_MONITOR; | ||
1408 | |||
1409 | if (compare_ether_addr(rx->dev->dev_addr, hdr->addr3) == 0) | ||
1410 | return RX_CONTINUE; | ||
1411 | |||
1412 | mesh_hdr->ttl--; | ||
1413 | |||
1414 | if (rx->flags & IEEE80211_RX_RA_MATCH) { | ||
1415 | if (!mesh_hdr->ttl) | ||
1416 | IEEE80211_IFSTA_MESH_CTR_INC(&rx->sdata->u.sta, | ||
1417 | dropped_frames_ttl); | ||
1418 | else { | ||
1419 | struct ieee80211_hdr *fwd_hdr; | ||
1420 | fwd_skb = skb_copy(skb, GFP_ATOMIC); | ||
1421 | |||
1422 | if (!fwd_skb && net_ratelimit()) | ||
1423 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", | ||
1424 | rx->dev->name); | ||
1425 | |||
1426 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | ||
1427 | /* | ||
1428 | * Save TA to addr1 to send TA a path error if a | ||
1429 | * suitable next hop is not found | ||
1430 | */ | ||
1431 | memcpy(fwd_hdr->addr1, fwd_hdr->addr2, ETH_ALEN); | ||
1432 | memcpy(fwd_hdr->addr2, rx->dev->dev_addr, ETH_ALEN); | ||
1433 | fwd_skb->dev = rx->local->mdev; | ||
1434 | fwd_skb->iif = rx->dev->ifindex; | ||
1435 | dev_queue_xmit(fwd_skb); | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1439 | if (is_multicast_ether_addr(hdr->addr3) || | ||
1440 | rx->dev->flags & IFF_PROMISC) | ||
1441 | return RX_CONTINUE; | ||
1442 | else | ||
1443 | return RX_DROP_MONITOR; | ||
1444 | } | ||
1445 | |||
1446 | |||
1447 | static ieee80211_rx_result debug_noinline | ||
1434 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) | 1448 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) |
1435 | { | 1449 | { |
1436 | struct net_device *dev = rx->dev; | 1450 | struct net_device *dev = rx->dev; |
@@ -1663,10 +1677,12 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, | |||
1663 | rx->sdata = sdata; | 1677 | rx->sdata = sdata; |
1664 | rx->dev = sdata->dev; | 1678 | rx->dev = sdata->dev; |
1665 | 1679 | ||
1666 | #define CALL_RXH(rxh) \ | 1680 | #define CALL_RXH(rxh) \ |
1667 | res = rxh(rx); \ | 1681 | do { \ |
1668 | if (res != RX_CONTINUE) \ | 1682 | res = rxh(rx); \ |
1669 | goto rxh_done; | 1683 | if (res != RX_CONTINUE) \ |
1684 | goto rxh_done; \ | ||
1685 | } while (0); | ||
1670 | 1686 | ||
1671 | CALL_RXH(ieee80211_rx_h_passive_scan) | 1687 | CALL_RXH(ieee80211_rx_h_passive_scan) |
1672 | CALL_RXH(ieee80211_rx_h_check) | 1688 | CALL_RXH(ieee80211_rx_h_check) |
@@ -1678,6 +1694,8 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, | |||
1678 | /* must be after MMIC verify so header is counted in MPDU mic */ | 1694 | /* must be after MMIC verify so header is counted in MPDU mic */ |
1679 | CALL_RXH(ieee80211_rx_h_remove_qos_control) | 1695 | CALL_RXH(ieee80211_rx_h_remove_qos_control) |
1680 | CALL_RXH(ieee80211_rx_h_amsdu) | 1696 | CALL_RXH(ieee80211_rx_h_amsdu) |
1697 | if (ieee80211_vif_is_mesh(&sdata->vif)) | ||
1698 | CALL_RXH(ieee80211_rx_h_mesh_fwding); | ||
1681 | CALL_RXH(ieee80211_rx_h_data) | 1699 | CALL_RXH(ieee80211_rx_h_data) |
1682 | CALL_RXH(ieee80211_rx_h_ctrl) | 1700 | CALL_RXH(ieee80211_rx_h_ctrl) |
1683 | CALL_RXH(ieee80211_rx_h_mgmt) | 1701 | CALL_RXH(ieee80211_rx_h_mgmt) |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 0fbadd8b983c..4788f7b91f49 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, | |||
1061 | static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | 1060 | static 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 | /* |
@@ -1300,14 +1301,15 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1300 | struct net_device *dev) | 1301 | struct net_device *dev) |
1301 | { | 1302 | { |
1302 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1303 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1304 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
1303 | struct net_device *odev = NULL; | 1305 | struct net_device *odev = NULL; |
1304 | struct ieee80211_sub_if_data *osdata; | 1306 | struct ieee80211_sub_if_data *osdata; |
1305 | int headroom; | 1307 | int headroom; |
1306 | bool may_encrypt; | 1308 | bool may_encrypt; |
1307 | int ret; | 1309 | int ret; |
1308 | 1310 | ||
1309 | if (info->control.ifindex) | 1311 | if (skb->iif) |
1310 | odev = dev_get_by_index(&init_net, info->control.ifindex); | 1312 | odev = dev_get_by_index(&init_net, skb->iif); |
1311 | if (unlikely(odev && !is_ieee80211_device(odev, dev))) { | 1313 | if (unlikely(odev && !is_ieee80211_device(odev, dev))) { |
1312 | dev_put(odev); | 1314 | dev_put(odev); |
1313 | odev = NULL; | 1315 | odev = NULL; |
@@ -1321,9 +1323,27 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1321 | return 0; | 1323 | return 0; |
1322 | } | 1324 | } |
1323 | 1325 | ||
1326 | memset(info, 0, sizeof(*info)); | ||
1327 | |||
1328 | info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; | ||
1329 | |||
1324 | osdata = IEEE80211_DEV_TO_SUB_IF(odev); | 1330 | osdata = IEEE80211_DEV_TO_SUB_IF(odev); |
1325 | 1331 | ||
1326 | may_encrypt = !(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT); | 1332 | if (ieee80211_vif_is_mesh(&osdata->vif) && |
1333 | ieee80211_is_data(hdr->frame_control)) { | ||
1334 | if (ieee80211_is_data(hdr->frame_control)) { | ||
1335 | if (is_multicast_ether_addr(hdr->addr3)) | ||
1336 | memcpy(hdr->addr1, hdr->addr3, ETH_ALEN); | ||
1337 | else | ||
1338 | if (mesh_nexthop_lookup(skb, odev)) | ||
1339 | return 0; | ||
1340 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) | ||
1341 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.sta, | ||
1342 | fwded_frames); | ||
1343 | } | ||
1344 | } | ||
1345 | |||
1346 | may_encrypt = !skb->do_not_encrypt; | ||
1327 | 1347 | ||
1328 | headroom = osdata->local->tx_headroom; | 1348 | headroom = osdata->local->tx_headroom; |
1329 | if (may_encrypt) | 1349 | if (may_encrypt) |
@@ -1348,7 +1368,6 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1348 | struct net_device *dev) | 1368 | struct net_device *dev) |
1349 | { | 1369 | { |
1350 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1370 | 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 = | 1371 | struct ieee80211_radiotap_header *prthdr = |
1353 | (struct ieee80211_radiotap_header *)skb->data; | 1372 | (struct ieee80211_radiotap_header *)skb->data; |
1354 | u16 len_rthdr; | 1373 | u16 len_rthdr; |
@@ -1371,11 +1390,11 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1371 | skb->dev = local->mdev; | 1390 | skb->dev = local->mdev; |
1372 | 1391 | ||
1373 | /* needed because we set skb device to master */ | 1392 | /* needed because we set skb device to master */ |
1374 | info->control.ifindex = dev->ifindex; | 1393 | skb->iif = dev->ifindex; |
1375 | 1394 | ||
1376 | info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; | 1395 | /* sometimes we do encrypt injected frames, will be fixed |
1377 | /* Interfaces should always request a status report */ | 1396 | * up in radiotap parser if not wanted */ |
1378 | info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; | 1397 | skb->do_not_encrypt = 0; |
1379 | 1398 | ||
1380 | /* | 1399 | /* |
1381 | * fix up the pointers accounting for the radiotap | 1400 | * fix up the pointers accounting for the radiotap |
@@ -1419,7 +1438,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1419 | struct net_device *dev) | 1438 | struct net_device *dev) |
1420 | { | 1439 | { |
1421 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1440 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1422 | struct ieee80211_tx_info *info; | ||
1423 | struct ieee80211_sub_if_data *sdata; | 1441 | struct ieee80211_sub_if_data *sdata; |
1424 | int ret = 1, head_need; | 1442 | int ret = 1, head_need; |
1425 | u16 ethertype, hdrlen, meshhdrlen = 0; | 1443 | u16 ethertype, hdrlen, meshhdrlen = 0; |
@@ -1469,30 +1487,17 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1469 | case IEEE80211_IF_TYPE_MESH_POINT: | 1487 | case IEEE80211_IF_TYPE_MESH_POINT: |
1470 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1488 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1471 | /* RA TA DA SA */ | 1489 | /* RA TA DA SA */ |
1472 | if (is_multicast_ether_addr(skb->data)) | 1490 | memset(hdr.addr1, 0, ETH_ALEN); |
1473 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | ||
1474 | else if (mesh_nexthop_lookup(hdr.addr1, skb, dev)) | ||
1475 | return 0; | ||
1476 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1491 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); |
1477 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1492 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1478 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1493 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1479 | if (skb->pkt_type == PACKET_OTHERHOST) { | 1494 | if (!sdata->u.sta.mshcfg.dot11MeshTTL) { |
1480 | /* Forwarded frame, keep mesh ttl and seqnum */ | 1495 | /* Do not send frames with mesh_ttl == 0 */ |
1481 | struct ieee80211s_hdr *prev_meshhdr; | 1496 | sdata->u.sta.mshstats.dropped_frames_ttl++; |
1482 | prev_meshhdr = ((struct ieee80211s_hdr *)skb->cb); | 1497 | ret = 0; |
1483 | meshhdrlen = ieee80211_get_mesh_hdrlen(prev_meshhdr); | 1498 | goto fail; |
1484 | memcpy(&mesh_hdr, prev_meshhdr, meshhdrlen); | ||
1485 | sdata->u.sta.mshstats.fwded_frames++; | ||
1486 | } else { | ||
1487 | if (!sdata->u.sta.mshcfg.dot11MeshTTL) { | ||
1488 | /* Do not send frames with mesh_ttl == 0 */ | ||
1489 | sdata->u.sta.mshstats.dropped_frames_ttl++; | ||
1490 | ret = 0; | ||
1491 | goto fail; | ||
1492 | } | ||
1493 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, | ||
1494 | sdata); | ||
1495 | } | 1499 | } |
1500 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, sdata); | ||
1496 | hdrlen = 30; | 1501 | hdrlen = 30; |
1497 | break; | 1502 | break; |
1498 | #endif | 1503 | #endif |
@@ -1540,7 +1545,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1540 | * Drop unicast frames to unauthorised stations unless they are | 1545 | * Drop unicast frames to unauthorised stations unless they are |
1541 | * EAPOL frames from the local station. | 1546 | * EAPOL frames from the local station. |
1542 | */ | 1547 | */ |
1543 | if (unlikely(!is_multicast_ether_addr(hdr.addr1) && | 1548 | if (!ieee80211_vif_is_mesh(&sdata->vif) && |
1549 | unlikely(!is_multicast_ether_addr(hdr.addr1) && | ||
1544 | !(sta_flags & WLAN_STA_AUTHORIZED) && | 1550 | !(sta_flags & WLAN_STA_AUTHORIZED) && |
1545 | !(ethertype == ETH_P_PAE && | 1551 | !(ethertype == ETH_P_PAE && |
1546 | compare_ether_addr(dev->dev_addr, | 1552 | compare_ether_addr(dev->dev_addr, |
@@ -1645,14 +1651,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1645 | nh_pos += hdrlen; | 1651 | nh_pos += hdrlen; |
1646 | h_pos += hdrlen; | 1652 | h_pos += hdrlen; |
1647 | 1653 | ||
1648 | info = IEEE80211_SKB_CB(skb); | 1654 | 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 | 1655 | ||
1657 | skb->dev = local->mdev; | 1656 | skb->dev = local->mdev; |
1658 | dev->stats.tx_packets++; | 1657 | dev->stats.tx_packets++; |
@@ -1714,14 +1713,19 @@ void ieee80211_tx_pending(unsigned long data) | |||
1714 | netif_tx_lock_bh(dev); | 1713 | netif_tx_lock_bh(dev); |
1715 | for (i = 0; i < ieee80211_num_regular_queues(&local->hw); i++) { | 1714 | for (i = 0; i < ieee80211_num_regular_queues(&local->hw); i++) { |
1716 | /* Check that this queue is ok */ | 1715 | /* Check that this queue is ok */ |
1717 | if (__netif_subqueue_stopped(local->mdev, i)) | 1716 | if (__netif_subqueue_stopped(local->mdev, i) && |
1717 | !test_bit(i, local->queues_pending_run)) | ||
1718 | continue; | 1718 | continue; |
1719 | 1719 | ||
1720 | if (!test_bit(i, local->queues_pending)) { | 1720 | if (!test_bit(i, local->queues_pending)) { |
1721 | clear_bit(i, local->queues_pending_run); | ||
1721 | ieee80211_wake_queue(&local->hw, i); | 1722 | ieee80211_wake_queue(&local->hw, i); |
1722 | continue; | 1723 | continue; |
1723 | } | 1724 | } |
1724 | 1725 | ||
1726 | clear_bit(i, local->queues_pending_run); | ||
1727 | netif_start_subqueue(local->mdev, i); | ||
1728 | |||
1725 | store = &local->pending_packet[i]; | 1729 | store = &local->pending_packet[i]; |
1726 | tx.extra_frag = store->extra_frag; | 1730 | tx.extra_frag = store->extra_frag; |
1727 | tx.num_extra_frag = store->num_extra_frag; | 1731 | tx.num_extra_frag = store->num_extra_frag; |
@@ -1922,6 +1926,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1922 | 1926 | ||
1923 | info = IEEE80211_SKB_CB(skb); | 1927 | info = IEEE80211_SKB_CB(skb); |
1924 | 1928 | ||
1929 | skb->do_not_encrypt = 1; | ||
1930 | |||
1925 | info->band = band; | 1931 | info->band = band; |
1926 | rate_control_get_rate(local->mdev, sband, skb, &rsel); | 1932 | rate_control_get_rate(local->mdev, sband, skb, &rsel); |
1927 | 1933 | ||
@@ -1931,7 +1937,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1931 | "no rate found\n", | 1937 | "no rate found\n", |
1932 | wiphy_name(local->hw.wiphy)); | 1938 | wiphy_name(local->hw.wiphy)); |
1933 | } | 1939 | } |
1934 | dev_kfree_skb(skb); | 1940 | dev_kfree_skb_any(skb); |
1935 | skb = NULL; | 1941 | skb = NULL; |
1936 | goto out; | 1942 | goto out; |
1937 | } | 1943 | } |
@@ -1940,7 +1946,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1940 | info->tx_rate_idx = rsel.rate_idx; | 1946 | info->tx_rate_idx = rsel.rate_idx; |
1941 | 1947 | ||
1942 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | 1948 | 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; | 1949 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; |
1945 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 1950 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
1946 | if (sdata->bss_conf.use_short_preamble && | 1951 | 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_core.c b/net/netfilter/nf_conntrack_core.c index c519d090bdb9..9d1830da8e84 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1032,10 +1032,10 @@ void nf_conntrack_cleanup(void) | |||
1032 | nf_ct_free_hashtable(nf_conntrack_hash, nf_conntrack_vmalloc, | 1032 | nf_ct_free_hashtable(nf_conntrack_hash, nf_conntrack_vmalloc, |
1033 | nf_conntrack_htable_size); | 1033 | nf_conntrack_htable_size); |
1034 | 1034 | ||
1035 | nf_conntrack_proto_fini(); | ||
1036 | nf_conntrack_helper_fini(); | ||
1037 | nf_conntrack_expect_fini(); | ||
1038 | nf_conntrack_acct_fini(); | 1035 | nf_conntrack_acct_fini(); |
1036 | nf_conntrack_expect_fini(); | ||
1037 | nf_conntrack_helper_fini(); | ||
1038 | nf_conntrack_proto_fini(); | ||
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced) | 1041 | struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced) |
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. */ |
70 | static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS; | 70 | static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS; |
71 | static unsigned int nf_ct_tcp_timeout_unacknowledged __read_mostly = 5 MINS; | ||
71 | 72 | ||
72 | static unsigned int tcp_timeouts[TCP_CONNTRACK_MAX] __read_mostly = { | 73 | static 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/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 869ef9349d0f..8509db14670b 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -324,6 +324,7 @@ static int log_invalid_proto_min = 0; | |||
324 | static int log_invalid_proto_max = 255; | 324 | static int log_invalid_proto_max = 255; |
325 | 325 | ||
326 | static struct ctl_table_header *nf_ct_sysctl_header; | 326 | static struct ctl_table_header *nf_ct_sysctl_header; |
327 | static struct ctl_table_header *nf_ct_netfilter_header; | ||
327 | 328 | ||
328 | static ctl_table nf_ct_sysctl_table[] = { | 329 | static ctl_table nf_ct_sysctl_table[] = { |
329 | { | 330 | { |
@@ -384,12 +385,6 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
384 | 385 | ||
385 | static ctl_table nf_ct_netfilter_table[] = { | 386 | static ctl_table nf_ct_netfilter_table[] = { |
386 | { | 387 | { |
387 | .ctl_name = NET_NETFILTER, | ||
388 | .procname = "netfilter", | ||
389 | .mode = 0555, | ||
390 | .child = nf_ct_sysctl_table, | ||
391 | }, | ||
392 | { | ||
393 | .ctl_name = NET_NF_CONNTRACK_MAX, | 388 | .ctl_name = NET_NF_CONNTRACK_MAX, |
394 | .procname = "nf_conntrack_max", | 389 | .procname = "nf_conntrack_max", |
395 | .data = &nf_conntrack_max, | 390 | .data = &nf_conntrack_max, |
@@ -409,18 +404,29 @@ EXPORT_SYMBOL_GPL(nf_ct_log_invalid); | |||
409 | 404 | ||
410 | static int nf_conntrack_standalone_init_sysctl(void) | 405 | static int nf_conntrack_standalone_init_sysctl(void) |
411 | { | 406 | { |
412 | nf_ct_sysctl_header = | 407 | nf_ct_netfilter_header = |
413 | register_sysctl_paths(nf_ct_path, nf_ct_netfilter_table); | 408 | register_sysctl_paths(nf_ct_path, nf_ct_netfilter_table); |
414 | if (nf_ct_sysctl_header == NULL) { | 409 | if (!nf_ct_netfilter_header) |
415 | printk("nf_conntrack: can't register to sysctl.\n"); | 410 | goto out; |
416 | return -ENOMEM; | 411 | |
417 | } | 412 | nf_ct_sysctl_header = |
413 | register_sysctl_paths(nf_net_netfilter_sysctl_path, | ||
414 | nf_ct_sysctl_table); | ||
415 | if (!nf_ct_sysctl_header) | ||
416 | goto out_unregister_netfilter; | ||
417 | |||
418 | return 0; | 418 | return 0; |
419 | 419 | ||
420 | out_unregister_netfilter: | ||
421 | unregister_sysctl_table(nf_ct_netfilter_header); | ||
422 | out: | ||
423 | printk("nf_conntrack: can't register to sysctl.\n"); | ||
424 | return -ENOMEM; | ||
420 | } | 425 | } |
421 | 426 | ||
422 | static void nf_conntrack_standalone_fini_sysctl(void) | 427 | static void nf_conntrack_standalone_fini_sysctl(void) |
423 | { | 428 | { |
429 | unregister_sysctl_table(nf_ct_netfilter_header); | ||
424 | unregister_sysctl_table(nf_ct_sysctl_header); | 430 | unregister_sysctl_table(nf_ct_sysctl_header); |
425 | } | 431 | } |
426 | #else | 432 | #else |
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 | ||
368 | static void htable_destroy(struct xt_hashlimit_htable *hinfo) | 368 | static 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); | |||
109 | static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX); | 109 | static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX); |
110 | static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN); | 110 | static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN); |
111 | 111 | ||
112 | static 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 | |||
112 | static void rfkill_event(struct input_handle *handle, unsigned int type, | 131 | static 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 | ||
194 | static 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 | |||
188 | static void rfkill_disconnect(struct input_handle *handle) | 211 | static 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 | ||
109 | static 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 | |||
108 | static void notify_rfkill_state_change(struct rfkill *rfkill) | 118 | static 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 | */ |
155 | static int rfkill_toggle_radio(struct rfkill *rfkill, | 164 | static 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 | */ |
210 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) | 219 | void 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 | */ |
233 | void rfkill_epo(void) | 245 | void 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 | */ |
257 | int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state) | 276 | int 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 | ||
390 | out_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 | */ |
566 | void rfkill_free(struct rfkill *rfkill) | 590 | void 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) | |||
585 | static void rfkill_led_trigger_unregister(struct rfkill *rfkill) | 612 | static 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/act_api.c b/net/sched/act_api.c index d308c19aa3f9..26c7e1f9a350 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -205,10 +205,9 @@ struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind, | |||
205 | { | 205 | { |
206 | struct tcf_common *p = NULL; | 206 | struct tcf_common *p = NULL; |
207 | if (index && (p = tcf_hash_lookup(index, hinfo)) != NULL) { | 207 | if (index && (p = tcf_hash_lookup(index, hinfo)) != NULL) { |
208 | if (bind) { | 208 | if (bind) |
209 | p->tcfc_bindcnt++; | 209 | p->tcfc_bindcnt++; |
210 | p->tcfc_refcnt++; | 210 | p->tcfc_refcnt++; |
211 | } | ||
212 | a->priv = p; | 211 | a->priv = p; |
213 | } | 212 | } |
214 | return p; | 213 | return p; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index b0601642e227..ba1d121f3127 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -189,7 +189,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) | |||
189 | 189 | ||
190 | for (i = 0; i < dev->num_tx_queues; i++) { | 190 | for (i = 0; i < dev->num_tx_queues; i++) { |
191 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | 191 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); |
192 | struct Qdisc *q, *txq_root = txq->qdisc; | 192 | struct Qdisc *q, *txq_root = txq->qdisc_sleeping; |
193 | 193 | ||
194 | if (!(txq_root->flags & TCQ_F_BUILTIN) && | 194 | if (!(txq_root->flags & TCQ_F_BUILTIN) && |
195 | txq_root->handle == handle) | 195 | txq_root->handle == handle) |
@@ -572,44 +572,21 @@ static u32 qdisc_alloc_handle(struct net_device *dev) | |||
572 | static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | 572 | static 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,8 +792,8 @@ 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 != TC_H_ROOT) && !(sch->flags & TCQ_F_INGRESS)) |
821 | list_add_tail(&sch->list, &dev_queue->qdisc->list); | 796 | list_add_tail(&sch->list, &dev_queue->qdisc_sleeping->list); |
822 | 797 | ||
823 | return sch; | 798 | return sch; |
824 | } | 799 | } |
@@ -1261,11 +1236,11 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) | |||
1261 | q_idx = 0; | 1236 | q_idx = 0; |
1262 | 1237 | ||
1263 | dev_queue = netdev_get_tx_queue(dev, 0); | 1238 | dev_queue = netdev_get_tx_queue(dev, 0); |
1264 | if (tc_dump_qdisc_root(dev_queue->qdisc, skb, cb, &q_idx, s_q_idx) < 0) | 1239 | if (tc_dump_qdisc_root(dev_queue->qdisc_sleeping, skb, cb, &q_idx, s_q_idx) < 0) |
1265 | goto done; | 1240 | goto done; |
1266 | 1241 | ||
1267 | dev_queue = &dev->rx_queue; | 1242 | dev_queue = &dev->rx_queue; |
1268 | if (tc_dump_qdisc_root(dev_queue->qdisc, skb, cb, &q_idx, s_q_idx) < 0) | 1243 | if (tc_dump_qdisc_root(dev_queue->qdisc_sleeping, skb, cb, &q_idx, s_q_idx) < 0) |
1269 | goto done; | 1244 | goto done; |
1270 | 1245 | ||
1271 | cont: | 1246 | cont: |
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) { |
434 | drop: __maybe_unused | 434 | drop: __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) | |||
267 | drop: | 268 | drop: |
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 | ||
273 | static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | 274 | static 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 | } |
506 | EXPORT_SYMBOL(qdisc_create_dflt); | 508 | EXPORT_SYMBOL(qdisc_create_dflt); |
507 | 509 | ||
508 | /* Under qdisc_root_lock(qdisc) and BH! */ | 510 | /* Under qdisc_lock(qdisc) and BH! */ |
509 | 511 | ||
510 | void qdisc_reset(struct Qdisc *qdisc) | 512 | void 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 | ||
546 | void qdisc_destroy(struct Qdisc *qdisc) | 548 | void 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, | |||
718 | void dev_init_scheduler(struct net_device *dev) | 722 | void 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, | |||
745 | void dev_shutdown(struct net_device *dev) | 749 | void 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. */ |
198 | static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport, | 198 | static 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 | ||
594 | out: | 592 | out: |
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. */ |
864 | static inline int sctp_v4_xmit(struct sk_buff *skb, | 864 | static 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 | ||
877 | static struct sctp_af sctp_af_inet; | 882 | static struct sctp_af sctp_af_inet; |
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index b210a88d0960..7f07152bc109 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c | |||
@@ -57,7 +57,6 @@ | |||
57 | #include <linux/vmalloc.h> /* vmalloc, vfree */ | 57 | #include <linux/vmalloc.h> /* vmalloc, vfree */ |
58 | #include <asm/uaccess.h> /* copy_to/from_user */ | 58 | #include <asm/uaccess.h> /* copy_to/from_user */ |
59 | #include <linux/init.h> /* __initfunc et al. */ | 59 | #include <linux/init.h> /* __initfunc et al. */ |
60 | #include <net/syncppp.h> | ||
61 | 60 | ||
62 | #define KMEM_SAFETYZONE 8 | 61 | #define KMEM_SAFETYZONE 8 |
63 | 62 | ||
@@ -567,9 +566,6 @@ static int wanrouter_device_new_if(struct wan_device *wandev, | |||
567 | { | 566 | { |
568 | wanif_conf_t *cnf; | 567 | wanif_conf_t *cnf; |
569 | struct net_device *dev = NULL; | 568 | struct net_device *dev = NULL; |
570 | #ifdef CONFIG_WANPIPE_MULTPPP | ||
571 | struct ppp_device *pppdev=NULL; | ||
572 | #endif | ||
573 | int err; | 569 | int err; |
574 | 570 | ||
575 | if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL)) | 571 | if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL)) |
@@ -588,25 +584,10 @@ static int wanrouter_device_new_if(struct wan_device *wandev, | |||
588 | goto out; | 584 | goto out; |
589 | 585 | ||
590 | if (cnf->config_id == WANCONFIG_MPPP) { | 586 | if (cnf->config_id == WANCONFIG_MPPP) { |
591 | #ifdef CONFIG_WANPIPE_MULTPPP | ||
592 | pppdev = kzalloc(sizeof(struct ppp_device), GFP_KERNEL); | ||
593 | err = -ENOBUFS; | ||
594 | if (pppdev == NULL) | ||
595 | goto out; | ||
596 | pppdev->dev = kzalloc(sizeof(struct net_device), GFP_KERNEL); | ||
597 | if (pppdev->dev == NULL) { | ||
598 | kfree(pppdev); | ||
599 | err = -ENOBUFS; | ||
600 | goto out; | ||
601 | } | ||
602 | err = wandev->new_if(wandev, (struct net_device *)pppdev, cnf); | ||
603 | dev = pppdev->dev; | ||
604 | #else | ||
605 | printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n", | 587 | printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n", |
606 | wandev->name); | 588 | wandev->name); |
607 | err = -EPROTONOSUPPORT; | 589 | err = -EPROTONOSUPPORT; |
608 | goto out; | 590 | goto out; |
609 | #endif | ||
610 | } else { | 591 | } else { |
611 | dev = kzalloc(sizeof(struct net_device), GFP_KERNEL); | 592 | dev = kzalloc(sizeof(struct net_device), GFP_KERNEL); |
612 | err = -ENOBUFS; | 593 | err = -ENOBUFS; |
@@ -661,17 +642,9 @@ static int wanrouter_device_new_if(struct wan_device *wandev, | |||
661 | kfree(dev->priv); | 642 | kfree(dev->priv); |
662 | dev->priv = NULL; | 643 | dev->priv = NULL; |
663 | 644 | ||
664 | #ifdef CONFIG_WANPIPE_MULTPPP | ||
665 | if (cnf->config_id == WANCONFIG_MPPP) | ||
666 | kfree(pppdev); | ||
667 | else | ||
668 | kfree(dev); | ||
669 | #else | ||
670 | /* Sync PPP is disabled */ | 645 | /* Sync PPP is disabled */ |
671 | if (cnf->config_id != WANCONFIG_MPPP) | 646 | if (cnf->config_id != WANCONFIG_MPPP) |
672 | kfree(dev); | 647 | kfree(dev); |
673 | #endif | ||
674 | |||
675 | out: | 648 | out: |
676 | kfree(cnf); | 649 | kfree(cnf); |
677 | return err; | 650 | return err; |
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 */ |
32 | static int get_drv_dev_by_info_ifindex(struct genl_info *info, | 32 | static 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 | ||
939 | static int nl80211_dump_station(struct sk_buff *skb, | 949 | static 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 | ||
1003 | static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) | 1024 | static 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 | ¶ms.station_flags)) | 1193 | ¶ms.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 | ||
1279 | static int nl80211_dump_mpath(struct sk_buff *skb, | 1300 | static 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 | ||
1344 | static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) | 1375 | static 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 | ||