diff options
| author | David S. Miller <davem@davemloft.net> | 2011-06-21 01:29:08 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-06-21 01:29:08 -0400 |
| commit | 9f6ec8d697c08963d83880ccd35c13c5ace716ea (patch) | |
| tree | ad8d93cf6fcdd09b86ade09f5fcbbc66cdb1cca2 /net | |
| parent | 4aa3a715551c93eda32d79bd52042ce500bd5383 (diff) | |
| parent | 56299378726d5f2ba8d3c8cbbd13cb280ba45e4f (diff) | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
drivers/net/wireless/rtlwifi/pci.c
net/netfilter/ipvs/ip_vs_core.c
Diffstat (limited to 'net')
59 files changed, 272 insertions, 202 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index cfa9afe9b11e..d24c4644b930 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
| @@ -207,7 +207,7 @@ int register_vlan_dev(struct net_device *dev) | |||
| 207 | grp->nr_vlans++; | 207 | grp->nr_vlans++; |
| 208 | 208 | ||
| 209 | if (ngrp) { | 209 | if (ngrp) { |
| 210 | if (ops->ndo_vlan_rx_register) | 210 | if (ops->ndo_vlan_rx_register && (real_dev->features & NETIF_F_HW_VLAN_RX)) |
| 211 | ops->ndo_vlan_rx_register(real_dev, ngrp); | 211 | ops->ndo_vlan_rx_register(real_dev, ngrp); |
| 212 | rcu_assign_pointer(real_dev->vlgrp, ngrp); | 212 | rcu_assign_pointer(real_dev->vlgrp, ngrp); |
| 213 | } | 213 | } |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 41495dc2a4c9..fcc684678af6 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
| @@ -23,6 +23,31 @@ bool vlan_do_receive(struct sk_buff **skbp) | |||
| 23 | return false; | 23 | return false; |
| 24 | 24 | ||
| 25 | skb->dev = vlan_dev; | 25 | skb->dev = vlan_dev; |
| 26 | if (skb->pkt_type == PACKET_OTHERHOST) { | ||
| 27 | /* Our lower layer thinks this is not local, let's make sure. | ||
| 28 | * This allows the VLAN to have a different MAC than the | ||
| 29 | * underlying device, and still route correctly. */ | ||
| 30 | if (!compare_ether_addr(eth_hdr(skb)->h_dest, | ||
| 31 | vlan_dev->dev_addr)) | ||
| 32 | skb->pkt_type = PACKET_HOST; | ||
| 33 | } | ||
| 34 | |||
| 35 | if (!(vlan_dev_info(vlan_dev)->flags & VLAN_FLAG_REORDER_HDR)) { | ||
| 36 | unsigned int offset = skb->data - skb_mac_header(skb); | ||
| 37 | |||
| 38 | /* | ||
| 39 | * vlan_insert_tag expect skb->data pointing to mac header. | ||
| 40 | * So change skb->data before calling it and change back to | ||
| 41 | * original position later | ||
| 42 | */ | ||
| 43 | skb_push(skb, offset); | ||
| 44 | skb = *skbp = vlan_insert_tag(skb, skb->vlan_tci); | ||
| 45 | if (!skb) | ||
| 46 | return false; | ||
| 47 | skb_pull(skb, offset + VLAN_HLEN); | ||
| 48 | skb_reset_mac_len(skb); | ||
| 49 | } | ||
| 50 | |||
| 26 | skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci); | 51 | skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci); |
| 27 | skb->vlan_tci = 0; | 52 | skb->vlan_tci = 0; |
| 28 | 53 | ||
| @@ -31,22 +56,8 @@ bool vlan_do_receive(struct sk_buff **skbp) | |||
| 31 | u64_stats_update_begin(&rx_stats->syncp); | 56 | u64_stats_update_begin(&rx_stats->syncp); |
| 32 | rx_stats->rx_packets++; | 57 | rx_stats->rx_packets++; |
| 33 | rx_stats->rx_bytes += skb->len; | 58 | rx_stats->rx_bytes += skb->len; |
| 34 | 59 | if (skb->pkt_type == PACKET_MULTICAST) | |
| 35 | switch (skb->pkt_type) { | ||
| 36 | case PACKET_BROADCAST: | ||
| 37 | break; | ||
| 38 | case PACKET_MULTICAST: | ||
| 39 | rx_stats->rx_multicast++; | 60 | rx_stats->rx_multicast++; |
| 40 | break; | ||
| 41 | case PACKET_OTHERHOST: | ||
| 42 | /* Our lower layer thinks this is not local, let's make sure. | ||
| 43 | * This allows the VLAN to have a different MAC than the | ||
| 44 | * underlying device, and still route correctly. */ | ||
| 45 | if (!compare_ether_addr(eth_hdr(skb)->h_dest, | ||
| 46 | vlan_dev->dev_addr)) | ||
| 47 | skb->pkt_type = PACKET_HOST; | ||
| 48 | break; | ||
| 49 | } | ||
| 50 | u64_stats_update_end(&rx_stats->syncp); | 61 | u64_stats_update_end(&rx_stats->syncp); |
| 51 | 62 | ||
| 52 | return true; | 63 | return true; |
| @@ -89,18 +100,13 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | |||
| 89 | } | 100 | } |
| 90 | EXPORT_SYMBOL(vlan_gro_frags); | 101 | EXPORT_SYMBOL(vlan_gro_frags); |
| 91 | 102 | ||
| 92 | static struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) | 103 | static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) |
| 93 | { | 104 | { |
| 94 | if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) { | 105 | if (skb_cow(skb, skb_headroom(skb)) < 0) |
| 95 | if (skb_cow(skb, skb_headroom(skb)) < 0) | 106 | return NULL; |
| 96 | skb = NULL; | 107 | memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); |
| 97 | if (skb) { | 108 | skb->mac_header += VLAN_HLEN; |
| 98 | /* Lifted from Gleb's VLAN code... */ | 109 | skb_reset_mac_len(skb); |
| 99 | memmove(skb->data - ETH_HLEN, | ||
| 100 | skb->data - VLAN_ETH_HLEN, 12); | ||
| 101 | skb->mac_header += VLAN_HLEN; | ||
| 102 | } | ||
| 103 | } | ||
| 104 | return skb; | 110 | return skb; |
| 105 | } | 111 | } |
| 106 | 112 | ||
| @@ -161,7 +167,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb) | |||
| 161 | skb_pull_rcsum(skb, VLAN_HLEN); | 167 | skb_pull_rcsum(skb, VLAN_HLEN); |
| 162 | vlan_set_encap_proto(skb, vhdr); | 168 | vlan_set_encap_proto(skb, vhdr); |
| 163 | 169 | ||
| 164 | skb = vlan_check_reorder_header(skb); | 170 | skb = vlan_reorder_header(skb); |
| 165 | if (unlikely(!skb)) | 171 | if (unlikely(!skb)) |
| 166 | goto err_free; | 172 | goto err_free; |
| 167 | 173 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index f13ddbf858ba..77930aa522e3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -477,14 +477,16 @@ static void hci_setup_event_mask(struct hci_dev *hdev) | |||
| 477 | * command otherwise */ | 477 | * command otherwise */ |
| 478 | u8 events[8] = { 0xff, 0xff, 0xfb, 0xff, 0x00, 0x00, 0x00, 0x00 }; | 478 | u8 events[8] = { 0xff, 0xff, 0xfb, 0xff, 0x00, 0x00, 0x00, 0x00 }; |
| 479 | 479 | ||
| 480 | /* Events for 1.2 and newer controllers */ | 480 | /* CSR 1.1 dongles does not accept any bitfield so don't try to set |
| 481 | if (hdev->lmp_ver > 1) { | 481 | * any event mask for pre 1.2 devices */ |
| 482 | events[4] |= 0x01; /* Flow Specification Complete */ | 482 | if (hdev->lmp_ver <= 1) |
| 483 | events[4] |= 0x02; /* Inquiry Result with RSSI */ | 483 | return; |
| 484 | events[4] |= 0x04; /* Read Remote Extended Features Complete */ | 484 | |
| 485 | events[5] |= 0x08; /* Synchronous Connection Complete */ | 485 | events[4] |= 0x01; /* Flow Specification Complete */ |
| 486 | events[5] |= 0x10; /* Synchronous Connection Changed */ | 486 | events[4] |= 0x02; /* Inquiry Result with RSSI */ |
| 487 | } | 487 | events[4] |= 0x04; /* Read Remote Extended Features Complete */ |
| 488 | events[5] |= 0x08; /* Synchronous Connection Complete */ | ||
| 489 | events[5] |= 0x10; /* Synchronous Connection Changed */ | ||
| 488 | 490 | ||
| 489 | if (hdev->features[3] & LMP_RSSI_INQ) | 491 | if (hdev->features[3] & LMP_RSSI_INQ) |
| 490 | events[4] |= 0x04; /* Inquiry Result with RSSI */ | 492 | events[4] |= 0x04; /* Inquiry Result with RSSI */ |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 18dc9888d8c2..8248303f44e8 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
| @@ -413,6 +413,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us | |||
| 413 | break; | 413 | break; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | memset(&cinfo, 0, sizeof(cinfo)); | ||
| 416 | cinfo.hci_handle = chan->conn->hcon->handle; | 417 | cinfo.hci_handle = chan->conn->hcon->handle; |
| 417 | memcpy(cinfo.dev_class, chan->conn->hcon->dev_class, 3); | 418 | memcpy(cinfo.dev_class, chan->conn->hcon->dev_class, 3); |
| 418 | 419 | ||
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 386cfaffd4b7..1b10727ce523 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
| @@ -788,6 +788,7 @@ static int rfcomm_sock_getsockopt_old(struct socket *sock, int optname, char __u | |||
| 788 | 788 | ||
| 789 | l2cap_sk = rfcomm_pi(sk)->dlc->session->sock->sk; | 789 | l2cap_sk = rfcomm_pi(sk)->dlc->session->sock->sk; |
| 790 | 790 | ||
| 791 | memset(&cinfo, 0, sizeof(cinfo)); | ||
| 791 | cinfo.hci_handle = conn->hcon->handle; | 792 | cinfo.hci_handle = conn->hcon->handle; |
| 792 | memcpy(cinfo.dev_class, conn->hcon->dev_class, 3); | 793 | memcpy(cinfo.dev_class, conn->hcon->dev_class, 3); |
| 793 | 794 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 42fdffd1d76c..cb4fb7837e5c 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
| @@ -369,6 +369,15 @@ static void __sco_sock_close(struct sock *sk) | |||
| 369 | 369 | ||
| 370 | case BT_CONNECTED: | 370 | case BT_CONNECTED: |
| 371 | case BT_CONFIG: | 371 | case BT_CONFIG: |
| 372 | if (sco_pi(sk)->conn) { | ||
| 373 | sk->sk_state = BT_DISCONN; | ||
| 374 | sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT); | ||
| 375 | hci_conn_put(sco_pi(sk)->conn->hcon); | ||
| 376 | sco_pi(sk)->conn->hcon = NULL; | ||
| 377 | } else | ||
| 378 | sco_chan_del(sk, ECONNRESET); | ||
| 379 | break; | ||
| 380 | |||
| 372 | case BT_CONNECT: | 381 | case BT_CONNECT: |
| 373 | case BT_DISCONN: | 382 | case BT_DISCONN: |
| 374 | sco_chan_del(sk, ECONNRESET); | 383 | sco_chan_del(sk, ECONNRESET); |
| @@ -819,7 +828,9 @@ static void sco_chan_del(struct sock *sk, int err) | |||
| 819 | conn->sk = NULL; | 828 | conn->sk = NULL; |
| 820 | sco_pi(sk)->conn = NULL; | 829 | sco_pi(sk)->conn = NULL; |
| 821 | sco_conn_unlock(conn); | 830 | sco_conn_unlock(conn); |
| 822 | hci_conn_put(conn->hcon); | 831 | |
| 832 | if (conn->hcon) | ||
| 833 | hci_conn_put(conn->hcon); | ||
| 823 | } | 834 | } |
| 824 | 835 | ||
| 825 | sk->sk_state = BT_CLOSED; | 836 | sk->sk_state = BT_CLOSED; |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index a6b2f86378c7..c188c803c09c 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
| @@ -243,6 +243,7 @@ int br_netpoll_enable(struct net_bridge_port *p) | |||
| 243 | goto out; | 243 | goto out; |
| 244 | 244 | ||
| 245 | np->dev = p->dev; | 245 | np->dev = p->dev; |
| 246 | strlcpy(np->dev_name, p->dev->name, IFNAMSIZ); | ||
| 246 | 247 | ||
| 247 | err = __netpoll_setup(np); | 248 | err = __netpoll_setup(np); |
| 248 | if (err) { | 249 | if (err) { |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 2f14eafdeeab..29b9812c8da0 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -1424,7 +1424,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, | |||
| 1424 | switch (ih->type) { | 1424 | switch (ih->type) { |
| 1425 | case IGMP_HOST_MEMBERSHIP_REPORT: | 1425 | case IGMP_HOST_MEMBERSHIP_REPORT: |
| 1426 | case IGMPV2_HOST_MEMBERSHIP_REPORT: | 1426 | case IGMPV2_HOST_MEMBERSHIP_REPORT: |
| 1427 | BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; | 1427 | BR_INPUT_SKB_CB(skb)->mrouters_only = 1; |
| 1428 | err = br_ip4_multicast_add_group(br, port, ih->group); | 1428 | err = br_ip4_multicast_add_group(br, port, ih->group); |
| 1429 | break; | 1429 | break; |
| 1430 | case IGMPV3_HOST_MEMBERSHIP_REPORT: | 1430 | case IGMPV3_HOST_MEMBERSHIP_REPORT: |
| @@ -1543,7 +1543,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
| 1543 | goto out; | 1543 | goto out; |
| 1544 | } | 1544 | } |
| 1545 | mld = (struct mld_msg *)skb_transport_header(skb2); | 1545 | mld = (struct mld_msg *)skb_transport_header(skb2); |
| 1546 | BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; | 1546 | BR_INPUT_SKB_CB(skb)->mrouters_only = 1; |
| 1547 | err = br_ip6_multicast_add_group(br, port, &mld->mld_mca); | 1547 | err = br_ip6_multicast_add_group(br, port, &mld->mld_mca); |
| 1548 | break; | 1548 | break; |
| 1549 | } | 1549 | } |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 3fa123185e89..56149ec36d7f 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -104,10 +104,16 @@ static void fake_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
| 104 | { | 104 | { |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old) | ||
| 108 | { | ||
| 109 | return NULL; | ||
| 110 | } | ||
| 111 | |||
| 107 | static struct dst_ops fake_dst_ops = { | 112 | static struct dst_ops fake_dst_ops = { |
| 108 | .family = AF_INET, | 113 | .family = AF_INET, |
| 109 | .protocol = cpu_to_be16(ETH_P_IP), | 114 | .protocol = cpu_to_be16(ETH_P_IP), |
| 110 | .update_pmtu = fake_update_pmtu, | 115 | .update_pmtu = fake_update_pmtu, |
| 116 | .cow_metrics = fake_cow_metrics, | ||
| 111 | }; | 117 | }; |
| 112 | 118 | ||
| 113 | /* | 119 | /* |
diff --git a/net/caif/cfmuxl.c b/net/caif/cfmuxl.c index 3a66b8c10e09..c23979e79dfa 100644 --- a/net/caif/cfmuxl.c +++ b/net/caif/cfmuxl.c | |||
| @@ -255,7 +255,7 @@ static void cfmuxl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | |||
| 255 | 255 | ||
| 256 | if (cfsrvl_phyid_match(layer, phyid) && layer->ctrlcmd) { | 256 | if (cfsrvl_phyid_match(layer, phyid) && layer->ctrlcmd) { |
| 257 | 257 | ||
| 258 | if ((ctrl == _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND || | 258 | if ((ctrl == _CAIF_CTRLCMD_PHYIF_DOWN_IND || |
| 259 | ctrl == CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND) && | 259 | ctrl == CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND) && |
| 260 | layer->id != 0) { | 260 | layer->id != 0) { |
| 261 | 261 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 6ea2b892f44b..9cb627a4073a 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -1144,6 +1144,13 @@ static void handle_osds_timeout(struct work_struct *work) | |||
| 1144 | round_jiffies_relative(delay)); | 1144 | round_jiffies_relative(delay)); |
| 1145 | } | 1145 | } |
| 1146 | 1146 | ||
| 1147 | static void complete_request(struct ceph_osd_request *req) | ||
| 1148 | { | ||
| 1149 | if (req->r_safe_callback) | ||
| 1150 | req->r_safe_callback(req, NULL); | ||
| 1151 | complete_all(&req->r_safe_completion); /* fsync waiter */ | ||
| 1152 | } | ||
| 1153 | |||
| 1147 | /* | 1154 | /* |
| 1148 | * handle osd op reply. either call the callback if it is specified, | 1155 | * handle osd op reply. either call the callback if it is specified, |
| 1149 | * or do the completion to wake up the waiting thread. | 1156 | * or do the completion to wake up the waiting thread. |
| @@ -1226,11 +1233,8 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, | |||
| 1226 | else | 1233 | else |
| 1227 | complete_all(&req->r_completion); | 1234 | complete_all(&req->r_completion); |
| 1228 | 1235 | ||
| 1229 | if (flags & CEPH_OSD_FLAG_ONDISK) { | 1236 | if (flags & CEPH_OSD_FLAG_ONDISK) |
| 1230 | if (req->r_safe_callback) | 1237 | complete_request(req); |
| 1231 | req->r_safe_callback(req, msg); | ||
| 1232 | complete_all(&req->r_safe_completion); /* fsync waiter */ | ||
| 1233 | } | ||
| 1234 | 1238 | ||
| 1235 | done: | 1239 | done: |
| 1236 | dout("req=%p req->r_linger=%d\n", req, req->r_linger); | 1240 | dout("req=%p req->r_linger=%d\n", req, req->r_linger); |
| @@ -1732,6 +1736,7 @@ int ceph_osdc_wait_request(struct ceph_osd_client *osdc, | |||
| 1732 | __cancel_request(req); | 1736 | __cancel_request(req); |
| 1733 | __unregister_request(osdc, req); | 1737 | __unregister_request(osdc, req); |
| 1734 | mutex_unlock(&osdc->request_mutex); | 1738 | mutex_unlock(&osdc->request_mutex); |
| 1739 | complete_request(req); | ||
| 1735 | dout("wait_request tid %llu canceled/timed out\n", req->r_tid); | 1740 | dout("wait_request tid %llu canceled/timed out\n", req->r_tid); |
| 1736 | return rc; | 1741 | return rc; |
| 1737 | } | 1742 | } |
diff --git a/net/core/dev.c b/net/core/dev.c index b3f52d2f56d7..8efe85070131 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -3114,7 +3114,7 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
| 3114 | 3114 | ||
| 3115 | skb_reset_network_header(skb); | 3115 | skb_reset_network_header(skb); |
| 3116 | skb_reset_transport_header(skb); | 3116 | skb_reset_transport_header(skb); |
| 3117 | skb->mac_len = skb->network_header - skb->mac_header; | 3117 | skb_reset_mac_len(skb); |
| 3118 | 3118 | ||
| 3119 | pt_prev = NULL; | 3119 | pt_prev = NULL; |
| 3120 | 3120 | ||
| @@ -6173,6 +6173,11 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
| 6173 | oldsd->output_queue = NULL; | 6173 | oldsd->output_queue = NULL; |
| 6174 | oldsd->output_queue_tailp = &oldsd->output_queue; | 6174 | oldsd->output_queue_tailp = &oldsd->output_queue; |
| 6175 | } | 6175 | } |
| 6176 | /* Append NAPI poll list from offline CPU. */ | ||
| 6177 | if (!list_empty(&oldsd->poll_list)) { | ||
| 6178 | list_splice_init(&oldsd->poll_list, &sd->poll_list); | ||
| 6179 | raise_softirq_irqoff(NET_RX_SOFTIRQ); | ||
| 6180 | } | ||
| 6176 | 6181 | ||
| 6177 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | 6182 | raise_softirq_irqoff(NET_TX_SOFTIRQ); |
| 6178 | local_irq_enable(); | 6183 | local_irq_enable(); |
| @@ -6259,29 +6264,23 @@ err_name: | |||
| 6259 | /** | 6264 | /** |
| 6260 | * netdev_drivername - network driver for the device | 6265 | * netdev_drivername - network driver for the device |
| 6261 | * @dev: network device | 6266 | * @dev: network device |
| 6262 | * @buffer: buffer for resulting name | ||
| 6263 | * @len: size of buffer | ||
| 6264 | * | 6267 | * |
| 6265 | * Determine network driver for device. | 6268 | * Determine network driver for device. |
| 6266 | */ | 6269 | */ |
| 6267 | char *netdev_drivername(const struct net_device *dev, char *buffer, int len) | 6270 | const char *netdev_drivername(const struct net_device *dev) |
| 6268 | { | 6271 | { |
| 6269 | const struct device_driver *driver; | 6272 | const struct device_driver *driver; |
| 6270 | const struct device *parent; | 6273 | const struct device *parent; |
| 6271 | 6274 | const char *empty = ""; | |
| 6272 | if (len <= 0 || !buffer) | ||
| 6273 | return buffer; | ||
| 6274 | buffer[0] = 0; | ||
| 6275 | 6275 | ||
| 6276 | parent = dev->dev.parent; | 6276 | parent = dev->dev.parent; |
| 6277 | |||
| 6278 | if (!parent) | 6277 | if (!parent) |
| 6279 | return buffer; | 6278 | return empty; |
| 6280 | 6279 | ||
| 6281 | driver = parent->driver; | 6280 | driver = parent->driver; |
| 6282 | if (driver && driver->name) | 6281 | if (driver && driver->name) |
| 6283 | strlcpy(buffer, driver->name, len); | 6282 | return driver->name; |
| 6284 | return buffer; | 6283 | return empty; |
| 6285 | } | 6284 | } |
| 6286 | 6285 | ||
| 6287 | static int __netdev_printk(const char *level, const struct net_device *dev, | 6286 | static int __netdev_printk(const char *level, const struct net_device *dev, |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 11b98bc2aa8f..33d2a1fba131 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
| @@ -1179,9 +1179,14 @@ static void remove_queue_kobjects(struct net_device *net) | |||
| 1179 | #endif | 1179 | #endif |
| 1180 | } | 1180 | } |
| 1181 | 1181 | ||
| 1182 | static const void *net_current_ns(void) | 1182 | static void *net_grab_current_ns(void) |
| 1183 | { | 1183 | { |
| 1184 | return current->nsproxy->net_ns; | 1184 | struct net *ns = current->nsproxy->net_ns; |
| 1185 | #ifdef CONFIG_NET_NS | ||
| 1186 | if (ns) | ||
| 1187 | atomic_inc(&ns->passive); | ||
| 1188 | #endif | ||
| 1189 | return ns; | ||
| 1185 | } | 1190 | } |
| 1186 | 1191 | ||
| 1187 | static const void *net_initial_ns(void) | 1192 | static const void *net_initial_ns(void) |
| @@ -1196,22 +1201,13 @@ static const void *net_netlink_ns(struct sock *sk) | |||
| 1196 | 1201 | ||
| 1197 | struct kobj_ns_type_operations net_ns_type_operations = { | 1202 | struct kobj_ns_type_operations net_ns_type_operations = { |
| 1198 | .type = KOBJ_NS_TYPE_NET, | 1203 | .type = KOBJ_NS_TYPE_NET, |
| 1199 | .current_ns = net_current_ns, | 1204 | .grab_current_ns = net_grab_current_ns, |
| 1200 | .netlink_ns = net_netlink_ns, | 1205 | .netlink_ns = net_netlink_ns, |
| 1201 | .initial_ns = net_initial_ns, | 1206 | .initial_ns = net_initial_ns, |
| 1207 | .drop_ns = net_drop_ns, | ||
| 1202 | }; | 1208 | }; |
| 1203 | EXPORT_SYMBOL_GPL(net_ns_type_operations); | 1209 | EXPORT_SYMBOL_GPL(net_ns_type_operations); |
| 1204 | 1210 | ||
| 1205 | static void net_kobj_ns_exit(struct net *net) | ||
| 1206 | { | ||
| 1207 | kobj_ns_exit(KOBJ_NS_TYPE_NET, net); | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | static struct pernet_operations kobj_net_ops = { | ||
| 1211 | .exit = net_kobj_ns_exit, | ||
| 1212 | }; | ||
| 1213 | |||
| 1214 | |||
| 1215 | #ifdef CONFIG_HOTPLUG | 1211 | #ifdef CONFIG_HOTPLUG |
| 1216 | static int netdev_uevent(struct device *d, struct kobj_uevent_env *env) | 1212 | static int netdev_uevent(struct device *d, struct kobj_uevent_env *env) |
| 1217 | { | 1213 | { |
| @@ -1339,6 +1335,5 @@ EXPORT_SYMBOL(netdev_class_remove_file); | |||
| 1339 | int netdev_kobject_init(void) | 1335 | int netdev_kobject_init(void) |
| 1340 | { | 1336 | { |
| 1341 | kobj_ns_type_register(&net_ns_type_operations); | 1337 | kobj_ns_type_register(&net_ns_type_operations); |
| 1342 | register_pernet_subsys(&kobj_net_ops); | ||
| 1343 | return class_register(&net_class); | 1338 | return class_register(&net_class); |
| 1344 | } | 1339 | } |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6c6b86d0da15..ea489db1bc23 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
| @@ -128,6 +128,7 @@ static __net_init int setup_net(struct net *net) | |||
| 128 | LIST_HEAD(net_exit_list); | 128 | LIST_HEAD(net_exit_list); |
| 129 | 129 | ||
| 130 | atomic_set(&net->count, 1); | 130 | atomic_set(&net->count, 1); |
| 131 | atomic_set(&net->passive, 1); | ||
| 131 | 132 | ||
| 132 | #ifdef NETNS_REFCNT_DEBUG | 133 | #ifdef NETNS_REFCNT_DEBUG |
| 133 | atomic_set(&net->use_count, 0); | 134 | atomic_set(&net->use_count, 0); |
| @@ -210,6 +211,13 @@ static void net_free(struct net *net) | |||
| 210 | kmem_cache_free(net_cachep, net); | 211 | kmem_cache_free(net_cachep, net); |
| 211 | } | 212 | } |
| 212 | 213 | ||
| 214 | void net_drop_ns(void *p) | ||
| 215 | { | ||
| 216 | struct net *ns = p; | ||
| 217 | if (ns && atomic_dec_and_test(&ns->passive)) | ||
| 218 | net_free(ns); | ||
| 219 | } | ||
| 220 | |||
| 213 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) | 221 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) |
| 214 | { | 222 | { |
| 215 | struct net *net; | 223 | struct net *net; |
| @@ -230,7 +238,7 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net) | |||
| 230 | } | 238 | } |
| 231 | mutex_unlock(&net_mutex); | 239 | mutex_unlock(&net_mutex); |
| 232 | if (rv < 0) { | 240 | if (rv < 0) { |
| 233 | net_free(net); | 241 | net_drop_ns(net); |
| 234 | return ERR_PTR(rv); | 242 | return ERR_PTR(rv); |
| 235 | } | 243 | } |
| 236 | return net; | 244 | return net; |
| @@ -286,7 +294,7 @@ static void cleanup_net(struct work_struct *work) | |||
| 286 | /* Finally it is safe to free my network namespace structure */ | 294 | /* Finally it is safe to free my network namespace structure */ |
| 287 | list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) { | 295 | list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) { |
| 288 | list_del_init(&net->exit_list); | 296 | list_del_init(&net->exit_list); |
| 289 | net_free(net); | 297 | net_drop_ns(net); |
| 290 | } | 298 | } |
| 291 | } | 299 | } |
| 292 | static DECLARE_WORK(net_cleanup_work, cleanup_net); | 300 | static DECLARE_WORK(net_cleanup_work, cleanup_net); |
| @@ -310,19 +318,17 @@ struct net *get_net_ns_by_fd(int fd) | |||
| 310 | struct file *file; | 318 | struct file *file; |
| 311 | struct net *net; | 319 | struct net *net; |
| 312 | 320 | ||
| 313 | net = ERR_PTR(-EINVAL); | ||
| 314 | file = proc_ns_fget(fd); | 321 | file = proc_ns_fget(fd); |
| 315 | if (!file) | 322 | if (IS_ERR(file)) |
| 316 | goto out; | 323 | return ERR_CAST(file); |
| 317 | 324 | ||
| 318 | ei = PROC_I(file->f_dentry->d_inode); | 325 | ei = PROC_I(file->f_dentry->d_inode); |
| 319 | if (ei->ns_ops != &netns_operations) | 326 | if (ei->ns_ops == &netns_operations) |
| 320 | goto out; | 327 | net = get_net(ei->ns); |
| 328 | else | ||
| 329 | net = ERR_PTR(-EINVAL); | ||
| 321 | 330 | ||
| 322 | net = get_net(ei->ns); | 331 | fput(file); |
| 323 | out: | ||
| 324 | if (file) | ||
| 325 | fput(file); | ||
| 326 | return net; | 332 | return net; |
| 327 | } | 333 | } |
| 328 | 334 | ||
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 2d7d6d473781..18d9cbda3a39 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
| @@ -792,6 +792,13 @@ int netpoll_setup(struct netpoll *np) | |||
| 792 | return -ENODEV; | 792 | return -ENODEV; |
| 793 | } | 793 | } |
| 794 | 794 | ||
| 795 | if (ndev->master) { | ||
| 796 | printk(KERN_ERR "%s: %s is a slave device, aborting.\n", | ||
| 797 | np->name, np->dev_name); | ||
| 798 | err = -EBUSY; | ||
| 799 | goto put; | ||
| 800 | } | ||
| 801 | |||
| 795 | if (!netif_running(ndev)) { | 802 | if (!netif_running(ndev)) { |
| 796 | unsigned long atmost, atleast; | 803 | unsigned long atmost, atleast; |
| 797 | 804 | ||
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index ed0eab39f531..02548b292b53 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c | |||
| @@ -44,7 +44,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 pid, | |||
| 44 | pr_debug("%s\n", __func__); | 44 | pr_debug("%s\n", __func__); |
| 45 | 45 | ||
| 46 | if (!buf) | 46 | if (!buf) |
| 47 | goto out; | 47 | return -EMSGSIZE; |
| 48 | 48 | ||
| 49 | hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags, | 49 | hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags, |
| 50 | IEEE802154_LIST_PHY); | 50 | IEEE802154_LIST_PHY); |
| @@ -65,6 +65,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 pid, | |||
| 65 | pages * sizeof(uint32_t), buf); | 65 | pages * sizeof(uint32_t), buf); |
| 66 | 66 | ||
| 67 | mutex_unlock(&phy->pib_lock); | 67 | mutex_unlock(&phy->pib_lock); |
| 68 | kfree(buf); | ||
| 68 | return genlmsg_end(msg, hdr); | 69 | return genlmsg_end(msg, hdr); |
| 69 | 70 | ||
| 70 | nla_put_failure: | 71 | nla_put_failure: |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 83673d23d4dd..0600f0fbe325 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
| @@ -676,6 +676,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 676 | 676 | ||
| 677 | lock_sock(sk2); | 677 | lock_sock(sk2); |
| 678 | 678 | ||
| 679 | sock_rps_record_flow(sk2); | ||
| 679 | WARN_ON(!((1 << sk2->sk_state) & | 680 | WARN_ON(!((1 << sk2->sk_state) & |
| 680 | (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE))); | 681 | (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE))); |
| 681 | 682 | ||
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 5ff47656fced..389a2e6a17fd 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -437,7 +437,7 @@ static int valid_cc(const void *bc, int len, int cc) | |||
| 437 | return 0; | 437 | return 0; |
| 438 | if (cc == len) | 438 | if (cc == len) |
| 439 | return 1; | 439 | return 1; |
| 440 | if (op->yes < 4) | 440 | if (op->yes < 4 || op->yes & 3) |
| 441 | return 0; | 441 | return 0; |
| 442 | len -= op->yes; | 442 | len -= op->yes; |
| 443 | bc += op->yes; | 443 | bc += op->yes; |
| @@ -447,11 +447,11 @@ static int valid_cc(const void *bc, int len, int cc) | |||
| 447 | 447 | ||
| 448 | static int inet_diag_bc_audit(const void *bytecode, int bytecode_len) | 448 | static int inet_diag_bc_audit(const void *bytecode, int bytecode_len) |
| 449 | { | 449 | { |
| 450 | const unsigned char *bc = bytecode; | 450 | const void *bc = bytecode; |
| 451 | int len = bytecode_len; | 451 | int len = bytecode_len; |
| 452 | 452 | ||
| 453 | while (len > 0) { | 453 | while (len > 0) { |
| 454 | struct inet_diag_bc_op *op = (struct inet_diag_bc_op *)bc; | 454 | const struct inet_diag_bc_op *op = bc; |
| 455 | 455 | ||
| 456 | //printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len); | 456 | //printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len); |
| 457 | switch (op->code) { | 457 | switch (op->code) { |
| @@ -462,22 +462,20 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len) | |||
| 462 | case INET_DIAG_BC_S_LE: | 462 | case INET_DIAG_BC_S_LE: |
| 463 | case INET_DIAG_BC_D_GE: | 463 | case INET_DIAG_BC_D_GE: |
| 464 | case INET_DIAG_BC_D_LE: | 464 | case INET_DIAG_BC_D_LE: |
| 465 | if (op->yes < 4 || op->yes > len + 4) | ||
| 466 | return -EINVAL; | ||
| 467 | case INET_DIAG_BC_JMP: | 465 | case INET_DIAG_BC_JMP: |
| 468 | if (op->no < 4 || op->no > len + 4) | 466 | if (op->no < 4 || op->no > len + 4 || op->no & 3) |
| 469 | return -EINVAL; | 467 | return -EINVAL; |
| 470 | if (op->no < len && | 468 | if (op->no < len && |
| 471 | !valid_cc(bytecode, bytecode_len, len - op->no)) | 469 | !valid_cc(bytecode, bytecode_len, len - op->no)) |
| 472 | return -EINVAL; | 470 | return -EINVAL; |
| 473 | break; | 471 | break; |
| 474 | case INET_DIAG_BC_NOP: | 472 | case INET_DIAG_BC_NOP: |
| 475 | if (op->yes < 4 || op->yes > len + 4) | ||
| 476 | return -EINVAL; | ||
| 477 | break; | 473 | break; |
| 478 | default: | 474 | default: |
| 479 | return -EINVAL; | 475 | return -EINVAL; |
| 480 | } | 476 | } |
| 477 | if (op->yes < 4 || op->yes > len + 4 || op->yes & 3) | ||
| 478 | return -EINVAL; | ||
| 481 | bc += op->yes; | 479 | bc += op->yes; |
| 482 | len -= op->yes; | 480 | len -= op->yes; |
| 483 | } | 481 | } |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 98af3697c718..a8024eaa0e87 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
| @@ -799,7 +799,9 @@ static int __ip_append_data(struct sock *sk, | |||
| 799 | int csummode = CHECKSUM_NONE; | 799 | int csummode = CHECKSUM_NONE; |
| 800 | struct rtable *rt = (struct rtable *)cork->dst; | 800 | struct rtable *rt = (struct rtable *)cork->dst; |
| 801 | 801 | ||
| 802 | exthdrlen = transhdrlen ? rt->dst.header_len : 0; | 802 | skb = skb_peek_tail(queue); |
| 803 | |||
| 804 | exthdrlen = !skb ? rt->dst.header_len : 0; | ||
| 803 | length += exthdrlen; | 805 | length += exthdrlen; |
| 804 | transhdrlen += exthdrlen; | 806 | transhdrlen += exthdrlen; |
| 805 | mtu = cork->fragsize; | 807 | mtu = cork->fragsize; |
| @@ -825,8 +827,6 @@ static int __ip_append_data(struct sock *sk, | |||
| 825 | !exthdrlen) | 827 | !exthdrlen) |
| 826 | csummode = CHECKSUM_PARTIAL; | 828 | csummode = CHECKSUM_PARTIAL; |
| 827 | 829 | ||
| 828 | skb = skb_peek_tail(queue); | ||
| 829 | |||
| 830 | cork->length += length; | 830 | cork->length += length; |
| 831 | if (((length > mtu) || (skb && skb_is_gso(skb))) && | 831 | if (((length > mtu) || (skb && skb_is_gso(skb))) && |
| 832 | (sk->sk_protocol == IPPROTO_UDP) && | 832 | (sk->sk_protocol == IPPROTO_UDP) && |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index d2c1311cb28d..5c9b9d963918 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
| @@ -203,7 +203,8 @@ ipq_build_packet_message(struct nf_queue_entry *entry, int *errp) | |||
| 203 | else | 203 | else |
| 204 | pmsg->outdev_name[0] = '\0'; | 204 | pmsg->outdev_name[0] = '\0'; |
| 205 | 205 | ||
| 206 | if (entry->indev && entry->skb->dev) { | 206 | if (entry->indev && entry->skb->dev && |
| 207 | entry->skb->mac_header != entry->skb->network_header) { | ||
| 207 | pmsg->hw_type = entry->skb->dev->type; | 208 | pmsg->hw_type = entry->skb->dev->type; |
| 208 | pmsg->hw_addrlen = dev_parse_header(entry->skb, | 209 | pmsg->hw_addrlen = dev_parse_header(entry->skb, |
| 209 | pmsg->hw_addr); | 210 | pmsg->hw_addr); |
| @@ -402,7 +403,8 @@ ipq_dev_drop(int ifindex) | |||
| 402 | static inline void | 403 | static inline void |
| 403 | __ipq_rcv_skb(struct sk_buff *skb) | 404 | __ipq_rcv_skb(struct sk_buff *skb) |
| 404 | { | 405 | { |
| 405 | int status, type, pid, flags, nlmsglen, skblen; | 406 | int status, type, pid, flags; |
| 407 | unsigned int nlmsglen, skblen; | ||
| 406 | struct nlmsghdr *nlh; | 408 | struct nlmsghdr *nlh; |
| 407 | 409 | ||
| 408 | skblen = skb->len; | 410 | skblen = skb->len; |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 764743843503..24e556e83a3b 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
| @@ -566,7 +566,7 @@ check_entry(const struct ipt_entry *e, const char *name) | |||
| 566 | const struct xt_entry_target *t; | 566 | const struct xt_entry_target *t; |
| 567 | 567 | ||
| 568 | if (!ip_checkentry(&e->ip)) { | 568 | if (!ip_checkentry(&e->ip)) { |
| 569 | duprintf("ip check failed %p %s.\n", e, par->match->name); | 569 | duprintf("ip check failed %p %s.\n", e, name); |
| 570 | return -EINVAL; | 570 | return -EINVAL; |
| 571 | } | 571 | } |
| 572 | 572 | ||
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index d609ac3cb9a4..5c9e97c79017 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
| @@ -307,7 +307,7 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
| 307 | * error messages (RELATED) and information requests (see below) */ | 307 | * error messages (RELATED) and information requests (see below) */ |
| 308 | if (ip_hdr(skb)->protocol == IPPROTO_ICMP && | 308 | if (ip_hdr(skb)->protocol == IPPROTO_ICMP && |
| 309 | (ctinfo == IP_CT_RELATED || | 309 | (ctinfo == IP_CT_RELATED || |
| 310 | ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)) | 310 | ctinfo == IP_CT_RELATED_REPLY)) |
| 311 | return XT_CONTINUE; | 311 | return XT_CONTINUE; |
| 312 | 312 | ||
| 313 | /* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO, | 313 | /* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO, |
| @@ -321,12 +321,12 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
| 321 | ct->mark = hash; | 321 | ct->mark = hash; |
| 322 | break; | 322 | break; |
| 323 | case IP_CT_RELATED: | 323 | case IP_CT_RELATED: |
| 324 | case IP_CT_RELATED+IP_CT_IS_REPLY: | 324 | case IP_CT_RELATED_REPLY: |
| 325 | /* FIXME: we don't handle expectations at the | 325 | /* FIXME: we don't handle expectations at the |
| 326 | * moment. they can arrive on a different node than | 326 | * moment. they can arrive on a different node than |
| 327 | * the master connection (e.g. FTP passive mode) */ | 327 | * the master connection (e.g. FTP passive mode) */ |
| 328 | case IP_CT_ESTABLISHED: | 328 | case IP_CT_ESTABLISHED: |
| 329 | case IP_CT_ESTABLISHED+IP_CT_IS_REPLY: | 329 | case IP_CT_ESTABLISHED_REPLY: |
| 330 | break; | 330 | break; |
| 331 | default: | 331 | default: |
| 332 | break; | 332 | break; |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index d2ed9dc74ebc..9931152a78b5 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
| @@ -60,7 +60,7 @@ masquerade_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
| 60 | nat = nfct_nat(ct); | 60 | nat = nfct_nat(ct); |
| 61 | 61 | ||
| 62 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || | 62 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || |
| 63 | ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); | 63 | ctinfo == IP_CT_RELATED_REPLY)); |
| 64 | 64 | ||
| 65 | /* Source address is 0.0.0.0 - locally generated packet that is | 65 | /* Source address is 0.0.0.0 - locally generated packet that is |
| 66 | * probably not supposed to be masqueraded. | 66 | * probably not supposed to be masqueraded. |
diff --git a/net/ipv4/netfilter/ipt_ecn.c b/net/ipv4/netfilter/ipt_ecn.c index af6e9c778345..2b57e52c746c 100644 --- a/net/ipv4/netfilter/ipt_ecn.c +++ b/net/ipv4/netfilter/ipt_ecn.c | |||
| @@ -25,7 +25,8 @@ MODULE_LICENSE("GPL"); | |||
| 25 | static inline bool match_ip(const struct sk_buff *skb, | 25 | static inline bool match_ip(const struct sk_buff *skb, |
| 26 | const struct ipt_ecn_info *einfo) | 26 | const struct ipt_ecn_info *einfo) |
| 27 | { | 27 | { |
| 28 | return (ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect; | 28 | return ((ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect) ^ |
| 29 | !!(einfo->invert & IPT_ECN_OP_MATCH_IP); | ||
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | static inline bool match_tcp(const struct sk_buff *skb, | 32 | static inline bool match_tcp(const struct sk_buff *skb, |
| @@ -76,8 +77,6 @@ static bool ecn_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
| 76 | return false; | 77 | return false; |
| 77 | 78 | ||
| 78 | if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR)) { | 79 | if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR)) { |
| 79 | if (ip_hdr(skb)->protocol != IPPROTO_TCP) | ||
| 80 | return false; | ||
| 81 | if (!match_tcp(skb, info, &par->hotdrop)) | 80 | if (!match_tcp(skb, info, &par->hotdrop)) |
| 82 | return false; | 81 | return false; |
| 83 | } | 82 | } |
| @@ -97,7 +96,7 @@ static int ecn_mt_check(const struct xt_mtchk_param *par) | |||
| 97 | return -EINVAL; | 96 | return -EINVAL; |
| 98 | 97 | ||
| 99 | if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR) && | 98 | if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR) && |
| 100 | ip->proto != IPPROTO_TCP) { | 99 | (ip->proto != IPPROTO_TCP || ip->invflags & IPT_INV_PROTO)) { |
| 101 | pr_info("cannot match TCP bits in rule for non-tcp packets\n"); | 100 | pr_info("cannot match TCP bits in rule for non-tcp packets\n"); |
| 102 | return -EINVAL; | 101 | return -EINVAL; |
| 103 | } | 102 | } |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 5a03c02af999..de9da21113a1 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
| @@ -101,7 +101,7 @@ static unsigned int ipv4_confirm(unsigned int hooknum, | |||
| 101 | 101 | ||
| 102 | /* This is where we call the helper: as the packet goes out. */ | 102 | /* This is where we call the helper: as the packet goes out. */ |
| 103 | ct = nf_ct_get(skb, &ctinfo); | 103 | ct = nf_ct_get(skb, &ctinfo); |
| 104 | if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY) | 104 | if (!ct || ctinfo == IP_CT_RELATED_REPLY) |
| 105 | goto out; | 105 | goto out; |
| 106 | 106 | ||
| 107 | help = nfct_help(ct); | 107 | help = nfct_help(ct); |
| @@ -121,7 +121,9 @@ static unsigned int ipv4_confirm(unsigned int hooknum, | |||
| 121 | return ret; | 121 | return ret; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) { | 124 | /* adjust seqs for loopback traffic only in outgoing direction */ |
| 125 | if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) && | ||
| 126 | !nf_is_loopback_packet(skb)) { | ||
| 125 | typeof(nf_nat_seq_adjust_hook) seq_adjust; | 127 | typeof(nf_nat_seq_adjust_hook) seq_adjust; |
| 126 | 128 | ||
| 127 | seq_adjust = rcu_dereference(nf_nat_seq_adjust_hook); | 129 | seq_adjust = rcu_dereference(nf_nat_seq_adjust_hook); |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 7404bde95994..ab5b27a2916f 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
| @@ -160,7 +160,7 @@ icmp_error_message(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb, | |||
| 160 | /* Update skb to refer to this connection */ | 160 | /* Update skb to refer to this connection */ |
| 161 | skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; | 161 | skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; |
| 162 | skb->nfctinfo = *ctinfo; | 162 | skb->nfctinfo = *ctinfo; |
| 163 | return -NF_ACCEPT; | 163 | return NF_ACCEPT; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /* Small and modified version of icmp_rcv */ | 166 | /* Small and modified version of icmp_rcv */ |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 9c71b2755ce3..3346de5d94d0 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
| @@ -433,7 +433,7 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct, | |||
| 433 | 433 | ||
| 434 | /* Must be RELATED */ | 434 | /* Must be RELATED */ |
| 435 | NF_CT_ASSERT(skb->nfctinfo == IP_CT_RELATED || | 435 | NF_CT_ASSERT(skb->nfctinfo == IP_CT_RELATED || |
| 436 | skb->nfctinfo == IP_CT_RELATED+IP_CT_IS_REPLY); | 436 | skb->nfctinfo == IP_CT_RELATED_REPLY); |
| 437 | 437 | ||
| 438 | /* Redirects on non-null nats must be dropped, else they'll | 438 | /* Redirects on non-null nats must be dropped, else they'll |
| 439 | start talking to each other without our translation, and be | 439 | start talking to each other without our translation, and be |
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c index 99cfa28b6d38..ebc5f8894f99 100644 --- a/net/ipv4/netfilter/nf_nat_helper.c +++ b/net/ipv4/netfilter/nf_nat_helper.c | |||
| @@ -160,7 +160,7 @@ static void nf_nat_csum(struct sk_buff *skb, const struct iphdr *iph, void *data | |||
| 160 | 160 | ||
| 161 | if (skb->ip_summed != CHECKSUM_PARTIAL) { | 161 | if (skb->ip_summed != CHECKSUM_PARTIAL) { |
| 162 | if (!(rt->rt_flags & RTCF_LOCAL) && | 162 | if (!(rt->rt_flags & RTCF_LOCAL) && |
| 163 | skb->dev->features & NETIF_F_V4_CSUM) { | 163 | (!skb->dev || skb->dev->features & NETIF_F_V4_CSUM)) { |
| 164 | skb->ip_summed = CHECKSUM_PARTIAL; | 164 | skb->ip_summed = CHECKSUM_PARTIAL; |
| 165 | skb->csum_start = skb_headroom(skb) + | 165 | skb->csum_start = skb_headroom(skb) + |
| 166 | skb_network_offset(skb) + | 166 | skb_network_offset(skb) + |
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c index 21c30426480b..733c9abc1cbd 100644 --- a/net/ipv4/netfilter/nf_nat_rule.c +++ b/net/ipv4/netfilter/nf_nat_rule.c | |||
| @@ -53,7 +53,7 @@ ipt_snat_target(struct sk_buff *skb, const struct xt_action_param *par) | |||
| 53 | 53 | ||
| 54 | /* Connection must be valid and new. */ | 54 | /* Connection must be valid and new. */ |
| 55 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || | 55 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || |
| 56 | ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); | 56 | ctinfo == IP_CT_RELATED_REPLY)); |
| 57 | NF_CT_ASSERT(par->out != NULL); | 57 | NF_CT_ASSERT(par->out != NULL); |
| 58 | 58 | ||
| 59 | return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_SRC); | 59 | return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_SRC); |
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c index 7317bdf1d457..483b76d042da 100644 --- a/net/ipv4/netfilter/nf_nat_standalone.c +++ b/net/ipv4/netfilter/nf_nat_standalone.c | |||
| @@ -116,7 +116,7 @@ nf_nat_fn(unsigned int hooknum, | |||
| 116 | 116 | ||
| 117 | switch (ctinfo) { | 117 | switch (ctinfo) { |
| 118 | case IP_CT_RELATED: | 118 | case IP_CT_RELATED: |
| 119 | case IP_CT_RELATED+IP_CT_IS_REPLY: | 119 | case IP_CT_RELATED_REPLY: |
| 120 | if (ip_hdr(skb)->protocol == IPPROTO_ICMP) { | 120 | if (ip_hdr(skb)->protocol == IPPROTO_ICMP) { |
| 121 | if (!nf_nat_icmp_reply_translation(ct, ctinfo, | 121 | if (!nf_nat_icmp_reply_translation(ct, ctinfo, |
| 122 | hooknum, skb)) | 122 | hooknum, skb)) |
| @@ -144,7 +144,7 @@ nf_nat_fn(unsigned int hooknum, | |||
| 144 | default: | 144 | default: |
| 145 | /* ESTABLISHED */ | 145 | /* ESTABLISHED */ |
| 146 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || | 146 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || |
| 147 | ctinfo == (IP_CT_ESTABLISHED+IP_CT_IS_REPLY)); | 147 | ctinfo == IP_CT_ESTABLISHED_REPLY); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | return nf_nat_packet(ct, ctinfo, hooknum, skb); | 150 | return nf_nat_packet(ct, ctinfo, hooknum, skb); |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 9aaa67165f42..39b403f854c6 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include <linux/proc_fs.h> | 41 | #include <linux/proc_fs.h> |
| 42 | #include <net/sock.h> | 42 | #include <net/sock.h> |
| 43 | #include <net/ping.h> | 43 | #include <net/ping.h> |
| 44 | #include <net/icmp.h> | ||
| 45 | #include <net/udp.h> | 44 | #include <net/udp.h> |
| 46 | #include <net/route.h> | 45 | #include <net/route.h> |
| 47 | #include <net/inet_common.h> | 46 | #include <net/inet_common.h> |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index aa29c6291353..f24c3359e5d0 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -1316,6 +1316,23 @@ reject_redirect: | |||
| 1316 | ; | 1316 | ; |
| 1317 | } | 1317 | } |
| 1318 | 1318 | ||
| 1319 | static bool peer_pmtu_expired(struct inet_peer *peer) | ||
| 1320 | { | ||
| 1321 | unsigned long orig = ACCESS_ONCE(peer->pmtu_expires); | ||
| 1322 | |||
| 1323 | return orig && | ||
| 1324 | time_after_eq(jiffies, orig) && | ||
| 1325 | cmpxchg(&peer->pmtu_expires, orig, 0) == orig; | ||
| 1326 | } | ||
| 1327 | |||
| 1328 | static bool peer_pmtu_cleaned(struct inet_peer *peer) | ||
| 1329 | { | ||
| 1330 | unsigned long orig = ACCESS_ONCE(peer->pmtu_expires); | ||
| 1331 | |||
| 1332 | return orig && | ||
| 1333 | cmpxchg(&peer->pmtu_expires, orig, 0) == orig; | ||
| 1334 | } | ||
| 1335 | |||
| 1319 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | 1336 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) |
| 1320 | { | 1337 | { |
| 1321 | struct rtable *rt = (struct rtable *)dst; | 1338 | struct rtable *rt = (struct rtable *)dst; |
| @@ -1331,14 +1348,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | |||
| 1331 | rt_genid(dev_net(dst->dev))); | 1348 | rt_genid(dev_net(dst->dev))); |
| 1332 | rt_del(hash, rt); | 1349 | rt_del(hash, rt); |
| 1333 | ret = NULL; | 1350 | ret = NULL; |
| 1334 | } else if (rt->peer && | 1351 | } else if (rt->peer && peer_pmtu_expired(rt->peer)) { |
| 1335 | rt->peer->pmtu_expires && | 1352 | dst_metric_set(dst, RTAX_MTU, rt->peer->pmtu_orig); |
| 1336 | time_after_eq(jiffies, rt->peer->pmtu_expires)) { | ||
| 1337 | unsigned long orig = rt->peer->pmtu_expires; | ||
| 1338 | |||
| 1339 | if (cmpxchg(&rt->peer->pmtu_expires, orig, 0) == orig) | ||
| 1340 | dst_metric_set(dst, RTAX_MTU, | ||
| 1341 | rt->peer->pmtu_orig); | ||
| 1342 | } | 1353 | } |
| 1343 | } | 1354 | } |
| 1344 | return ret; | 1355 | return ret; |
| @@ -1531,8 +1542,10 @@ unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, | |||
| 1531 | 1542 | ||
| 1532 | static void check_peer_pmtu(struct dst_entry *dst, struct inet_peer *peer) | 1543 | static void check_peer_pmtu(struct dst_entry *dst, struct inet_peer *peer) |
| 1533 | { | 1544 | { |
| 1534 | unsigned long expires = peer->pmtu_expires; | 1545 | unsigned long expires = ACCESS_ONCE(peer->pmtu_expires); |
| 1535 | 1546 | ||
| 1547 | if (!expires) | ||
| 1548 | return; | ||
| 1536 | if (time_before(jiffies, expires)) { | 1549 | if (time_before(jiffies, expires)) { |
| 1537 | u32 orig_dst_mtu = dst_mtu(dst); | 1550 | u32 orig_dst_mtu = dst_mtu(dst); |
| 1538 | if (peer->pmtu_learned < orig_dst_mtu) { | 1551 | if (peer->pmtu_learned < orig_dst_mtu) { |
| @@ -1555,10 +1568,11 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
| 1555 | rt_bind_peer(rt, rt->rt_dst, 1); | 1568 | rt_bind_peer(rt, rt->rt_dst, 1); |
| 1556 | peer = rt->peer; | 1569 | peer = rt->peer; |
| 1557 | if (peer) { | 1570 | if (peer) { |
| 1571 | unsigned long pmtu_expires = ACCESS_ONCE(peer->pmtu_expires); | ||
| 1572 | |||
| 1558 | if (mtu < ip_rt_min_pmtu) | 1573 | if (mtu < ip_rt_min_pmtu) |
| 1559 | mtu = ip_rt_min_pmtu; | 1574 | mtu = ip_rt_min_pmtu; |
| 1560 | if (!peer->pmtu_expires || mtu < peer->pmtu_learned) { | 1575 | if (!pmtu_expires || mtu < peer->pmtu_learned) { |
| 1561 | unsigned long pmtu_expires; | ||
| 1562 | 1576 | ||
| 1563 | pmtu_expires = jiffies + ip_rt_mtu_expires; | 1577 | pmtu_expires = jiffies + ip_rt_mtu_expires; |
| 1564 | if (!pmtu_expires) | 1578 | if (!pmtu_expires) |
| @@ -1612,13 +1626,14 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | |||
| 1612 | rt_bind_peer(rt, rt->rt_dst, 0); | 1626 | rt_bind_peer(rt, rt->rt_dst, 0); |
| 1613 | 1627 | ||
| 1614 | peer = rt->peer; | 1628 | peer = rt->peer; |
| 1615 | if (peer && peer->pmtu_expires) | 1629 | if (peer) { |
| 1616 | check_peer_pmtu(dst, peer); | 1630 | check_peer_pmtu(dst, peer); |
| 1617 | 1631 | ||
| 1618 | if (peer && peer->redirect_learned.a4 && | 1632 | if (peer->redirect_learned.a4 && |
| 1619 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1633 | peer->redirect_learned.a4 != rt->rt_gateway) { |
| 1620 | if (check_peer_redir(dst, peer)) | 1634 | if (check_peer_redir(dst, peer)) |
| 1621 | return NULL; | 1635 | return NULL; |
| 1636 | } | ||
| 1622 | } | 1637 | } |
| 1623 | 1638 | ||
| 1624 | rt->rt_peer_genid = rt_peer_genid(); | 1639 | rt->rt_peer_genid = rt_peer_genid(); |
| @@ -1649,14 +1664,8 @@ static void ipv4_link_failure(struct sk_buff *skb) | |||
| 1649 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); | 1664 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); |
| 1650 | 1665 | ||
| 1651 | rt = skb_rtable(skb); | 1666 | rt = skb_rtable(skb); |
| 1652 | if (rt && | 1667 | if (rt && rt->peer && peer_pmtu_cleaned(rt->peer)) |
| 1653 | rt->peer && | 1668 | dst_metric_set(&rt->dst, RTAX_MTU, rt->peer->pmtu_orig); |
| 1654 | rt->peer->pmtu_expires) { | ||
| 1655 | unsigned long orig = rt->peer->pmtu_expires; | ||
| 1656 | |||
| 1657 | if (cmpxchg(&rt->peer->pmtu_expires, orig, 0) == orig) | ||
| 1658 | dst_metric_set(&rt->dst, RTAX_MTU, rt->peer->pmtu_orig); | ||
| 1659 | } | ||
| 1660 | } | 1669 | } |
| 1661 | 1670 | ||
| 1662 | static int ip_rt_bug(struct sk_buff *skb) | 1671 | static int ip_rt_bug(struct sk_buff *skb) |
| @@ -1770,8 +1779,7 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4, | |||
| 1770 | sizeof(u32) * RTAX_MAX); | 1779 | sizeof(u32) * RTAX_MAX); |
| 1771 | dst_init_metrics(&rt->dst, peer->metrics, false); | 1780 | dst_init_metrics(&rt->dst, peer->metrics, false); |
| 1772 | 1781 | ||
| 1773 | if (peer->pmtu_expires) | 1782 | check_peer_pmtu(&rt->dst, peer); |
| 1774 | check_peer_pmtu(&rt->dst, peer); | ||
| 1775 | if (peer->redirect_learned.a4 && | 1783 | if (peer->redirect_learned.a4 && |
| 1776 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1784 | peer->redirect_learned.a4 != rt->rt_gateway) { |
| 1777 | rt->rt_gateway = peer->redirect_learned.a4; | 1785 | rt->rt_gateway = peer->redirect_learned.a4; |
| @@ -1894,9 +1902,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
| 1894 | 1902 | ||
| 1895 | hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); | 1903 | hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); |
| 1896 | rth = rt_intern_hash(hash, rth, skb, dev->ifindex); | 1904 | rth = rt_intern_hash(hash, rth, skb, dev->ifindex); |
| 1897 | err = 0; | 1905 | return IS_ERR(rth) ? PTR_ERR(rth) : 0; |
| 1898 | if (IS_ERR(rth)) | ||
| 1899 | err = PTR_ERR(rth); | ||
| 1900 | 1906 | ||
| 1901 | e_nobufs: | 1907 | e_nobufs: |
| 1902 | return -ENOBUFS; | 1908 | return -ENOBUFS; |
| @@ -2775,7 +2781,8 @@ static int rt_fill_info(struct net *net, | |||
| 2775 | struct rtable *rt = skb_rtable(skb); | 2781 | struct rtable *rt = skb_rtable(skb); |
| 2776 | struct rtmsg *r; | 2782 | struct rtmsg *r; |
| 2777 | struct nlmsghdr *nlh; | 2783 | struct nlmsghdr *nlh; |
| 2778 | long expires; | 2784 | long expires = 0; |
| 2785 | const struct inet_peer *peer = rt->peer; | ||
| 2779 | u32 id = 0, ts = 0, tsage = 0, error; | 2786 | u32 id = 0, ts = 0, tsage = 0, error; |
| 2780 | 2787 | ||
| 2781 | nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags); | 2788 | nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags); |
| @@ -2823,15 +2830,16 @@ static int rt_fill_info(struct net *net, | |||
| 2823 | NLA_PUT_BE32(skb, RTA_MARK, rt->rt_mark); | 2830 | NLA_PUT_BE32(skb, RTA_MARK, rt->rt_mark); |
| 2824 | 2831 | ||
| 2825 | error = rt->dst.error; | 2832 | error = rt->dst.error; |
| 2826 | expires = (rt->peer && rt->peer->pmtu_expires) ? | 2833 | if (peer) { |
| 2827 | rt->peer->pmtu_expires - jiffies : 0; | ||
| 2828 | if (rt->peer) { | ||
| 2829 | inet_peer_refcheck(rt->peer); | 2834 | inet_peer_refcheck(rt->peer); |
| 2830 | id = atomic_read(&rt->peer->ip_id_count) & 0xffff; | 2835 | id = atomic_read(&peer->ip_id_count) & 0xffff; |
| 2831 | if (rt->peer->tcp_ts_stamp) { | 2836 | if (peer->tcp_ts_stamp) { |
| 2832 | ts = rt->peer->tcp_ts; | 2837 | ts = peer->tcp_ts; |
| 2833 | tsage = get_seconds() - rt->peer->tcp_ts_stamp; | 2838 | tsage = get_seconds() - peer->tcp_ts_stamp; |
| 2834 | } | 2839 | } |
| 2840 | expires = ACCESS_ONCE(peer->pmtu_expires); | ||
| 2841 | if (expires) | ||
| 2842 | expires -= jiffies; | ||
| 2835 | } | 2843 | } |
| 2836 | 2844 | ||
| 2837 | if (rt_is_input_route(rt)) { | 2845 | if (rt_is_input_route(rt)) { |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 617dee3ccfb1..955b8e65b69e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1594,6 +1594,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 1594 | goto discard; | 1594 | goto discard; |
| 1595 | 1595 | ||
| 1596 | if (nsk != sk) { | 1596 | if (nsk != sk) { |
| 1597 | sock_rps_save_rxhash(nsk, skb->rxhash); | ||
| 1597 | if (tcp_child_process(sk, nsk, skb)) { | 1598 | if (tcp_child_process(sk, nsk, skb)) { |
| 1598 | rsk = nsk; | 1599 | rsk = nsk; |
| 1599 | goto reset; | 1600 | goto reset; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index b7919f901fbf..d450a2f9fc06 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
| @@ -272,6 +272,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
| 272 | 272 | ||
| 273 | if (addr_len < SIN6_LEN_RFC2133) | 273 | if (addr_len < SIN6_LEN_RFC2133) |
| 274 | return -EINVAL; | 274 | return -EINVAL; |
| 275 | |||
| 276 | if (addr->sin6_family != AF_INET6) | ||
| 277 | return -EINVAL; | ||
| 278 | |||
| 275 | addr_type = ipv6_addr_type(&addr->sin6_addr); | 279 | addr_type = ipv6_addr_type(&addr->sin6_addr); |
| 276 | if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM) | 280 | if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM) |
| 277 | return -EINVAL; | 281 | return -EINVAL; |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 413ab0754e1f..249394863284 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
| @@ -204,7 +204,8 @@ ipq_build_packet_message(struct nf_queue_entry *entry, int *errp) | |||
| 204 | else | 204 | else |
| 205 | pmsg->outdev_name[0] = '\0'; | 205 | pmsg->outdev_name[0] = '\0'; |
| 206 | 206 | ||
| 207 | if (entry->indev && entry->skb->dev) { | 207 | if (entry->indev && entry->skb->dev && |
| 208 | entry->skb->mac_header != entry->skb->network_header) { | ||
| 208 | pmsg->hw_type = entry->skb->dev->type; | 209 | pmsg->hw_type = entry->skb->dev->type; |
| 209 | pmsg->hw_addrlen = dev_parse_header(entry->skb, pmsg->hw_addr); | 210 | pmsg->hw_addrlen = dev_parse_header(entry->skb, pmsg->hw_addr); |
| 210 | } | 211 | } |
| @@ -403,7 +404,8 @@ ipq_dev_drop(int ifindex) | |||
| 403 | static inline void | 404 | static inline void |
| 404 | __ipq_rcv_skb(struct sk_buff *skb) | 405 | __ipq_rcv_skb(struct sk_buff *skb) |
| 405 | { | 406 | { |
| 406 | int status, type, pid, flags, nlmsglen, skblen; | 407 | int status, type, pid, flags; |
| 408 | unsigned int nlmsglen, skblen; | ||
| 407 | struct nlmsghdr *nlh; | 409 | struct nlmsghdr *nlh; |
| 408 | 410 | ||
| 409 | skblen = skb->len; | 411 | skblen = skb->len; |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index c8af58b22562..4111050a9fc5 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
| @@ -160,7 +160,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum, | |||
| 160 | 160 | ||
| 161 | /* This is where we call the helper: as the packet goes out. */ | 161 | /* This is where we call the helper: as the packet goes out. */ |
| 162 | ct = nf_ct_get(skb, &ctinfo); | 162 | ct = nf_ct_get(skb, &ctinfo); |
| 163 | if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY) | 163 | if (!ct || ctinfo == IP_CT_RELATED_REPLY) |
| 164 | goto out; | 164 | goto out; |
| 165 | 165 | ||
| 166 | help = nfct_help(ct); | 166 | help = nfct_help(ct); |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 1df3c8b6bf47..7c05e7eacbc6 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
| @@ -177,7 +177,7 @@ icmpv6_error_message(struct net *net, struct nf_conn *tmpl, | |||
| 177 | /* Update skb to refer to this connection */ | 177 | /* Update skb to refer to this connection */ |
| 178 | skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; | 178 | skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; |
| 179 | skb->nfctinfo = *ctinfo; | 179 | skb->nfctinfo = *ctinfo; |
| 180 | return -NF_ACCEPT; | 180 | return NF_ACCEPT; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | static int | 183 | static int |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index a1ef61a889c3..78aa53492b3e 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1649,6 +1649,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 1649 | * the new socket.. | 1649 | * the new socket.. |
| 1650 | */ | 1650 | */ |
| 1651 | if(nsk != sk) { | 1651 | if(nsk != sk) { |
| 1652 | sock_rps_save_rxhash(nsk, skb->rxhash); | ||
| 1652 | if (tcp_child_process(sk, nsk, skb)) | 1653 | if (tcp_child_process(sk, nsk, skb)) |
| 1653 | goto reset; | 1654 | goto reset; |
| 1654 | if (opt_skb) | 1655 | if (opt_skb) |
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index dfc7b47d48fe..e71e85ba2bf1 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
| @@ -87,6 +87,8 @@ static inline void iriap_start_watchdog_timer(struct iriap_cb *self, | |||
| 87 | iriap_watchdog_timer_expired); | 87 | iriap_watchdog_timer_expired); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static struct lock_class_key irias_objects_key; | ||
| 91 | |||
| 90 | /* | 92 | /* |
| 91 | * Function iriap_init (void) | 93 | * Function iriap_init (void) |
| 92 | * | 94 | * |
| @@ -114,6 +116,9 @@ int __init iriap_init(void) | |||
| 114 | return -ENOMEM; | 116 | return -ENOMEM; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 119 | lockdep_set_class_and_name(&irias_objects->hb_spinlock, &irias_objects_key, | ||
| 120 | "irias_objects"); | ||
| 121 | |||
| 117 | /* | 122 | /* |
| 118 | * Register some default services for IrLMP | 123 | * Register some default services for IrLMP |
| 119 | */ | 124 | */ |
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index b8dbae82fab8..76130134bfa6 100644 --- a/net/l2tp/l2tp_debugfs.c +++ b/net/l2tp/l2tp_debugfs.c | |||
| @@ -258,7 +258,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file) | |||
| 258 | */ | 258 | */ |
| 259 | pd->net = get_net_ns_by_pid(current->pid); | 259 | pd->net = get_net_ns_by_pid(current->pid); |
| 260 | if (IS_ERR(pd->net)) { | 260 | if (IS_ERR(pd->net)) { |
| 261 | rc = -PTR_ERR(pd->net); | 261 | rc = PTR_ERR(pd->net); |
| 262 | goto err_free_pd; | 262 | goto err_free_pd; |
| 263 | } | 263 | } |
| 264 | 264 | ||
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 421eaa6b0c2b..56c24cabf26d 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
| @@ -965,6 +965,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) | |||
| 965 | 965 | ||
| 966 | mutex_lock(&sdata->u.ibss.mtx); | 966 | mutex_lock(&sdata->u.ibss.mtx); |
| 967 | 967 | ||
| 968 | sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; | ||
| 969 | memset(sdata->u.ibss.bssid, 0, ETH_ALEN); | ||
| 970 | sdata->u.ibss.ssid_len = 0; | ||
| 971 | |||
| 968 | active_ibss = ieee80211_sta_active_ibss(sdata); | 972 | active_ibss = ieee80211_sta_active_ibss(sdata); |
| 969 | 973 | ||
| 970 | if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) { | 974 | if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) { |
| @@ -999,8 +1003,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) | |||
| 999 | kfree_skb(skb); | 1003 | kfree_skb(skb); |
| 1000 | 1004 | ||
| 1001 | skb_queue_purge(&sdata->skb_queue); | 1005 | skb_queue_purge(&sdata->skb_queue); |
| 1002 | memset(sdata->u.ibss.bssid, 0, ETH_ALEN); | ||
| 1003 | sdata->u.ibss.ssid_len = 0; | ||
| 1004 | 1006 | ||
| 1005 | del_timer_sync(&sdata->u.ibss.timer); | 1007 | del_timer_sync(&sdata->u.ibss.timer); |
| 1006 | 1008 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 456cccf26b51..d595265d6c22 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -232,9 +232,6 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
| 232 | WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type)); | 232 | WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type)); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
| 236 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
| 237 | |||
| 238 | /* channel_type change automatically detected */ | 235 | /* channel_type change automatically detected */ |
| 239 | ieee80211_hw_config(local, 0); | 236 | ieee80211_hw_config(local, 0); |
| 240 | 237 | ||
| @@ -248,9 +245,6 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
| 248 | rcu_read_unlock(); | 245 | rcu_read_unlock(); |
| 249 | } | 246 | } |
| 250 | 247 | ||
| 251 | ieee80211_wake_queues_by_reason(&sdata->local->hw, | ||
| 252 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
| 253 | |||
| 254 | ht_opmode = le16_to_cpu(hti->operation_mode); | 248 | ht_opmode = le16_to_cpu(hti->operation_mode); |
| 255 | 249 | ||
| 256 | /* if bss configuration changed store the new one */ | 250 | /* if bss configuration changed store the new one */ |
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 77c61b0b6d68..12571fb2881c 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c | |||
| @@ -776,8 +776,16 @@ static void ip_vs_conn_expire(unsigned long data) | |||
| 776 | if (cp->control) | 776 | if (cp->control) |
| 777 | ip_vs_control_del(cp); | 777 | ip_vs_control_del(cp); |
| 778 | 778 | ||
| 779 | if (cp->flags & IP_VS_CONN_F_NFCT) | 779 | if (cp->flags & IP_VS_CONN_F_NFCT) { |
| 780 | ip_vs_conn_drop_conntrack(cp); | 780 | ip_vs_conn_drop_conntrack(cp); |
| 781 | /* Do not access conntracks during subsys cleanup | ||
| 782 | * because nf_conntrack_find_get can not be used after | ||
| 783 | * conntrack cleanup for the net. | ||
| 784 | */ | ||
| 785 | smp_rmb(); | ||
| 786 | if (ipvs->enable) | ||
| 787 | ip_vs_conn_drop_conntrack(cp); | ||
| 788 | } | ||
| 781 | 789 | ||
| 782 | ip_vs_pe_put(cp->pe); | 790 | ip_vs_pe_put(cp->pe); |
| 783 | kfree(cp->pe_data); | 791 | kfree(cp->pe_data); |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 2200bae1d4dd..e33d48cae9fd 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
| @@ -1772,7 +1772,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1772 | .owner = THIS_MODULE, | 1772 | .owner = THIS_MODULE, |
| 1773 | .pf = PF_INET, | 1773 | .pf = PF_INET, |
| 1774 | .hooknum = NF_INET_LOCAL_IN, | 1774 | .hooknum = NF_INET_LOCAL_IN, |
| 1775 | .priority = 99, | 1775 | .priority = NF_IP_PRI_NAT_SRC - 2, |
| 1776 | }, | 1776 | }, |
| 1777 | /* After packet filtering, forward packet through VS/DR, VS/TUN, | 1777 | /* After packet filtering, forward packet through VS/DR, VS/TUN, |
| 1778 | * or VS/NAT(change destination), so that filtering rules can be | 1778 | * or VS/NAT(change destination), so that filtering rules can be |
| @@ -1782,7 +1782,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1782 | .owner = THIS_MODULE, | 1782 | .owner = THIS_MODULE, |
| 1783 | .pf = PF_INET, | 1783 | .pf = PF_INET, |
| 1784 | .hooknum = NF_INET_LOCAL_IN, | 1784 | .hooknum = NF_INET_LOCAL_IN, |
| 1785 | .priority = 101, | 1785 | .priority = NF_IP_PRI_NAT_SRC - 1, |
| 1786 | }, | 1786 | }, |
| 1787 | /* Before ip_vs_in, change source only for VS/NAT */ | 1787 | /* Before ip_vs_in, change source only for VS/NAT */ |
| 1788 | { | 1788 | { |
| @@ -1790,7 +1790,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1790 | .owner = THIS_MODULE, | 1790 | .owner = THIS_MODULE, |
| 1791 | .pf = PF_INET, | 1791 | .pf = PF_INET, |
| 1792 | .hooknum = NF_INET_LOCAL_OUT, | 1792 | .hooknum = NF_INET_LOCAL_OUT, |
| 1793 | .priority = -99, | 1793 | .priority = NF_IP_PRI_NAT_DST + 1, |
| 1794 | }, | 1794 | }, |
| 1795 | /* After mangle, schedule and forward local requests */ | 1795 | /* After mangle, schedule and forward local requests */ |
| 1796 | { | 1796 | { |
| @@ -1798,7 +1798,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1798 | .owner = THIS_MODULE, | 1798 | .owner = THIS_MODULE, |
| 1799 | .pf = PF_INET, | 1799 | .pf = PF_INET, |
| 1800 | .hooknum = NF_INET_LOCAL_OUT, | 1800 | .hooknum = NF_INET_LOCAL_OUT, |
| 1801 | .priority = -98, | 1801 | .priority = NF_IP_PRI_NAT_DST + 2, |
| 1802 | }, | 1802 | }, |
| 1803 | /* After packet filtering (but before ip_vs_out_icmp), catch icmp | 1803 | /* After packet filtering (but before ip_vs_out_icmp), catch icmp |
| 1804 | * destined for 0.0.0.0/0, which is for incoming IPVS connections */ | 1804 | * destined for 0.0.0.0/0, which is for incoming IPVS connections */ |
| @@ -1824,7 +1824,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1824 | .owner = THIS_MODULE, | 1824 | .owner = THIS_MODULE, |
| 1825 | .pf = PF_INET6, | 1825 | .pf = PF_INET6, |
| 1826 | .hooknum = NF_INET_LOCAL_IN, | 1826 | .hooknum = NF_INET_LOCAL_IN, |
| 1827 | .priority = 99, | 1827 | .priority = NF_IP6_PRI_NAT_SRC - 2, |
| 1828 | }, | 1828 | }, |
| 1829 | /* After packet filtering, forward packet through VS/DR, VS/TUN, | 1829 | /* After packet filtering, forward packet through VS/DR, VS/TUN, |
| 1830 | * or VS/NAT(change destination), so that filtering rules can be | 1830 | * or VS/NAT(change destination), so that filtering rules can be |
| @@ -1834,7 +1834,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1834 | .owner = THIS_MODULE, | 1834 | .owner = THIS_MODULE, |
| 1835 | .pf = PF_INET6, | 1835 | .pf = PF_INET6, |
| 1836 | .hooknum = NF_INET_LOCAL_IN, | 1836 | .hooknum = NF_INET_LOCAL_IN, |
| 1837 | .priority = 101, | 1837 | .priority = NF_IP6_PRI_NAT_SRC - 1, |
| 1838 | }, | 1838 | }, |
| 1839 | /* Before ip_vs_in, change source only for VS/NAT */ | 1839 | /* Before ip_vs_in, change source only for VS/NAT */ |
| 1840 | { | 1840 | { |
| @@ -1842,7 +1842,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1842 | .owner = THIS_MODULE, | 1842 | .owner = THIS_MODULE, |
| 1843 | .pf = PF_INET, | 1843 | .pf = PF_INET, |
| 1844 | .hooknum = NF_INET_LOCAL_OUT, | 1844 | .hooknum = NF_INET_LOCAL_OUT, |
| 1845 | .priority = -99, | 1845 | .priority = NF_IP6_PRI_NAT_DST + 1, |
| 1846 | }, | 1846 | }, |
| 1847 | /* After mangle, schedule and forward local requests */ | 1847 | /* After mangle, schedule and forward local requests */ |
| 1848 | { | 1848 | { |
| @@ -1850,7 +1850,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
| 1850 | .owner = THIS_MODULE, | 1850 | .owner = THIS_MODULE, |
| 1851 | .pf = PF_INET6, | 1851 | .pf = PF_INET6, |
| 1852 | .hooknum = NF_INET_LOCAL_OUT, | 1852 | .hooknum = NF_INET_LOCAL_OUT, |
| 1853 | .priority = -98, | 1853 | .priority = NF_IP6_PRI_NAT_DST + 2, |
| 1854 | }, | 1854 | }, |
| 1855 | /* After packet filtering (but before ip_vs_out_icmp), catch icmp | 1855 | /* After packet filtering (but before ip_vs_out_icmp), catch icmp |
| 1856 | * destined for 0.0.0.0/0, which is for incoming IPVS connections */ | 1856 | * destined for 0.0.0.0/0, which is for incoming IPVS connections */ |
| @@ -1945,6 +1945,7 @@ static void __net_exit __ip_vs_dev_cleanup(struct net *net) | |||
| 1945 | { | 1945 | { |
| 1946 | EnterFunction(2); | 1946 | EnterFunction(2); |
| 1947 | net_ipvs(net)->enable = 0; /* Disable packet reception */ | 1947 | net_ipvs(net)->enable = 0; /* Disable packet reception */ |
| 1948 | smp_wmb(); | ||
| 1948 | ip_vs_sync_net_cleanup(net); | 1949 | ip_vs_sync_net_cleanup(net); |
| 1949 | LeaveFunction(2); | 1950 | LeaveFunction(2); |
| 1950 | } | 1951 | } |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 2e1c11f78419..f7af8b866017 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -850,7 +850,7 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl, | |||
| 850 | 850 | ||
| 851 | /* It exists; we have (non-exclusive) reference. */ | 851 | /* It exists; we have (non-exclusive) reference. */ |
| 852 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) { | 852 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) { |
| 853 | *ctinfo = IP_CT_ESTABLISHED + IP_CT_IS_REPLY; | 853 | *ctinfo = IP_CT_ESTABLISHED_REPLY; |
| 854 | /* Please set reply bit if this packet OK */ | 854 | /* Please set reply bit if this packet OK */ |
| 855 | *set_reply = 1; | 855 | *set_reply = 1; |
| 856 | } else { | 856 | } else { |
| @@ -922,6 +922,9 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum, | |||
| 922 | ret = -ret; | 922 | ret = -ret; |
| 923 | goto out; | 923 | goto out; |
| 924 | } | 924 | } |
| 925 | /* ICMP[v6] protocol trackers may assign one conntrack. */ | ||
| 926 | if (skb->nfct) | ||
| 927 | goto out; | ||
| 925 | } | 928 | } |
| 926 | 929 | ||
| 927 | ct = resolve_normal_ct(net, tmpl, skb, dataoff, pf, protonum, | 930 | ct = resolve_normal_ct(net, tmpl, skb, dataoff, pf, protonum, |
| @@ -1143,7 +1146,7 @@ static void nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb) | |||
| 1143 | /* This ICMP is in reverse direction to the packet which caused it */ | 1146 | /* This ICMP is in reverse direction to the packet which caused it */ |
| 1144 | ct = nf_ct_get(skb, &ctinfo); | 1147 | ct = nf_ct_get(skb, &ctinfo); |
| 1145 | if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) | 1148 | if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) |
| 1146 | ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY; | 1149 | ctinfo = IP_CT_RELATED_REPLY; |
| 1147 | else | 1150 | else |
| 1148 | ctinfo = IP_CT_RELATED; | 1151 | ctinfo = IP_CT_RELATED; |
| 1149 | 1152 | ||
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index e17cb7c7dd8f..6f5801eac999 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c | |||
| @@ -368,7 +368,7 @@ static int help(struct sk_buff *skb, | |||
| 368 | 368 | ||
| 369 | /* Until there's been traffic both ways, don't look in packets. */ | 369 | /* Until there's been traffic both ways, don't look in packets. */ |
| 370 | if (ctinfo != IP_CT_ESTABLISHED && | 370 | if (ctinfo != IP_CT_ESTABLISHED && |
| 371 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { | 371 | ctinfo != IP_CT_ESTABLISHED_REPLY) { |
| 372 | pr_debug("ftp: Conntrackinfo = %u\n", ctinfo); | 372 | pr_debug("ftp: Conntrackinfo = %u\n", ctinfo); |
| 373 | return NF_ACCEPT; | 373 | return NF_ACCEPT; |
| 374 | } | 374 | } |
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 18b2ce5c8ced..f03c2d4539f6 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
| @@ -571,10 +571,9 @@ static int h245_help(struct sk_buff *skb, unsigned int protoff, | |||
| 571 | int ret; | 571 | int ret; |
| 572 | 572 | ||
| 573 | /* Until there's been traffic both ways, don't look in packets. */ | 573 | /* Until there's been traffic both ways, don't look in packets. */ |
| 574 | if (ctinfo != IP_CT_ESTABLISHED && | 574 | if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY) |
| 575 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { | ||
| 576 | return NF_ACCEPT; | 575 | return NF_ACCEPT; |
| 577 | } | 576 | |
| 578 | pr_debug("nf_ct_h245: skblen = %u\n", skb->len); | 577 | pr_debug("nf_ct_h245: skblen = %u\n", skb->len); |
| 579 | 578 | ||
| 580 | spin_lock_bh(&nf_h323_lock); | 579 | spin_lock_bh(&nf_h323_lock); |
| @@ -1125,10 +1124,9 @@ static int q931_help(struct sk_buff *skb, unsigned int protoff, | |||
| 1125 | int ret; | 1124 | int ret; |
| 1126 | 1125 | ||
| 1127 | /* Until there's been traffic both ways, don't look in packets. */ | 1126 | /* Until there's been traffic both ways, don't look in packets. */ |
| 1128 | if (ctinfo != IP_CT_ESTABLISHED && | 1127 | if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY) |
| 1129 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { | ||
| 1130 | return NF_ACCEPT; | 1128 | return NF_ACCEPT; |
| 1131 | } | 1129 | |
| 1132 | pr_debug("nf_ct_q931: skblen = %u\n", skb->len); | 1130 | pr_debug("nf_ct_q931: skblen = %u\n", skb->len); |
| 1133 | 1131 | ||
| 1134 | spin_lock_bh(&nf_h323_lock); | 1132 | spin_lock_bh(&nf_h323_lock); |
diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c index b394aa318776..4f9390b98697 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c | |||
| @@ -125,8 +125,7 @@ static int help(struct sk_buff *skb, unsigned int protoff, | |||
| 125 | return NF_ACCEPT; | 125 | return NF_ACCEPT; |
| 126 | 126 | ||
| 127 | /* Until there's been traffic both ways, don't look in packets. */ | 127 | /* Until there's been traffic both ways, don't look in packets. */ |
| 128 | if (ctinfo != IP_CT_ESTABLISHED && | 128 | if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY) |
| 129 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) | ||
| 130 | return NF_ACCEPT; | 129 | return NF_ACCEPT; |
| 131 | 130 | ||
| 132 | /* Not a full tcp header? */ | 131 | /* Not a full tcp header? */ |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index 088944824e13..2fd4565144de 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
| @@ -519,8 +519,7 @@ conntrack_pptp_help(struct sk_buff *skb, unsigned int protoff, | |||
| 519 | u_int16_t msg; | 519 | u_int16_t msg; |
| 520 | 520 | ||
| 521 | /* don't do any tracking before tcp handshake complete */ | 521 | /* don't do any tracking before tcp handshake complete */ |
| 522 | if (ctinfo != IP_CT_ESTABLISHED && | 522 | if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY) |
| 523 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) | ||
| 524 | return NF_ACCEPT; | 523 | return NF_ACCEPT; |
| 525 | 524 | ||
| 526 | nexthdr_off = protoff; | 525 | nexthdr_off = protoff; |
diff --git a/net/netfilter/nf_conntrack_sane.c b/net/netfilter/nf_conntrack_sane.c index d9e27734b2a2..8501823b3f9b 100644 --- a/net/netfilter/nf_conntrack_sane.c +++ b/net/netfilter/nf_conntrack_sane.c | |||
| @@ -78,7 +78,7 @@ static int help(struct sk_buff *skb, | |||
| 78 | ct_sane_info = &nfct_help(ct)->help.ct_sane_info; | 78 | ct_sane_info = &nfct_help(ct)->help.ct_sane_info; |
| 79 | /* Until there's been traffic both ways, don't look in packets. */ | 79 | /* Until there's been traffic both ways, don't look in packets. */ |
| 80 | if (ctinfo != IP_CT_ESTABLISHED && | 80 | if (ctinfo != IP_CT_ESTABLISHED && |
| 81 | ctinfo != IP_CT_ESTABLISHED+IP_CT_IS_REPLY) | 81 | ctinfo != IP_CT_ESTABLISHED_REPLY) |
| 82 | return NF_ACCEPT; | 82 | return NF_ACCEPT; |
| 83 | 83 | ||
| 84 | /* Not a full tcp header? */ | 84 | /* Not a full tcp header? */ |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index cb5a28581782..93faf6a3a637 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
| @@ -1423,7 +1423,7 @@ static int sip_help_tcp(struct sk_buff *skb, unsigned int protoff, | |||
| 1423 | typeof(nf_nat_sip_seq_adjust_hook) nf_nat_sip_seq_adjust; | 1423 | typeof(nf_nat_sip_seq_adjust_hook) nf_nat_sip_seq_adjust; |
| 1424 | 1424 | ||
| 1425 | if (ctinfo != IP_CT_ESTABLISHED && | 1425 | if (ctinfo != IP_CT_ESTABLISHED && |
| 1426 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) | 1426 | ctinfo != IP_CT_ESTABLISHED_REPLY) |
| 1427 | return NF_ACCEPT; | 1427 | return NF_ACCEPT; |
| 1428 | 1428 | ||
| 1429 | /* No Data ? */ | 1429 | /* No Data ? */ |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index e0ee010935e7..2e7ccbb43ddb 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
| @@ -456,7 +456,8 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
| 456 | if (skb->mark) | 456 | if (skb->mark) |
| 457 | NLA_PUT_BE32(inst->skb, NFULA_MARK, htonl(skb->mark)); | 457 | NLA_PUT_BE32(inst->skb, NFULA_MARK, htonl(skb->mark)); |
| 458 | 458 | ||
| 459 | if (indev && skb->dev) { | 459 | if (indev && skb->dev && |
| 460 | skb->mac_header != skb->network_header) { | ||
| 460 | struct nfulnl_msg_packet_hw phw; | 461 | struct nfulnl_msg_packet_hw phw; |
| 461 | int len = dev_parse_header(skb, phw.hw_addr); | 462 | int len = dev_parse_header(skb, phw.hw_addr); |
| 462 | if (len > 0) { | 463 | if (len > 0) { |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index b83123f12b42..fdd2fafe0a14 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
| @@ -335,7 +335,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
| 335 | if (entskb->mark) | 335 | if (entskb->mark) |
| 336 | NLA_PUT_BE32(skb, NFQA_MARK, htonl(entskb->mark)); | 336 | NLA_PUT_BE32(skb, NFQA_MARK, htonl(entskb->mark)); |
| 337 | 337 | ||
| 338 | if (indev && entskb->dev) { | 338 | if (indev && entskb->dev && |
| 339 | entskb->mac_header != entskb->network_header) { | ||
| 339 | struct nfqnl_msg_packet_hw phw; | 340 | struct nfqnl_msg_packet_hw phw; |
| 340 | int len = dev_parse_header(entskb, phw.hw_addr); | 341 | int len = dev_parse_header(entskb, phw.hw_addr); |
| 341 | if (len) { | 342 | if (len) { |
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index 9cc46356b577..fe39f7e913df 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
| @@ -143,9 +143,9 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
| 143 | ct = nf_ct_get(skb, &ctinfo); | 143 | ct = nf_ct_get(skb, &ctinfo); |
| 144 | if (ct && !nf_ct_is_untracked(ct) && | 144 | if (ct && !nf_ct_is_untracked(ct) && |
| 145 | ((iph->protocol != IPPROTO_ICMP && | 145 | ((iph->protocol != IPPROTO_ICMP && |
| 146 | ctinfo == IP_CT_IS_REPLY + IP_CT_ESTABLISHED) || | 146 | ctinfo == IP_CT_ESTABLISHED_REPLY) || |
| 147 | (iph->protocol == IPPROTO_ICMP && | 147 | (iph->protocol == IPPROTO_ICMP && |
| 148 | ctinfo == IP_CT_IS_REPLY + IP_CT_RELATED)) && | 148 | ctinfo == IP_CT_RELATED_REPLY)) && |
| 149 | (ct->status & IPS_SRC_NAT_DONE)) { | 149 | (ct->status & IPS_SRC_NAT_DONE)) { |
| 150 | 150 | ||
| 151 | daddr = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; | 151 | daddr = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index b54ec41adea9..461b16fa1c52 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
| @@ -804,6 +804,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
| 804 | } else { | 804 | } else { |
| 805 | h.h2->tp_vlan_tci = 0; | 805 | h.h2->tp_vlan_tci = 0; |
| 806 | } | 806 | } |
| 807 | h.h2->tp_padding = 0; | ||
| 807 | hdrlen = sizeof(*h.h2); | 808 | hdrlen = sizeof(*h.h2); |
| 808 | break; | 809 | break; |
| 809 | default: | 810 | default: |
| @@ -1743,6 +1744,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1743 | } else { | 1744 | } else { |
| 1744 | aux.tp_vlan_tci = 0; | 1745 | aux.tp_vlan_tci = 0; |
| 1745 | } | 1746 | } |
| 1747 | aux.tp_padding = 0; | ||
| 1746 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); | 1748 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); |
| 1747 | } | 1749 | } |
| 1748 | 1750 | ||
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index b1721d71c27c..b4c680900d7a 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
| @@ -251,9 +251,8 @@ static void dev_watchdog(unsigned long arg) | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | if (some_queue_timedout) { | 253 | if (some_queue_timedout) { |
| 254 | char drivername[64]; | ||
| 255 | WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", | 254 | WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", |
| 256 | dev->name, netdev_drivername(dev, drivername, 64), i); | 255 | dev->name, netdev_drivername(dev), i); |
| 257 | dev->netdev_ops->ndo_tx_timeout(dev); | 256 | dev->netdev_ops->ndo_tx_timeout(dev); |
| 258 | } | 257 | } |
| 259 | if (!mod_timer(&dev->watchdog_timer, | 258 | if (!mod_timer(&dev->watchdog_timer, |
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index 0a9a2ec2e469..c3b75333b821 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/sunrpc/gss_krb5.h> | 43 | #include <linux/sunrpc/gss_krb5.h> |
| 44 | #include <linux/sunrpc/xdr.h> | 44 | #include <linux/sunrpc/xdr.h> |
| 45 | #include <linux/crypto.h> | 45 | #include <linux/crypto.h> |
| 46 | #include <linux/sunrpc/gss_krb5_enctypes.h> | ||
| 46 | 47 | ||
| 47 | #ifdef RPC_DEBUG | 48 | #ifdef RPC_DEBUG |
| 48 | # define RPCDBG_FACILITY RPCDBG_AUTH | 49 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| @@ -750,7 +751,7 @@ static struct gss_api_mech gss_kerberos_mech = { | |||
| 750 | .gm_ops = &gss_kerberos_ops, | 751 | .gm_ops = &gss_kerberos_ops, |
| 751 | .gm_pf_num = ARRAY_SIZE(gss_kerberos_pfs), | 752 | .gm_pf_num = ARRAY_SIZE(gss_kerberos_pfs), |
| 752 | .gm_pfs = gss_kerberos_pfs, | 753 | .gm_pfs = gss_kerberos_pfs, |
| 753 | .gm_upcall_enctypes = "18,17,16,23,3,1,2", | 754 | .gm_upcall_enctypes = KRB5_SUPPORTED_ENCTYPES, |
| 754 | }; | 755 | }; |
| 755 | 756 | ||
| 756 | static int __init init_kerberos_module(void) | 757 | static int __init init_kerberos_module(void) |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 70cbc8ca371e..10823e2b60ce 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -3406,11 +3406,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
| 3406 | i = 0; | 3406 | i = 0; |
| 3407 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { | 3407 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { |
| 3408 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { | 3408 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { |
| 3409 | request->ssids[i].ssid_len = nla_len(attr); | 3409 | if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) { |
| 3410 | if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) { | ||
| 3411 | err = -EINVAL; | 3410 | err = -EINVAL; |
| 3412 | goto out_free; | 3411 | goto out_free; |
| 3413 | } | 3412 | } |
| 3413 | request->ssids[i].ssid_len = nla_len(attr); | ||
| 3414 | memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); | 3414 | memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); |
| 3415 | i++; | 3415 | i++; |
| 3416 | } | 3416 | } |
| @@ -3572,12 +3572,11 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
| 3572 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { | 3572 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { |
| 3573 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], | 3573 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], |
| 3574 | tmp) { | 3574 | tmp) { |
| 3575 | request->ssids[i].ssid_len = nla_len(attr); | 3575 | if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) { |
| 3576 | if (request->ssids[i].ssid_len > | ||
| 3577 | IEEE80211_MAX_SSID_LEN) { | ||
| 3578 | err = -EINVAL; | 3576 | err = -EINVAL; |
| 3579 | goto out_free; | 3577 | goto out_free; |
| 3580 | } | 3578 | } |
| 3579 | request->ssids[i].ssid_len = nla_len(attr); | ||
| 3581 | memcpy(request->ssids[i].ssid, nla_data(attr), | 3580 | memcpy(request->ssids[i].ssid, nla_data(attr), |
| 3582 | nla_len(attr)); | 3581 | nla_len(attr)); |
| 3583 | i++; | 3582 | i++; |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 47f1b8638df9..b11ea692bd7d 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
| @@ -265,7 +265,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq) | |||
| 265 | bitnr = bitnr & 0x1F; | 265 | bitnr = bitnr & 0x1F; |
| 266 | replay_esn->bmp[nr] |= (1U << bitnr); | 266 | replay_esn->bmp[nr] |= (1U << bitnr); |
| 267 | } else { | 267 | } else { |
| 268 | nr = replay_esn->replay_window >> 5; | 268 | nr = (replay_esn->replay_window - 1) >> 5; |
| 269 | for (i = 0; i <= nr; i++) | 269 | for (i = 0; i <= nr; i++) |
| 270 | replay_esn->bmp[i] = 0; | 270 | replay_esn->bmp[i] = 0; |
| 271 | 271 | ||
| @@ -471,7 +471,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) | |||
| 471 | bitnr = bitnr & 0x1F; | 471 | bitnr = bitnr & 0x1F; |
| 472 | replay_esn->bmp[nr] |= (1U << bitnr); | 472 | replay_esn->bmp[nr] |= (1U << bitnr); |
| 473 | } else { | 473 | } else { |
| 474 | nr = replay_esn->replay_window >> 5; | 474 | nr = (replay_esn->replay_window - 1) >> 5; |
| 475 | for (i = 0; i <= nr; i++) | 475 | for (i = 0; i <= nr; i++) |
| 476 | replay_esn->bmp[i] = 0; | 476 | replay_esn->bmp[i] = 0; |
| 477 | 477 | ||
