diff options
Diffstat (limited to 'net')
65 files changed, 537 insertions, 317 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index c1c597e3e198..e0af7237cd92 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -673,7 +673,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
673 | goto encrypt; | 673 | goto encrypt; |
674 | 674 | ||
675 | auth: | 675 | auth: |
676 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 676 | if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
677 | return 0; | 677 | return 0; |
678 | 678 | ||
679 | if (!hci_conn_auth(conn, sec_level, auth_type)) | 679 | if (!hci_conn_auth(conn, sec_level, auth_type)) |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 8cd12917733b..5ea94a1eecf2 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -251,7 +251,7 @@ static void l2cap_chan_timeout(unsigned long arg) | |||
251 | 251 | ||
252 | if (sock_owned_by_user(sk)) { | 252 | if (sock_owned_by_user(sk)) { |
253 | /* sk is owned by user. Try again later */ | 253 | /* sk is owned by user. Try again later */ |
254 | __set_chan_timer(chan, HZ / 5); | 254 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
255 | bh_unlock_sock(sk); | 255 | bh_unlock_sock(sk); |
256 | chan_put(chan); | 256 | chan_put(chan); |
257 | return; | 257 | return; |
@@ -2488,7 +2488,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
2488 | if (sock_owned_by_user(sk)) { | 2488 | if (sock_owned_by_user(sk)) { |
2489 | l2cap_state_change(chan, BT_DISCONN); | 2489 | l2cap_state_change(chan, BT_DISCONN); |
2490 | __clear_chan_timer(chan); | 2490 | __clear_chan_timer(chan); |
2491 | __set_chan_timer(chan, HZ / 5); | 2491 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
2492 | break; | 2492 | break; |
2493 | } | 2493 | } |
2494 | 2494 | ||
@@ -2661,7 +2661,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
2661 | 2661 | ||
2662 | default: | 2662 | default: |
2663 | sk->sk_err = ECONNRESET; | 2663 | sk->sk_err = ECONNRESET; |
2664 | __set_chan_timer(chan, HZ * 5); | 2664 | __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); |
2665 | l2cap_send_disconn_req(conn, chan, ECONNRESET); | 2665 | l2cap_send_disconn_req(conn, chan, ECONNRESET); |
2666 | goto done; | 2666 | goto done; |
2667 | } | 2667 | } |
@@ -2718,7 +2718,7 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd | |||
2718 | if (sock_owned_by_user(sk)) { | 2718 | if (sock_owned_by_user(sk)) { |
2719 | l2cap_state_change(chan, BT_DISCONN); | 2719 | l2cap_state_change(chan, BT_DISCONN); |
2720 | __clear_chan_timer(chan); | 2720 | __clear_chan_timer(chan); |
2721 | __set_chan_timer(chan, HZ / 5); | 2721 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
2722 | bh_unlock_sock(sk); | 2722 | bh_unlock_sock(sk); |
2723 | return 0; | 2723 | return 0; |
2724 | } | 2724 | } |
@@ -2752,7 +2752,7 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd | |||
2752 | if (sock_owned_by_user(sk)) { | 2752 | if (sock_owned_by_user(sk)) { |
2753 | l2cap_state_change(chan,BT_DISCONN); | 2753 | l2cap_state_change(chan,BT_DISCONN); |
2754 | __clear_chan_timer(chan); | 2754 | __clear_chan_timer(chan); |
2755 | __set_chan_timer(chan, HZ / 5); | 2755 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
2756 | bh_unlock_sock(sk); | 2756 | bh_unlock_sock(sk); |
2757 | return 0; | 2757 | return 0; |
2758 | } | 2758 | } |
@@ -3998,7 +3998,7 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt) | |||
3998 | if (encrypt == 0x00) { | 3998 | if (encrypt == 0x00) { |
3999 | if (chan->sec_level == BT_SECURITY_MEDIUM) { | 3999 | if (chan->sec_level == BT_SECURITY_MEDIUM) { |
4000 | __clear_chan_timer(chan); | 4000 | __clear_chan_timer(chan); |
4001 | __set_chan_timer(chan, HZ * 5); | 4001 | __set_chan_timer(chan, L2CAP_ENC_TIMEOUT); |
4002 | } else if (chan->sec_level == BT_SECURITY_HIGH) | 4002 | } else if (chan->sec_level == BT_SECURITY_HIGH) |
4003 | l2cap_chan_close(chan, ECONNREFUSED); | 4003 | l2cap_chan_close(chan, ECONNREFUSED); |
4004 | } else { | 4004 | } else { |
@@ -4066,7 +4066,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4066 | L2CAP_CONN_REQ, sizeof(req), &req); | 4066 | L2CAP_CONN_REQ, sizeof(req), &req); |
4067 | } else { | 4067 | } else { |
4068 | __clear_chan_timer(chan); | 4068 | __clear_chan_timer(chan); |
4069 | __set_chan_timer(chan, HZ / 10); | 4069 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
4070 | } | 4070 | } |
4071 | } else if (chan->state == BT_CONNECT2) { | 4071 | } else if (chan->state == BT_CONNECT2) { |
4072 | struct l2cap_conn_rsp rsp; | 4072 | struct l2cap_conn_rsp rsp; |
@@ -4086,7 +4086,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4086 | } | 4086 | } |
4087 | } else { | 4087 | } else { |
4088 | l2cap_state_change(chan, BT_DISCONN); | 4088 | l2cap_state_change(chan, BT_DISCONN); |
4089 | __set_chan_timer(chan, HZ / 10); | 4089 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
4090 | res = L2CAP_CR_SEC_BLOCK; | 4090 | res = L2CAP_CR_SEC_BLOCK; |
4091 | stat = L2CAP_CS_NO_INFO; | 4091 | stat = L2CAP_CS_NO_INFO; |
4092 | } | 4092 | } |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 995cbe0ac0b2..a5f4e5769809 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1501,6 +1501,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
1501 | 1501 | ||
1502 | __skb_pull(skb2, offset); | 1502 | __skb_pull(skb2, offset); |
1503 | skb_reset_transport_header(skb2); | 1503 | skb_reset_transport_header(skb2); |
1504 | skb_postpull_rcsum(skb2, skb_network_header(skb2), | ||
1505 | skb_network_header_len(skb2)); | ||
1504 | 1506 | ||
1505 | icmp6_type = icmp6_hdr(skb2)->icmp6_type; | 1507 | icmp6_type = icmp6_hdr(skb2)->icmp6_type; |
1506 | 1508 | ||
@@ -1770,7 +1772,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val) | |||
1770 | int err = 0; | 1772 | int err = 0; |
1771 | struct net_bridge_mdb_htable *mdb; | 1773 | struct net_bridge_mdb_htable *mdb; |
1772 | 1774 | ||
1773 | spin_lock(&br->multicast_lock); | 1775 | spin_lock_bh(&br->multicast_lock); |
1774 | if (br->multicast_disabled == !val) | 1776 | if (br->multicast_disabled == !val) |
1775 | goto unlock; | 1777 | goto unlock; |
1776 | 1778 | ||
@@ -1806,7 +1808,7 @@ rollback: | |||
1806 | } | 1808 | } |
1807 | 1809 | ||
1808 | unlock: | 1810 | unlock: |
1809 | spin_unlock(&br->multicast_lock); | 1811 | spin_unlock_bh(&br->multicast_lock); |
1810 | 1812 | ||
1811 | return err; | 1813 | return err; |
1812 | } | 1814 | } |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index e5f9ece3c9a0..a1daf8227ed1 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <net/sock.h> | 18 | #include <net/sock.h> |
19 | 19 | ||
20 | #include "br_private.h" | 20 | #include "br_private.h" |
21 | #include "br_private_stp.h" | ||
21 | 22 | ||
22 | static inline size_t br_nlmsg_size(void) | 23 | static inline size_t br_nlmsg_size(void) |
23 | { | 24 | { |
@@ -188,6 +189,11 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
188 | 189 | ||
189 | p->state = new_state; | 190 | p->state = new_state; |
190 | br_log_state(p); | 191 | br_log_state(p); |
192 | |||
193 | spin_lock_bh(&p->br->lock); | ||
194 | br_port_state_selection(p->br); | ||
195 | spin_unlock_bh(&p->br->lock); | ||
196 | |||
191 | br_ifinfo_notify(RTM_NEWLINK, p); | 197 | br_ifinfo_notify(RTM_NEWLINK, p); |
192 | 198 | ||
193 | return 0; | 199 | return 0; |
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index ad0a3f7cf6cc..dd147d78a588 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c | |||
@@ -399,25 +399,24 @@ void br_port_state_selection(struct net_bridge *br) | |||
399 | struct net_bridge_port *p; | 399 | struct net_bridge_port *p; |
400 | unsigned int liveports = 0; | 400 | unsigned int liveports = 0; |
401 | 401 | ||
402 | /* Don't change port states if userspace is handling STP */ | ||
403 | if (br->stp_enabled == BR_USER_STP) | ||
404 | return; | ||
405 | |||
406 | list_for_each_entry(p, &br->port_list, list) { | 402 | list_for_each_entry(p, &br->port_list, list) { |
407 | if (p->state == BR_STATE_DISABLED) | 403 | if (p->state == BR_STATE_DISABLED) |
408 | continue; | 404 | continue; |
409 | 405 | ||
410 | if (p->port_no == br->root_port) { | 406 | /* Don't change port states if userspace is handling STP */ |
411 | p->config_pending = 0; | 407 | if (br->stp_enabled != BR_USER_STP) { |
412 | p->topology_change_ack = 0; | 408 | if (p->port_no == br->root_port) { |
413 | br_make_forwarding(p); | 409 | p->config_pending = 0; |
414 | } else if (br_is_designated_port(p)) { | 410 | p->topology_change_ack = 0; |
415 | del_timer(&p->message_age_timer); | 411 | br_make_forwarding(p); |
416 | br_make_forwarding(p); | 412 | } else if (br_is_designated_port(p)) { |
417 | } else { | 413 | del_timer(&p->message_age_timer); |
418 | p->config_pending = 0; | 414 | br_make_forwarding(p); |
419 | p->topology_change_ack = 0; | 415 | } else { |
420 | br_make_blocking(p); | 416 | p->config_pending = 0; |
417 | p->topology_change_ack = 0; | ||
418 | br_make_blocking(p); | ||
419 | } | ||
421 | } | 420 | } |
422 | 421 | ||
423 | if (p->state == BR_STATE_FORWARDING) | 422 | if (p->state == BR_STATE_FORWARDING) |
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c index f39921171d0d..d3ca87bf23b7 100644 --- a/net/caif/cffrml.c +++ b/net/caif/cffrml.c | |||
@@ -136,20 +136,21 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) | |||
136 | 136 | ||
137 | static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) | 137 | static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) |
138 | { | 138 | { |
139 | int tmp; | ||
140 | u16 chks; | 139 | u16 chks; |
141 | u16 len; | 140 | u16 len; |
141 | __le16 data; | ||
142 | |||
142 | struct cffrml *this = container_obj(layr); | 143 | struct cffrml *this = container_obj(layr); |
143 | if (this->dofcs) { | 144 | if (this->dofcs) { |
144 | chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); | 145 | chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); |
145 | tmp = cpu_to_le16(chks); | 146 | data = cpu_to_le16(chks); |
146 | cfpkt_add_trail(pkt, &tmp, 2); | 147 | cfpkt_add_trail(pkt, &data, 2); |
147 | } else { | 148 | } else { |
148 | cfpkt_pad_trail(pkt, 2); | 149 | cfpkt_pad_trail(pkt, 2); |
149 | } | 150 | } |
150 | len = cfpkt_getlen(pkt); | 151 | len = cfpkt_getlen(pkt); |
151 | tmp = cpu_to_le16(len); | 152 | data = cpu_to_le16(len); |
152 | cfpkt_add_head(pkt, &tmp, 2); | 153 | cfpkt_add_head(pkt, &data, 2); |
153 | cfpkt_info(pkt)->hdr_len += 2; | 154 | cfpkt_info(pkt)->hdr_len += 2; |
154 | if (cfpkt_erroneous(pkt)) { | 155 | if (cfpkt_erroneous(pkt)) { |
155 | pr_err("Packet is erroneous!\n"); | 156 | pr_err("Packet is erroneous!\n"); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 733e46008b89..f4f3f58f5234 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -244,7 +244,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, | |||
244 | ceph_pagelist_init(req->r_trail); | 244 | ceph_pagelist_init(req->r_trail); |
245 | } | 245 | } |
246 | /* create request message; allow space for oid */ | 246 | /* create request message; allow space for oid */ |
247 | msg_size += 40; | 247 | msg_size += MAX_OBJ_NAME_SIZE; |
248 | if (snapc) | 248 | if (snapc) |
249 | msg_size += sizeof(u64) * snapc->num_snaps; | 249 | msg_size += sizeof(u64) * snapc->num_snaps; |
250 | if (use_mempool) | 250 | if (use_mempool) |
diff --git a/net/core/dev.c b/net/core/dev.c index 6ba50a1e404c..5a13edfc9f73 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1396,7 +1396,7 @@ rollback: | |||
1396 | for_each_net(net) { | 1396 | for_each_net(net) { |
1397 | for_each_netdev(net, dev) { | 1397 | for_each_netdev(net, dev) { |
1398 | if (dev == last) | 1398 | if (dev == last) |
1399 | break; | 1399 | goto outroll; |
1400 | 1400 | ||
1401 | if (dev->flags & IFF_UP) { | 1401 | if (dev->flags & IFF_UP) { |
1402 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | 1402 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); |
@@ -1407,6 +1407,7 @@ rollback: | |||
1407 | } | 1407 | } |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | outroll: | ||
1410 | raw_notifier_chain_unregister(&netdev_chain, nb); | 1411 | raw_notifier_chain_unregister(&netdev_chain, nb); |
1411 | goto unlock; | 1412 | goto unlock; |
1412 | } | 1413 | } |
@@ -4282,6 +4283,12 @@ static int dev_seq_open(struct inode *inode, struct file *file) | |||
4282 | sizeof(struct dev_iter_state)); | 4283 | sizeof(struct dev_iter_state)); |
4283 | } | 4284 | } |
4284 | 4285 | ||
4286 | int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
4287 | const struct seq_operations *ops) | ||
4288 | { | ||
4289 | return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state)); | ||
4290 | } | ||
4291 | |||
4285 | static const struct file_operations dev_seq_fops = { | 4292 | static const struct file_operations dev_seq_fops = { |
4286 | .owner = THIS_MODULE, | 4293 | .owner = THIS_MODULE, |
4287 | .open = dev_seq_open, | 4294 | .open = dev_seq_open, |
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index 277faef9148d..febba516db62 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -696,8 +696,7 @@ static const struct seq_operations dev_mc_seq_ops = { | |||
696 | 696 | ||
697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | 697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) |
698 | { | 698 | { |
699 | return seq_open_net(inode, file, &dev_mc_seq_ops, | 699 | return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); |
700 | sizeof(struct seq_net_private)); | ||
701 | } | 700 | } |
702 | 701 | ||
703 | static const struct file_operations dev_mc_seq_fops = { | 702 | static const struct file_operations dev_mc_seq_fops = { |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 039d51e6c284..5ac07d31fbc9 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2397,7 +2397,10 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq, | |||
2397 | struct net *net = seq_file_net(seq); | 2397 | struct net *net = seq_file_net(seq); |
2398 | struct neigh_table *tbl = state->tbl; | 2398 | struct neigh_table *tbl = state->tbl; |
2399 | 2399 | ||
2400 | pn = pn->next; | 2400 | do { |
2401 | pn = pn->next; | ||
2402 | } while (pn && !net_eq(pneigh_net(pn), net)); | ||
2403 | |||
2401 | while (!pn) { | 2404 | while (!pn) { |
2402 | if (++state->bucket > PNEIGH_HASHMASK) | 2405 | if (++state->bucket > PNEIGH_HASHMASK) |
2403 | break; | 2406 | break; |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 182236b2510a..9b570a6a33c5 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -26,10 +26,11 @@ | |||
26 | * but then some measure against one socket starving all other sockets | 26 | * but then some measure against one socket starving all other sockets |
27 | * would be needed. | 27 | * would be needed. |
28 | * | 28 | * |
29 | * It was 128 by default. Experiments with real servers show, that | 29 | * The minimum value of it is 128. Experiments with real servers show that |
30 | * it is absolutely not enough even at 100conn/sec. 256 cures most | 30 | * it is absolutely not enough even at 100conn/sec. 256 cures most |
31 | * of problems. This value is adjusted to 128 for very small machines | 31 | * of problems. |
32 | * (<=32Mb of memory) and to 1024 on normal or better ones (>=256Mb). | 32 | * This value is adjusted to 128 for low memory machines, |
33 | * and it will increase in proportion to the memory of machine. | ||
33 | * Note : Dont forget somaxconn that may limit backlog too. | 34 | * Note : Dont forget somaxconn that may limit backlog too. |
34 | */ | 35 | */ |
35 | int sysctl_max_syn_backlog = 256; | 36 | int sysctl_max_syn_backlog = 256; |
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c index 025233de25f9..925991ae6f52 100644 --- a/net/core/secure_seq.c +++ b/net/core/secure_seq.c | |||
@@ -19,6 +19,7 @@ static int __init net_secret_init(void) | |||
19 | } | 19 | } |
20 | late_initcall(net_secret_init); | 20 | late_initcall(net_secret_init); |
21 | 21 | ||
22 | #ifdef CONFIG_INET | ||
22 | static u32 seq_scale(u32 seq) | 23 | static u32 seq_scale(u32 seq) |
23 | { | 24 | { |
24 | /* | 25 | /* |
@@ -33,6 +34,7 @@ static u32 seq_scale(u32 seq) | |||
33 | */ | 34 | */ |
34 | return seq + (ktime_to_ns(ktime_get_real()) >> 6); | 35 | return seq + (ktime_to_ns(ktime_get_real()) >> 6); |
35 | } | 36 | } |
37 | #endif | ||
36 | 38 | ||
37 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
38 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, | 40 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 18a3cebb753d..3c30ee4a5710 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2230,7 +2230,7 @@ static int skb_prepare_for_shift(struct sk_buff *skb) | |||
2230 | * @shiftlen: shift up to this many bytes | 2230 | * @shiftlen: shift up to this many bytes |
2231 | * | 2231 | * |
2232 | * Attempts to shift up to shiftlen worth of bytes, which may be less than | 2232 | * Attempts to shift up to shiftlen worth of bytes, which may be less than |
2233 | * the length of the skb, from tgt to skb. Returns number bytes shifted. | 2233 | * the length of the skb, from skb to tgt. Returns number bytes shifted. |
2234 | * It's up to caller to free skb if everything was shifted. | 2234 | * It's up to caller to free skb if everything was shifted. |
2235 | * | 2235 | * |
2236 | * If @tgt runs out of frags, the whole operation is aborted. | 2236 | * If @tgt runs out of frags, the whole operation is aborted. |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 90a919afbed7..3f4e5414c8e5 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -111,6 +111,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
111 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, | 111 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, |
112 | inet->inet_sport, inet->inet_dport, sk); | 112 | inet->inet_sport, inet->inet_dport, sk); |
113 | if (IS_ERR(rt)) { | 113 | if (IS_ERR(rt)) { |
114 | err = PTR_ERR(rt); | ||
114 | rt = NULL; | 115 | rt = NULL; |
115 | goto failure; | 116 | goto failure; |
116 | } | 117 | } |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index a77d16158eb6..94f4ec036669 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -112,7 +112,7 @@ static unsigned long dn_rt_deadline; | |||
112 | static int dn_dst_gc(struct dst_ops *ops); | 112 | static int dn_dst_gc(struct dst_ops *ops); |
113 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); | 113 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); |
114 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); | 114 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); |
115 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst); | 115 | static unsigned int dn_dst_mtu(const struct dst_entry *dst); |
116 | static void dn_dst_destroy(struct dst_entry *); | 116 | static void dn_dst_destroy(struct dst_entry *); |
117 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); | 117 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); |
118 | static void dn_dst_link_failure(struct sk_buff *); | 118 | static void dn_dst_link_failure(struct sk_buff *); |
@@ -135,7 +135,7 @@ static struct dst_ops dn_dst_ops = { | |||
135 | .gc = dn_dst_gc, | 135 | .gc = dn_dst_gc, |
136 | .check = dn_dst_check, | 136 | .check = dn_dst_check, |
137 | .default_advmss = dn_dst_default_advmss, | 137 | .default_advmss = dn_dst_default_advmss, |
138 | .default_mtu = dn_dst_default_mtu, | 138 | .mtu = dn_dst_mtu, |
139 | .cow_metrics = dst_cow_metrics_generic, | 139 | .cow_metrics = dst_cow_metrics_generic, |
140 | .destroy = dn_dst_destroy, | 140 | .destroy = dn_dst_destroy, |
141 | .negative_advice = dn_dst_negative_advice, | 141 | .negative_advice = dn_dst_negative_advice, |
@@ -825,9 +825,11 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst) | |||
825 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); | 825 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); |
826 | } | 826 | } |
827 | 827 | ||
828 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst) | 828 | static unsigned int dn_dst_mtu(const struct dst_entry *dst) |
829 | { | 829 | { |
830 | return dst->dev->mtu; | 830 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
831 | |||
832 | return mtu ? : dst->dev->mtu; | ||
831 | } | 833 | } |
832 | 834 | ||
833 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 835 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c index 67f691bd4acf..d9c150cc59a9 100644 --- a/net/decnet/dn_timer.c +++ b/net/decnet/dn_timer.c | |||
@@ -36,16 +36,13 @@ static void dn_slow_timer(unsigned long arg); | |||
36 | 36 | ||
37 | void dn_start_slow_timer(struct sock *sk) | 37 | void dn_start_slow_timer(struct sock *sk) |
38 | { | 38 | { |
39 | sk->sk_timer.expires = jiffies + SLOW_INTERVAL; | 39 | setup_timer(&sk->sk_timer, dn_slow_timer, (unsigned long)sk); |
40 | sk->sk_timer.function = dn_slow_timer; | 40 | sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); |
41 | sk->sk_timer.data = (unsigned long)sk; | ||
42 | |||
43 | add_timer(&sk->sk_timer); | ||
44 | } | 41 | } |
45 | 42 | ||
46 | void dn_stop_slow_timer(struct sock *sk) | 43 | void dn_stop_slow_timer(struct sock *sk) |
47 | { | 44 | { |
48 | del_timer(&sk->sk_timer); | 45 | sk_stop_timer(sk, &sk->sk_timer); |
49 | } | 46 | } |
50 | 47 | ||
51 | static void dn_slow_timer(unsigned long arg) | 48 | static void dn_slow_timer(unsigned long arg) |
@@ -53,12 +50,10 @@ static void dn_slow_timer(unsigned long arg) | |||
53 | struct sock *sk = (struct sock *)arg; | 50 | struct sock *sk = (struct sock *)arg; |
54 | struct dn_scp *scp = DN_SK(sk); | 51 | struct dn_scp *scp = DN_SK(sk); |
55 | 52 | ||
56 | sock_hold(sk); | ||
57 | bh_lock_sock(sk); | 53 | bh_lock_sock(sk); |
58 | 54 | ||
59 | if (sock_owned_by_user(sk)) { | 55 | if (sock_owned_by_user(sk)) { |
60 | sk->sk_timer.expires = jiffies + HZ / 10; | 56 | sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 10); |
61 | add_timer(&sk->sk_timer); | ||
62 | goto out; | 57 | goto out; |
63 | } | 58 | } |
64 | 59 | ||
@@ -100,9 +95,7 @@ static void dn_slow_timer(unsigned long arg) | |||
100 | scp->keepalive_fxn(sk); | 95 | scp->keepalive_fxn(sk); |
101 | } | 96 | } |
102 | 97 | ||
103 | sk->sk_timer.expires = jiffies + SLOW_INTERVAL; | 98 | sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); |
104 | |||
105 | add_timer(&sk->sk_timer); | ||
106 | out: | 99 | out: |
107 | bh_unlock_sock(sk); | 100 | bh_unlock_sock(sk); |
108 | sock_put(sk); | 101 | sock_put(sk); |
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index c1f4154552fc..36d14406261e 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -136,8 +136,6 @@ static void ah_output_done(struct crypto_async_request *base, int err) | |||
136 | memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); | 136 | memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); |
137 | } | 137 | } |
138 | 138 | ||
139 | err = ah->nexthdr; | ||
140 | |||
141 | kfree(AH_SKB_CB(skb)->tmp); | 139 | kfree(AH_SKB_CB(skb)->tmp); |
142 | xfrm_output_resume(skb, err); | 140 | xfrm_output_resume(skb, err); |
143 | } | 141 | } |
@@ -264,12 +262,12 @@ static void ah_input_done(struct crypto_async_request *base, int err) | |||
264 | if (err) | 262 | if (err) |
265 | goto out; | 263 | goto out; |
266 | 264 | ||
265 | err = ah->nexthdr; | ||
266 | |||
267 | skb->network_header += ah_hlen; | 267 | skb->network_header += ah_hlen; |
268 | memcpy(skb_network_header(skb), work_iph, ihl); | 268 | memcpy(skb_network_header(skb), work_iph, ihl); |
269 | __skb_pull(skb, ah_hlen + ihl); | 269 | __skb_pull(skb, ah_hlen + ihl); |
270 | skb_set_transport_header(skb, -ihl); | 270 | skb_set_transport_header(skb, -ihl); |
271 | |||
272 | err = ah->nexthdr; | ||
273 | out: | 271 | out: |
274 | kfree(AH_SKB_CB(skb)->tmp); | 272 | kfree(AH_SKB_CB(skb)->tmp); |
275 | xfrm_input_resume(skb, err); | 273 | xfrm_input_resume(skb, err); |
@@ -371,8 +369,6 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) | |||
371 | if (err == -EINPROGRESS) | 369 | if (err == -EINPROGRESS) |
372 | goto out; | 370 | goto out; |
373 | 371 | ||
374 | if (err == -EBUSY) | ||
375 | err = NET_XMIT_DROP; | ||
376 | goto out_free; | 372 | goto out_free; |
377 | } | 373 | } |
378 | 374 | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index c6b5092f29a1..65f01dc47565 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1490 | void __user *buffer, | 1490 | void __user *buffer, |
1491 | size_t *lenp, loff_t *ppos) | 1491 | size_t *lenp, loff_t *ppos) |
1492 | { | 1492 | { |
1493 | int old_value = *(int *)ctl->data; | ||
1493 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); | 1494 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
1495 | int new_value = *(int *)ctl->data; | ||
1494 | 1496 | ||
1495 | if (write) { | 1497 | if (write) { |
1496 | struct ipv4_devconf *cnf = ctl->extra1; | 1498 | struct ipv4_devconf *cnf = ctl->extra1; |
@@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1501 | 1503 | ||
1502 | if (cnf == net->ipv4.devconf_dflt) | 1504 | if (cnf == net->ipv4.devconf_dflt) |
1503 | devinet_copy_dflt_conf(net, i); | 1505 | devinet_copy_dflt_conf(net, i); |
1506 | if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1) | ||
1507 | if ((new_value == 0) && (old_value != 0)) | ||
1508 | rt_cache_flush(net, 0); | ||
1504 | } | 1509 | } |
1505 | 1510 | ||
1506 | return ret; | 1511 | return ret; |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index c7472eff2d51..b2ca095cb9da 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1716,7 +1716,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1716 | if (err) { | 1716 | if (err) { |
1717 | int j; | 1717 | int j; |
1718 | 1718 | ||
1719 | pmc->sfcount[sfmode]--; | 1719 | if (!delta) |
1720 | pmc->sfcount[sfmode]--; | ||
1720 | for (j=0; j<i; j++) | 1721 | for (j=0; j<i; j++) |
1721 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); | 1722 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); |
1722 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { | 1723 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index f5e2bdaef949..ccee270a9b65 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -108,9 +108,6 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
108 | icsk->icsk_ca_ops->name); | 108 | icsk->icsk_ca_ops->name); |
109 | } | 109 | } |
110 | 110 | ||
111 | if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6)) | ||
112 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
113 | |||
114 | r->idiag_family = sk->sk_family; | 111 | r->idiag_family = sk->sk_family; |
115 | r->idiag_state = sk->sk_state; | 112 | r->idiag_state = sk->sk_state; |
116 | r->idiag_timer = 0; | 113 | r->idiag_timer = 0; |
@@ -125,16 +122,23 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
125 | r->id.idiag_src[0] = inet->inet_rcv_saddr; | 122 | r->id.idiag_src[0] = inet->inet_rcv_saddr; |
126 | r->id.idiag_dst[0] = inet->inet_daddr; | 123 | r->id.idiag_dst[0] = inet->inet_daddr; |
127 | 124 | ||
125 | /* IPv6 dual-stack sockets use inet->tos for IPv4 connections, | ||
126 | * hence this needs to be included regardless of socket family. | ||
127 | */ | ||
128 | if (ext & (1 << (INET_DIAG_TOS - 1))) | ||
129 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
130 | |||
128 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 131 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
129 | if (r->idiag_family == AF_INET6) { | 132 | if (r->idiag_family == AF_INET6) { |
130 | const struct ipv6_pinfo *np = inet6_sk(sk); | 133 | const struct ipv6_pinfo *np = inet6_sk(sk); |
131 | 134 | ||
135 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
136 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
137 | |||
132 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, | 138 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
133 | &np->rcv_saddr); | 139 | &np->rcv_saddr); |
134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 140 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
135 | &np->daddr); | 141 | &np->daddr); |
136 | if (ext & (1 << (INET_DIAG_TOS - 1))) | ||
137 | RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass); | ||
138 | } | 142 | } |
139 | #endif | 143 | #endif |
140 | 144 | ||
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 3b34d1c86270..29a07b6c7168 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb) | |||
84 | 84 | ||
85 | rt = skb_rtable(skb); | 85 | rt = skb_rtable(skb); |
86 | 86 | ||
87 | if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway) | 87 | if (opt->is_strictroute && opt->nexthop != rt->rt_gateway) |
88 | goto sr_failed; | 88 | goto sr_failed; |
89 | 89 | ||
90 | if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && | 90 | if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index ec93335901dd..1e60f7679075 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -568,12 +568,13 @@ void ip_forward_options(struct sk_buff *skb) | |||
568 | ) { | 568 | ) { |
569 | if (srrptr + 3 > srrspace) | 569 | if (srrptr + 3 > srrspace) |
570 | break; | 570 | break; |
571 | if (memcmp(&ip_hdr(skb)->daddr, &optptr[srrptr-1], 4) == 0) | 571 | if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) |
572 | break; | 572 | break; |
573 | } | 573 | } |
574 | if (srrptr + 3 <= srrspace) { | 574 | if (srrptr + 3 <= srrspace) { |
575 | opt->is_changed = 1; | 575 | opt->is_changed = 1; |
576 | ip_rt_get_source(&optptr[srrptr-1], skb, rt); | 576 | ip_rt_get_source(&optptr[srrptr-1], skb, rt); |
577 | ip_hdr(skb)->daddr = opt->nexthop; | ||
577 | optptr[2] = srrptr+4; | 578 | optptr[2] = srrptr+4; |
578 | } else if (net_ratelimit()) | 579 | } else if (net_ratelimit()) |
579 | printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); | 580 | printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); |
@@ -640,6 +641,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
640 | } | 641 | } |
641 | if (srrptr <= srrspace) { | 642 | if (srrptr <= srrspace) { |
642 | opt->srr_is_hit = 1; | 643 | opt->srr_is_hit = 1; |
644 | opt->nexthop = nexthop; | ||
643 | opt->is_changed = 1; | 645 | opt->is_changed = 1; |
644 | } | 646 | } |
645 | return 0; | 647 | return 0; |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index 9899619ab9b8..4f47e064e262 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -64,7 +64,8 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
64 | /* Change in oif may mean change in hh_len. */ | 64 | /* Change in oif may mean change in hh_len. */ |
65 | hh_len = skb_dst(skb)->dev->hard_header_len; | 65 | hh_len = skb_dst(skb)->dev->hard_header_len; |
66 | if (skb_headroom(skb) < hh_len && | 66 | if (skb_headroom(skb) < hh_len && |
67 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) | 67 | pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)), |
68 | 0, GFP_ATOMIC)) | ||
68 | return -1; | 69 | return -1; |
69 | 70 | ||
70 | return 0; | 71 | return 0; |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index 1dfc18a03fd4..f19f2182894c 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -325,7 +325,6 @@ config IP_NF_TARGET_TTL | |||
325 | # raw + specific targets | 325 | # raw + specific targets |
326 | config IP_NF_RAW | 326 | config IP_NF_RAW |
327 | tristate 'raw table support (required for NOTRACK/TRACE)' | 327 | tristate 'raw table support (required for NOTRACK/TRACE)' |
328 | depends on NETFILTER_ADVANCED | ||
329 | help | 328 | help |
330 | This option adds a `raw' table to iptables. This table is the very | 329 | This option adds a `raw' table to iptables. This table is the very |
331 | first in the netfilter framework and hooks in at the PREROUTING | 330 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index a06f73fdb3c0..43d4c3b22369 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -339,7 +339,6 @@ void ping_err(struct sk_buff *skb, u32 info) | |||
339 | sk = ping_v4_lookup(net, iph->daddr, iph->saddr, | 339 | sk = ping_v4_lookup(net, iph->daddr, iph->saddr, |
340 | ntohs(icmph->un.echo.id), skb->dev->ifindex); | 340 | ntohs(icmph->un.echo.id), skb->dev->ifindex); |
341 | if (sk == NULL) { | 341 | if (sk == NULL) { |
342 | ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); | ||
343 | pr_debug("no socket, dropping\n"); | 342 | pr_debug("no socket, dropping\n"); |
344 | return; /* No socket for error */ | 343 | return; /* No socket for error */ |
345 | } | 344 | } |
@@ -679,7 +678,6 @@ static int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
679 | pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n", | 678 | pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n", |
680 | inet_sk(sk), inet_sk(sk)->inet_num, skb); | 679 | inet_sk(sk), inet_sk(sk)->inet_num, skb); |
681 | if (sock_queue_rcv_skb(sk, skb) < 0) { | 680 | if (sock_queue_rcv_skb(sk, skb) < 0) { |
682 | ICMP_INC_STATS_BH(sock_net(sk), ICMP_MIB_INERRORS); | ||
683 | kfree_skb(skb); | 681 | kfree_skb(skb); |
684 | pr_debug("ping_queue_rcv_skb -> failed\n"); | 682 | pr_debug("ping_queue_rcv_skb -> failed\n"); |
685 | return -1; | 683 | return -1; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 155138d8ec8b..46af62363b8c 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -112,7 +112,7 @@ | |||
112 | #include <net/secure_seq.h> | 112 | #include <net/secure_seq.h> |
113 | 113 | ||
114 | #define RT_FL_TOS(oldflp4) \ | 114 | #define RT_FL_TOS(oldflp4) \ |
115 | ((u32)(oldflp4->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))) | 115 | ((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK)) |
116 | 116 | ||
117 | #define IP_MAX_MTU 0xFFF0 | 117 | #define IP_MAX_MTU 0xFFF0 |
118 | 118 | ||
@@ -131,6 +131,7 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; | |||
131 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; | 131 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; |
132 | static int ip_rt_min_advmss __read_mostly = 256; | 132 | static int ip_rt_min_advmss __read_mostly = 256; |
133 | static int rt_chain_length_max __read_mostly = 20; | 133 | static int rt_chain_length_max __read_mostly = 20; |
134 | static int redirect_genid; | ||
134 | 135 | ||
135 | /* | 136 | /* |
136 | * Interface to generic destination cache. | 137 | * Interface to generic destination cache. |
@@ -138,7 +139,7 @@ static int rt_chain_length_max __read_mostly = 20; | |||
138 | 139 | ||
139 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); | 140 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); |
140 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst); | 141 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst); |
141 | static unsigned int ipv4_default_mtu(const struct dst_entry *dst); | 142 | static unsigned int ipv4_mtu(const struct dst_entry *dst); |
142 | static void ipv4_dst_destroy(struct dst_entry *dst); | 143 | static void ipv4_dst_destroy(struct dst_entry *dst); |
143 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); | 144 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); |
144 | static void ipv4_link_failure(struct sk_buff *skb); | 145 | static void ipv4_link_failure(struct sk_buff *skb); |
@@ -193,7 +194,7 @@ static struct dst_ops ipv4_dst_ops = { | |||
193 | .gc = rt_garbage_collect, | 194 | .gc = rt_garbage_collect, |
194 | .check = ipv4_dst_check, | 195 | .check = ipv4_dst_check, |
195 | .default_advmss = ipv4_default_advmss, | 196 | .default_advmss = ipv4_default_advmss, |
196 | .default_mtu = ipv4_default_mtu, | 197 | .mtu = ipv4_mtu, |
197 | .cow_metrics = ipv4_cow_metrics, | 198 | .cow_metrics = ipv4_cow_metrics, |
198 | .destroy = ipv4_dst_destroy, | 199 | .destroy = ipv4_dst_destroy, |
199 | .ifdown = ipv4_dst_ifdown, | 200 | .ifdown = ipv4_dst_ifdown, |
@@ -416,9 +417,13 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
416 | else { | 417 | else { |
417 | struct rtable *r = v; | 418 | struct rtable *r = v; |
418 | struct neighbour *n; | 419 | struct neighbour *n; |
419 | int len; | 420 | int len, HHUptod; |
420 | 421 | ||
422 | rcu_read_lock(); | ||
421 | n = dst_get_neighbour(&r->dst); | 423 | n = dst_get_neighbour(&r->dst); |
424 | HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0; | ||
425 | rcu_read_unlock(); | ||
426 | |||
422 | seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" | 427 | seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" |
423 | "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", | 428 | "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", |
424 | r->dst.dev ? r->dst.dev->name : "*", | 429 | r->dst.dev ? r->dst.dev->name : "*", |
@@ -432,7 +437,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
432 | dst_metric(&r->dst, RTAX_RTTVAR)), | 437 | dst_metric(&r->dst, RTAX_RTTVAR)), |
433 | r->rt_key_tos, | 438 | r->rt_key_tos, |
434 | -1, | 439 | -1, |
435 | (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0, | 440 | HHUptod, |
436 | r->rt_spec_dst, &len); | 441 | r->rt_spec_dst, &len); |
437 | 442 | ||
438 | seq_printf(seq, "%*s\n", 127 - len, ""); | 443 | seq_printf(seq, "%*s\n", 127 - len, ""); |
@@ -837,6 +842,7 @@ static void rt_cache_invalidate(struct net *net) | |||
837 | 842 | ||
838 | get_random_bytes(&shuffle, sizeof(shuffle)); | 843 | get_random_bytes(&shuffle, sizeof(shuffle)); |
839 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); | 844 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); |
845 | redirect_genid++; | ||
840 | } | 846 | } |
841 | 847 | ||
842 | /* | 848 | /* |
@@ -1304,16 +1310,40 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1304 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1310 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1305 | } | 1311 | } |
1306 | 1312 | ||
1313 | static void check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | ||
1314 | { | ||
1315 | struct rtable *rt = (struct rtable *) dst; | ||
1316 | __be32 orig_gw = rt->rt_gateway; | ||
1317 | struct neighbour *n, *old_n; | ||
1318 | |||
1319 | dst_confirm(&rt->dst); | ||
1320 | |||
1321 | rt->rt_gateway = peer->redirect_learned.a4; | ||
1322 | |||
1323 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); | ||
1324 | if (IS_ERR(n)) { | ||
1325 | rt->rt_gateway = orig_gw; | ||
1326 | return; | ||
1327 | } | ||
1328 | old_n = xchg(&rt->dst._neighbour, n); | ||
1329 | if (old_n) | ||
1330 | neigh_release(old_n); | ||
1331 | if (!(n->nud_state & NUD_VALID)) { | ||
1332 | neigh_event_send(n, NULL); | ||
1333 | } else { | ||
1334 | rt->rt_flags |= RTCF_REDIRECTED; | ||
1335 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); | ||
1336 | } | ||
1337 | } | ||
1338 | |||
1307 | /* called in rcu_read_lock() section */ | 1339 | /* called in rcu_read_lock() section */ |
1308 | void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | 1340 | void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, |
1309 | __be32 saddr, struct net_device *dev) | 1341 | __be32 saddr, struct net_device *dev) |
1310 | { | 1342 | { |
1311 | int s, i; | 1343 | int s, i; |
1312 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 1344 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
1313 | struct rtable *rt; | ||
1314 | __be32 skeys[2] = { saddr, 0 }; | 1345 | __be32 skeys[2] = { saddr, 0 }; |
1315 | int ikeys[2] = { dev->ifindex, 0 }; | 1346 | int ikeys[2] = { dev->ifindex, 0 }; |
1316 | struct flowi4 fl4; | ||
1317 | struct inet_peer *peer; | 1347 | struct inet_peer *peer; |
1318 | struct net *net; | 1348 | struct net *net; |
1319 | 1349 | ||
@@ -1336,33 +1366,44 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1336 | goto reject_redirect; | 1366 | goto reject_redirect; |
1337 | } | 1367 | } |
1338 | 1368 | ||
1339 | memset(&fl4, 0, sizeof(fl4)); | ||
1340 | fl4.daddr = daddr; | ||
1341 | for (s = 0; s < 2; s++) { | 1369 | for (s = 0; s < 2; s++) { |
1342 | for (i = 0; i < 2; i++) { | 1370 | for (i = 0; i < 2; i++) { |
1343 | fl4.flowi4_oif = ikeys[i]; | 1371 | unsigned int hash; |
1344 | fl4.saddr = skeys[s]; | 1372 | struct rtable __rcu **rthp; |
1345 | rt = __ip_route_output_key(net, &fl4); | 1373 | struct rtable *rt; |
1346 | if (IS_ERR(rt)) | 1374 | |
1347 | continue; | 1375 | hash = rt_hash(daddr, skeys[s], ikeys[i], rt_genid(net)); |
1348 | 1376 | ||
1349 | if (rt->dst.error || rt->dst.dev != dev || | 1377 | rthp = &rt_hash_table[hash].chain; |
1350 | rt->rt_gateway != old_gw) { | 1378 | |
1351 | ip_rt_put(rt); | 1379 | while ((rt = rcu_dereference(*rthp)) != NULL) { |
1352 | continue; | 1380 | rthp = &rt->dst.rt_next; |
1353 | } | 1381 | |
1354 | 1382 | if (rt->rt_key_dst != daddr || | |
1355 | if (!rt->peer) | 1383 | rt->rt_key_src != skeys[s] || |
1356 | rt_bind_peer(rt, rt->rt_dst, 1); | 1384 | rt->rt_oif != ikeys[i] || |
1385 | rt_is_input_route(rt) || | ||
1386 | rt_is_expired(rt) || | ||
1387 | !net_eq(dev_net(rt->dst.dev), net) || | ||
1388 | rt->dst.error || | ||
1389 | rt->dst.dev != dev || | ||
1390 | rt->rt_gateway != old_gw) | ||
1391 | continue; | ||
1357 | 1392 | ||
1358 | peer = rt->peer; | 1393 | if (!rt->peer) |
1359 | if (peer) { | 1394 | rt_bind_peer(rt, rt->rt_dst, 1); |
1360 | peer->redirect_learned.a4 = new_gw; | 1395 | |
1361 | atomic_inc(&__rt_peer_genid); | 1396 | peer = rt->peer; |
1397 | if (peer) { | ||
1398 | if (peer->redirect_learned.a4 != new_gw || | ||
1399 | peer->redirect_genid != redirect_genid) { | ||
1400 | peer->redirect_learned.a4 = new_gw; | ||
1401 | peer->redirect_genid = redirect_genid; | ||
1402 | atomic_inc(&__rt_peer_genid); | ||
1403 | } | ||
1404 | check_peer_redir(&rt->dst, peer); | ||
1405 | } | ||
1362 | } | 1406 | } |
1363 | |||
1364 | ip_rt_put(rt); | ||
1365 | return; | ||
1366 | } | 1407 | } |
1367 | } | 1408 | } |
1368 | return; | 1409 | return; |
@@ -1649,40 +1690,9 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
1649 | } | 1690 | } |
1650 | } | 1691 | } |
1651 | 1692 | ||
1652 | static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | ||
1653 | { | ||
1654 | struct rtable *rt = (struct rtable *) dst; | ||
1655 | __be32 orig_gw = rt->rt_gateway; | ||
1656 | struct neighbour *n, *old_n; | ||
1657 | |||
1658 | dst_confirm(&rt->dst); | ||
1659 | |||
1660 | rt->rt_gateway = peer->redirect_learned.a4; | ||
1661 | |||
1662 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); | ||
1663 | if (IS_ERR(n)) | ||
1664 | return PTR_ERR(n); | ||
1665 | old_n = xchg(&rt->dst._neighbour, n); | ||
1666 | if (old_n) | ||
1667 | neigh_release(old_n); | ||
1668 | if (!n || !(n->nud_state & NUD_VALID)) { | ||
1669 | if (n) | ||
1670 | neigh_event_send(n, NULL); | ||
1671 | rt->rt_gateway = orig_gw; | ||
1672 | return -EAGAIN; | ||
1673 | } else { | ||
1674 | rt->rt_flags |= RTCF_REDIRECTED; | ||
1675 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); | ||
1676 | } | ||
1677 | return 0; | ||
1678 | } | ||
1679 | 1693 | ||
1680 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | 1694 | static void ipv4_validate_peer(struct rtable *rt) |
1681 | { | 1695 | { |
1682 | struct rtable *rt = (struct rtable *) dst; | ||
1683 | |||
1684 | if (rt_is_expired(rt)) | ||
1685 | return NULL; | ||
1686 | if (rt->rt_peer_genid != rt_peer_genid()) { | 1696 | if (rt->rt_peer_genid != rt_peer_genid()) { |
1687 | struct inet_peer *peer; | 1697 | struct inet_peer *peer; |
1688 | 1698 | ||
@@ -1691,17 +1701,26 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | |||
1691 | 1701 | ||
1692 | peer = rt->peer; | 1702 | peer = rt->peer; |
1693 | if (peer) { | 1703 | if (peer) { |
1694 | check_peer_pmtu(dst, peer); | 1704 | check_peer_pmtu(&rt->dst, peer); |
1695 | 1705 | ||
1706 | if (peer->redirect_genid != redirect_genid) | ||
1707 | peer->redirect_learned.a4 = 0; | ||
1696 | if (peer->redirect_learned.a4 && | 1708 | if (peer->redirect_learned.a4 && |
1697 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1709 | peer->redirect_learned.a4 != rt->rt_gateway) |
1698 | if (check_peer_redir(dst, peer)) | 1710 | check_peer_redir(&rt->dst, peer); |
1699 | return NULL; | ||
1700 | } | ||
1701 | } | 1711 | } |
1702 | 1712 | ||
1703 | rt->rt_peer_genid = rt_peer_genid(); | 1713 | rt->rt_peer_genid = rt_peer_genid(); |
1704 | } | 1714 | } |
1715 | } | ||
1716 | |||
1717 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | ||
1718 | { | ||
1719 | struct rtable *rt = (struct rtable *) dst; | ||
1720 | |||
1721 | if (rt_is_expired(rt)) | ||
1722 | return NULL; | ||
1723 | ipv4_validate_peer(rt); | ||
1705 | return dst; | 1724 | return dst; |
1706 | } | 1725 | } |
1707 | 1726 | ||
@@ -1806,12 +1825,17 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst) | |||
1806 | return advmss; | 1825 | return advmss; |
1807 | } | 1826 | } |
1808 | 1827 | ||
1809 | static unsigned int ipv4_default_mtu(const struct dst_entry *dst) | 1828 | static unsigned int ipv4_mtu(const struct dst_entry *dst) |
1810 | { | 1829 | { |
1811 | unsigned int mtu = dst->dev->mtu; | 1830 | const struct rtable *rt = (const struct rtable *) dst; |
1831 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
1832 | |||
1833 | if (mtu && rt_is_output_route(rt)) | ||
1834 | return mtu; | ||
1835 | |||
1836 | mtu = dst->dev->mtu; | ||
1812 | 1837 | ||
1813 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { | 1838 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { |
1814 | const struct rtable *rt = (const struct rtable *) dst; | ||
1815 | 1839 | ||
1816 | if (rt->rt_gateway != rt->rt_dst && mtu > 576) | 1840 | if (rt->rt_gateway != rt->rt_dst && mtu > 576) |
1817 | mtu = 576; | 1841 | mtu = 576; |
@@ -1844,6 +1868,8 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4, | |||
1844 | dst_init_metrics(&rt->dst, peer->metrics, false); | 1868 | dst_init_metrics(&rt->dst, peer->metrics, false); |
1845 | 1869 | ||
1846 | check_peer_pmtu(&rt->dst, peer); | 1870 | check_peer_pmtu(&rt->dst, peer); |
1871 | if (peer->redirect_genid != redirect_genid) | ||
1872 | peer->redirect_learned.a4 = 0; | ||
1847 | if (peer->redirect_learned.a4 && | 1873 | if (peer->redirect_learned.a4 && |
1848 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1874 | peer->redirect_learned.a4 != rt->rt_gateway) { |
1849 | rt->rt_gateway = peer->redirect_learned.a4; | 1875 | rt->rt_gateway = peer->redirect_learned.a4; |
@@ -2349,6 +2375,7 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2349 | rth->rt_mark == skb->mark && | 2375 | rth->rt_mark == skb->mark && |
2350 | net_eq(dev_net(rth->dst.dev), net) && | 2376 | net_eq(dev_net(rth->dst.dev), net) && |
2351 | !rt_is_expired(rth)) { | 2377 | !rt_is_expired(rth)) { |
2378 | ipv4_validate_peer(rth); | ||
2352 | if (noref) { | 2379 | if (noref) { |
2353 | dst_use_noref(&rth->dst, jiffies); | 2380 | dst_use_noref(&rth->dst, jiffies); |
2354 | skb_dst_set_noref(skb, &rth->dst); | 2381 | skb_dst_set_noref(skb, &rth->dst); |
@@ -2407,11 +2434,11 @@ EXPORT_SYMBOL(ip_route_input_common); | |||
2407 | static struct rtable *__mkroute_output(const struct fib_result *res, | 2434 | static struct rtable *__mkroute_output(const struct fib_result *res, |
2408 | const struct flowi4 *fl4, | 2435 | const struct flowi4 *fl4, |
2409 | __be32 orig_daddr, __be32 orig_saddr, | 2436 | __be32 orig_daddr, __be32 orig_saddr, |
2410 | int orig_oif, struct net_device *dev_out, | 2437 | int orig_oif, __u8 orig_rtos, |
2438 | struct net_device *dev_out, | ||
2411 | unsigned int flags) | 2439 | unsigned int flags) |
2412 | { | 2440 | { |
2413 | struct fib_info *fi = res->fi; | 2441 | struct fib_info *fi = res->fi; |
2414 | u32 tos = RT_FL_TOS(fl4); | ||
2415 | struct in_device *in_dev; | 2442 | struct in_device *in_dev; |
2416 | u16 type = res->type; | 2443 | u16 type = res->type; |
2417 | struct rtable *rth; | 2444 | struct rtable *rth; |
@@ -2462,7 +2489,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2462 | rth->rt_genid = rt_genid(dev_net(dev_out)); | 2489 | rth->rt_genid = rt_genid(dev_net(dev_out)); |
2463 | rth->rt_flags = flags; | 2490 | rth->rt_flags = flags; |
2464 | rth->rt_type = type; | 2491 | rth->rt_type = type; |
2465 | rth->rt_key_tos = tos; | 2492 | rth->rt_key_tos = orig_rtos; |
2466 | rth->rt_dst = fl4->daddr; | 2493 | rth->rt_dst = fl4->daddr; |
2467 | rth->rt_src = fl4->saddr; | 2494 | rth->rt_src = fl4->saddr; |
2468 | rth->rt_route_iif = 0; | 2495 | rth->rt_route_iif = 0; |
@@ -2512,7 +2539,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2512 | static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | 2539 | static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) |
2513 | { | 2540 | { |
2514 | struct net_device *dev_out = NULL; | 2541 | struct net_device *dev_out = NULL; |
2515 | u32 tos = RT_FL_TOS(fl4); | 2542 | __u8 tos = RT_FL_TOS(fl4); |
2516 | unsigned int flags = 0; | 2543 | unsigned int flags = 0; |
2517 | struct fib_result res; | 2544 | struct fib_result res; |
2518 | struct rtable *rth; | 2545 | struct rtable *rth; |
@@ -2688,7 +2715,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | |||
2688 | 2715 | ||
2689 | make_route: | 2716 | make_route: |
2690 | rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, | 2717 | rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, |
2691 | dev_out, flags); | 2718 | tos, dev_out, flags); |
2692 | if (!IS_ERR(rth)) { | 2719 | if (!IS_ERR(rth)) { |
2693 | unsigned int hash; | 2720 | unsigned int hash; |
2694 | 2721 | ||
@@ -2724,6 +2751,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4) | |||
2724 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2751 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
2725 | net_eq(dev_net(rth->dst.dev), net) && | 2752 | net_eq(dev_net(rth->dst.dev), net) && |
2726 | !rt_is_expired(rth)) { | 2753 | !rt_is_expired(rth)) { |
2754 | ipv4_validate_peer(rth); | ||
2727 | dst_use(&rth->dst, jiffies); | 2755 | dst_use(&rth->dst, jiffies); |
2728 | RT_CACHE_STAT_INC(out_hit); | 2756 | RT_CACHE_STAT_INC(out_hit); |
2729 | rcu_read_unlock_bh(); | 2757 | rcu_read_unlock_bh(); |
@@ -2747,9 +2775,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo | |||
2747 | return NULL; | 2775 | return NULL; |
2748 | } | 2776 | } |
2749 | 2777 | ||
2750 | static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) | 2778 | static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) |
2751 | { | 2779 | { |
2752 | return 0; | 2780 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
2781 | |||
2782 | return mtu ? : dst->dev->mtu; | ||
2753 | } | 2783 | } |
2754 | 2784 | ||
2755 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 2785 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -2767,7 +2797,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = { | |||
2767 | .protocol = cpu_to_be16(ETH_P_IP), | 2797 | .protocol = cpu_to_be16(ETH_P_IP), |
2768 | .destroy = ipv4_dst_destroy, | 2798 | .destroy = ipv4_dst_destroy, |
2769 | .check = ipv4_blackhole_dst_check, | 2799 | .check = ipv4_blackhole_dst_check, |
2770 | .default_mtu = ipv4_blackhole_default_mtu, | 2800 | .mtu = ipv4_blackhole_mtu, |
2771 | .default_advmss = ipv4_default_advmss, | 2801 | .default_advmss = ipv4_default_advmss, |
2772 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, | 2802 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, |
2773 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, | 2803 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, |
@@ -2845,7 +2875,7 @@ static int rt_fill_info(struct net *net, | |||
2845 | struct rtable *rt = skb_rtable(skb); | 2875 | struct rtable *rt = skb_rtable(skb); |
2846 | struct rtmsg *r; | 2876 | struct rtmsg *r; |
2847 | struct nlmsghdr *nlh; | 2877 | struct nlmsghdr *nlh; |
2848 | long expires = 0; | 2878 | unsigned long expires = 0; |
2849 | const struct inet_peer *peer = rt->peer; | 2879 | const struct inet_peer *peer = rt->peer; |
2850 | u32 id = 0, ts = 0, tsage = 0, error; | 2880 | u32 id = 0, ts = 0, tsage = 0, error; |
2851 | 2881 | ||
@@ -2902,8 +2932,12 @@ static int rt_fill_info(struct net *net, | |||
2902 | tsage = get_seconds() - peer->tcp_ts_stamp; | 2932 | tsage = get_seconds() - peer->tcp_ts_stamp; |
2903 | } | 2933 | } |
2904 | expires = ACCESS_ONCE(peer->pmtu_expires); | 2934 | expires = ACCESS_ONCE(peer->pmtu_expires); |
2905 | if (expires) | 2935 | if (expires) { |
2906 | expires -= jiffies; | 2936 | if (time_before(jiffies, expires)) |
2937 | expires -= jiffies; | ||
2938 | else | ||
2939 | expires = 0; | ||
2940 | } | ||
2907 | } | 2941 | } |
2908 | 2942 | ||
2909 | if (rt_is_input_route(rt)) { | 2943 | if (rt_is_input_route(rt)) { |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a7443159c400..a9db4b1a2215 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1510,6 +1510,7 @@ exit: | |||
1510 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 1510 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |
1511 | return NULL; | 1511 | return NULL; |
1512 | put_and_exit: | 1512 | put_and_exit: |
1513 | tcp_clear_xmit_timers(newsk); | ||
1513 | bh_unlock_sock(newsk); | 1514 | bh_unlock_sock(newsk); |
1514 | sock_put(newsk); | 1515 | sock_put(newsk); |
1515 | goto exit; | 1516 | goto exit; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 980b98f6288c..63170e297540 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1382,7 +1382,7 @@ static inline int tcp_minshall_check(const struct tcp_sock *tp) | |||
1382 | /* Return 0, if packet can be sent now without violation Nagle's rules: | 1382 | /* Return 0, if packet can be sent now without violation Nagle's rules: |
1383 | * 1. It is full sized. | 1383 | * 1. It is full sized. |
1384 | * 2. Or it contains FIN. (already checked by caller) | 1384 | * 2. Or it contains FIN. (already checked by caller) |
1385 | * 3. Or TCP_NODELAY was set. | 1385 | * 3. Or TCP_CORK is not set, and TCP_NODELAY is set. |
1386 | * 4. Or TCP_CORK is not set, and all sent packets are ACKed. | 1386 | * 4. Or TCP_CORK is not set, and all sent packets are ACKed. |
1387 | * With Minshall's modification: all sent small packets are ACKed. | 1387 | * With Minshall's modification: all sent small packets are ACKed. |
1388 | */ | 1388 | */ |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index ab0966df1e2a..5a65eeac1d29 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1164,7 +1164,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1164 | struct inet_sock *inet = inet_sk(sk); | 1164 | struct inet_sock *inet = inet_sk(sk); |
1165 | struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; | 1165 | struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; |
1166 | struct sk_buff *skb; | 1166 | struct sk_buff *skb; |
1167 | unsigned int ulen; | 1167 | unsigned int ulen, copied; |
1168 | int peeked; | 1168 | int peeked; |
1169 | int err; | 1169 | int err; |
1170 | int is_udplite = IS_UDPLITE(sk); | 1170 | int is_udplite = IS_UDPLITE(sk); |
@@ -1186,9 +1186,10 @@ try_again: | |||
1186 | goto out; | 1186 | goto out; |
1187 | 1187 | ||
1188 | ulen = skb->len - sizeof(struct udphdr); | 1188 | ulen = skb->len - sizeof(struct udphdr); |
1189 | if (len > ulen) | 1189 | copied = len; |
1190 | len = ulen; | 1190 | if (copied > ulen) |
1191 | else if (len < ulen) | 1191 | copied = ulen; |
1192 | else if (copied < ulen) | ||
1192 | msg->msg_flags |= MSG_TRUNC; | 1193 | msg->msg_flags |= MSG_TRUNC; |
1193 | 1194 | ||
1194 | /* | 1195 | /* |
@@ -1197,14 +1198,14 @@ try_again: | |||
1197 | * coverage checksum (UDP-Lite), do it before the copy. | 1198 | * coverage checksum (UDP-Lite), do it before the copy. |
1198 | */ | 1199 | */ |
1199 | 1200 | ||
1200 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 1201 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
1201 | if (udp_lib_checksum_complete(skb)) | 1202 | if (udp_lib_checksum_complete(skb)) |
1202 | goto csum_copy_err; | 1203 | goto csum_copy_err; |
1203 | } | 1204 | } |
1204 | 1205 | ||
1205 | if (skb_csum_unnecessary(skb)) | 1206 | if (skb_csum_unnecessary(skb)) |
1206 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 1207 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
1207 | msg->msg_iov, len); | 1208 | msg->msg_iov, copied); |
1208 | else { | 1209 | else { |
1209 | err = skb_copy_and_csum_datagram_iovec(skb, | 1210 | err = skb_copy_and_csum_datagram_iovec(skb, |
1210 | sizeof(struct udphdr), | 1211 | sizeof(struct udphdr), |
@@ -1233,7 +1234,7 @@ try_again: | |||
1233 | if (inet->cmsg_flags) | 1234 | if (inet->cmsg_flags) |
1234 | ip_cmsg_recv(msg, skb); | 1235 | ip_cmsg_recv(msg, skb); |
1235 | 1236 | ||
1236 | err = len; | 1237 | err = copied; |
1237 | if (flags & MSG_TRUNC) | 1238 | if (flags & MSG_TRUNC) |
1238 | err = ulen; | 1239 | err = ulen; |
1239 | 1240 | ||
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 2195ae651923..4c0f894d0843 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -324,8 +324,6 @@ static void ah6_output_done(struct crypto_async_request *base, int err) | |||
324 | #endif | 324 | #endif |
325 | } | 325 | } |
326 | 326 | ||
327 | err = ah->nexthdr; | ||
328 | |||
329 | kfree(AH_SKB_CB(skb)->tmp); | 327 | kfree(AH_SKB_CB(skb)->tmp); |
330 | xfrm_output_resume(skb, err); | 328 | xfrm_output_resume(skb, err); |
331 | } | 329 | } |
@@ -466,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err) | |||
466 | if (err) | 464 | if (err) |
467 | goto out; | 465 | goto out; |
468 | 466 | ||
467 | err = ah->nexthdr; | ||
468 | |||
469 | skb->network_header += ah_hlen; | 469 | skb->network_header += ah_hlen; |
470 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 470 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
471 | __skb_pull(skb, ah_hlen + hdr_len); | 471 | __skb_pull(skb, ah_hlen + hdr_len); |
472 | skb_set_transport_header(skb, -hdr_len); | 472 | skb_set_transport_header(skb, -hdr_len); |
473 | |||
474 | err = ah->nexthdr; | ||
475 | out: | 473 | out: |
476 | kfree(AH_SKB_CB(skb)->tmp); | 474 | kfree(AH_SKB_CB(skb)->tmp); |
477 | xfrm_input_resume(skb, err); | 475 | xfrm_input_resume(skb, err); |
@@ -583,8 +581,6 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
583 | if (err == -EINPROGRESS) | 581 | if (err == -EINPROGRESS) |
584 | goto out; | 582 | goto out; |
585 | 583 | ||
586 | if (err == -EBUSY) | ||
587 | err = NET_XMIT_DROP; | ||
588 | goto out_free; | 584 | goto out_free; |
589 | } | 585 | } |
590 | 586 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index fee46d5a2f12..1567fb120392 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -85,7 +85,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk, | |||
85 | * request_sock (formerly open request) hash tables. | 85 | * request_sock (formerly open request) hash tables. |
86 | */ | 86 | */ |
87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, | 87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, |
88 | const u32 rnd, const u16 synq_hsize) | 88 | const u32 rnd, const u32 synq_hsize) |
89 | { | 89 | { |
90 | u32 c; | 90 | u32 c; |
91 | 91 | ||
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 027c7ff6f1e5..a46c64eb0a66 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -111,6 +111,14 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
111 | ipv6_addr_loopback(&hdr->daddr)) | 111 | ipv6_addr_loopback(&hdr->daddr)) |
112 | goto err; | 112 | goto err; |
113 | 113 | ||
114 | /* | ||
115 | * RFC4291 2.7 | ||
116 | * Multicast addresses must not be used as source addresses in IPv6 | ||
117 | * packets or appear in any Routing header. | ||
118 | */ | ||
119 | if (ipv6_addr_is_multicast(&hdr->saddr)) | ||
120 | goto err; | ||
121 | |||
114 | skb->transport_header = skb->network_header + sizeof(*hdr); | 122 | skb->transport_header = skb->network_header + sizeof(*hdr); |
115 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | 123 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
116 | 124 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index bdc15c9003d7..4e2e9ff67ef2 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p) | |||
289 | if ((err = register_netdevice(dev)) < 0) | 289 | if ((err = register_netdevice(dev)) < 0) |
290 | goto failed_free; | 290 | goto failed_free; |
291 | 291 | ||
292 | strcpy(t->parms.name, dev->name); | ||
293 | |||
292 | dev_hold(dev); | 294 | dev_hold(dev); |
293 | ip6_tnl_link(ip6n, t); | 295 | ip6_tnl_link(ip6n, t); |
294 | return t; | 296 | return t; |
@@ -1407,7 +1409,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev) | |||
1407 | struct ip6_tnl *t = netdev_priv(dev); | 1409 | struct ip6_tnl *t = netdev_priv(dev); |
1408 | 1410 | ||
1409 | t->dev = dev; | 1411 | t->dev = dev; |
1410 | strcpy(t->parms.name, dev->name); | ||
1411 | dev->tstats = alloc_percpu(struct pcpu_tstats); | 1412 | dev->tstats = alloc_percpu(struct pcpu_tstats); |
1412 | if (!dev->tstats) | 1413 | if (!dev->tstats) |
1413 | return -ENOMEM; | 1414 | return -ENOMEM; |
@@ -1487,6 +1488,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n) | |||
1487 | static int __net_init ip6_tnl_init_net(struct net *net) | 1488 | static int __net_init ip6_tnl_init_net(struct net *net) |
1488 | { | 1489 | { |
1489 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 1490 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
1491 | struct ip6_tnl *t = NULL; | ||
1490 | int err; | 1492 | int err; |
1491 | 1493 | ||
1492 | ip6n->tnls[0] = ip6n->tnls_wc; | 1494 | ip6n->tnls[0] = ip6n->tnls_wc; |
@@ -1507,6 +1509,10 @@ static int __net_init ip6_tnl_init_net(struct net *net) | |||
1507 | err = register_netdev(ip6n->fb_tnl_dev); | 1509 | err = register_netdev(ip6n->fb_tnl_dev); |
1508 | if (err < 0) | 1510 | if (err < 0) |
1509 | goto err_register; | 1511 | goto err_register; |
1512 | |||
1513 | t = netdev_priv(ip6n->fb_tnl_dev); | ||
1514 | |||
1515 | strcpy(t->parms.name, ip6n->fb_tnl_dev->name); | ||
1510 | return 0; | 1516 | return 0; |
1511 | 1517 | ||
1512 | err_register: | 1518 | err_register: |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index c99e3ee9781f..26cb08c84b74 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -503,7 +503,7 @@ done: | |||
503 | goto e_inval; | 503 | goto e_inval; |
504 | if (val > 255 || val < -1) | 504 | if (val > 255 || val < -1) |
505 | goto e_inval; | 505 | goto e_inval; |
506 | np->mcast_hops = val; | 506 | np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val); |
507 | retv = 0; | 507 | retv = 0; |
508 | break; | 508 | break; |
509 | 509 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 44e5b7f2a6c1..0cb78d7ddaf5 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1571,7 +1571,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1571 | } | 1571 | } |
1572 | if (!rt->rt6i_peer) | 1572 | if (!rt->rt6i_peer) |
1573 | rt6_bind_peer(rt, 1); | 1573 | rt6_bind_peer(rt, 1); |
1574 | if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) | 1574 | if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) |
1575 | goto release; | 1575 | goto release; |
1576 | 1576 | ||
1577 | if (dev->addr_len) { | 1577 | if (dev->addr_len) { |
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index 448464844a25..f792b34cbe9c 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
@@ -186,7 +186,6 @@ config IP6_NF_MANGLE | |||
186 | 186 | ||
187 | config IP6_NF_RAW | 187 | config IP6_NF_RAW |
188 | tristate 'raw table support (required for TRACE)' | 188 | tristate 'raw table support (required for TRACE)' |
189 | depends on NETFILTER_ADVANCED | ||
190 | help | 189 | help |
191 | This option adds a `raw' table to ip6tables. This table is the very | 190 | This option adds a `raw' table to ip6tables. This table is the very |
192 | first in the netfilter framework and hooks in at the PREROUTING | 191 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8473016bba4a..3399dd326287 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -77,7 +77,7 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
77 | const struct in6_addr *dest); | 77 | const struct in6_addr *dest); |
78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
80 | static unsigned int ip6_default_mtu(const struct dst_entry *dst); | 80 | static unsigned int ip6_mtu(const struct dst_entry *dst); |
81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); | 81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); |
82 | static void ip6_dst_destroy(struct dst_entry *); | 82 | static void ip6_dst_destroy(struct dst_entry *); |
83 | static void ip6_dst_ifdown(struct dst_entry *, | 83 | static void ip6_dst_ifdown(struct dst_entry *, |
@@ -144,7 +144,7 @@ static struct dst_ops ip6_dst_ops_template = { | |||
144 | .gc_thresh = 1024, | 144 | .gc_thresh = 1024, |
145 | .check = ip6_dst_check, | 145 | .check = ip6_dst_check, |
146 | .default_advmss = ip6_default_advmss, | 146 | .default_advmss = ip6_default_advmss, |
147 | .default_mtu = ip6_default_mtu, | 147 | .mtu = ip6_mtu, |
148 | .cow_metrics = ipv6_cow_metrics, | 148 | .cow_metrics = ipv6_cow_metrics, |
149 | .destroy = ip6_dst_destroy, | 149 | .destroy = ip6_dst_destroy, |
150 | .ifdown = ip6_dst_ifdown, | 150 | .ifdown = ip6_dst_ifdown, |
@@ -155,9 +155,11 @@ static struct dst_ops ip6_dst_ops_template = { | |||
155 | .neigh_lookup = ip6_neigh_lookup, | 155 | .neigh_lookup = ip6_neigh_lookup, |
156 | }; | 156 | }; |
157 | 157 | ||
158 | static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) | 158 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) |
159 | { | 159 | { |
160 | return 0; | 160 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
161 | |||
162 | return mtu ? : dst->dev->mtu; | ||
161 | } | 163 | } |
162 | 164 | ||
163 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 165 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -175,7 +177,7 @@ static struct dst_ops ip6_dst_blackhole_ops = { | |||
175 | .protocol = cpu_to_be16(ETH_P_IPV6), | 177 | .protocol = cpu_to_be16(ETH_P_IPV6), |
176 | .destroy = ip6_dst_destroy, | 178 | .destroy = ip6_dst_destroy, |
177 | .check = ip6_dst_check, | 179 | .check = ip6_dst_check, |
178 | .default_mtu = ip6_blackhole_default_mtu, | 180 | .mtu = ip6_blackhole_mtu, |
179 | .default_advmss = ip6_default_advmss, | 181 | .default_advmss = ip6_default_advmss, |
180 | .update_pmtu = ip6_rt_blackhole_update_pmtu, | 182 | .update_pmtu = ip6_rt_blackhole_update_pmtu, |
181 | .cow_metrics = ip6_rt_blackhole_cow_metrics, | 183 | .cow_metrics = ip6_rt_blackhole_cow_metrics, |
@@ -1041,10 +1043,15 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) | |||
1041 | return mtu; | 1043 | return mtu; |
1042 | } | 1044 | } |
1043 | 1045 | ||
1044 | static unsigned int ip6_default_mtu(const struct dst_entry *dst) | 1046 | static unsigned int ip6_mtu(const struct dst_entry *dst) |
1045 | { | 1047 | { |
1046 | unsigned int mtu = IPV6_MIN_MTU; | ||
1047 | struct inet6_dev *idev; | 1048 | struct inet6_dev *idev; |
1049 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
1050 | |||
1051 | if (mtu) | ||
1052 | return mtu; | ||
1053 | |||
1054 | mtu = IPV6_MIN_MTU; | ||
1048 | 1055 | ||
1049 | rcu_read_lock(); | 1056 | rcu_read_lock(); |
1050 | idev = __in6_dev_get(dst->dev); | 1057 | idev = __in6_dev_get(dst->dev); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 36131d122a6f..2dea4bb7b54a 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1255,6 +1255,13 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1255 | if (!want_cookie || tmp_opt.tstamp_ok) | 1255 | if (!want_cookie || tmp_opt.tstamp_ok) |
1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
1257 | 1257 | ||
1258 | treq->iif = sk->sk_bound_dev_if; | ||
1259 | |||
1260 | /* So that link locals have meaning */ | ||
1261 | if (!sk->sk_bound_dev_if && | ||
1262 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
1263 | treq->iif = inet6_iif(skb); | ||
1264 | |||
1258 | if (!isn) { | 1265 | if (!isn) { |
1259 | struct inet_peer *peer = NULL; | 1266 | struct inet_peer *peer = NULL; |
1260 | 1267 | ||
@@ -1264,12 +1271,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1264 | atomic_inc(&skb->users); | 1271 | atomic_inc(&skb->users); |
1265 | treq->pktopts = skb; | 1272 | treq->pktopts = skb; |
1266 | } | 1273 | } |
1267 | treq->iif = sk->sk_bound_dev_if; | ||
1268 | |||
1269 | /* So that link locals have meaning */ | ||
1270 | if (!sk->sk_bound_dev_if && | ||
1271 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
1272 | treq->iif = inet6_iif(skb); | ||
1273 | 1274 | ||
1274 | if (want_cookie) { | 1275 | if (want_cookie) { |
1275 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); | 1276 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 846f4757eb8d..8c2541915183 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -340,7 +340,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
340 | struct ipv6_pinfo *np = inet6_sk(sk); | 340 | struct ipv6_pinfo *np = inet6_sk(sk); |
341 | struct inet_sock *inet = inet_sk(sk); | 341 | struct inet_sock *inet = inet_sk(sk); |
342 | struct sk_buff *skb; | 342 | struct sk_buff *skb; |
343 | unsigned int ulen; | 343 | unsigned int ulen, copied; |
344 | int peeked; | 344 | int peeked; |
345 | int err; | 345 | int err; |
346 | int is_udplite = IS_UDPLITE(sk); | 346 | int is_udplite = IS_UDPLITE(sk); |
@@ -363,9 +363,10 @@ try_again: | |||
363 | goto out; | 363 | goto out; |
364 | 364 | ||
365 | ulen = skb->len - sizeof(struct udphdr); | 365 | ulen = skb->len - sizeof(struct udphdr); |
366 | if (len > ulen) | 366 | copied = len; |
367 | len = ulen; | 367 | if (copied > ulen) |
368 | else if (len < ulen) | 368 | copied = ulen; |
369 | else if (copied < ulen) | ||
369 | msg->msg_flags |= MSG_TRUNC; | 370 | msg->msg_flags |= MSG_TRUNC; |
370 | 371 | ||
371 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); | 372 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); |
@@ -376,14 +377,14 @@ try_again: | |||
376 | * coverage checksum (UDP-Lite), do it before the copy. | 377 | * coverage checksum (UDP-Lite), do it before the copy. |
377 | */ | 378 | */ |
378 | 379 | ||
379 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 380 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
380 | if (udp_lib_checksum_complete(skb)) | 381 | if (udp_lib_checksum_complete(skb)) |
381 | goto csum_copy_err; | 382 | goto csum_copy_err; |
382 | } | 383 | } |
383 | 384 | ||
384 | if (skb_csum_unnecessary(skb)) | 385 | if (skb_csum_unnecessary(skb)) |
385 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 386 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
386 | msg->msg_iov,len); | 387 | msg->msg_iov, copied ); |
387 | else { | 388 | else { |
388 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); | 389 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); |
389 | if (err == -EINVAL) | 390 | if (err == -EINVAL) |
@@ -432,7 +433,7 @@ try_again: | |||
432 | datagram_recv_ctl(sk, msg, skb); | 433 | datagram_recv_ctl(sk, msg, skb); |
433 | } | 434 | } |
434 | 435 | ||
435 | err = len; | 436 | err = copied; |
436 | if (flags & MSG_TRUNC) | 437 | if (flags & MSG_TRUNC) |
437 | err = ulen; | 438 | err = ulen; |
438 | 439 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index bf8d50c67931..89ff8c67943e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -756,9 +756,6 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, | |||
756 | goto error; | 756 | goto error; |
757 | } | 757 | } |
758 | 758 | ||
759 | /* Point to L2TP header */ | ||
760 | optr = ptr = skb->data; | ||
761 | |||
762 | /* Trace packet contents, if enabled */ | 759 | /* Trace packet contents, if enabled */ |
763 | if (tunnel->debug & L2TP_MSG_DATA) { | 760 | if (tunnel->debug & L2TP_MSG_DATA) { |
764 | length = min(32u, skb->len); | 761 | length = min(32u, skb->len); |
@@ -769,12 +766,15 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, | |||
769 | 766 | ||
770 | offset = 0; | 767 | offset = 0; |
771 | do { | 768 | do { |
772 | printk(" %02X", ptr[offset]); | 769 | printk(" %02X", skb->data[offset]); |
773 | } while (++offset < length); | 770 | } while (++offset < length); |
774 | 771 | ||
775 | printk("\n"); | 772 | printk("\n"); |
776 | } | 773 | } |
777 | 774 | ||
775 | /* Point to L2TP header */ | ||
776 | optr = ptr = skb->data; | ||
777 | |||
778 | /* Get L2TP header flags */ | 778 | /* Get L2TP header flags */ |
779 | hdrflags = ntohs(*(__be16 *) ptr); | 779 | hdrflags = ntohs(*(__be16 *) ptr); |
780 | 780 | ||
@@ -1072,7 +1072,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len | |||
1072 | 1072 | ||
1073 | /* Get routing info from the tunnel socket */ | 1073 | /* Get routing info from the tunnel socket */ |
1074 | skb_dst_drop(skb); | 1074 | skb_dst_drop(skb); |
1075 | skb_dst_set(skb, dst_clone(__sk_dst_get(sk))); | 1075 | skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0))); |
1076 | 1076 | ||
1077 | inet = inet_sk(sk); | 1077 | inet = inet_sk(sk); |
1078 | fl = &inet->cork.fl; | 1078 | fl = &inet->cork.fl; |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index b3f65520e7a7..b064e4df12c6 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -161,6 +161,12 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
161 | return -ENOENT; | 161 | return -ENOENT; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* if we're already stopping ignore any new requests to stop */ | ||
165 | if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | ||
166 | spin_unlock_bh(&sta->lock); | ||
167 | return -EALREADY; | ||
168 | } | ||
169 | |||
164 | if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { | 170 | if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { |
165 | /* not even started yet! */ | 171 | /* not even started yet! */ |
166 | ieee80211_assign_tid_tx(sta, tid, NULL); | 172 | ieee80211_assign_tid_tx(sta, tid, NULL); |
@@ -169,6 +175,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
169 | return 0; | 175 | return 0; |
170 | } | 176 | } |
171 | 177 | ||
178 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | ||
179 | |||
172 | spin_unlock_bh(&sta->lock); | 180 | spin_unlock_bh(&sta->lock); |
173 | 181 | ||
174 | #ifdef CONFIG_MAC80211_HT_DEBUG | 182 | #ifdef CONFIG_MAC80211_HT_DEBUG |
@@ -176,8 +184,6 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
176 | sta->sta.addr, tid); | 184 | sta->sta.addr, tid); |
177 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 185 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
178 | 186 | ||
179 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | ||
180 | |||
181 | del_timer_sync(&tid_tx->addba_resp_timer); | 187 | del_timer_sync(&tid_tx->addba_resp_timer); |
182 | 188 | ||
183 | /* | 189 | /* |
@@ -187,6 +193,20 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
187 | */ | 193 | */ |
188 | clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); | 194 | clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); |
189 | 195 | ||
196 | /* | ||
197 | * There might be a few packets being processed right now (on | ||
198 | * another CPU) that have already gotten past the aggregation | ||
199 | * check when it was still OPERATIONAL and consequently have | ||
200 | * IEEE80211_TX_CTL_AMPDU set. In that case, this code might | ||
201 | * call into the driver at the same time or even before the | ||
202 | * TX paths calls into it, which could confuse the driver. | ||
203 | * | ||
204 | * Wait for all currently running TX paths to finish before | ||
205 | * telling the driver. New packets will not go through since | ||
206 | * the aggregation session is no longer OPERATIONAL. | ||
207 | */ | ||
208 | synchronize_net(); | ||
209 | |||
190 | tid_tx->stop_initiator = initiator; | 210 | tid_tx->stop_initiator = initiator; |
191 | tid_tx->tx_stop = tx; | 211 | tid_tx->tx_stop = tx; |
192 | 212 | ||
@@ -757,11 +777,27 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
757 | goto out; | 777 | goto out; |
758 | } | 778 | } |
759 | 779 | ||
760 | del_timer(&tid_tx->addba_resp_timer); | 780 | del_timer_sync(&tid_tx->addba_resp_timer); |
761 | 781 | ||
762 | #ifdef CONFIG_MAC80211_HT_DEBUG | 782 | #ifdef CONFIG_MAC80211_HT_DEBUG |
763 | printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); | 783 | printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); |
764 | #endif | 784 | #endif |
785 | |||
786 | /* | ||
787 | * addba_resp_timer may have fired before we got here, and | ||
788 | * caused WANT_STOP to be set. If the stop then was already | ||
789 | * processed further, STOPPING might be set. | ||
790 | */ | ||
791 | if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || | ||
792 | test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | ||
793 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
794 | printk(KERN_DEBUG | ||
795 | "got addBA resp for tid %d but we already gave up\n", | ||
796 | tid); | ||
797 | #endif | ||
798 | goto out; | ||
799 | } | ||
800 | |||
765 | /* | 801 | /* |
766 | * IEEE 802.11-2007 7.3.1.14: | 802 | * IEEE 802.11-2007 7.3.1.14: |
767 | * In an ADDBA Response frame, when the Status Code field | 803 | * In an ADDBA Response frame, when the Status Code field |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index c5f341798c16..3110cbdc501b 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -274,9 +274,9 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, | |||
274 | 274 | ||
275 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); | 275 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); |
276 | 276 | ||
277 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
278 | "3839 bytes"); | ||
279 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " | 277 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " |
278 | "3839 bytes"); | ||
279 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
280 | "7935 bytes"); | 280 | "7935 bytes"); |
281 | 281 | ||
282 | /* | 282 | /* |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index d999bf3b84e1..cae443563ec9 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -757,6 +757,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
757 | if (!local->int_scan_req) | 757 | if (!local->int_scan_req) |
758 | return -ENOMEM; | 758 | return -ENOMEM; |
759 | 759 | ||
760 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
761 | if (!local->hw.wiphy->bands[band]) | ||
762 | continue; | ||
763 | local->int_scan_req->rates[band] = (u32) -1; | ||
764 | } | ||
765 | |||
760 | /* if low-level driver supports AP, we also support VLAN */ | 766 | /* if low-level driver supports AP, we also support VLAN */ |
761 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { | 767 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { |
762 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); | 768 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 72c8bea81a6c..b1b1bb368f70 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1487,6 +1487,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1487 | int i, j, err; | 1487 | int i, j, err; |
1488 | bool have_higher_than_11mbit = false; | 1488 | bool have_higher_than_11mbit = false; |
1489 | u16 ap_ht_cap_flags; | 1489 | u16 ap_ht_cap_flags; |
1490 | int min_rate = INT_MAX, min_rate_index = -1; | ||
1490 | 1491 | ||
1491 | /* AssocResp and ReassocResp have identical structure */ | 1492 | /* AssocResp and ReassocResp have identical structure */ |
1492 | 1493 | ||
@@ -1553,6 +1554,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1553 | rates |= BIT(j); | 1554 | rates |= BIT(j); |
1554 | if (is_basic) | 1555 | if (is_basic) |
1555 | basic_rates |= BIT(j); | 1556 | basic_rates |= BIT(j); |
1557 | if (rate < min_rate) { | ||
1558 | min_rate = rate; | ||
1559 | min_rate_index = j; | ||
1560 | } | ||
1556 | break; | 1561 | break; |
1557 | } | 1562 | } |
1558 | } | 1563 | } |
@@ -1570,11 +1575,25 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1570 | rates |= BIT(j); | 1575 | rates |= BIT(j); |
1571 | if (is_basic) | 1576 | if (is_basic) |
1572 | basic_rates |= BIT(j); | 1577 | basic_rates |= BIT(j); |
1578 | if (rate < min_rate) { | ||
1579 | min_rate = rate; | ||
1580 | min_rate_index = j; | ||
1581 | } | ||
1573 | break; | 1582 | break; |
1574 | } | 1583 | } |
1575 | } | 1584 | } |
1576 | } | 1585 | } |
1577 | 1586 | ||
1587 | /* | ||
1588 | * some buggy APs don't advertise basic_rates. use the lowest | ||
1589 | * supported rate instead. | ||
1590 | */ | ||
1591 | if (unlikely(!basic_rates) && min_rate_index >= 0) { | ||
1592 | printk(KERN_DEBUG "%s: No basic rates in AssocResp. " | ||
1593 | "Using min supported rate instead.\n", sdata->name); | ||
1594 | basic_rates = BIT(min_rate_index); | ||
1595 | } | ||
1596 | |||
1578 | sta->sta.supp_rates[wk->chan->band] = rates; | 1597 | sta->sta.supp_rates[wk->chan->band] = rates; |
1579 | sdata->vif.bss_conf.basic_rates = basic_rates; | 1598 | sdata->vif.bss_conf.basic_rates = basic_rates; |
1580 | 1599 | ||
@@ -2269,6 +2288,7 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
2269 | 2288 | ||
2270 | cancel_work_sync(&ifmgd->request_smps_work); | 2289 | cancel_work_sync(&ifmgd->request_smps_work); |
2271 | 2290 | ||
2291 | cancel_work_sync(&ifmgd->monitor_work); | ||
2272 | cancel_work_sync(&ifmgd->beacon_connection_loss_work); | 2292 | cancel_work_sync(&ifmgd->beacon_connection_loss_work); |
2273 | if (del_timer_sync(&ifmgd->timer)) | 2293 | if (del_timer_sync(&ifmgd->timer)) |
2274 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); | 2294 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); |
@@ -2277,7 +2297,6 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
2277 | if (del_timer_sync(&ifmgd->chswitch_timer)) | 2297 | if (del_timer_sync(&ifmgd->chswitch_timer)) |
2278 | set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); | 2298 | set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); |
2279 | 2299 | ||
2280 | cancel_work_sync(&ifmgd->monitor_work); | ||
2281 | /* these will just be re-established on connection */ | 2300 | /* these will just be re-established on connection */ |
2282 | del_timer_sync(&ifmgd->conn_mon_timer); | 2301 | del_timer_sync(&ifmgd->conn_mon_timer); |
2283 | del_timer_sync(&ifmgd->bcn_mon_timer); | 2302 | del_timer_sync(&ifmgd->bcn_mon_timer); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bb53726cb04a..fb123e2e081a 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -141,8 +141,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
141 | pos++; | 141 | pos++; |
142 | 142 | ||
143 | /* IEEE80211_RADIOTAP_RATE */ | 143 | /* IEEE80211_RADIOTAP_RATE */ |
144 | if (status->flag & RX_FLAG_HT) { | 144 | if (!rate || status->flag & RX_FLAG_HT) { |
145 | /* | 145 | /* |
146 | * Without rate information don't add it. If we have, | ||
146 | * MCS information is a separate field in radiotap, | 147 | * MCS information is a separate field in radiotap, |
147 | * added below. The byte here is needed as padding | 148 | * added below. The byte here is needed as padding |
148 | * for the channel though, so initialise it to 0. | 149 | * for the channel though, so initialise it to 0. |
@@ -163,12 +164,14 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
163 | else if (status->flag & RX_FLAG_HT) | 164 | else if (status->flag & RX_FLAG_HT) |
164 | put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ, | 165 | put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ, |
165 | pos); | 166 | pos); |
166 | else if (rate->flags & IEEE80211_RATE_ERP_G) | 167 | else if (rate && rate->flags & IEEE80211_RATE_ERP_G) |
167 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, | 168 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, |
168 | pos); | 169 | pos); |
169 | else | 170 | else if (rate) |
170 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, | 171 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, |
171 | pos); | 172 | pos); |
173 | else | ||
174 | put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos); | ||
172 | pos += 2; | 175 | pos += 2; |
173 | 176 | ||
174 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ | 177 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index ce962d2c8782..8eaa746ec7a2 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1354,12 +1354,12 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, | |||
1354 | * Use MoreData flag to indicate whether there are | 1354 | * Use MoreData flag to indicate whether there are |
1355 | * more buffered frames for this STA | 1355 | * more buffered frames for this STA |
1356 | */ | 1356 | */ |
1357 | if (!more_data) | 1357 | if (more_data || !skb_queue_empty(&frames)) |
1358 | hdr->frame_control &= | ||
1359 | cpu_to_le16(~IEEE80211_FCTL_MOREDATA); | ||
1360 | else | ||
1361 | hdr->frame_control |= | 1358 | hdr->frame_control |= |
1362 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | 1359 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); |
1360 | else | ||
1361 | hdr->frame_control &= | ||
1362 | cpu_to_le16(~IEEE80211_FCTL_MOREDATA); | ||
1363 | 1363 | ||
1364 | if (ieee80211_is_data_qos(hdr->frame_control) || | 1364 | if (ieee80211_is_data_qos(hdr->frame_control) || |
1365 | ieee80211_is_qos_nullfunc(hdr->frame_control)) | 1365 | ieee80211_is_qos_nullfunc(hdr->frame_control)) |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 80de436eae20..16518f386117 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -260,7 +260,7 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band | |||
260 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 260 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
261 | struct ieee80211_radiotap_header *rthdr; | 261 | struct ieee80211_radiotap_header *rthdr; |
262 | unsigned char *pos; | 262 | unsigned char *pos; |
263 | __le16 txflags; | 263 | u16 txflags; |
264 | 264 | ||
265 | rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); | 265 | rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); |
266 | 266 | ||
@@ -290,13 +290,13 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band | |||
290 | txflags = 0; | 290 | txflags = 0; |
291 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && | 291 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
292 | !is_multicast_ether_addr(hdr->addr1)) | 292 | !is_multicast_ether_addr(hdr->addr1)) |
293 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); | 293 | txflags |= IEEE80211_RADIOTAP_F_TX_FAIL; |
294 | 294 | ||
295 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || | 295 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || |
296 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) | 296 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) |
297 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); | 297 | txflags |= IEEE80211_RADIOTAP_F_TX_CTS; |
298 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) | 298 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
299 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); | 299 | txflags |= IEEE80211_RADIOTAP_F_TX_RTS; |
300 | 300 | ||
301 | put_unaligned_le16(txflags, pos); | 301 | put_unaligned_le16(txflags, pos); |
302 | pos += 2; | 302 | pos += 2; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 51e256c5fb78..d5230ecc784d 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -881,6 +881,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
881 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, | 881 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, |
882 | ssid, ssid_len, | 882 | ssid, ssid_len, |
883 | buf, buf_len); | 883 | buf, buf_len); |
884 | if (!skb) | ||
885 | goto out; | ||
884 | 886 | ||
885 | if (dst) { | 887 | if (dst) { |
886 | mgmt = (struct ieee80211_mgmt *) skb->data; | 888 | mgmt = (struct ieee80211_mgmt *) skb->data; |
@@ -889,6 +891,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
889 | } | 891 | } |
890 | 892 | ||
891 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 893 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
894 | |||
895 | out: | ||
892 | kfree(buf); | 896 | kfree(buf); |
893 | 897 | ||
894 | return skb; | 898 | return skb; |
@@ -1035,7 +1039,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1035 | struct ieee80211_sub_if_data, | 1039 | struct ieee80211_sub_if_data, |
1036 | u.ap); | 1040 | u.ap); |
1037 | 1041 | ||
1038 | memset(&sta->sta.drv_priv, 0, hw->sta_data_size); | ||
1039 | WARN_ON(drv_sta_add(local, sdata, &sta->sta)); | 1042 | WARN_ON(drv_sta_add(local, sdata, &sta->sta)); |
1040 | } | 1043 | } |
1041 | } | 1044 | } |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 8260b13d93c9..d5597b759ba3 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -201,7 +201,6 @@ config NF_CONNTRACK_BROADCAST | |||
201 | 201 | ||
202 | config NF_CONNTRACK_NETBIOS_NS | 202 | config NF_CONNTRACK_NETBIOS_NS |
203 | tristate "NetBIOS name service protocol support" | 203 | tristate "NetBIOS name service protocol support" |
204 | depends on NETFILTER_ADVANCED | ||
205 | select NF_CONNTRACK_BROADCAST | 204 | select NF_CONNTRACK_BROADCAST |
206 | help | 205 | help |
207 | NetBIOS name service requests are sent as broadcast messages from an | 206 | NetBIOS name service requests are sent as broadcast messages from an |
@@ -542,7 +541,6 @@ config NETFILTER_XT_TARGET_NOTRACK | |||
542 | tristate '"NOTRACK" target support' | 541 | tristate '"NOTRACK" target support' |
543 | depends on IP_NF_RAW || IP6_NF_RAW | 542 | depends on IP_NF_RAW || IP6_NF_RAW |
544 | depends on NF_CONNTRACK | 543 | depends on NF_CONNTRACK |
545 | depends on NETFILTER_ADVANCED | ||
546 | help | 544 | help |
547 | The NOTRACK target allows a select rule to specify | 545 | The NOTRACK target allows a select rule to specify |
548 | which packets *not* to enter the conntrack/NAT | 546 | which packets *not* to enter the conntrack/NAT |
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index 6ee10f5d59bd..37d667e3f6f8 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
@@ -158,7 +158,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
158 | const struct ip_set_hash *h = set->data; | 158 | const struct ip_set_hash *h = set->data; |
159 | ipset_adtfn adtfn = set->variant->adt[adt]; | 159 | ipset_adtfn adtfn = set->variant->adt[adt]; |
160 | struct hash_ipport4_elem data = { }; | 160 | struct hash_ipport4_elem data = { }; |
161 | u32 ip, ip_to, p = 0, port, port_to; | 161 | u32 ip, ip_to = 0, p = 0, port, port_to; |
162 | u32 timeout = h->timeout; | 162 | u32 timeout = h->timeout; |
163 | bool with_ports = false; | 163 | bool with_ports = false; |
164 | int ret; | 164 | int ret; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index fb90e344e907..e69e2718fbe1 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
@@ -162,7 +162,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
162 | const struct ip_set_hash *h = set->data; | 162 | const struct ip_set_hash *h = set->data; |
163 | ipset_adtfn adtfn = set->variant->adt[adt]; | 163 | ipset_adtfn adtfn = set->variant->adt[adt]; |
164 | struct hash_ipportip4_elem data = { }; | 164 | struct hash_ipportip4_elem data = { }; |
165 | u32 ip, ip_to, p = 0, port, port_to; | 165 | u32 ip, ip_to = 0, p = 0, port, port_to; |
166 | u32 timeout = h->timeout; | 166 | u32 timeout = h->timeout; |
167 | bool with_ports = false; | 167 | bool with_ports = false; |
168 | int ret; | 168 | int ret; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index deb3e3dfa5fc..64199b4e93c9 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
@@ -184,7 +184,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
184 | const struct ip_set_hash *h = set->data; | 184 | const struct ip_set_hash *h = set->data; |
185 | ipset_adtfn adtfn = set->variant->adt[adt]; | 185 | ipset_adtfn adtfn = set->variant->adt[adt]; |
186 | struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; | 186 | struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; |
187 | u32 ip, ip_to, p = 0, port, port_to; | 187 | u32 ip, ip_to = 0, p = 0, port, port_to; |
188 | u32 ip2_from = 0, ip2_to, ip2_last, ip2; | 188 | u32 ip2_from = 0, ip2_to, ip2_last, ip2; |
189 | u32 timeout = h->timeout; | 189 | u32 timeout = h->timeout; |
190 | bool with_ports = false; | 190 | bool with_ports = false; |
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index 6b368be937c6..b62c4148b921 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
@@ -27,22 +27,17 @@ | |||
27 | 27 | ||
28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); | 28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); |
29 | 29 | ||
30 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb __read_mostly; | ||
31 | EXPORT_SYMBOL_GPL(nf_conntrack_event_cb); | ||
32 | |||
33 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb __read_mostly; | ||
34 | EXPORT_SYMBOL_GPL(nf_expect_event_cb); | ||
35 | |||
36 | /* deliver cached events and clear cache entry - must be called with locally | 30 | /* deliver cached events and clear cache entry - must be called with locally |
37 | * disabled softirqs */ | 31 | * disabled softirqs */ |
38 | void nf_ct_deliver_cached_events(struct nf_conn *ct) | 32 | void nf_ct_deliver_cached_events(struct nf_conn *ct) |
39 | { | 33 | { |
34 | struct net *net = nf_ct_net(ct); | ||
40 | unsigned long events; | 35 | unsigned long events; |
41 | struct nf_ct_event_notifier *notify; | 36 | struct nf_ct_event_notifier *notify; |
42 | struct nf_conntrack_ecache *e; | 37 | struct nf_conntrack_ecache *e; |
43 | 38 | ||
44 | rcu_read_lock(); | 39 | rcu_read_lock(); |
45 | notify = rcu_dereference(nf_conntrack_event_cb); | 40 | notify = rcu_dereference(net->ct.nf_conntrack_event_cb); |
46 | if (notify == NULL) | 41 | if (notify == NULL) |
47 | goto out_unlock; | 42 | goto out_unlock; |
48 | 43 | ||
@@ -83,19 +78,20 @@ out_unlock: | |||
83 | } | 78 | } |
84 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); | 79 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); |
85 | 80 | ||
86 | int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new) | 81 | int nf_conntrack_register_notifier(struct net *net, |
82 | struct nf_ct_event_notifier *new) | ||
87 | { | 83 | { |
88 | int ret = 0; | 84 | int ret = 0; |
89 | struct nf_ct_event_notifier *notify; | 85 | struct nf_ct_event_notifier *notify; |
90 | 86 | ||
91 | mutex_lock(&nf_ct_ecache_mutex); | 87 | mutex_lock(&nf_ct_ecache_mutex); |
92 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 88 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
93 | lockdep_is_held(&nf_ct_ecache_mutex)); | 89 | lockdep_is_held(&nf_ct_ecache_mutex)); |
94 | if (notify != NULL) { | 90 | if (notify != NULL) { |
95 | ret = -EBUSY; | 91 | ret = -EBUSY; |
96 | goto out_unlock; | 92 | goto out_unlock; |
97 | } | 93 | } |
98 | RCU_INIT_POINTER(nf_conntrack_event_cb, new); | 94 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new); |
99 | mutex_unlock(&nf_ct_ecache_mutex); | 95 | mutex_unlock(&nf_ct_ecache_mutex); |
100 | return ret; | 96 | return ret; |
101 | 97 | ||
@@ -105,32 +101,34 @@ out_unlock: | |||
105 | } | 101 | } |
106 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); | 102 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); |
107 | 103 | ||
108 | void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new) | 104 | void nf_conntrack_unregister_notifier(struct net *net, |
105 | struct nf_ct_event_notifier *new) | ||
109 | { | 106 | { |
110 | struct nf_ct_event_notifier *notify; | 107 | struct nf_ct_event_notifier *notify; |
111 | 108 | ||
112 | mutex_lock(&nf_ct_ecache_mutex); | 109 | mutex_lock(&nf_ct_ecache_mutex); |
113 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 110 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
114 | lockdep_is_held(&nf_ct_ecache_mutex)); | 111 | lockdep_is_held(&nf_ct_ecache_mutex)); |
115 | BUG_ON(notify != new); | 112 | BUG_ON(notify != new); |
116 | RCU_INIT_POINTER(nf_conntrack_event_cb, NULL); | 113 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL); |
117 | mutex_unlock(&nf_ct_ecache_mutex); | 114 | mutex_unlock(&nf_ct_ecache_mutex); |
118 | } | 115 | } |
119 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); | 116 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); |
120 | 117 | ||
121 | int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new) | 118 | int nf_ct_expect_register_notifier(struct net *net, |
119 | struct nf_exp_event_notifier *new) | ||
122 | { | 120 | { |
123 | int ret = 0; | 121 | int ret = 0; |
124 | struct nf_exp_event_notifier *notify; | 122 | struct nf_exp_event_notifier *notify; |
125 | 123 | ||
126 | mutex_lock(&nf_ct_ecache_mutex); | 124 | mutex_lock(&nf_ct_ecache_mutex); |
127 | notify = rcu_dereference_protected(nf_expect_event_cb, | 125 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
128 | lockdep_is_held(&nf_ct_ecache_mutex)); | 126 | lockdep_is_held(&nf_ct_ecache_mutex)); |
129 | if (notify != NULL) { | 127 | if (notify != NULL) { |
130 | ret = -EBUSY; | 128 | ret = -EBUSY; |
131 | goto out_unlock; | 129 | goto out_unlock; |
132 | } | 130 | } |
133 | RCU_INIT_POINTER(nf_expect_event_cb, new); | 131 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new); |
134 | mutex_unlock(&nf_ct_ecache_mutex); | 132 | mutex_unlock(&nf_ct_ecache_mutex); |
135 | return ret; | 133 | return ret; |
136 | 134 | ||
@@ -140,15 +138,16 @@ out_unlock: | |||
140 | } | 138 | } |
141 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); | 139 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); |
142 | 140 | ||
143 | void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new) | 141 | void nf_ct_expect_unregister_notifier(struct net *net, |
142 | struct nf_exp_event_notifier *new) | ||
144 | { | 143 | { |
145 | struct nf_exp_event_notifier *notify; | 144 | struct nf_exp_event_notifier *notify; |
146 | 145 | ||
147 | mutex_lock(&nf_ct_ecache_mutex); | 146 | mutex_lock(&nf_ct_ecache_mutex); |
148 | notify = rcu_dereference_protected(nf_expect_event_cb, | 147 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
149 | lockdep_is_held(&nf_ct_ecache_mutex)); | 148 | lockdep_is_held(&nf_ct_ecache_mutex)); |
150 | BUG_ON(notify != new); | 149 | BUG_ON(notify != new); |
151 | RCU_INIT_POINTER(nf_expect_event_cb, NULL); | 150 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL); |
152 | mutex_unlock(&nf_ct_ecache_mutex); | 151 | mutex_unlock(&nf_ct_ecache_mutex); |
153 | } | 152 | } |
154 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); | 153 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index e58aa9b1fe8a..ef21b221f036 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * (C) 2001 by Jay Schulist <jschlst@samba.org> | 4 | * (C) 2001 by Jay Schulist <jschlst@samba.org> |
5 | * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> | 5 | * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> |
6 | * (C) 2003 by Patrick Mchardy <kaber@trash.net> | 6 | * (C) 2003 by Patrick Mchardy <kaber@trash.net> |
7 | * (C) 2005-2008 by Pablo Neira Ayuso <pablo@netfilter.org> | 7 | * (C) 2005-2011 by Pablo Neira Ayuso <pablo@netfilter.org> |
8 | * | 8 | * |
9 | * Initial connection tracking via netlink development funded and | 9 | * Initial connection tracking via netlink development funded and |
10 | * generally made possible by Network Robots, Inc. (www.networkrobots.com) | 10 | * generally made possible by Network Robots, Inc. (www.networkrobots.com) |
@@ -2163,6 +2163,54 @@ MODULE_ALIAS("ip_conntrack_netlink"); | |||
2163 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); | 2163 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); |
2164 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); | 2164 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); |
2165 | 2165 | ||
2166 | static int __net_init ctnetlink_net_init(struct net *net) | ||
2167 | { | ||
2168 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2169 | int ret; | ||
2170 | |||
2171 | ret = nf_conntrack_register_notifier(net, &ctnl_notifier); | ||
2172 | if (ret < 0) { | ||
2173 | pr_err("ctnetlink_init: cannot register notifier.\n"); | ||
2174 | goto err_out; | ||
2175 | } | ||
2176 | |||
2177 | ret = nf_ct_expect_register_notifier(net, &ctnl_notifier_exp); | ||
2178 | if (ret < 0) { | ||
2179 | pr_err("ctnetlink_init: cannot expect register notifier.\n"); | ||
2180 | goto err_unreg_notifier; | ||
2181 | } | ||
2182 | #endif | ||
2183 | return 0; | ||
2184 | |||
2185 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2186 | err_unreg_notifier: | ||
2187 | nf_conntrack_unregister_notifier(net, &ctnl_notifier); | ||
2188 | err_out: | ||
2189 | return ret; | ||
2190 | #endif | ||
2191 | } | ||
2192 | |||
2193 | static void ctnetlink_net_exit(struct net *net) | ||
2194 | { | ||
2195 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2196 | nf_ct_expect_unregister_notifier(net, &ctnl_notifier_exp); | ||
2197 | nf_conntrack_unregister_notifier(net, &ctnl_notifier); | ||
2198 | #endif | ||
2199 | } | ||
2200 | |||
2201 | static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list) | ||
2202 | { | ||
2203 | struct net *net; | ||
2204 | |||
2205 | list_for_each_entry(net, net_exit_list, exit_list) | ||
2206 | ctnetlink_net_exit(net); | ||
2207 | } | ||
2208 | |||
2209 | static struct pernet_operations ctnetlink_net_ops = { | ||
2210 | .init = ctnetlink_net_init, | ||
2211 | .exit_batch = ctnetlink_net_exit_batch, | ||
2212 | }; | ||
2213 | |||
2166 | static int __init ctnetlink_init(void) | 2214 | static int __init ctnetlink_init(void) |
2167 | { | 2215 | { |
2168 | int ret; | 2216 | int ret; |
@@ -2180,28 +2228,15 @@ static int __init ctnetlink_init(void) | |||
2180 | goto err_unreg_subsys; | 2228 | goto err_unreg_subsys; |
2181 | } | 2229 | } |
2182 | 2230 | ||
2183 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 2231 | if (register_pernet_subsys(&ctnetlink_net_ops)) { |
2184 | ret = nf_conntrack_register_notifier(&ctnl_notifier); | 2232 | pr_err("ctnetlink_init: cannot register pernet operations\n"); |
2185 | if (ret < 0) { | ||
2186 | pr_err("ctnetlink_init: cannot register notifier.\n"); | ||
2187 | goto err_unreg_exp_subsys; | 2233 | goto err_unreg_exp_subsys; |
2188 | } | 2234 | } |
2189 | 2235 | ||
2190 | ret = nf_ct_expect_register_notifier(&ctnl_notifier_exp); | ||
2191 | if (ret < 0) { | ||
2192 | pr_err("ctnetlink_init: cannot expect register notifier.\n"); | ||
2193 | goto err_unreg_notifier; | ||
2194 | } | ||
2195 | #endif | ||
2196 | |||
2197 | return 0; | 2236 | return 0; |
2198 | 2237 | ||
2199 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2200 | err_unreg_notifier: | ||
2201 | nf_conntrack_unregister_notifier(&ctnl_notifier); | ||
2202 | err_unreg_exp_subsys: | 2238 | err_unreg_exp_subsys: |
2203 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); | 2239 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); |
2204 | #endif | ||
2205 | err_unreg_subsys: | 2240 | err_unreg_subsys: |
2206 | nfnetlink_subsys_unregister(&ctnl_subsys); | 2241 | nfnetlink_subsys_unregister(&ctnl_subsys); |
2207 | err_out: | 2242 | err_out: |
@@ -2213,11 +2248,7 @@ static void __exit ctnetlink_exit(void) | |||
2213 | pr_info("ctnetlink: unregistering from nfnetlink.\n"); | 2248 | pr_info("ctnetlink: unregistering from nfnetlink.\n"); |
2214 | 2249 | ||
2215 | nf_ct_remove_userspace_expectations(); | 2250 | nf_ct_remove_userspace_expectations(); |
2216 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 2251 | unregister_pernet_subsys(&ctnetlink_net_ops); |
2217 | nf_ct_expect_unregister_notifier(&ctnl_notifier_exp); | ||
2218 | nf_conntrack_unregister_notifier(&ctnl_notifier); | ||
2219 | #endif | ||
2220 | |||
2221 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); | 2252 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); |
2222 | nfnetlink_subsys_unregister(&ctnl_subsys); | 2253 | nfnetlink_subsys_unregister(&ctnl_subsys); |
2223 | } | 2254 | } |
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 9c24de10a657..824f184f7a9b 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c | |||
@@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
111 | struct netlbl_domaddr_map *addrmap = NULL; | 111 | struct netlbl_domaddr_map *addrmap = NULL; |
112 | struct netlbl_domaddr4_map *map4 = NULL; | 112 | struct netlbl_domaddr4_map *map4 = NULL; |
113 | struct netlbl_domaddr6_map *map6 = NULL; | 113 | struct netlbl_domaddr6_map *map6 = NULL; |
114 | const struct in_addr *addr4, *mask4; | ||
115 | const struct in6_addr *addr6, *mask6; | ||
116 | 114 | ||
117 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); | 115 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
118 | if (entry == NULL) | 116 | if (entry == NULL) |
@@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
133 | INIT_LIST_HEAD(&addrmap->list6); | 131 | INIT_LIST_HEAD(&addrmap->list6); |
134 | 132 | ||
135 | switch (family) { | 133 | switch (family) { |
136 | case AF_INET: | 134 | case AF_INET: { |
137 | addr4 = addr; | 135 | const struct in_addr *addr4 = addr; |
138 | mask4 = mask; | 136 | const struct in_addr *mask4 = mask; |
139 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); | 137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); |
140 | if (map4 == NULL) | 138 | if (map4 == NULL) |
141 | goto cfg_unlbl_map_add_failure; | 139 | goto cfg_unlbl_map_add_failure; |
@@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
148 | if (ret_val != 0) | 146 | if (ret_val != 0) |
149 | goto cfg_unlbl_map_add_failure; | 147 | goto cfg_unlbl_map_add_failure; |
150 | break; | 148 | break; |
151 | case AF_INET6: | 149 | } |
152 | addr6 = addr; | 150 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
153 | mask6 = mask; | 151 | case AF_INET6: { |
152 | const struct in6_addr *addr6 = addr; | ||
153 | const struct in6_addr *mask6 = mask; | ||
154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); | 154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); |
155 | if (map6 == NULL) | 155 | if (map6 == NULL) |
156 | goto cfg_unlbl_map_add_failure; | 156 | goto cfg_unlbl_map_add_failure; |
@@ -162,11 +162,13 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
162 | map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; | 162 | map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; |
163 | ipv6_addr_copy(&map6->list.mask, mask6); | 163 | ipv6_addr_copy(&map6->list.mask, mask6); |
164 | map6->list.valid = 1; | 164 | map6->list.valid = 1; |
165 | ret_val = netlbl_af4list_add(&map4->list, | 165 | ret_val = netlbl_af6list_add(&map6->list, |
166 | &addrmap->list4); | 166 | &addrmap->list6); |
167 | if (ret_val != 0) | 167 | if (ret_val != 0) |
168 | goto cfg_unlbl_map_add_failure; | 168 | goto cfg_unlbl_map_add_failure; |
169 | break; | 169 | break; |
170 | } | ||
171 | #endif /* IPv6 */ | ||
170 | default: | 172 | default: |
171 | goto cfg_unlbl_map_add_failure; | 173 | goto cfg_unlbl_map_add_failure; |
172 | break; | 174 | break; |
@@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net, | |||
225 | case AF_INET: | 227 | case AF_INET: |
226 | addr_len = sizeof(struct in_addr); | 228 | addr_len = sizeof(struct in_addr); |
227 | break; | 229 | break; |
230 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
228 | case AF_INET6: | 231 | case AF_INET6: |
229 | addr_len = sizeof(struct in6_addr); | 232 | addr_len = sizeof(struct in6_addr); |
230 | break; | 233 | break; |
234 | #endif /* IPv6 */ | ||
231 | default: | 235 | default: |
232 | return -EPFNOSUPPORT; | 236 | return -EPFNOSUPPORT; |
233 | } | 237 | } |
@@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net, | |||
266 | case AF_INET: | 270 | case AF_INET: |
267 | addr_len = sizeof(struct in_addr); | 271 | addr_len = sizeof(struct in_addr); |
268 | break; | 272 | break; |
273 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
269 | case AF_INET6: | 274 | case AF_INET6: |
270 | addr_len = sizeof(struct in6_addr); | 275 | addr_len = sizeof(struct in6_addr); |
271 | break; | 276 | break; |
277 | #endif /* IPv6 */ | ||
272 | default: | 278 | default: |
273 | return -EPFNOSUPPORT; | 279 | return -EPFNOSUPPORT; |
274 | } | 280 | } |
diff --git a/net/rds/Kconfig b/net/rds/Kconfig index 4cf6dc7910e4..ec753b3ae72a 100644 --- a/net/rds/Kconfig +++ b/net/rds/Kconfig | |||
@@ -9,7 +9,6 @@ config RDS | |||
9 | 9 | ||
10 | config RDS_RDMA | 10 | config RDS_RDMA |
11 | tristate "RDS over Infiniband and iWARP" | 11 | tristate "RDS over Infiniband and iWARP" |
12 | select LLIST | ||
13 | depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS | 12 | depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS |
14 | ---help--- | 13 | ---help--- |
15 | Allow RDS to use Infiniband and iWARP as a transport. | 14 | Allow RDS to use Infiniband and iWARP as a transport. |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 6649463da1b6..d617161f8dd3 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -209,8 +209,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | |||
209 | ctl->Plog, ctl->Scell_log, | 209 | ctl->Plog, ctl->Scell_log, |
210 | nla_data(tb[TCA_RED_STAB])); | 210 | nla_data(tb[TCA_RED_STAB])); |
211 | 211 | ||
212 | if (skb_queue_empty(&sch->q)) | 212 | if (!q->qdisc->q.qlen) |
213 | red_end_of_idle_period(&q->parms); | 213 | red_start_of_idle_period(&q->parms); |
214 | 214 | ||
215 | sch_tree_unlock(sch); | 215 | sch_tree_unlock(sch); |
216 | return 0; | 216 | return 0; |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index a3b7120fcc74..4f4c52c0eeb3 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -225,11 +225,11 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt) | |||
225 | 225 | ||
226 | 226 | ||
227 | static int | 227 | static int |
228 | __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) | 228 | __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, |
229 | struct net_device *dev, struct netdev_queue *txq, | ||
230 | struct neighbour *mn) | ||
229 | { | 231 | { |
230 | struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, 0); | 232 | struct teql_sched_data *q = qdisc_priv(txq->qdisc); |
231 | struct teql_sched_data *q = qdisc_priv(dev_queue->qdisc); | ||
232 | struct neighbour *mn = dst_get_neighbour(skb_dst(skb)); | ||
233 | struct neighbour *n = q->ncache; | 233 | struct neighbour *n = q->ncache; |
234 | 234 | ||
235 | if (mn->tbl == NULL) | 235 | if (mn->tbl == NULL) |
@@ -262,17 +262,26 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device * | |||
262 | } | 262 | } |
263 | 263 | ||
264 | static inline int teql_resolve(struct sk_buff *skb, | 264 | static inline int teql_resolve(struct sk_buff *skb, |
265 | struct sk_buff *skb_res, struct net_device *dev) | 265 | struct sk_buff *skb_res, |
266 | struct net_device *dev, | ||
267 | struct netdev_queue *txq) | ||
266 | { | 268 | { |
267 | struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); | 269 | struct dst_entry *dst = skb_dst(skb); |
270 | struct neighbour *mn; | ||
271 | int res; | ||
272 | |||
268 | if (txq->qdisc == &noop_qdisc) | 273 | if (txq->qdisc == &noop_qdisc) |
269 | return -ENODEV; | 274 | return -ENODEV; |
270 | 275 | ||
271 | if (dev->header_ops == NULL || | 276 | if (!dev->header_ops || !dst) |
272 | skb_dst(skb) == NULL || | ||
273 | dst_get_neighbour(skb_dst(skb)) == NULL) | ||
274 | return 0; | 277 | return 0; |
275 | return __teql_resolve(skb, skb_res, dev); | 278 | |
279 | rcu_read_lock(); | ||
280 | mn = dst_get_neighbour(dst); | ||
281 | res = mn ? __teql_resolve(skb, skb_res, dev, txq, mn) : 0; | ||
282 | rcu_read_unlock(); | ||
283 | |||
284 | return res; | ||
276 | } | 285 | } |
277 | 286 | ||
278 | static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) | 287 | static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -307,7 +316,7 @@ restart: | |||
307 | continue; | 316 | continue; |
308 | } | 317 | } |
309 | 318 | ||
310 | switch (teql_resolve(skb, skb_res, slave)) { | 319 | switch (teql_resolve(skb, skb_res, slave, slave_txq)) { |
311 | case 0: | 320 | case 0: |
312 | if (__netif_tx_trylock(slave_txq)) { | 321 | if (__netif_tx_trylock(slave_txq)) { |
313 | unsigned int length = qdisc_pkt_len(skb); | 322 | unsigned int length = qdisc_pkt_len(skb); |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 865e68fef21c..bf812048cf6f 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -82,7 +82,7 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp) | |||
82 | struct sctp_auth_bytes *key; | 82 | struct sctp_auth_bytes *key; |
83 | 83 | ||
84 | /* Verify that we are not going to overflow INT_MAX */ | 84 | /* Verify that we are not going to overflow INT_MAX */ |
85 | if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes)) | 85 | if (key_len > (INT_MAX - sizeof(struct sctp_auth_bytes))) |
86 | return NULL; | 86 | return NULL; |
87 | 87 | ||
88 | /* Allocate the shared key */ | 88 | /* Allocate the shared key */ |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d7f97ef26590..55472c48825e 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -496,7 +496,7 @@ static int xs_nospace(struct rpc_task *task) | |||
496 | struct rpc_rqst *req = task->tk_rqstp; | 496 | struct rpc_rqst *req = task->tk_rqstp; |
497 | struct rpc_xprt *xprt = req->rq_xprt; | 497 | struct rpc_xprt *xprt = req->rq_xprt; |
498 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | 498 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
499 | int ret = 0; | 499 | int ret = -EAGAIN; |
500 | 500 | ||
501 | dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", | 501 | dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", |
502 | task->tk_pid, req->rq_slen - req->rq_bytes_sent, | 502 | task->tk_pid, req->rq_slen - req->rq_bytes_sent, |
@@ -508,7 +508,6 @@ static int xs_nospace(struct rpc_task *task) | |||
508 | /* Don't race with disconnect */ | 508 | /* Don't race with disconnect */ |
509 | if (xprt_connected(xprt)) { | 509 | if (xprt_connected(xprt)) { |
510 | if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { | 510 | if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { |
511 | ret = -EAGAIN; | ||
512 | /* | 511 | /* |
513 | * Notify TCP that we're limited by the application | 512 | * Notify TCP that we're limited by the application |
514 | * window size | 513 | * window size |
@@ -2530,8 +2529,10 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, | |||
2530 | int err; | 2529 | int err; |
2531 | err = xs_init_anyaddr(args->dstaddr->sa_family, | 2530 | err = xs_init_anyaddr(args->dstaddr->sa_family, |
2532 | (struct sockaddr *)&new->srcaddr); | 2531 | (struct sockaddr *)&new->srcaddr); |
2533 | if (err != 0) | 2532 | if (err != 0) { |
2533 | xprt_free(xprt); | ||
2534 | return ERR_PTR(err); | 2534 | return ERR_PTR(err); |
2535 | } | ||
2535 | } | 2536 | } |
2536 | 2537 | ||
2537 | return xprt; | 2538 | return xprt; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 466fbcc5cf77..b595a3d8679f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1957,6 +1957,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1957 | if ((UNIXCB(skb).pid != siocb->scm->pid) || | 1957 | if ((UNIXCB(skb).pid != siocb->scm->pid) || |
1958 | (UNIXCB(skb).cred != siocb->scm->cred)) { | 1958 | (UNIXCB(skb).cred != siocb->scm->cred)) { |
1959 | skb_queue_head(&sk->sk_receive_queue, skb); | 1959 | skb_queue_head(&sk->sk_receive_queue, skb); |
1960 | sk->sk_data_ready(sk, skb->len); | ||
1960 | break; | 1961 | break; |
1961 | } | 1962 | } |
1962 | } else { | 1963 | } else { |
@@ -1974,6 +1975,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1974 | chunk = min_t(unsigned int, skb->len, size); | 1975 | chunk = min_t(unsigned int, skb->len, size); |
1975 | if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { | 1976 | if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { |
1976 | skb_queue_head(&sk->sk_receive_queue, skb); | 1977 | skb_queue_head(&sk->sk_receive_queue, skb); |
1978 | sk->sk_data_ready(sk, skb->len); | ||
1977 | if (copied == 0) | 1979 | if (copied == 0) |
1978 | copied = -EFAULT; | 1980 | copied = -EFAULT; |
1979 | break; | 1981 | break; |
@@ -1991,6 +1993,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1991 | /* put the skb back if we didn't use it up.. */ | 1993 | /* put the skb back if we didn't use it up.. */ |
1992 | if (skb->len) { | 1994 | if (skb->len) { |
1993 | skb_queue_head(&sk->sk_receive_queue, skb); | 1995 | skb_queue_head(&sk->sk_receive_queue, skb); |
1996 | sk->sk_data_ready(sk, skb->len); | ||
1994 | break; | 1997 | break; |
1995 | } | 1998 | } |
1996 | 1999 | ||
@@ -2006,6 +2009,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
2006 | 2009 | ||
2007 | /* put message back and return */ | 2010 | /* put message back and return */ |
2008 | skb_queue_head(&sk->sk_receive_queue, skb); | 2011 | skb_queue_head(&sk->sk_receive_queue, skb); |
2012 | sk->sk_data_ready(sk, skb->len); | ||
2009 | break; | 2013 | break; |
2010 | } | 2014 | } |
2011 | } while (size); | 2015 | } while (size); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 48260c2d092a..ffafda5022c2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -89,8 +89,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
89 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, | 89 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, |
90 | [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, | 90 | [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, |
91 | 91 | ||
92 | [NL80211_ATTR_MAC] = { .type = NLA_BINARY, .len = ETH_ALEN }, | 92 | [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, |
93 | [NL80211_ATTR_PREV_BSSID] = { .type = NLA_BINARY, .len = ETH_ALEN }, | 93 | [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, |
94 | 94 | ||
95 | [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, | 95 | [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, |
96 | [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, | 96 | [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, |
@@ -132,8 +132,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
132 | [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, | 132 | [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, |
133 | [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG }, | 133 | [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG }, |
134 | 134 | ||
135 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, | 135 | [NL80211_ATTR_HT_CAPABILITY] = { .len = NL80211_HT_CAPABILITY_LEN }, |
136 | .len = NL80211_HT_CAPABILITY_LEN }, | ||
137 | 136 | ||
138 | [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 }, | 137 | [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 }, |
139 | [NL80211_ATTR_IE] = { .type = NLA_BINARY, | 138 | [NL80211_ATTR_IE] = { .type = NLA_BINARY, |
@@ -1253,6 +1252,12 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1253 | goto bad_res; | 1252 | goto bad_res; |
1254 | } | 1253 | } |
1255 | 1254 | ||
1255 | if (netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | ||
1256 | netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
1257 | result = -EINVAL; | ||
1258 | goto bad_res; | ||
1259 | } | ||
1260 | |||
1256 | nla_for_each_nested(nl_txq_params, | 1261 | nla_for_each_nested(nl_txq_params, |
1257 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | 1262 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], |
1258 | rem_txq_params) { | 1263 | rem_txq_params) { |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 6acba9d18cc8..3302c56f60d1 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -57,8 +57,17 @@ | |||
57 | #define REG_DBG_PRINT(args...) | 57 | #define REG_DBG_PRINT(args...) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | static struct regulatory_request core_request_world = { | ||
61 | .initiator = NL80211_REGDOM_SET_BY_CORE, | ||
62 | .alpha2[0] = '0', | ||
63 | .alpha2[1] = '0', | ||
64 | .intersect = false, | ||
65 | .processed = true, | ||
66 | .country_ie_env = ENVIRON_ANY, | ||
67 | }; | ||
68 | |||
60 | /* Receipt of information from last regulatory request */ | 69 | /* Receipt of information from last regulatory request */ |
61 | static struct regulatory_request *last_request; | 70 | static struct regulatory_request *last_request = &core_request_world; |
62 | 71 | ||
63 | /* To trigger userspace events */ | 72 | /* To trigger userspace events */ |
64 | static struct platform_device *reg_pdev; | 73 | static struct platform_device *reg_pdev; |
@@ -150,7 +159,7 @@ static char user_alpha2[2]; | |||
150 | module_param(ieee80211_regdom, charp, 0444); | 159 | module_param(ieee80211_regdom, charp, 0444); |
151 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); | 160 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); |
152 | 161 | ||
153 | static void reset_regdomains(void) | 162 | static void reset_regdomains(bool full_reset) |
154 | { | 163 | { |
155 | /* avoid freeing static information or freeing something twice */ | 164 | /* avoid freeing static information or freeing something twice */ |
156 | if (cfg80211_regdomain == cfg80211_world_regdom) | 165 | if (cfg80211_regdomain == cfg80211_world_regdom) |
@@ -165,6 +174,13 @@ static void reset_regdomains(void) | |||
165 | 174 | ||
166 | cfg80211_world_regdom = &world_regdom; | 175 | cfg80211_world_regdom = &world_regdom; |
167 | cfg80211_regdomain = NULL; | 176 | cfg80211_regdomain = NULL; |
177 | |||
178 | if (!full_reset) | ||
179 | return; | ||
180 | |||
181 | if (last_request != &core_request_world) | ||
182 | kfree(last_request); | ||
183 | last_request = &core_request_world; | ||
168 | } | 184 | } |
169 | 185 | ||
170 | /* | 186 | /* |
@@ -175,7 +191,7 @@ static void update_world_regdomain(const struct ieee80211_regdomain *rd) | |||
175 | { | 191 | { |
176 | BUG_ON(!last_request); | 192 | BUG_ON(!last_request); |
177 | 193 | ||
178 | reset_regdomains(); | 194 | reset_regdomains(false); |
179 | 195 | ||
180 | cfg80211_world_regdom = rd; | 196 | cfg80211_world_regdom = rd; |
181 | cfg80211_regdomain = rd; | 197 | cfg80211_regdomain = rd; |
@@ -1407,7 +1423,8 @@ static int __regulatory_hint(struct wiphy *wiphy, | |||
1407 | } | 1423 | } |
1408 | 1424 | ||
1409 | new_request: | 1425 | new_request: |
1410 | kfree(last_request); | 1426 | if (last_request != &core_request_world) |
1427 | kfree(last_request); | ||
1411 | 1428 | ||
1412 | last_request = pending_request; | 1429 | last_request = pending_request; |
1413 | last_request->intersect = intersect; | 1430 | last_request->intersect = intersect; |
@@ -1577,9 +1594,6 @@ static int regulatory_hint_core(const char *alpha2) | |||
1577 | { | 1594 | { |
1578 | struct regulatory_request *request; | 1595 | struct regulatory_request *request; |
1579 | 1596 | ||
1580 | kfree(last_request); | ||
1581 | last_request = NULL; | ||
1582 | |||
1583 | request = kzalloc(sizeof(struct regulatory_request), | 1597 | request = kzalloc(sizeof(struct regulatory_request), |
1584 | GFP_KERNEL); | 1598 | GFP_KERNEL); |
1585 | if (!request) | 1599 | if (!request) |
@@ -1777,7 +1791,7 @@ static void restore_regulatory_settings(bool reset_user) | |||
1777 | mutex_lock(&cfg80211_mutex); | 1791 | mutex_lock(&cfg80211_mutex); |
1778 | mutex_lock(®_mutex); | 1792 | mutex_lock(®_mutex); |
1779 | 1793 | ||
1780 | reset_regdomains(); | 1794 | reset_regdomains(true); |
1781 | restore_alpha2(alpha2, reset_user); | 1795 | restore_alpha2(alpha2, reset_user); |
1782 | 1796 | ||
1783 | /* | 1797 | /* |
@@ -2037,12 +2051,18 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2037 | } | 2051 | } |
2038 | 2052 | ||
2039 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); | 2053 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); |
2054 | if (!request_wiphy && | ||
2055 | (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || | ||
2056 | last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) { | ||
2057 | schedule_delayed_work(®_timeout, 0); | ||
2058 | return -ENODEV; | ||
2059 | } | ||
2040 | 2060 | ||
2041 | if (!last_request->intersect) { | 2061 | if (!last_request->intersect) { |
2042 | int r; | 2062 | int r; |
2043 | 2063 | ||
2044 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { | 2064 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { |
2045 | reset_regdomains(); | 2065 | reset_regdomains(false); |
2046 | cfg80211_regdomain = rd; | 2066 | cfg80211_regdomain = rd; |
2047 | return 0; | 2067 | return 0; |
2048 | } | 2068 | } |
@@ -2063,7 +2083,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2063 | if (r) | 2083 | if (r) |
2064 | return r; | 2084 | return r; |
2065 | 2085 | ||
2066 | reset_regdomains(); | 2086 | reset_regdomains(false); |
2067 | cfg80211_regdomain = rd; | 2087 | cfg80211_regdomain = rd; |
2068 | return 0; | 2088 | return 0; |
2069 | } | 2089 | } |
@@ -2088,7 +2108,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2088 | 2108 | ||
2089 | rd = NULL; | 2109 | rd = NULL; |
2090 | 2110 | ||
2091 | reset_regdomains(); | 2111 | reset_regdomains(false); |
2092 | cfg80211_regdomain = intersected_rd; | 2112 | cfg80211_regdomain = intersected_rd; |
2093 | 2113 | ||
2094 | return 0; | 2114 | return 0; |
@@ -2108,7 +2128,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2108 | kfree(rd); | 2128 | kfree(rd); |
2109 | rd = NULL; | 2129 | rd = NULL; |
2110 | 2130 | ||
2111 | reset_regdomains(); | 2131 | reset_regdomains(false); |
2112 | cfg80211_regdomain = intersected_rd; | 2132 | cfg80211_regdomain = intersected_rd; |
2113 | 2133 | ||
2114 | return 0; | 2134 | return 0; |
@@ -2261,9 +2281,9 @@ void /* __init_or_exit */ regulatory_exit(void) | |||
2261 | mutex_lock(&cfg80211_mutex); | 2281 | mutex_lock(&cfg80211_mutex); |
2262 | mutex_lock(®_mutex); | 2282 | mutex_lock(®_mutex); |
2263 | 2283 | ||
2264 | reset_regdomains(); | 2284 | reset_regdomains(true); |
2265 | 2285 | ||
2266 | kfree(last_request); | 2286 | dev_set_uevent_suppress(®_pdev->dev, true); |
2267 | 2287 | ||
2268 | platform_device_unregister(reg_pdev); | 2288 | platform_device_unregister(reg_pdev); |
2269 | 2289 | ||
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 0fb142410404..dc23b31594e0 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -259,17 +259,20 @@ static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2) | |||
259 | { | 259 | { |
260 | const u8 *ie1 = cfg80211_find_ie(num, ies1, len1); | 260 | const u8 *ie1 = cfg80211_find_ie(num, ies1, len1); |
261 | const u8 *ie2 = cfg80211_find_ie(num, ies2, len2); | 261 | const u8 *ie2 = cfg80211_find_ie(num, ies2, len2); |
262 | int r; | ||
263 | 262 | ||
263 | /* equal if both missing */ | ||
264 | if (!ie1 && !ie2) | 264 | if (!ie1 && !ie2) |
265 | return 0; | 265 | return 0; |
266 | if (!ie1 || !ie2) | 266 | /* sort missing IE before (left of) present IE */ |
267 | if (!ie1) | ||
267 | return -1; | 268 | return -1; |
269 | if (!ie2) | ||
270 | return 1; | ||
268 | 271 | ||
269 | r = memcmp(ie1 + 2, ie2 + 2, min(ie1[1], ie2[1])); | 272 | /* sort by length first, then by contents */ |
270 | if (r == 0 && ie1[1] != ie2[1]) | 273 | if (ie1[1] != ie2[1]) |
271 | return ie2[1] - ie1[1]; | 274 | return ie2[1] - ie1[1]; |
272 | return r; | 275 | return memcmp(ie1 + 2, ie2 + 2, ie1[1]); |
273 | } | 276 | } |
274 | 277 | ||
275 | static bool is_bss(struct cfg80211_bss *a, | 278 | static bool is_bss(struct cfg80211_bss *a, |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 552df27dcf53..2118d6446630 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2382,9 +2382,11 @@ static unsigned int xfrm_default_advmss(const struct dst_entry *dst) | |||
2382 | return dst_metric_advmss(dst->path); | 2382 | return dst_metric_advmss(dst->path); |
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | static unsigned int xfrm_default_mtu(const struct dst_entry *dst) | 2385 | static unsigned int xfrm_mtu(const struct dst_entry *dst) |
2386 | { | 2386 | { |
2387 | return dst_mtu(dst->path); | 2387 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
2388 | |||
2389 | return mtu ? : dst_mtu(dst->path); | ||
2388 | } | 2390 | } |
2389 | 2391 | ||
2390 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 2392 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
@@ -2411,8 +2413,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
2411 | dst_ops->check = xfrm_dst_check; | 2413 | dst_ops->check = xfrm_dst_check; |
2412 | if (likely(dst_ops->default_advmss == NULL)) | 2414 | if (likely(dst_ops->default_advmss == NULL)) |
2413 | dst_ops->default_advmss = xfrm_default_advmss; | 2415 | dst_ops->default_advmss = xfrm_default_advmss; |
2414 | if (likely(dst_ops->default_mtu == NULL)) | 2416 | if (likely(dst_ops->mtu == NULL)) |
2415 | dst_ops->default_mtu = xfrm_default_mtu; | 2417 | dst_ops->mtu = xfrm_mtu; |
2416 | if (likely(dst_ops->negative_advice == NULL)) | 2418 | if (likely(dst_ops->negative_advice == NULL)) |
2417 | dst_ops->negative_advice = xfrm_negative_advice; | 2419 | dst_ops->negative_advice = xfrm_negative_advice; |
2418 | if (likely(dst_ops->link_failure == NULL)) | 2420 | if (likely(dst_ops->link_failure == NULL)) |