diff options
Diffstat (limited to 'net')
41 files changed, 360 insertions, 287 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 0906c194a413..9d9a6a3edbd5 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -2011,16 +2011,17 @@ static void __exit ax25_exit(void) | |||
2011 | proc_net_remove(&init_net, "ax25_route"); | 2011 | proc_net_remove(&init_net, "ax25_route"); |
2012 | proc_net_remove(&init_net, "ax25"); | 2012 | proc_net_remove(&init_net, "ax25"); |
2013 | proc_net_remove(&init_net, "ax25_calls"); | 2013 | proc_net_remove(&init_net, "ax25_calls"); |
2014 | ax25_rt_free(); | ||
2015 | ax25_uid_free(); | ||
2016 | ax25_dev_free(); | ||
2017 | 2014 | ||
2018 | ax25_unregister_sysctl(); | ||
2019 | unregister_netdevice_notifier(&ax25_dev_notifier); | 2015 | unregister_netdevice_notifier(&ax25_dev_notifier); |
2016 | ax25_unregister_sysctl(); | ||
2020 | 2017 | ||
2021 | dev_remove_pack(&ax25_packet_type); | 2018 | dev_remove_pack(&ax25_packet_type); |
2022 | 2019 | ||
2023 | sock_unregister(PF_AX25); | 2020 | sock_unregister(PF_AX25); |
2024 | proto_unregister(&ax25_proto); | 2021 | proto_unregister(&ax25_proto); |
2022 | |||
2023 | ax25_rt_free(); | ||
2024 | ax25_uid_free(); | ||
2025 | ax25_dev_free(); | ||
2025 | } | 2026 | } |
2026 | module_exit(ax25_exit); | 2027 | module_exit(ax25_exit); |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 61f65344e711..a2098e3de500 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -47,6 +47,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb) | |||
47 | kfree_skb(skb); | 47 | kfree_skb(skb); |
48 | } else { | 48 | } else { |
49 | skb_push(skb, ETH_HLEN); | 49 | skb_push(skb, ETH_HLEN); |
50 | br_drop_fake_rtable(skb); | ||
50 | dev_queue_xmit(skb); | 51 | dev_queue_xmit(skb); |
51 | } | 52 | } |
52 | 53 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 702a1ae9220b..27ca25ed7021 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -241,7 +241,6 @@ static void br_multicast_group_expired(unsigned long data) | |||
241 | hlist_del_rcu(&mp->hlist[mdb->ver]); | 241 | hlist_del_rcu(&mp->hlist[mdb->ver]); |
242 | mdb->size--; | 242 | mdb->size--; |
243 | 243 | ||
244 | del_timer(&mp->query_timer); | ||
245 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 244 | call_rcu_bh(&mp->rcu, br_multicast_free_group); |
246 | 245 | ||
247 | out: | 246 | out: |
@@ -271,7 +270,6 @@ static void br_multicast_del_pg(struct net_bridge *br, | |||
271 | rcu_assign_pointer(*pp, p->next); | 270 | rcu_assign_pointer(*pp, p->next); |
272 | hlist_del_init(&p->mglist); | 271 | hlist_del_init(&p->mglist); |
273 | del_timer(&p->timer); | 272 | del_timer(&p->timer); |
274 | del_timer(&p->query_timer); | ||
275 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 273 | call_rcu_bh(&p->rcu, br_multicast_free_pg); |
276 | 274 | ||
277 | if (!mp->ports && !mp->mglist && | 275 | if (!mp->ports && !mp->mglist && |
@@ -507,74 +505,6 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br, | |||
507 | return NULL; | 505 | return NULL; |
508 | } | 506 | } |
509 | 507 | ||
510 | static void br_multicast_send_group_query(struct net_bridge_mdb_entry *mp) | ||
511 | { | ||
512 | struct net_bridge *br = mp->br; | ||
513 | struct sk_buff *skb; | ||
514 | |||
515 | skb = br_multicast_alloc_query(br, &mp->addr); | ||
516 | if (!skb) | ||
517 | goto timer; | ||
518 | |||
519 | netif_rx(skb); | ||
520 | |||
521 | timer: | ||
522 | if (++mp->queries_sent < br->multicast_last_member_count) | ||
523 | mod_timer(&mp->query_timer, | ||
524 | jiffies + br->multicast_last_member_interval); | ||
525 | } | ||
526 | |||
527 | static void br_multicast_group_query_expired(unsigned long data) | ||
528 | { | ||
529 | struct net_bridge_mdb_entry *mp = (void *)data; | ||
530 | struct net_bridge *br = mp->br; | ||
531 | |||
532 | spin_lock(&br->multicast_lock); | ||
533 | if (!netif_running(br->dev) || !mp->mglist || | ||
534 | mp->queries_sent >= br->multicast_last_member_count) | ||
535 | goto out; | ||
536 | |||
537 | br_multicast_send_group_query(mp); | ||
538 | |||
539 | out: | ||
540 | spin_unlock(&br->multicast_lock); | ||
541 | } | ||
542 | |||
543 | static void br_multicast_send_port_group_query(struct net_bridge_port_group *pg) | ||
544 | { | ||
545 | struct net_bridge_port *port = pg->port; | ||
546 | struct net_bridge *br = port->br; | ||
547 | struct sk_buff *skb; | ||
548 | |||
549 | skb = br_multicast_alloc_query(br, &pg->addr); | ||
550 | if (!skb) | ||
551 | goto timer; | ||
552 | |||
553 | br_deliver(port, skb); | ||
554 | |||
555 | timer: | ||
556 | if (++pg->queries_sent < br->multicast_last_member_count) | ||
557 | mod_timer(&pg->query_timer, | ||
558 | jiffies + br->multicast_last_member_interval); | ||
559 | } | ||
560 | |||
561 | static void br_multicast_port_group_query_expired(unsigned long data) | ||
562 | { | ||
563 | struct net_bridge_port_group *pg = (void *)data; | ||
564 | struct net_bridge_port *port = pg->port; | ||
565 | struct net_bridge *br = port->br; | ||
566 | |||
567 | spin_lock(&br->multicast_lock); | ||
568 | if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) || | ||
569 | pg->queries_sent >= br->multicast_last_member_count) | ||
570 | goto out; | ||
571 | |||
572 | br_multicast_send_port_group_query(pg); | ||
573 | |||
574 | out: | ||
575 | spin_unlock(&br->multicast_lock); | ||
576 | } | ||
577 | |||
578 | static struct net_bridge_mdb_entry *br_multicast_get_group( | 508 | static struct net_bridge_mdb_entry *br_multicast_get_group( |
579 | struct net_bridge *br, struct net_bridge_port *port, | 509 | struct net_bridge *br, struct net_bridge_port *port, |
580 | struct br_ip *group, int hash) | 510 | struct br_ip *group, int hash) |
@@ -690,8 +620,6 @@ rehash: | |||
690 | mp->addr = *group; | 620 | mp->addr = *group; |
691 | setup_timer(&mp->timer, br_multicast_group_expired, | 621 | setup_timer(&mp->timer, br_multicast_group_expired, |
692 | (unsigned long)mp); | 622 | (unsigned long)mp); |
693 | setup_timer(&mp->query_timer, br_multicast_group_query_expired, | ||
694 | (unsigned long)mp); | ||
695 | 623 | ||
696 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); | 624 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); |
697 | mdb->size++; | 625 | mdb->size++; |
@@ -746,8 +674,6 @@ static int br_multicast_add_group(struct net_bridge *br, | |||
746 | hlist_add_head(&p->mglist, &port->mglist); | 674 | hlist_add_head(&p->mglist, &port->mglist); |
747 | setup_timer(&p->timer, br_multicast_port_group_expired, | 675 | setup_timer(&p->timer, br_multicast_port_group_expired, |
748 | (unsigned long)p); | 676 | (unsigned long)p); |
749 | setup_timer(&p->query_timer, br_multicast_port_group_query_expired, | ||
750 | (unsigned long)p); | ||
751 | 677 | ||
752 | rcu_assign_pointer(*pp, p); | 678 | rcu_assign_pointer(*pp, p); |
753 | 679 | ||
@@ -1291,9 +1217,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1291 | time_after(mp->timer.expires, time) : | 1217 | time_after(mp->timer.expires, time) : |
1292 | try_to_del_timer_sync(&mp->timer) >= 0)) { | 1218 | try_to_del_timer_sync(&mp->timer) >= 0)) { |
1293 | mod_timer(&mp->timer, time); | 1219 | mod_timer(&mp->timer, time); |
1294 | |||
1295 | mp->queries_sent = 0; | ||
1296 | mod_timer(&mp->query_timer, now); | ||
1297 | } | 1220 | } |
1298 | 1221 | ||
1299 | goto out; | 1222 | goto out; |
@@ -1310,9 +1233,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1310 | time_after(p->timer.expires, time) : | 1233 | time_after(p->timer.expires, time) : |
1311 | try_to_del_timer_sync(&p->timer) >= 0)) { | 1234 | try_to_del_timer_sync(&p->timer) >= 0)) { |
1312 | mod_timer(&p->timer, time); | 1235 | mod_timer(&p->timer, time); |
1313 | |||
1314 | p->queries_sent = 0; | ||
1315 | mod_timer(&p->query_timer, now); | ||
1316 | } | 1236 | } |
1317 | 1237 | ||
1318 | break; | 1238 | break; |
@@ -1681,7 +1601,6 @@ void br_multicast_stop(struct net_bridge *br) | |||
1681 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], | 1601 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], |
1682 | hlist[ver]) { | 1602 | hlist[ver]) { |
1683 | del_timer(&mp->timer); | 1603 | del_timer(&mp->timer); |
1684 | del_timer(&mp->query_timer); | ||
1685 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 1604 | call_rcu_bh(&mp->rcu, br_multicast_free_group); |
1686 | } | 1605 | } |
1687 | } | 1606 | } |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index dec4f3817133..d7f49b63ab0f 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -156,7 +156,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
156 | rt->dst.dev = br->dev; | 156 | rt->dst.dev = br->dev; |
157 | rt->dst.path = &rt->dst; | 157 | rt->dst.path = &rt->dst; |
158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); | 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER; | 159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER | DST_FAKE_RTABLE; |
160 | rt->dst.ops = &fake_dst_ops; | 160 | rt->dst.ops = &fake_dst_ops; |
161 | } | 161 | } |
162 | 162 | ||
@@ -694,11 +694,7 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, | |||
694 | const struct net_device *out, | 694 | const struct net_device *out, |
695 | int (*okfn)(struct sk_buff *)) | 695 | int (*okfn)(struct sk_buff *)) |
696 | { | 696 | { |
697 | struct rtable *rt = skb_rtable(skb); | 697 | br_drop_fake_rtable(skb); |
698 | |||
699 | if (rt && rt == bridge_parent_rtable(in)) | ||
700 | skb_dst_drop(skb); | ||
701 | |||
702 | return NF_ACCEPT; | 698 | return NF_ACCEPT; |
703 | } | 699 | } |
704 | 700 | ||
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 0b67a63ad7a8..e1d882257877 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -82,9 +82,7 @@ struct net_bridge_port_group { | |||
82 | struct hlist_node mglist; | 82 | struct hlist_node mglist; |
83 | struct rcu_head rcu; | 83 | struct rcu_head rcu; |
84 | struct timer_list timer; | 84 | struct timer_list timer; |
85 | struct timer_list query_timer; | ||
86 | struct br_ip addr; | 85 | struct br_ip addr; |
87 | u32 queries_sent; | ||
88 | }; | 86 | }; |
89 | 87 | ||
90 | struct net_bridge_mdb_entry | 88 | struct net_bridge_mdb_entry |
@@ -94,10 +92,8 @@ struct net_bridge_mdb_entry | |||
94 | struct net_bridge_port_group __rcu *ports; | 92 | struct net_bridge_port_group __rcu *ports; |
95 | struct rcu_head rcu; | 93 | struct rcu_head rcu; |
96 | struct timer_list timer; | 94 | struct timer_list timer; |
97 | struct timer_list query_timer; | ||
98 | struct br_ip addr; | 95 | struct br_ip addr; |
99 | bool mglist; | 96 | bool mglist; |
100 | u32 queries_sent; | ||
101 | }; | 97 | }; |
102 | 98 | ||
103 | struct net_bridge_mdb_htable | 99 | struct net_bridge_mdb_htable |
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 20618dd3088b..d09340e1523f 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
103 | skb->protocol = htons(ETH_P_IPV6); | 103 | skb->protocol = htons(ETH_P_IPV6); |
104 | break; | 104 | break; |
105 | default: | 105 | default: |
106 | kfree_skb(skb); | ||
106 | priv->netdev->stats.rx_errors++; | 107 | priv->netdev->stats.rx_errors++; |
107 | return -EINVAL; | 108 | return -EINVAL; |
108 | } | 109 | } |
@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
220 | 221 | ||
221 | if (skb->len > priv->netdev->mtu) { | 222 | if (skb->len > priv->netdev->mtu) { |
222 | pr_warn("Size of skb exceeded MTU\n"); | 223 | pr_warn("Size of skb exceeded MTU\n"); |
224 | kfree_skb(skb); | ||
223 | dev->stats.tx_errors++; | 225 | dev->stats.tx_errors++; |
224 | return -ENOSPC; | 226 | return NETDEV_TX_OK; |
225 | } | 227 | } |
226 | 228 | ||
227 | if (!priv->flowenabled) { | 229 | if (!priv->flowenabled) { |
228 | pr_debug("dropping packets flow off\n"); | 230 | pr_debug("dropping packets flow off\n"); |
231 | kfree_skb(skb); | ||
229 | dev->stats.tx_dropped++; | 232 | dev->stats.tx_dropped++; |
230 | return NETDEV_TX_BUSY; | 233 | return NETDEV_TX_OK; |
231 | } | 234 | } |
232 | 235 | ||
233 | if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) | 236 | if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) |
@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
242 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); | 245 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); |
243 | if (result) { | 246 | if (result) { |
244 | dev->stats.tx_dropped++; | 247 | dev->stats.tx_dropped++; |
245 | return result; | 248 | return NETDEV_TX_OK; |
246 | } | 249 | } |
247 | 250 | ||
248 | /* Update statistics. */ | 251 | /* Update statistics. */ |
diff --git a/net/core/dev.c b/net/core/dev.c index c25d453b2803..9bb8f87c4cda 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier); | |||
1409 | * register_netdevice_notifier(). The notifier is unlinked into the | 1409 | * register_netdevice_notifier(). The notifier is unlinked into the |
1410 | * kernel structures and may then be reused. A negative errno code | 1410 | * kernel structures and may then be reused. A negative errno code |
1411 | * is returned on a failure. | 1411 | * is returned on a failure. |
1412 | * | ||
1413 | * After unregistering unregister and down device events are synthesized | ||
1414 | * for all devices on the device list to the removed notifier to remove | ||
1415 | * the need for special case cleanup code. | ||
1412 | */ | 1416 | */ |
1413 | 1417 | ||
1414 | int unregister_netdevice_notifier(struct notifier_block *nb) | 1418 | int unregister_netdevice_notifier(struct notifier_block *nb) |
1415 | { | 1419 | { |
1420 | struct net_device *dev; | ||
1421 | struct net *net; | ||
1416 | int err; | 1422 | int err; |
1417 | 1423 | ||
1418 | rtnl_lock(); | 1424 | rtnl_lock(); |
1419 | err = raw_notifier_chain_unregister(&netdev_chain, nb); | 1425 | err = raw_notifier_chain_unregister(&netdev_chain, nb); |
1426 | if (err) | ||
1427 | goto unlock; | ||
1428 | |||
1429 | for_each_net(net) { | ||
1430 | for_each_netdev(net, dev) { | ||
1431 | if (dev->flags & IFF_UP) { | ||
1432 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | ||
1433 | nb->notifier_call(nb, NETDEV_DOWN, dev); | ||
1434 | } | ||
1435 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | ||
1436 | nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev); | ||
1437 | } | ||
1438 | } | ||
1439 | unlock: | ||
1420 | rtnl_unlock(); | 1440 | rtnl_unlock(); |
1421 | return err; | 1441 | return err; |
1422 | } | 1442 | } |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 7f36b38e060f..7592943513e3 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -42,11 +42,11 @@ static void send_dm_alert(struct work_struct *unused); | |||
42 | * netlink alerts | 42 | * netlink alerts |
43 | */ | 43 | */ |
44 | static int trace_state = TRACE_OFF; | 44 | static int trace_state = TRACE_OFF; |
45 | static DEFINE_SPINLOCK(trace_state_lock); | 45 | static DEFINE_MUTEX(trace_state_mutex); |
46 | 46 | ||
47 | struct per_cpu_dm_data { | 47 | struct per_cpu_dm_data { |
48 | struct work_struct dm_alert_work; | 48 | struct work_struct dm_alert_work; |
49 | struct sk_buff *skb; | 49 | struct sk_buff __rcu *skb; |
50 | atomic_t dm_hit_count; | 50 | atomic_t dm_hit_count; |
51 | struct timer_list send_timer; | 51 | struct timer_list send_timer; |
52 | }; | 52 | }; |
@@ -73,35 +73,58 @@ static int dm_hit_limit = 64; | |||
73 | static int dm_delay = 1; | 73 | static int dm_delay = 1; |
74 | static unsigned long dm_hw_check_delta = 2*HZ; | 74 | static unsigned long dm_hw_check_delta = 2*HZ; |
75 | static LIST_HEAD(hw_stats_list); | 75 | static LIST_HEAD(hw_stats_list); |
76 | static int initialized = 0; | ||
76 | 77 | ||
77 | static void reset_per_cpu_data(struct per_cpu_dm_data *data) | 78 | static void reset_per_cpu_data(struct per_cpu_dm_data *data) |
78 | { | 79 | { |
79 | size_t al; | 80 | size_t al; |
80 | struct net_dm_alert_msg *msg; | 81 | struct net_dm_alert_msg *msg; |
81 | struct nlattr *nla; | 82 | struct nlattr *nla; |
83 | struct sk_buff *skb; | ||
84 | struct sk_buff *oskb = rcu_dereference_protected(data->skb, 1); | ||
82 | 85 | ||
83 | al = sizeof(struct net_dm_alert_msg); | 86 | al = sizeof(struct net_dm_alert_msg); |
84 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); | 87 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
85 | al += sizeof(struct nlattr); | 88 | al += sizeof(struct nlattr); |
86 | 89 | ||
87 | data->skb = genlmsg_new(al, GFP_KERNEL); | 90 | skb = genlmsg_new(al, GFP_KERNEL); |
88 | genlmsg_put(data->skb, 0, 0, &net_drop_monitor_family, | 91 | |
89 | 0, NET_DM_CMD_ALERT); | 92 | if (skb) { |
90 | nla = nla_reserve(data->skb, NLA_UNSPEC, sizeof(struct net_dm_alert_msg)); | 93 | genlmsg_put(skb, 0, 0, &net_drop_monitor_family, |
91 | msg = nla_data(nla); | 94 | 0, NET_DM_CMD_ALERT); |
92 | memset(msg, 0, al); | 95 | nla = nla_reserve(skb, NLA_UNSPEC, |
93 | atomic_set(&data->dm_hit_count, dm_hit_limit); | 96 | sizeof(struct net_dm_alert_msg)); |
97 | msg = nla_data(nla); | ||
98 | memset(msg, 0, al); | ||
99 | } else if (initialized) | ||
100 | schedule_work_on(smp_processor_id(), &data->dm_alert_work); | ||
101 | |||
102 | /* | ||
103 | * Don't need to lock this, since we are guaranteed to only | ||
104 | * run this on a single cpu at a time. | ||
105 | * Note also that we only update data->skb if the old and new skb | ||
106 | * pointers don't match. This ensures that we don't continually call | ||
107 | * synchornize_rcu if we repeatedly fail to alloc a new netlink message. | ||
108 | */ | ||
109 | if (skb != oskb) { | ||
110 | rcu_assign_pointer(data->skb, skb); | ||
111 | |||
112 | synchronize_rcu(); | ||
113 | |||
114 | atomic_set(&data->dm_hit_count, dm_hit_limit); | ||
115 | } | ||
116 | |||
94 | } | 117 | } |
95 | 118 | ||
96 | static void send_dm_alert(struct work_struct *unused) | 119 | static void send_dm_alert(struct work_struct *unused) |
97 | { | 120 | { |
98 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
99 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 122 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
100 | 123 | ||
101 | /* | 124 | /* |
102 | * Grab the skb we're about to send | 125 | * Grab the skb we're about to send |
103 | */ | 126 | */ |
104 | skb = data->skb; | 127 | skb = rcu_dereference_protected(data->skb, 1); |
105 | 128 | ||
106 | /* | 129 | /* |
107 | * Replace it with a new one | 130 | * Replace it with a new one |
@@ -111,8 +134,10 @@ static void send_dm_alert(struct work_struct *unused) | |||
111 | /* | 134 | /* |
112 | * Ship it! | 135 | * Ship it! |
113 | */ | 136 | */ |
114 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | 137 | if (skb) |
138 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | ||
115 | 139 | ||
140 | put_cpu_var(dm_cpu_data); | ||
116 | } | 141 | } |
117 | 142 | ||
118 | /* | 143 | /* |
@@ -123,9 +148,11 @@ static void send_dm_alert(struct work_struct *unused) | |||
123 | */ | 148 | */ |
124 | static void sched_send_work(unsigned long unused) | 149 | static void sched_send_work(unsigned long unused) |
125 | { | 150 | { |
126 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 151 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
152 | |||
153 | schedule_work_on(smp_processor_id(), &data->dm_alert_work); | ||
127 | 154 | ||
128 | schedule_work(&data->dm_alert_work); | 155 | put_cpu_var(dm_cpu_data); |
129 | } | 156 | } |
130 | 157 | ||
131 | static void trace_drop_common(struct sk_buff *skb, void *location) | 158 | static void trace_drop_common(struct sk_buff *skb, void *location) |
@@ -134,9 +161,16 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
134 | struct nlmsghdr *nlh; | 161 | struct nlmsghdr *nlh; |
135 | struct nlattr *nla; | 162 | struct nlattr *nla; |
136 | int i; | 163 | int i; |
137 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 164 | struct sk_buff *dskb; |
165 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | ||
138 | 166 | ||
139 | 167 | ||
168 | rcu_read_lock(); | ||
169 | dskb = rcu_dereference(data->skb); | ||
170 | |||
171 | if (!dskb) | ||
172 | goto out; | ||
173 | |||
140 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { | 174 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { |
141 | /* | 175 | /* |
142 | * we're already at zero, discard this hit | 176 | * we're already at zero, discard this hit |
@@ -144,12 +178,13 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
144 | goto out; | 178 | goto out; |
145 | } | 179 | } |
146 | 180 | ||
147 | nlh = (struct nlmsghdr *)data->skb->data; | 181 | nlh = (struct nlmsghdr *)dskb->data; |
148 | nla = genlmsg_data(nlmsg_data(nlh)); | 182 | nla = genlmsg_data(nlmsg_data(nlh)); |
149 | msg = nla_data(nla); | 183 | msg = nla_data(nla); |
150 | for (i = 0; i < msg->entries; i++) { | 184 | for (i = 0; i < msg->entries; i++) { |
151 | if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { | 185 | if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { |
152 | msg->points[i].count++; | 186 | msg->points[i].count++; |
187 | atomic_inc(&data->dm_hit_count); | ||
153 | goto out; | 188 | goto out; |
154 | } | 189 | } |
155 | } | 190 | } |
@@ -157,7 +192,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
157 | /* | 192 | /* |
158 | * We need to create a new entry | 193 | * We need to create a new entry |
159 | */ | 194 | */ |
160 | __nla_reserve_nohdr(data->skb, sizeof(struct net_dm_drop_point)); | 195 | __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point)); |
161 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); | 196 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); |
162 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); | 197 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); |
163 | msg->points[msg->entries].count = 1; | 198 | msg->points[msg->entries].count = 1; |
@@ -169,6 +204,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
169 | } | 204 | } |
170 | 205 | ||
171 | out: | 206 | out: |
207 | rcu_read_unlock(); | ||
208 | put_cpu_var(dm_cpu_data); | ||
172 | return; | 209 | return; |
173 | } | 210 | } |
174 | 211 | ||
@@ -213,7 +250,7 @@ static int set_all_monitor_traces(int state) | |||
213 | struct dm_hw_stat_delta *new_stat = NULL; | 250 | struct dm_hw_stat_delta *new_stat = NULL; |
214 | struct dm_hw_stat_delta *temp; | 251 | struct dm_hw_stat_delta *temp; |
215 | 252 | ||
216 | spin_lock(&trace_state_lock); | 253 | mutex_lock(&trace_state_mutex); |
217 | 254 | ||
218 | if (state == trace_state) { | 255 | if (state == trace_state) { |
219 | rc = -EAGAIN; | 256 | rc = -EAGAIN; |
@@ -252,7 +289,7 @@ static int set_all_monitor_traces(int state) | |||
252 | rc = -EINPROGRESS; | 289 | rc = -EINPROGRESS; |
253 | 290 | ||
254 | out_unlock: | 291 | out_unlock: |
255 | spin_unlock(&trace_state_lock); | 292 | mutex_unlock(&trace_state_mutex); |
256 | 293 | ||
257 | return rc; | 294 | return rc; |
258 | } | 295 | } |
@@ -295,12 +332,12 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
295 | 332 | ||
296 | new_stat->dev = dev; | 333 | new_stat->dev = dev; |
297 | new_stat->last_rx = jiffies; | 334 | new_stat->last_rx = jiffies; |
298 | spin_lock(&trace_state_lock); | 335 | mutex_lock(&trace_state_mutex); |
299 | list_add_rcu(&new_stat->list, &hw_stats_list); | 336 | list_add_rcu(&new_stat->list, &hw_stats_list); |
300 | spin_unlock(&trace_state_lock); | 337 | mutex_unlock(&trace_state_mutex); |
301 | break; | 338 | break; |
302 | case NETDEV_UNREGISTER: | 339 | case NETDEV_UNREGISTER: |
303 | spin_lock(&trace_state_lock); | 340 | mutex_lock(&trace_state_mutex); |
304 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { | 341 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
305 | if (new_stat->dev == dev) { | 342 | if (new_stat->dev == dev) { |
306 | new_stat->dev = NULL; | 343 | new_stat->dev = NULL; |
@@ -311,7 +348,7 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
311 | } | 348 | } |
312 | } | 349 | } |
313 | } | 350 | } |
314 | spin_unlock(&trace_state_lock); | 351 | mutex_unlock(&trace_state_mutex); |
315 | break; | 352 | break; |
316 | } | 353 | } |
317 | out: | 354 | out: |
@@ -374,6 +411,8 @@ static int __init init_net_drop_monitor(void) | |||
374 | data->send_timer.function = sched_send_work; | 411 | data->send_timer.function = sched_send_work; |
375 | } | 412 | } |
376 | 413 | ||
414 | initialized = 1; | ||
415 | |||
377 | goto out; | 416 | goto out; |
378 | 417 | ||
379 | out_unreg: | 418 | out_unreg: |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 0e950fda9a0a..31a5ae51a45c 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -83,21 +83,29 @@ assign: | |||
83 | 83 | ||
84 | static int ops_init(const struct pernet_operations *ops, struct net *net) | 84 | static int ops_init(const struct pernet_operations *ops, struct net *net) |
85 | { | 85 | { |
86 | int err; | 86 | int err = -ENOMEM; |
87 | void *data = NULL; | ||
88 | |||
87 | if (ops->id && ops->size) { | 89 | if (ops->id && ops->size) { |
88 | void *data = kzalloc(ops->size, GFP_KERNEL); | 90 | data = kzalloc(ops->size, GFP_KERNEL); |
89 | if (!data) | 91 | if (!data) |
90 | return -ENOMEM; | 92 | goto out; |
91 | 93 | ||
92 | err = net_assign_generic(net, *ops->id, data); | 94 | err = net_assign_generic(net, *ops->id, data); |
93 | if (err) { | 95 | if (err) |
94 | kfree(data); | 96 | goto cleanup; |
95 | return err; | ||
96 | } | ||
97 | } | 97 | } |
98 | err = 0; | ||
98 | if (ops->init) | 99 | if (ops->init) |
99 | return ops->init(net); | 100 | err = ops->init(net); |
100 | return 0; | 101 | if (!err) |
102 | return 0; | ||
103 | |||
104 | cleanup: | ||
105 | kfree(data); | ||
106 | |||
107 | out: | ||
108 | return err; | ||
101 | } | 109 | } |
102 | 110 | ||
103 | static void ops_free(const struct pernet_operations *ops, struct net *net) | 111 | static void ops_free(const struct pernet_operations *ops, struct net *net) |
@@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops) | |||
448 | static int __register_pernet_operations(struct list_head *list, | 456 | static int __register_pernet_operations(struct list_head *list, |
449 | struct pernet_operations *ops) | 457 | struct pernet_operations *ops) |
450 | { | 458 | { |
451 | int err = 0; | 459 | return ops_init(ops, &init_net); |
452 | err = ops_init(ops, &init_net); | ||
453 | if (err) | ||
454 | ops_free(ops, &init_net); | ||
455 | return err; | ||
456 | |||
457 | } | 460 | } |
458 | 461 | ||
459 | static void __unregister_pernet_operations(struct pernet_operations *ops) | 462 | static void __unregister_pernet_operations(struct pernet_operations *ops) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index baf8d281152c..e59840010d45 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -952,9 +952,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
952 | goto adjust_others; | 952 | goto adjust_others; |
953 | } | 953 | } |
954 | 954 | ||
955 | data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | 955 | data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), |
956 | gfp_mask); | ||
956 | if (!data) | 957 | if (!data) |
957 | goto nodata; | 958 | goto nodata; |
959 | size = SKB_WITH_OVERHEAD(ksize(data)); | ||
958 | 960 | ||
959 | /* Copy only real data... and, alas, header. This should be | 961 | /* Copy only real data... and, alas, header. This should be |
960 | * optimized for the cases when header is void. | 962 | * optimized for the cases when header is void. |
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 368515885368..840821b90bcd 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev) | |||
1044 | free_netdev(dev); | 1044 | free_netdev(dev); |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | ||
1048 | { | ||
1049 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
1050 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | ||
1051 | } | ||
1052 | |||
1053 | static u16 lowpan_get_pan_id(const struct net_device *dev) | ||
1054 | { | ||
1055 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
1056 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | ||
1057 | } | ||
1058 | |||
1059 | static u16 lowpan_get_short_addr(const struct net_device *dev) | ||
1060 | { | ||
1061 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
1062 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | ||
1063 | } | ||
1064 | |||
1047 | static struct header_ops lowpan_header_ops = { | 1065 | static struct header_ops lowpan_header_ops = { |
1048 | .create = lowpan_header_create, | 1066 | .create = lowpan_header_create, |
1049 | }; | 1067 | }; |
@@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = { | |||
1053 | .ndo_set_mac_address = eth_mac_addr, | 1071 | .ndo_set_mac_address = eth_mac_addr, |
1054 | }; | 1072 | }; |
1055 | 1073 | ||
1074 | static struct ieee802154_mlme_ops lowpan_mlme = { | ||
1075 | .get_pan_id = lowpan_get_pan_id, | ||
1076 | .get_phy = lowpan_get_phy, | ||
1077 | .get_short_addr = lowpan_get_short_addr, | ||
1078 | }; | ||
1079 | |||
1056 | static void lowpan_setup(struct net_device *dev) | 1080 | static void lowpan_setup(struct net_device *dev) |
1057 | { | 1081 | { |
1058 | pr_debug("(%s)\n", __func__); | 1082 | pr_debug("(%s)\n", __func__); |
@@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev) | |||
1070 | 1094 | ||
1071 | dev->netdev_ops = &lowpan_netdev_ops; | 1095 | dev->netdev_ops = &lowpan_netdev_ops; |
1072 | dev->header_ops = &lowpan_header_ops; | 1096 | dev->header_ops = &lowpan_header_ops; |
1097 | dev->ml_priv = &lowpan_mlme; | ||
1073 | dev->destructor = lowpan_dev_free; | 1098 | dev->destructor = lowpan_dev_free; |
1074 | } | 1099 | } |
1075 | 1100 | ||
@@ -1143,6 +1168,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
1143 | list_add_tail(&entry->list, &lowpan_devices); | 1168 | list_add_tail(&entry->list, &lowpan_devices); |
1144 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); | 1169 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); |
1145 | 1170 | ||
1171 | spin_lock_init(&flist_lock); | ||
1172 | |||
1146 | register_netdevice(dev); | 1173 | register_netdevice(dev); |
1147 | 1174 | ||
1148 | return 0; | 1175 | return 0; |
@@ -1152,11 +1179,20 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head) | |||
1152 | { | 1179 | { |
1153 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); | 1180 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); |
1154 | struct net_device *real_dev = lowpan_dev->real_dev; | 1181 | struct net_device *real_dev = lowpan_dev->real_dev; |
1155 | struct lowpan_dev_record *entry; | 1182 | struct lowpan_dev_record *entry, *tmp; |
1156 | struct lowpan_dev_record *tmp; | 1183 | struct lowpan_fragment *frame, *tframe; |
1157 | 1184 | ||
1158 | ASSERT_RTNL(); | 1185 | ASSERT_RTNL(); |
1159 | 1186 | ||
1187 | spin_lock(&flist_lock); | ||
1188 | list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) { | ||
1189 | del_timer(&frame->timer); | ||
1190 | list_del(&frame->list); | ||
1191 | dev_kfree_skb(frame->skb); | ||
1192 | kfree(frame); | ||
1193 | } | ||
1194 | spin_unlock(&flist_lock); | ||
1195 | |||
1160 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); | 1196 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); |
1161 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { | 1197 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { |
1162 | if (entry->ldev == dev) { | 1198 | if (entry->ldev == dev) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 8d25a1c557eb..8f8db724bfaf 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -141,7 +141,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
141 | goto rtattr_failure; | 141 | goto rtattr_failure; |
142 | 142 | ||
143 | if (icsk == NULL) { | 143 | if (icsk == NULL) { |
144 | r->idiag_rqueue = r->idiag_wqueue = 0; | 144 | handler->idiag_get_info(sk, r, NULL); |
145 | goto out; | 145 | goto out; |
146 | } | 146 | } |
147 | 147 | ||
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index de9da21113a1..cf73cc70ed2d 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -74,16 +74,24 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | |||
74 | 74 | ||
75 | iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); | 75 | iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); |
76 | if (iph == NULL) | 76 | if (iph == NULL) |
77 | return -NF_DROP; | 77 | return -NF_ACCEPT; |
78 | 78 | ||
79 | /* Conntrack defragments packets, we might still see fragments | 79 | /* Conntrack defragments packets, we might still see fragments |
80 | * inside ICMP packets though. */ | 80 | * inside ICMP packets though. */ |
81 | if (iph->frag_off & htons(IP_OFFSET)) | 81 | if (iph->frag_off & htons(IP_OFFSET)) |
82 | return -NF_DROP; | 82 | return -NF_ACCEPT; |
83 | 83 | ||
84 | *dataoff = nhoff + (iph->ihl << 2); | 84 | *dataoff = nhoff + (iph->ihl << 2); |
85 | *protonum = iph->protocol; | 85 | *protonum = iph->protocol; |
86 | 86 | ||
87 | /* Check bogus IP headers */ | ||
88 | if (*dataoff > skb->len) { | ||
89 | pr_debug("nf_conntrack_ipv4: bogus IPv4 packet: " | ||
90 | "nhoff %u, ihl %u, skblen %u\n", | ||
91 | nhoff, iph->ihl << 2, skb->len); | ||
92 | return -NF_ACCEPT; | ||
93 | } | ||
94 | |||
87 | return NF_ACCEPT; | 95 | return NF_ACCEPT; |
88 | } | 96 | } |
89 | 97 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 5d54ed30e821..8bb6adeb62c0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) | |||
701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | 701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); |
702 | if (skb) { | 702 | if (skb) { |
703 | if (sk_wmem_schedule(sk, skb->truesize)) { | 703 | if (sk_wmem_schedule(sk, skb->truesize)) { |
704 | skb_reserve(skb, sk->sk_prot->max_header); | ||
704 | /* | 705 | /* |
705 | * Make sure that we have exactly size bytes | 706 | * Make sure that we have exactly size bytes |
706 | * available to the caller, no more, no less. | 707 | * available to the caller, no more, no less. |
707 | */ | 708 | */ |
708 | skb_reserve(skb, skb_tailroom(skb) - size); | 709 | skb->avail_size = size; |
709 | return skb; | 710 | return skb; |
710 | } | 711 | } |
711 | __kfree_skb(skb); | 712 | __kfree_skb(skb); |
@@ -995,10 +996,9 @@ new_segment: | |||
995 | copy = seglen; | 996 | copy = seglen; |
996 | 997 | ||
997 | /* Where to copy to? */ | 998 | /* Where to copy to? */ |
998 | if (skb_tailroom(skb) > 0) { | 999 | if (skb_availroom(skb) > 0) { |
999 | /* We have some space in skb head. Superb! */ | 1000 | /* We have some space in skb head. Superb! */ |
1000 | if (copy > skb_tailroom(skb)) | 1001 | copy = min_t(int, copy, skb_availroom(skb)); |
1001 | copy = skb_tailroom(skb); | ||
1002 | err = skb_add_data_nocache(sk, skb, from, copy); | 1002 | err = skb_add_data_nocache(sk, skb, from, copy); |
1003 | if (err) | 1003 | if (err) |
1004 | goto do_fault; | 1004 | goto do_fault; |
@@ -1452,7 +1452,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1452 | if ((available < target) && | 1452 | if ((available < target) && |
1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && | 1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && |
1454 | !sysctl_tcp_low_latency && | 1454 | !sysctl_tcp_low_latency && |
1455 | dma_find_channel(DMA_MEMCPY)) { | 1455 | net_dma_find_channel()) { |
1456 | preempt_enable_no_resched(); | 1456 | preempt_enable_no_resched(); |
1457 | tp->ucopy.pinned_list = | 1457 | tp->ucopy.pinned_list = |
1458 | dma_pin_iovec_pages(msg->msg_iov, len); | 1458 | dma_pin_iovec_pages(msg->msg_iov, len); |
@@ -1667,7 +1667,7 @@ do_prequeue: | |||
1667 | if (!(flags & MSG_TRUNC)) { | 1667 | if (!(flags & MSG_TRUNC)) { |
1668 | #ifdef CONFIG_NET_DMA | 1668 | #ifdef CONFIG_NET_DMA |
1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1670 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1670 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1671 | 1671 | ||
1672 | if (tp->ucopy.dma_chan) { | 1672 | if (tp->ucopy.dma_chan) { |
1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( | 1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( |
@@ -3302,8 +3302,7 @@ void __init tcp_init(void) | |||
3302 | 3302 | ||
3303 | tcp_init_mem(&init_net); | 3303 | tcp_init_mem(&init_net); |
3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10); | 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
3306 | limit = max(limit, 128UL); | ||
3307 | max_share = min(4UL*1024*1024, limit); | 3306 | max_share = min(4UL*1024*1024, limit); |
3308 | 3307 | ||
3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; | 3308 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e886e2f7fa8d..d99efd7dfb6c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -335,6 +335,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) | |||
335 | incr = __tcp_grow_window(sk, skb); | 335 | incr = __tcp_grow_window(sk, skb); |
336 | 336 | ||
337 | if (incr) { | 337 | if (incr) { |
338 | incr = max_t(int, incr, 2 * skb->len); | ||
338 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, | 339 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, |
339 | tp->window_clamp); | 340 | tp->window_clamp); |
340 | inet_csk(sk)->icsk_ack.quick |= 1; | 341 | inet_csk(sk)->icsk_ack.quick |= 1; |
@@ -474,8 +475,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) | |||
474 | if (!win_dep) { | 475 | if (!win_dep) { |
475 | m -= (new_sample >> 3); | 476 | m -= (new_sample >> 3); |
476 | new_sample += m; | 477 | new_sample += m; |
477 | } else if (m < new_sample) | 478 | } else { |
478 | new_sample = m << 3; | 479 | m <<= 3; |
480 | if (m < new_sample) | ||
481 | new_sample = m; | ||
482 | } | ||
479 | } else { | 483 | } else { |
480 | /* No previous measure. */ | 484 | /* No previous measure. */ |
481 | new_sample = m << 3; | 485 | new_sample = m << 3; |
@@ -491,7 +495,7 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) | |||
491 | goto new_measure; | 495 | goto new_measure; |
492 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) | 496 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) |
493 | return; | 497 | return; |
494 | tcp_rcv_rtt_update(tp, jiffies - tp->rcv_rtt_est.time, 1); | 498 | tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_rtt_est.time, 1); |
495 | 499 | ||
496 | new_measure: | 500 | new_measure: |
497 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; | 501 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; |
@@ -2864,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk) | |||
2864 | 2868 | ||
2865 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ | 2869 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ |
2866 | if (tp->undo_marker) { | 2870 | if (tp->undo_marker) { |
2867 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) | 2871 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) { |
2868 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); | 2872 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); |
2869 | else /* PRR */ | 2873 | tp->snd_cwnd_stamp = tcp_time_stamp; |
2874 | } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) { | ||
2875 | /* PRR algorithm. */ | ||
2870 | tp->snd_cwnd = tp->snd_ssthresh; | 2876 | tp->snd_cwnd = tp->snd_ssthresh; |
2871 | tp->snd_cwnd_stamp = tcp_time_stamp; | 2877 | tp->snd_cwnd_stamp = tcp_time_stamp; |
2878 | } | ||
2872 | } | 2879 | } |
2873 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); | 2880 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); |
2874 | } | 2881 | } |
@@ -5225,7 +5232,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, | |||
5225 | return 0; | 5232 | return 0; |
5226 | 5233 | ||
5227 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 5234 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
5228 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 5235 | tp->ucopy.dma_chan = net_dma_find_channel(); |
5229 | 5236 | ||
5230 | if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { | 5237 | if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { |
5231 | 5238 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 3a25cf743f8b..0cb86ceb652f 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1730,7 +1730,7 @@ process: | |||
1730 | #ifdef CONFIG_NET_DMA | 1730 | #ifdef CONFIG_NET_DMA |
1731 | struct tcp_sock *tp = tcp_sk(sk); | 1731 | struct tcp_sock *tp = tcp_sk(sk); |
1732 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1732 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1733 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1733 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1734 | if (tp->ucopy.dma_chan) | 1734 | if (tp->ucopy.dma_chan) |
1735 | ret = tcp_v4_do_rcv(sk, skb); | 1735 | ret = tcp_v4_do_rcv(sk, skb); |
1736 | else | 1736 | else |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 364784a91939..7ac6423117ad 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1096,6 +1096,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | |||
1096 | eat = min_t(int, len, skb_headlen(skb)); | 1096 | eat = min_t(int, len, skb_headlen(skb)); |
1097 | if (eat) { | 1097 | if (eat) { |
1098 | __skb_pull(skb, eat); | 1098 | __skb_pull(skb, eat); |
1099 | skb->avail_size -= eat; | ||
1099 | len -= eat; | 1100 | len -= eat; |
1100 | if (!len) | 1101 | if (!len) |
1101 | return; | 1102 | return; |
@@ -2060,7 +2061,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to, | |||
2060 | /* Punt if not enough space exists in the first SKB for | 2061 | /* Punt if not enough space exists in the first SKB for |
2061 | * the data in the second | 2062 | * the data in the second |
2062 | */ | 2063 | */ |
2063 | if (skb->len > skb_tailroom(to)) | 2064 | if (skb->len > skb_availroom(to)) |
2064 | break; | 2065 | break; |
2065 | 2066 | ||
2066 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) | 2067 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) |
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c index 8a949f19deb6..a7f86a3cd502 100644 --- a/net/ipv4/udp_diag.c +++ b/net/ipv4/udp_diag.c | |||
@@ -146,9 +146,17 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, | |||
146 | return udp_dump_one(&udp_table, in_skb, nlh, req); | 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); |
147 | } | 147 | } |
148 | 148 | ||
149 | static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | ||
150 | void *info) | ||
151 | { | ||
152 | r->idiag_rqueue = sk_rmem_alloc_get(sk); | ||
153 | r->idiag_wqueue = sk_wmem_alloc_get(sk); | ||
154 | } | ||
155 | |||
149 | static const struct inet_diag_handler udp_diag_handler = { | 156 | static const struct inet_diag_handler udp_diag_handler = { |
150 | .dump = udp_diag_dump, | 157 | .dump = udp_diag_dump, |
151 | .dump_one = udp_diag_dump_one, | 158 | .dump_one = udp_diag_dump_one, |
159 | .idiag_get_info = udp_diag_get_info, | ||
152 | .idiag_type = IPPROTO_UDP, | 160 | .idiag_type = IPPROTO_UDP, |
153 | }; | 161 | }; |
154 | 162 | ||
@@ -167,6 +175,7 @@ static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr * | |||
167 | static const struct inet_diag_handler udplite_diag_handler = { | 175 | static const struct inet_diag_handler udplite_diag_handler = { |
168 | .dump = udplite_diag_dump, | 176 | .dump = udplite_diag_dump, |
169 | .dump_one = udplite_diag_dump_one, | 177 | .dump_one = udplite_diag_dump_one, |
178 | .idiag_get_info = udp_diag_get_info, | ||
170 | .idiag_type = IPPROTO_UDPLITE, | 179 | .idiag_type = IPPROTO_UDPLITE, |
171 | }; | 180 | }; |
172 | 181 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6a3bb6077e19..7d5cb975cc6f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -803,8 +803,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
803 | ip6_del_rt(rt); | 803 | ip6_del_rt(rt); |
804 | rt = NULL; | 804 | rt = NULL; |
805 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 805 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { |
806 | rt->dst.expires = expires; | 806 | rt6_set_expires(rt, expires); |
807 | rt->rt6i_flags |= RTF_EXPIRES; | ||
808 | } | 807 | } |
809 | } | 808 | } |
810 | dst_release(&rt->dst); | 809 | dst_release(&rt->dst); |
@@ -1887,11 +1886,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) | |||
1887 | rt = NULL; | 1886 | rt = NULL; |
1888 | } else if (addrconf_finite_timeout(rt_expires)) { | 1887 | } else if (addrconf_finite_timeout(rt_expires)) { |
1889 | /* not infinity */ | 1888 | /* not infinity */ |
1890 | rt->dst.expires = jiffies + rt_expires; | 1889 | rt6_set_expires(rt, jiffies + rt_expires); |
1891 | rt->rt6i_flags |= RTF_EXPIRES; | ||
1892 | } else { | 1890 | } else { |
1893 | rt->rt6i_flags &= ~RTF_EXPIRES; | 1891 | rt6_clean_expires(rt); |
1894 | rt->dst.expires = 0; | ||
1895 | } | 1892 | } |
1896 | } else if (valid_lft) { | 1893 | } else if (valid_lft) { |
1897 | clock_t expires = 0; | 1894 | clock_t expires = 0; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 5b27fbcae346..93717435013e 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -673,11 +673,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
673 | &rt->rt6i_gateway)) { | 673 | &rt->rt6i_gateway)) { |
674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) | 674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) |
675 | return -EEXIST; | 675 | return -EEXIST; |
676 | iter->dst.expires = rt->dst.expires; | 676 | if (!(rt->rt6i_flags & RTF_EXPIRES)) |
677 | if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 677 | rt6_clean_expires(iter); |
678 | iter->rt6i_flags &= ~RTF_EXPIRES; | 678 | else |
679 | iter->dst.expires = 0; | 679 | rt6_set_expires(iter, rt->dst.expires); |
680 | } | ||
681 | return -EEXIST; | 680 | return -EEXIST; |
682 | } | 681 | } |
683 | } | 682 | } |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3dcdb81ec3e8..176b469322ac 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1264,8 +1264,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | if (rt) | 1266 | if (rt) |
1267 | rt->dst.expires = jiffies + (HZ * lifetime); | 1267 | rt6_set_expires(rt, jiffies + (HZ * lifetime)); |
1268 | |||
1269 | if (ra_msg->icmph.icmp6_hop_limit) { | 1268 | if (ra_msg->icmph.icmp6_hop_limit) { |
1270 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; | 1269 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; |
1271 | if (rt) | 1270 | if (rt) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 94874b0bdcdc..9d4e15559319 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -78,19 +78,6 @@ EXPORT_SYMBOL_GPL(ip6t_alloc_initial_table); | |||
78 | 78 | ||
79 | Hence the start of any table is given by get_table() below. */ | 79 | Hence the start of any table is given by get_table() below. */ |
80 | 80 | ||
81 | /* Check for an extension */ | ||
82 | int | ||
83 | ip6t_ext_hdr(u8 nexthdr) | ||
84 | { | ||
85 | return (nexthdr == IPPROTO_HOPOPTS) || | ||
86 | (nexthdr == IPPROTO_ROUTING) || | ||
87 | (nexthdr == IPPROTO_FRAGMENT) || | ||
88 | (nexthdr == IPPROTO_ESP) || | ||
89 | (nexthdr == IPPROTO_AH) || | ||
90 | (nexthdr == IPPROTO_NONE) || | ||
91 | (nexthdr == IPPROTO_DSTOPTS); | ||
92 | } | ||
93 | |||
94 | /* Returns whether matches rule or not. */ | 81 | /* Returns whether matches rule or not. */ |
95 | /* Performance critical - called for every packet */ | 82 | /* Performance critical - called for every packet */ |
96 | static inline bool | 83 | static inline bool |
@@ -2366,7 +2353,6 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | |||
2366 | EXPORT_SYMBOL(ip6t_register_table); | 2353 | EXPORT_SYMBOL(ip6t_register_table); |
2367 | EXPORT_SYMBOL(ip6t_unregister_table); | 2354 | EXPORT_SYMBOL(ip6t_unregister_table); |
2368 | EXPORT_SYMBOL(ip6t_do_table); | 2355 | EXPORT_SYMBOL(ip6t_do_table); |
2369 | EXPORT_SYMBOL(ip6t_ext_hdr); | ||
2370 | EXPORT_SYMBOL(ipv6_find_hdr); | 2356 | EXPORT_SYMBOL(ipv6_find_hdr); |
2371 | 2357 | ||
2372 | module_init(ip6_tables_init); | 2358 | module_init(ip6_tables_init); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 3992e26a6039..bc4888d902b2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <linux/sysctl.h> | 62 | #include <linux/sysctl.h> |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 65 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
66 | const struct in6_addr *dest); | 66 | const struct in6_addr *dest); |
67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
@@ -285,6 +285,10 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
285 | rt->rt6i_idev = NULL; | 285 | rt->rt6i_idev = NULL; |
286 | in6_dev_put(idev); | 286 | in6_dev_put(idev); |
287 | } | 287 | } |
288 | |||
289 | if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from) | ||
290 | dst_release(dst->from); | ||
291 | |||
288 | if (peer) { | 292 | if (peer) { |
289 | rt->rt6i_peer = NULL; | 293 | rt->rt6i_peer = NULL; |
290 | inet_putpeer(peer); | 294 | inet_putpeer(peer); |
@@ -329,8 +333,17 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
329 | 333 | ||
330 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) | 334 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) |
331 | { | 335 | { |
332 | return (rt->rt6i_flags & RTF_EXPIRES) && | 336 | struct rt6_info *ort = NULL; |
333 | time_after(jiffies, rt->dst.expires); | 337 | |
338 | if (rt->rt6i_flags & RTF_EXPIRES) { | ||
339 | if (time_after(jiffies, rt->dst.expires)) | ||
340 | return 1; | ||
341 | } else if (rt->dst.from) { | ||
342 | ort = (struct rt6_info *) rt->dst.from; | ||
343 | return (ort->rt6i_flags & RTF_EXPIRES) && | ||
344 | time_after(jiffies, ort->dst.expires); | ||
345 | } | ||
346 | return 0; | ||
334 | } | 347 | } |
335 | 348 | ||
336 | static inline int rt6_need_strict(const struct in6_addr *daddr) | 349 | static inline int rt6_need_strict(const struct in6_addr *daddr) |
@@ -620,12 +633,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
620 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); | 633 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); |
621 | 634 | ||
622 | if (rt) { | 635 | if (rt) { |
623 | if (!addrconf_finite_timeout(lifetime)) { | 636 | if (!addrconf_finite_timeout(lifetime)) |
624 | rt->rt6i_flags &= ~RTF_EXPIRES; | 637 | rt6_clean_expires(rt); |
625 | } else { | 638 | else |
626 | rt->dst.expires = jiffies + HZ * lifetime; | 639 | rt6_set_expires(rt, jiffies + HZ * lifetime); |
627 | rt->rt6i_flags |= RTF_EXPIRES; | 640 | |
628 | } | ||
629 | dst_release(&rt->dst); | 641 | dst_release(&rt->dst); |
630 | } | 642 | } |
631 | return 0; | 643 | return 0; |
@@ -730,7 +742,7 @@ int ip6_ins_rt(struct rt6_info *rt) | |||
730 | return __ip6_ins_rt(rt, &info); | 742 | return __ip6_ins_rt(rt, &info); |
731 | } | 743 | } |
732 | 744 | ||
733 | static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, | 745 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, |
734 | const struct in6_addr *daddr, | 746 | const struct in6_addr *daddr, |
735 | const struct in6_addr *saddr) | 747 | const struct in6_addr *saddr) |
736 | { | 748 | { |
@@ -954,10 +966,10 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori | |||
954 | rt->rt6i_idev = ort->rt6i_idev; | 966 | rt->rt6i_idev = ort->rt6i_idev; |
955 | if (rt->rt6i_idev) | 967 | if (rt->rt6i_idev) |
956 | in6_dev_hold(rt->rt6i_idev); | 968 | in6_dev_hold(rt->rt6i_idev); |
957 | rt->dst.expires = 0; | ||
958 | 969 | ||
959 | rt->rt6i_gateway = ort->rt6i_gateway; | 970 | rt->rt6i_gateway = ort->rt6i_gateway; |
960 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 971 | rt->rt6i_flags = ort->rt6i_flags; |
972 | rt6_clean_expires(rt); | ||
961 | rt->rt6i_metric = 0; | 973 | rt->rt6i_metric = 0; |
962 | 974 | ||
963 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); | 975 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); |
@@ -1019,10 +1031,9 @@ static void ip6_link_failure(struct sk_buff *skb) | |||
1019 | 1031 | ||
1020 | rt = (struct rt6_info *) skb_dst(skb); | 1032 | rt = (struct rt6_info *) skb_dst(skb); |
1021 | if (rt) { | 1033 | if (rt) { |
1022 | if (rt->rt6i_flags & RTF_CACHE) { | 1034 | if (rt->rt6i_flags & RTF_CACHE) |
1023 | dst_set_expires(&rt->dst, 0); | 1035 | rt6_update_expires(rt, 0); |
1024 | rt->rt6i_flags |= RTF_EXPIRES; | 1036 | else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) |
1025 | } else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) | ||
1026 | rt->rt6i_node->fn_sernum = -1; | 1037 | rt->rt6i_node->fn_sernum = -1; |
1027 | } | 1038 | } |
1028 | } | 1039 | } |
@@ -1289,9 +1300,12 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1289 | } | 1300 | } |
1290 | 1301 | ||
1291 | rt->dst.obsolete = -1; | 1302 | rt->dst.obsolete = -1; |
1292 | rt->dst.expires = (cfg->fc_flags & RTF_EXPIRES) ? | 1303 | |
1293 | jiffies + clock_t_to_jiffies(cfg->fc_expires) : | 1304 | if (cfg->fc_flags & RTF_EXPIRES) |
1294 | 0; | 1305 | rt6_set_expires(rt, jiffies + |
1306 | clock_t_to_jiffies(cfg->fc_expires)); | ||
1307 | else | ||
1308 | rt6_clean_expires(rt); | ||
1295 | 1309 | ||
1296 | if (cfg->fc_protocol == RTPROT_UNSPEC) | 1310 | if (cfg->fc_protocol == RTPROT_UNSPEC) |
1297 | cfg->fc_protocol = RTPROT_BOOT; | 1311 | cfg->fc_protocol = RTPROT_BOOT; |
@@ -1736,8 +1750,8 @@ again: | |||
1736 | features |= RTAX_FEATURE_ALLFRAG; | 1750 | features |= RTAX_FEATURE_ALLFRAG; |
1737 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); | 1751 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); |
1738 | } | 1752 | } |
1739 | dst_set_expires(&rt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1753 | rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
1740 | rt->rt6i_flags |= RTF_MODIFIED|RTF_EXPIRES; | 1754 | rt->rt6i_flags |= RTF_MODIFIED; |
1741 | goto out; | 1755 | goto out; |
1742 | } | 1756 | } |
1743 | 1757 | ||
@@ -1765,9 +1779,8 @@ again: | |||
1765 | * which is 10 mins. After 10 mins the decreased pmtu is expired | 1779 | * which is 10 mins. After 10 mins the decreased pmtu is expired |
1766 | * and detecting PMTU increase will be automatically happened. | 1780 | * and detecting PMTU increase will be automatically happened. |
1767 | */ | 1781 | */ |
1768 | dst_set_expires(&nrt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1782 | rt6_update_expires(nrt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
1769 | nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES; | 1783 | nrt->rt6i_flags |= RTF_DYNAMIC; |
1770 | |||
1771 | ip6_ins_rt(nrt); | 1784 | ip6_ins_rt(nrt); |
1772 | } | 1785 | } |
1773 | out: | 1786 | out: |
@@ -1799,7 +1812,7 @@ void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *sad | |||
1799 | * Misc support functions | 1812 | * Misc support functions |
1800 | */ | 1813 | */ |
1801 | 1814 | ||
1802 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 1815 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
1803 | const struct in6_addr *dest) | 1816 | const struct in6_addr *dest) |
1804 | { | 1817 | { |
1805 | struct net *net = dev_net(ort->dst.dev); | 1818 | struct net *net = dev_net(ort->dst.dev); |
@@ -1819,10 +1832,14 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
1819 | if (rt->rt6i_idev) | 1832 | if (rt->rt6i_idev) |
1820 | in6_dev_hold(rt->rt6i_idev); | 1833 | in6_dev_hold(rt->rt6i_idev); |
1821 | rt->dst.lastuse = jiffies; | 1834 | rt->dst.lastuse = jiffies; |
1822 | rt->dst.expires = 0; | ||
1823 | 1835 | ||
1824 | rt->rt6i_gateway = ort->rt6i_gateway; | 1836 | rt->rt6i_gateway = ort->rt6i_gateway; |
1825 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 1837 | rt->rt6i_flags = ort->rt6i_flags; |
1838 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == | ||
1839 | (RTF_DEFAULT | RTF_ADDRCONF)) | ||
1840 | rt6_set_from(rt, ort); | ||
1841 | else | ||
1842 | rt6_clean_expires(rt); | ||
1826 | rt->rt6i_metric = 0; | 1843 | rt->rt6i_metric = 0; |
1827 | 1844 | ||
1828 | #ifdef CONFIG_IPV6_SUBTREES | 1845 | #ifdef CONFIG_IPV6_SUBTREES |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 12c6ece67f39..98256cf72f9d 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1383,6 +1383,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1383 | tcp_mtup_init(newsk); | 1383 | tcp_mtup_init(newsk); |
1384 | tcp_sync_mss(newsk, dst_mtu(dst)); | 1384 | tcp_sync_mss(newsk, dst_mtu(dst)); |
1385 | newtp->advmss = dst_metric_advmss(dst); | 1385 | newtp->advmss = dst_metric_advmss(dst); |
1386 | if (tcp_sk(sk)->rx_opt.user_mss && | ||
1387 | tcp_sk(sk)->rx_opt.user_mss < newtp->advmss) | ||
1388 | newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; | ||
1389 | |||
1386 | tcp_initialize_rcv_mss(newsk); | 1390 | tcp_initialize_rcv_mss(newsk); |
1387 | if (tcp_rsk(req)->snt_synack) | 1391 | if (tcp_rsk(req)->snt_synack) |
1388 | tcp_valid_rtt_meas(newsk, | 1392 | tcp_valid_rtt_meas(newsk, |
@@ -1645,7 +1649,7 @@ process: | |||
1645 | #ifdef CONFIG_NET_DMA | 1649 | #ifdef CONFIG_NET_DMA |
1646 | struct tcp_sock *tp = tcp_sk(sk); | 1650 | struct tcp_sock *tp = tcp_sk(sk); |
1647 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1651 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1648 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1652 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1649 | if (tp->ucopy.dma_chan) | 1653 | if (tp->ucopy.dma_chan) |
1650 | ret = tcp_v6_do_rcv(sk, skb); | 1654 | ret = tcp_v6_do_rcv(sk, skb); |
1651 | else | 1655 | else |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 11dbb2255ccb..7e5d927b576f 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -3480,7 +3480,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
3480 | 3480 | ||
3481 | /* Addresses to be used by KM for negotiation, if ext is available */ | 3481 | /* Addresses to be used by KM for negotiation, if ext is available */ |
3482 | if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) | 3482 | if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) |
3483 | return -EINVAL; | 3483 | goto err; |
3484 | 3484 | ||
3485 | /* selector src */ | 3485 | /* selector src */ |
3486 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); | 3486 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 55670ec3cd0f..585d93ecee2d 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout) | |||
232 | { | 232 | { |
233 | write_lock_bh(&l2tp_ip_lock); | 233 | write_lock_bh(&l2tp_ip_lock); |
234 | hlist_del_init(&sk->sk_bind_node); | 234 | hlist_del_init(&sk->sk_bind_node); |
235 | hlist_del_init(&sk->sk_node); | 235 | sk_del_node_init(sk); |
236 | write_unlock_bh(&l2tp_ip_lock); | 236 | write_unlock_bh(&l2tp_ip_lock); |
237 | sk_common_release(sk); | 237 | sk_common_release(sk); |
238 | } | 238 | } |
@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
271 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) | 271 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) |
272 | goto out; | 272 | goto out; |
273 | 273 | ||
274 | inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; | 274 | if (addr->l2tp_addr.s_addr) |
275 | inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; | ||
275 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) | 276 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) |
276 | inet->inet_saddr = 0; /* Use device */ | 277 | inet->inet_saddr = 0; /* Use device */ |
277 | sk_dst_reset(sk); | 278 | sk_dst_reset(sk); |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 2555816e7788..00bdb1d9d690 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1924,6 +1924,7 @@ protocol_fail: | |||
1924 | control_fail: | 1924 | control_fail: |
1925 | ip_vs_estimator_net_cleanup(net); | 1925 | ip_vs_estimator_net_cleanup(net); |
1926 | estimator_fail: | 1926 | estimator_fail: |
1927 | net->ipvs = NULL; | ||
1927 | return -ENOMEM; | 1928 | return -ENOMEM; |
1928 | } | 1929 | } |
1929 | 1930 | ||
@@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) | |||
1936 | ip_vs_control_net_cleanup(net); | 1937 | ip_vs_control_net_cleanup(net); |
1937 | ip_vs_estimator_net_cleanup(net); | 1938 | ip_vs_estimator_net_cleanup(net); |
1938 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); | 1939 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); |
1940 | net->ipvs = NULL; | ||
1939 | } | 1941 | } |
1940 | 1942 | ||
1941 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) | 1943 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) |
@@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) | |||
1993 | goto cleanup_dev; | 1995 | goto cleanup_dev; |
1994 | } | 1996 | } |
1995 | 1997 | ||
1998 | ret = ip_vs_register_nl_ioctl(); | ||
1999 | if (ret < 0) { | ||
2000 | pr_err("can't register netlink/ioctl.\n"); | ||
2001 | goto cleanup_hooks; | ||
2002 | } | ||
2003 | |||
1996 | pr_info("ipvs loaded.\n"); | 2004 | pr_info("ipvs loaded.\n"); |
1997 | 2005 | ||
1998 | return ret; | 2006 | return ret; |
1999 | 2007 | ||
2008 | cleanup_hooks: | ||
2009 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | ||
2000 | cleanup_dev: | 2010 | cleanup_dev: |
2001 | unregister_pernet_device(&ipvs_core_dev_ops); | 2011 | unregister_pernet_device(&ipvs_core_dev_ops); |
2002 | cleanup_sub: | 2012 | cleanup_sub: |
@@ -2012,6 +2022,7 @@ exit: | |||
2012 | 2022 | ||
2013 | static void __exit ip_vs_cleanup(void) | 2023 | static void __exit ip_vs_cleanup(void) |
2014 | { | 2024 | { |
2025 | ip_vs_unregister_nl_ioctl(); | ||
2015 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | 2026 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); |
2016 | unregister_pernet_device(&ipvs_core_dev_ops); | 2027 | unregister_pernet_device(&ipvs_core_dev_ops); |
2017 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ | 2028 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index b3afe189af61..f5589987fc80 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) | |||
3680 | return 0; | 3680 | return 0; |
3681 | } | 3681 | } |
3682 | 3682 | ||
3683 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | 3683 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) |
3684 | { | 3684 | { |
3685 | struct netns_ipvs *ipvs = net_ipvs(net); | 3685 | struct netns_ipvs *ipvs = net_ipvs(net); |
3686 | 3686 | ||
@@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
3692 | #else | 3692 | #else |
3693 | 3693 | ||
3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } | 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } |
3695 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } | 3695 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } |
3696 | 3696 | ||
3697 | #endif | 3697 | #endif |
3698 | 3698 | ||
@@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) | |||
3750 | free_percpu(ipvs->tot_stats.cpustats); | 3750 | free_percpu(ipvs->tot_stats.cpustats); |
3751 | } | 3751 | } |
3752 | 3752 | ||
3753 | int __init ip_vs_control_init(void) | 3753 | int __init ip_vs_register_nl_ioctl(void) |
3754 | { | 3754 | { |
3755 | int idx; | ||
3756 | int ret; | 3755 | int ret; |
3757 | 3756 | ||
3758 | EnterFunction(2); | ||
3759 | |||
3760 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
3761 | for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
3762 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
3763 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
3764 | } | ||
3765 | |||
3766 | smp_wmb(); /* Do we really need it now ? */ | ||
3767 | |||
3768 | ret = nf_register_sockopt(&ip_vs_sockopts); | 3757 | ret = nf_register_sockopt(&ip_vs_sockopts); |
3769 | if (ret) { | 3758 | if (ret) { |
3770 | pr_err("cannot register sockopt.\n"); | 3759 | pr_err("cannot register sockopt.\n"); |
@@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) | |||
3776 | pr_err("cannot register Generic Netlink interface.\n"); | 3765 | pr_err("cannot register Generic Netlink interface.\n"); |
3777 | goto err_genl; | 3766 | goto err_genl; |
3778 | } | 3767 | } |
3779 | |||
3780 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
3781 | if (ret < 0) | ||
3782 | goto err_notf; | ||
3783 | |||
3784 | LeaveFunction(2); | ||
3785 | return 0; | 3768 | return 0; |
3786 | 3769 | ||
3787 | err_notf: | ||
3788 | ip_vs_genl_unregister(); | ||
3789 | err_genl: | 3770 | err_genl: |
3790 | nf_unregister_sockopt(&ip_vs_sockopts); | 3771 | nf_unregister_sockopt(&ip_vs_sockopts); |
3791 | err_sock: | 3772 | err_sock: |
3792 | return ret; | 3773 | return ret; |
3793 | } | 3774 | } |
3794 | 3775 | ||
3776 | void ip_vs_unregister_nl_ioctl(void) | ||
3777 | { | ||
3778 | ip_vs_genl_unregister(); | ||
3779 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
3780 | } | ||
3781 | |||
3782 | int __init ip_vs_control_init(void) | ||
3783 | { | ||
3784 | int idx; | ||
3785 | int ret; | ||
3786 | |||
3787 | EnterFunction(2); | ||
3788 | |||
3789 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
3790 | for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
3791 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
3792 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
3793 | } | ||
3794 | |||
3795 | smp_wmb(); /* Do we really need it now ? */ | ||
3796 | |||
3797 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
3798 | if (ret < 0) | ||
3799 | return ret; | ||
3800 | |||
3801 | LeaveFunction(2); | ||
3802 | return 0; | ||
3803 | } | ||
3804 | |||
3795 | 3805 | ||
3796 | void ip_vs_control_cleanup(void) | 3806 | void ip_vs_control_cleanup(void) |
3797 | { | 3807 | { |
3798 | EnterFunction(2); | 3808 | EnterFunction(2); |
3799 | unregister_netdevice_notifier(&ip_vs_dst_notifier); | 3809 | unregister_netdevice_notifier(&ip_vs_dst_notifier); |
3800 | ip_vs_genl_unregister(); | ||
3801 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
3802 | LeaveFunction(2); | 3810 | LeaveFunction(2); |
3803 | } | 3811 | } |
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c index 538d74ee4f68..e39f693dd3e4 100644 --- a/net/netfilter/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c | |||
@@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) | |||
439 | struct ip_vs_app *app; | 439 | struct ip_vs_app *app; |
440 | struct netns_ipvs *ipvs = net_ipvs(net); | 440 | struct netns_ipvs *ipvs = net_ipvs(net); |
441 | 441 | ||
442 | if (!ipvs) | ||
443 | return -ENOENT; | ||
442 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); | 444 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); |
443 | if (!app) | 445 | if (!app) |
444 | return -ENOMEM; | 446 | return -ENOMEM; |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 0f16283fd058..caa43704e55e 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
@@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
551 | { | 551 | { |
552 | struct netns_ipvs *ipvs = net_ipvs(net); | 552 | struct netns_ipvs *ipvs = net_ipvs(net); |
553 | 553 | ||
554 | if (!ipvs) | ||
555 | return -ENOENT; | ||
556 | |||
554 | if (!net_eq(net, &init_net)) { | 557 | if (!net_eq(net, &init_net)) { |
555 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, | 558 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, |
556 | sizeof(vs_vars_table), | 559 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index eec797f8cce7..548bf37aa29e 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) | |||
745 | { | 745 | { |
746 | struct netns_ipvs *ipvs = net_ipvs(net); | 746 | struct netns_ipvs *ipvs = net_ipvs(net); |
747 | 747 | ||
748 | if (!ipvs) | ||
749 | return -ENOENT; | ||
750 | |||
748 | if (!net_eq(net, &init_net)) { | 751 | if (!net_eq(net, &init_net)) { |
749 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, | 752 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, |
750 | sizeof(vs_vars_table), | 753 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c index f843a8833250..ed835e67a07e 100644 --- a/net/netfilter/ipvs/ip_vs_proto.c +++ b/net/netfilter/ipvs/ip_vs_proto.c | |||
@@ -59,9 +59,6 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp) | |||
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | #if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP) || \ | ||
63 | defined(CONFIG_IP_VS_PROTO_SCTP) || defined(CONFIG_IP_VS_PROTO_AH) || \ | ||
64 | defined(CONFIG_IP_VS_PROTO_ESP) | ||
65 | /* | 62 | /* |
66 | * register an ipvs protocols netns related data | 63 | * register an ipvs protocols netns related data |
67 | */ | 64 | */ |
@@ -81,12 +78,18 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp) | |||
81 | ipvs->proto_data_table[hash] = pd; | 78 | ipvs->proto_data_table[hash] = pd; |
82 | atomic_set(&pd->appcnt, 0); /* Init app counter */ | 79 | atomic_set(&pd->appcnt, 0); /* Init app counter */ |
83 | 80 | ||
84 | if (pp->init_netns != NULL) | 81 | if (pp->init_netns != NULL) { |
85 | pp->init_netns(net, pd); | 82 | int ret = pp->init_netns(net, pd); |
83 | if (ret) { | ||
84 | /* unlink an free proto data */ | ||
85 | ipvs->proto_data_table[hash] = pd->next; | ||
86 | kfree(pd); | ||
87 | return ret; | ||
88 | } | ||
89 | } | ||
86 | 90 | ||
87 | return 0; | 91 | return 0; |
88 | } | 92 | } |
89 | #endif | ||
90 | 93 | ||
91 | /* | 94 | /* |
92 | * unregister an ipvs protocol | 95 | * unregister an ipvs protocol |
@@ -316,22 +319,35 @@ ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, | |||
316 | */ | 319 | */ |
317 | int __net_init ip_vs_protocol_net_init(struct net *net) | 320 | int __net_init ip_vs_protocol_net_init(struct net *net) |
318 | { | 321 | { |
322 | int i, ret; | ||
323 | static struct ip_vs_protocol *protos[] = { | ||
319 | #ifdef CONFIG_IP_VS_PROTO_TCP | 324 | #ifdef CONFIG_IP_VS_PROTO_TCP |
320 | register_ip_vs_proto_netns(net, &ip_vs_protocol_tcp); | 325 | &ip_vs_protocol_tcp, |
321 | #endif | 326 | #endif |
322 | #ifdef CONFIG_IP_VS_PROTO_UDP | 327 | #ifdef CONFIG_IP_VS_PROTO_UDP |
323 | register_ip_vs_proto_netns(net, &ip_vs_protocol_udp); | 328 | &ip_vs_protocol_udp, |
324 | #endif | 329 | #endif |
325 | #ifdef CONFIG_IP_VS_PROTO_SCTP | 330 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
326 | register_ip_vs_proto_netns(net, &ip_vs_protocol_sctp); | 331 | &ip_vs_protocol_sctp, |
327 | #endif | 332 | #endif |
328 | #ifdef CONFIG_IP_VS_PROTO_AH | 333 | #ifdef CONFIG_IP_VS_PROTO_AH |
329 | register_ip_vs_proto_netns(net, &ip_vs_protocol_ah); | 334 | &ip_vs_protocol_ah, |
330 | #endif | 335 | #endif |
331 | #ifdef CONFIG_IP_VS_PROTO_ESP | 336 | #ifdef CONFIG_IP_VS_PROTO_ESP |
332 | register_ip_vs_proto_netns(net, &ip_vs_protocol_esp); | 337 | &ip_vs_protocol_esp, |
333 | #endif | 338 | #endif |
339 | }; | ||
340 | |||
341 | for (i = 0; i < ARRAY_SIZE(protos); i++) { | ||
342 | ret = register_ip_vs_proto_netns(net, protos[i]); | ||
343 | if (ret < 0) | ||
344 | goto cleanup; | ||
345 | } | ||
334 | return 0; | 346 | return 0; |
347 | |||
348 | cleanup: | ||
349 | ip_vs_protocol_net_cleanup(net); | ||
350 | return ret; | ||
335 | } | 351 | } |
336 | 352 | ||
337 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) | 353 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 1fbf7a2816f5..9f3fb751c491 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -1090,7 +1090,7 @@ out: | |||
1090 | * timeouts is netns related now. | 1090 | * timeouts is netns related now. |
1091 | * --------------------------------------------- | 1091 | * --------------------------------------------- |
1092 | */ | 1092 | */ |
1093 | static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | 1093 | static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) |
1094 | { | 1094 | { |
1095 | struct netns_ipvs *ipvs = net_ipvs(net); | 1095 | struct netns_ipvs *ipvs = net_ipvs(net); |
1096 | 1096 | ||
@@ -1098,6 +1098,9 @@ static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
1098 | spin_lock_init(&ipvs->sctp_app_lock); | 1098 | spin_lock_init(&ipvs->sctp_app_lock); |
1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, | 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, |
1100 | sizeof(sctp_timeouts)); | 1100 | sizeof(sctp_timeouts)); |
1101 | if (!pd->timeout_table) | ||
1102 | return -ENOMEM; | ||
1103 | return 0; | ||
1101 | } | 1104 | } |
1102 | 1105 | ||
1103 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) | 1106 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index ef8641f7af83..cd609cc62721 100644 --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c | |||
@@ -677,7 +677,7 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp) | |||
677 | * timeouts is netns related now. | 677 | * timeouts is netns related now. |
678 | * --------------------------------------------- | 678 | * --------------------------------------------- |
679 | */ | 679 | */ |
680 | static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | 680 | static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) |
681 | { | 681 | { |
682 | struct netns_ipvs *ipvs = net_ipvs(net); | 682 | struct netns_ipvs *ipvs = net_ipvs(net); |
683 | 683 | ||
@@ -685,7 +685,10 @@ static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
685 | spin_lock_init(&ipvs->tcp_app_lock); | 685 | spin_lock_init(&ipvs->tcp_app_lock); |
686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, | 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, |
687 | sizeof(tcp_timeouts)); | 687 | sizeof(tcp_timeouts)); |
688 | if (!pd->timeout_table) | ||
689 | return -ENOMEM; | ||
688 | pd->tcp_state_table = tcp_states; | 690 | pd->tcp_state_table = tcp_states; |
691 | return 0; | ||
689 | } | 692 | } |
690 | 693 | ||
691 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) | 694 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c index f4b7262896bb..2fedb2dcb3d1 100644 --- a/net/netfilter/ipvs/ip_vs_proto_udp.c +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c | |||
@@ -467,7 +467,7 @@ udp_state_transition(struct ip_vs_conn *cp, int direction, | |||
467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; | 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; |
468 | } | 468 | } |
469 | 469 | ||
470 | static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | 470 | static int __udp_init(struct net *net, struct ip_vs_proto_data *pd) |
471 | { | 471 | { |
472 | struct netns_ipvs *ipvs = net_ipvs(net); | 472 | struct netns_ipvs *ipvs = net_ipvs(net); |
473 | 473 | ||
@@ -475,6 +475,9 @@ static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
475 | spin_lock_init(&ipvs->udp_app_lock); | 475 | spin_lock_init(&ipvs->udp_app_lock); |
476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, | 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, |
477 | sizeof(udp_timeouts)); | 477 | sizeof(udp_timeouts)); |
478 | if (!pd->timeout_table) | ||
479 | return -ENOMEM; | ||
480 | return 0; | ||
478 | } | 481 | } |
479 | 482 | ||
480 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) | 483 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 3cc4487ac349..729f157a0efa 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1592,7 +1592,7 @@ static int nf_conntrack_init_net(struct net *net) | |||
1592 | return 0; | 1592 | return 0; |
1593 | 1593 | ||
1594 | err_timeout: | 1594 | err_timeout: |
1595 | nf_conntrack_timeout_fini(net); | 1595 | nf_conntrack_ecache_fini(net); |
1596 | err_ecache: | 1596 | err_ecache: |
1597 | nf_conntrack_tstamp_fini(net); | 1597 | nf_conntrack_tstamp_fini(net); |
1598 | err_tstamp: | 1598 | err_tstamp: |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 361eade62a09..0d07a1dcf605 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
584 | * Let's try to use the data from the packet. | 584 | * Let's try to use the data from the packet. |
585 | */ | 585 | */ |
586 | sender->td_end = end; | 586 | sender->td_end = end; |
587 | win <<= sender->td_scale; | 587 | swin = win << sender->td_scale; |
588 | sender->td_maxwin = (win == 0 ? 1 : win); | 588 | sender->td_maxwin = (swin == 0 ? 1 : swin); |
589 | sender->td_maxend = end + sender->td_maxwin; | 589 | sender->td_maxend = end + sender->td_maxwin; |
590 | /* | 590 | /* |
591 | * We haven't seen traffic in the other direction yet | 591 | * We haven't seen traffic in the other direction yet |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 59530e93fa58..3746d8b9a478 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -227,7 +227,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
230 | if (info->timeout) { | 230 | if (info->timeout[0]) { |
231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; | 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
232 | struct nf_conn_timeout *timeout_ext; | 232 | struct nf_conn_timeout *timeout_ext; |
233 | 233 | ||
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 9b9a85ecc4c7..bf5cf69c820a 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -331,23 +331,6 @@ static int __net_init phonet_init_net(struct net *net) | |||
331 | 331 | ||
332 | static void __net_exit phonet_exit_net(struct net *net) | 332 | static void __net_exit phonet_exit_net(struct net *net) |
333 | { | 333 | { |
334 | struct phonet_net *pnn = phonet_pernet(net); | ||
335 | struct net_device *dev; | ||
336 | unsigned i; | ||
337 | |||
338 | rtnl_lock(); | ||
339 | for_each_netdev(net, dev) | ||
340 | phonet_device_destroy(dev); | ||
341 | |||
342 | for (i = 0; i < 64; i++) { | ||
343 | dev = pnn->routes.table[i]; | ||
344 | if (dev) { | ||
345 | rtm_phonet_notify(RTM_DELROUTE, dev, i); | ||
346 | dev_put(dev); | ||
347 | } | ||
348 | } | ||
349 | rtnl_unlock(); | ||
350 | |||
351 | proc_net_remove(net, "phonet"); | 334 | proc_net_remove(net, "phonet"); |
352 | } | 335 | } |
353 | 336 | ||
@@ -361,7 +344,7 @@ static struct pernet_operations phonet_net_ops = { | |||
361 | /* Initialize Phonet devices list */ | 344 | /* Initialize Phonet devices list */ |
362 | int __init phonet_device_init(void) | 345 | int __init phonet_device_init(void) |
363 | { | 346 | { |
364 | int err = register_pernet_device(&phonet_net_ops); | 347 | int err = register_pernet_subsys(&phonet_net_ops); |
365 | if (err) | 348 | if (err) |
366 | return err; | 349 | return err; |
367 | 350 | ||
@@ -377,7 +360,7 @@ void phonet_device_exit(void) | |||
377 | { | 360 | { |
378 | rtnl_unregister_all(PF_PHONET); | 361 | rtnl_unregister_all(PF_PHONET); |
379 | unregister_netdevice_notifier(&phonet_device_notifier); | 362 | unregister_netdevice_notifier(&phonet_device_notifier); |
380 | unregister_pernet_device(&phonet_net_ops); | 363 | unregister_pernet_subsys(&phonet_net_ops); |
381 | proc_net_remove(&init_net, "pnresource"); | 364 | proc_net_remove(&init_net, "pnresource"); |
382 | } | 365 | } |
383 | 366 | ||
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 0b15236be7b6..8179494c269a 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
@@ -565,11 +565,8 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
565 | opt.packets = q->packetsin; | 565 | opt.packets = q->packetsin; |
566 | opt.bytesin = q->bytesin; | 566 | opt.bytesin = q->bytesin; |
567 | 567 | ||
568 | if (gred_wred_mode(table)) { | 568 | if (gred_wred_mode(table)) |
569 | q->vars.qidlestart = | 569 | gred_load_wred_set(table, q); |
570 | table->tab[table->def]->vars.qidlestart; | ||
571 | q->vars.qavg = table->tab[table->def]->vars.qavg; | ||
572 | } | ||
573 | 570 | ||
574 | opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); | 571 | opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); |
575 | 572 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 5da548fa7ae9..ebd22966f748 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { | 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || | 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || |
410 | (skb->ip_summed == CHECKSUM_PARTIAL && | 410 | (skb->ip_summed == CHECKSUM_PARTIAL && |
411 | skb_checksum_help(skb))) { | 411 | skb_checksum_help(skb))) |
412 | sch->qstats.drops++; | 412 | return qdisc_drop(skb, sch); |
413 | return NET_XMIT_DROP; | ||
414 | } | ||
415 | 413 | ||
416 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 414 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
417 | } | 415 | } |