aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/request_sock.c7
-rw-r--r--net/core/secure_seq.c2
-rw-r--r--net/ipv4/route.c47
-rw-r--r--net/mac80211/main.c6
-rw-r--r--net/mac80211/util.c1
-rw-r--r--net/wireless/reg.c49
6 files changed, 62 insertions, 50 deletions
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 182236b2510a..9b570a6a33c5 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -26,10 +26,11 @@
26 * but then some measure against one socket starving all other sockets 26 * but then some measure against one socket starving all other sockets
27 * would be needed. 27 * would be needed.
28 * 28 *
29 * It was 128 by default. Experiments with real servers show, that 29 * The minimum value of it is 128. Experiments with real servers show that
30 * it is absolutely not enough even at 100conn/sec. 256 cures most 30 * it is absolutely not enough even at 100conn/sec. 256 cures most
31 * of problems. This value is adjusted to 128 for very small machines 31 * of problems.
32 * (<=32Mb of memory) and to 1024 on normal or better ones (>=256Mb). 32 * This value is adjusted to 128 for low memory machines,
33 * and it will increase in proportion to the memory of machine.
33 * Note : Dont forget somaxconn that may limit backlog too. 34 * Note : Dont forget somaxconn that may limit backlog too.
34 */ 35 */
35int sysctl_max_syn_backlog = 256; 36int sysctl_max_syn_backlog = 256;
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c
index 025233de25f9..925991ae6f52 100644
--- a/net/core/secure_seq.c
+++ b/net/core/secure_seq.c
@@ -19,6 +19,7 @@ static int __init net_secret_init(void)
19} 19}
20late_initcall(net_secret_init); 20late_initcall(net_secret_init);
21 21
22#ifdef CONFIG_INET
22static u32 seq_scale(u32 seq) 23static u32 seq_scale(u32 seq)
23{ 24{
24 /* 25 /*
@@ -33,6 +34,7 @@ static u32 seq_scale(u32 seq)
33 */ 34 */
34 return seq + (ktime_to_ns(ktime_get_real()) >> 6); 35 return seq + (ktime_to_ns(ktime_get_real()) >> 6);
35} 36}
37#endif
36 38
37#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 39#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
38__u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, 40__u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index ca5e237df029..46af62363b8c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -112,7 +112,7 @@
112#include <net/secure_seq.h> 112#include <net/secure_seq.h>
113 113
114#define RT_FL_TOS(oldflp4) \ 114#define RT_FL_TOS(oldflp4) \
115 ((u32)(oldflp4->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))) 115 ((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))
116 116
117#define IP_MAX_MTU 0xFFF0 117#define IP_MAX_MTU 0xFFF0
118 118
@@ -1310,7 +1310,7 @@ static void rt_del(unsigned hash, struct rtable *rt)
1310 spin_unlock_bh(rt_hash_lock_addr(hash)); 1310 spin_unlock_bh(rt_hash_lock_addr(hash));
1311} 1311}
1312 1312
1313static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) 1313static void check_peer_redir(struct dst_entry *dst, struct inet_peer *peer)
1314{ 1314{
1315 struct rtable *rt = (struct rtable *) dst; 1315 struct rtable *rt = (struct rtable *) dst;
1316 __be32 orig_gw = rt->rt_gateway; 1316 __be32 orig_gw = rt->rt_gateway;
@@ -1321,21 +1321,19 @@ static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer)
1321 rt->rt_gateway = peer->redirect_learned.a4; 1321 rt->rt_gateway = peer->redirect_learned.a4;
1322 1322
1323 n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); 1323 n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway);
1324 if (IS_ERR(n)) 1324 if (IS_ERR(n)) {
1325 return PTR_ERR(n); 1325 rt->rt_gateway = orig_gw;
1326 return;
1327 }
1326 old_n = xchg(&rt->dst._neighbour, n); 1328 old_n = xchg(&rt->dst._neighbour, n);
1327 if (old_n) 1329 if (old_n)
1328 neigh_release(old_n); 1330 neigh_release(old_n);
1329 if (!n || !(n->nud_state & NUD_VALID)) { 1331 if (!(n->nud_state & NUD_VALID)) {
1330 if (n) 1332 neigh_event_send(n, NULL);
1331 neigh_event_send(n, NULL);
1332 rt->rt_gateway = orig_gw;
1333 return -EAGAIN;
1334 } else { 1333 } else {
1335 rt->rt_flags |= RTCF_REDIRECTED; 1334 rt->rt_flags |= RTCF_REDIRECTED;
1336 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); 1335 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n);
1337 } 1336 }
1338 return 0;
1339} 1337}
1340 1338
1341/* called in rcu_read_lock() section */ 1339/* called in rcu_read_lock() section */
@@ -1693,7 +1691,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
1693} 1691}
1694 1692
1695 1693
1696static struct rtable *ipv4_validate_peer(struct rtable *rt) 1694static void ipv4_validate_peer(struct rtable *rt)
1697{ 1695{
1698 if (rt->rt_peer_genid != rt_peer_genid()) { 1696 if (rt->rt_peer_genid != rt_peer_genid()) {
1699 struct inet_peer *peer; 1697 struct inet_peer *peer;
@@ -1708,15 +1706,12 @@ static struct rtable *ipv4_validate_peer(struct rtable *rt)
1708 if (peer->redirect_genid != redirect_genid) 1706 if (peer->redirect_genid != redirect_genid)
1709 peer->redirect_learned.a4 = 0; 1707 peer->redirect_learned.a4 = 0;
1710 if (peer->redirect_learned.a4 && 1708 if (peer->redirect_learned.a4 &&
1711 peer->redirect_learned.a4 != rt->rt_gateway) { 1709 peer->redirect_learned.a4 != rt->rt_gateway)
1712 if (check_peer_redir(&rt->dst, peer)) 1710 check_peer_redir(&rt->dst, peer);
1713 return NULL;
1714 }
1715 } 1711 }
1716 1712
1717 rt->rt_peer_genid = rt_peer_genid(); 1713 rt->rt_peer_genid = rt_peer_genid();
1718 } 1714 }
1719 return rt;
1720} 1715}
1721 1716
1722static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) 1717static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
@@ -1725,7 +1720,7 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
1725 1720
1726 if (rt_is_expired(rt)) 1721 if (rt_is_expired(rt))
1727 return NULL; 1722 return NULL;
1728 dst = (struct dst_entry *) ipv4_validate_peer(rt); 1723 ipv4_validate_peer(rt);
1729 return dst; 1724 return dst;
1730} 1725}
1731 1726
@@ -2380,9 +2375,7 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2380 rth->rt_mark == skb->mark && 2375 rth->rt_mark == skb->mark &&
2381 net_eq(dev_net(rth->dst.dev), net) && 2376 net_eq(dev_net(rth->dst.dev), net) &&
2382 !rt_is_expired(rth)) { 2377 !rt_is_expired(rth)) {
2383 rth = ipv4_validate_peer(rth); 2378 ipv4_validate_peer(rth);
2384 if (!rth)
2385 continue;
2386 if (noref) { 2379 if (noref) {
2387 dst_use_noref(&rth->dst, jiffies); 2380 dst_use_noref(&rth->dst, jiffies);
2388 skb_dst_set_noref(skb, &rth->dst); 2381 skb_dst_set_noref(skb, &rth->dst);
@@ -2441,11 +2434,11 @@ EXPORT_SYMBOL(ip_route_input_common);
2441static struct rtable *__mkroute_output(const struct fib_result *res, 2434static struct rtable *__mkroute_output(const struct fib_result *res,
2442 const struct flowi4 *fl4, 2435 const struct flowi4 *fl4,
2443 __be32 orig_daddr, __be32 orig_saddr, 2436 __be32 orig_daddr, __be32 orig_saddr,
2444 int orig_oif, struct net_device *dev_out, 2437 int orig_oif, __u8 orig_rtos,
2438 struct net_device *dev_out,
2445 unsigned int flags) 2439 unsigned int flags)
2446{ 2440{
2447 struct fib_info *fi = res->fi; 2441 struct fib_info *fi = res->fi;
2448 u32 tos = RT_FL_TOS(fl4);
2449 struct in_device *in_dev; 2442 struct in_device *in_dev;
2450 u16 type = res->type; 2443 u16 type = res->type;
2451 struct rtable *rth; 2444 struct rtable *rth;
@@ -2496,7 +2489,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
2496 rth->rt_genid = rt_genid(dev_net(dev_out)); 2489 rth->rt_genid = rt_genid(dev_net(dev_out));
2497 rth->rt_flags = flags; 2490 rth->rt_flags = flags;
2498 rth->rt_type = type; 2491 rth->rt_type = type;
2499 rth->rt_key_tos = tos; 2492 rth->rt_key_tos = orig_rtos;
2500 rth->rt_dst = fl4->daddr; 2493 rth->rt_dst = fl4->daddr;
2501 rth->rt_src = fl4->saddr; 2494 rth->rt_src = fl4->saddr;
2502 rth->rt_route_iif = 0; 2495 rth->rt_route_iif = 0;
@@ -2546,7 +2539,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
2546static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) 2539static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
2547{ 2540{
2548 struct net_device *dev_out = NULL; 2541 struct net_device *dev_out = NULL;
2549 u32 tos = RT_FL_TOS(fl4); 2542 __u8 tos = RT_FL_TOS(fl4);
2550 unsigned int flags = 0; 2543 unsigned int flags = 0;
2551 struct fib_result res; 2544 struct fib_result res;
2552 struct rtable *rth; 2545 struct rtable *rth;
@@ -2722,7 +2715,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
2722 2715
2723make_route: 2716make_route:
2724 rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, 2717 rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif,
2725 dev_out, flags); 2718 tos, dev_out, flags);
2726 if (!IS_ERR(rth)) { 2719 if (!IS_ERR(rth)) {
2727 unsigned int hash; 2720 unsigned int hash;
2728 2721
@@ -2758,9 +2751,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4)
2758 (IPTOS_RT_MASK | RTO_ONLINK)) && 2751 (IPTOS_RT_MASK | RTO_ONLINK)) &&
2759 net_eq(dev_net(rth->dst.dev), net) && 2752 net_eq(dev_net(rth->dst.dev), net) &&
2760 !rt_is_expired(rth)) { 2753 !rt_is_expired(rth)) {
2761 rth = ipv4_validate_peer(rth); 2754 ipv4_validate_peer(rth);
2762 if (!rth)
2763 continue;
2764 dst_use(&rth->dst, jiffies); 2755 dst_use(&rth->dst, jiffies);
2765 RT_CACHE_STAT_INC(out_hit); 2756 RT_CACHE_STAT_INC(out_hit);
2766 rcu_read_unlock_bh(); 2757 rcu_read_unlock_bh();
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d999bf3b84e1..cae443563ec9 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -757,6 +757,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
757 if (!local->int_scan_req) 757 if (!local->int_scan_req)
758 return -ENOMEM; 758 return -ENOMEM;
759 759
760 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
761 if (!local->hw.wiphy->bands[band])
762 continue;
763 local->int_scan_req->rates[band] = (u32) -1;
764 }
765
760 /* if low-level driver supports AP, we also support VLAN */ 766 /* if low-level driver supports AP, we also support VLAN */
761 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { 767 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
762 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); 768 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index eca0fad09709..d5230ecc784d 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1039,7 +1039,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1039 struct ieee80211_sub_if_data, 1039 struct ieee80211_sub_if_data,
1040 u.ap); 1040 u.ap);
1041 1041
1042 memset(&sta->sta.drv_priv, 0, hw->sta_data_size);
1043 WARN_ON(drv_sta_add(local, sdata, &sta->sta)); 1042 WARN_ON(drv_sta_add(local, sdata, &sta->sta));
1044 } 1043 }
1045 } 1044 }
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 77e926738014..3302c56f60d1 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -57,8 +57,17 @@
57#define REG_DBG_PRINT(args...) 57#define REG_DBG_PRINT(args...)
58#endif 58#endif
59 59
60static struct regulatory_request core_request_world = {
61 .initiator = NL80211_REGDOM_SET_BY_CORE,
62 .alpha2[0] = '0',
63 .alpha2[1] = '0',
64 .intersect = false,
65 .processed = true,
66 .country_ie_env = ENVIRON_ANY,
67};
68
60/* Receipt of information from last regulatory request */ 69/* Receipt of information from last regulatory request */
61static struct regulatory_request *last_request; 70static struct regulatory_request *last_request = &core_request_world;
62 71
63/* To trigger userspace events */ 72/* To trigger userspace events */
64static struct platform_device *reg_pdev; 73static struct platform_device *reg_pdev;
@@ -150,7 +159,7 @@ static char user_alpha2[2];
150module_param(ieee80211_regdom, charp, 0444); 159module_param(ieee80211_regdom, charp, 0444);
151MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); 160MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
152 161
153static void reset_regdomains(void) 162static void reset_regdomains(bool full_reset)
154{ 163{
155 /* avoid freeing static information or freeing something twice */ 164 /* avoid freeing static information or freeing something twice */
156 if (cfg80211_regdomain == cfg80211_world_regdom) 165 if (cfg80211_regdomain == cfg80211_world_regdom)
@@ -165,6 +174,13 @@ static void reset_regdomains(void)
165 174
166 cfg80211_world_regdom = &world_regdom; 175 cfg80211_world_regdom = &world_regdom;
167 cfg80211_regdomain = NULL; 176 cfg80211_regdomain = NULL;
177
178 if (!full_reset)
179 return;
180
181 if (last_request != &core_request_world)
182 kfree(last_request);
183 last_request = &core_request_world;
168} 184}
169 185
170/* 186/*
@@ -175,7 +191,7 @@ static void update_world_regdomain(const struct ieee80211_regdomain *rd)
175{ 191{
176 BUG_ON(!last_request); 192 BUG_ON(!last_request);
177 193
178 reset_regdomains(); 194 reset_regdomains(false);
179 195
180 cfg80211_world_regdom = rd; 196 cfg80211_world_regdom = rd;
181 cfg80211_regdomain = rd; 197 cfg80211_regdomain = rd;
@@ -1407,7 +1423,8 @@ static int __regulatory_hint(struct wiphy *wiphy,
1407 } 1423 }
1408 1424
1409new_request: 1425new_request:
1410 kfree(last_request); 1426 if (last_request != &core_request_world)
1427 kfree(last_request);
1411 1428
1412 last_request = pending_request; 1429 last_request = pending_request;
1413 last_request->intersect = intersect; 1430 last_request->intersect = intersect;
@@ -1577,9 +1594,6 @@ static int regulatory_hint_core(const char *alpha2)
1577{ 1594{
1578 struct regulatory_request *request; 1595 struct regulatory_request *request;
1579 1596
1580 kfree(last_request);
1581 last_request = NULL;
1582
1583 request = kzalloc(sizeof(struct regulatory_request), 1597 request = kzalloc(sizeof(struct regulatory_request),
1584 GFP_KERNEL); 1598 GFP_KERNEL);
1585 if (!request) 1599 if (!request)
@@ -1777,7 +1791,7 @@ static void restore_regulatory_settings(bool reset_user)
1777 mutex_lock(&cfg80211_mutex); 1791 mutex_lock(&cfg80211_mutex);
1778 mutex_lock(&reg_mutex); 1792 mutex_lock(&reg_mutex);
1779 1793
1780 reset_regdomains(); 1794 reset_regdomains(true);
1781 restore_alpha2(alpha2, reset_user); 1795 restore_alpha2(alpha2, reset_user);
1782 1796
1783 /* 1797 /*
@@ -2037,8 +2051,10 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2037 } 2051 }
2038 2052
2039 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); 2053 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
2040 if (!request_wiphy) { 2054 if (!request_wiphy &&
2041 reg_set_request_processed(); 2055 (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER ||
2056 last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) {
2057 schedule_delayed_work(&reg_timeout, 0);
2042 return -ENODEV; 2058 return -ENODEV;
2043 } 2059 }
2044 2060
@@ -2046,7 +2062,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2046 int r; 2062 int r;
2047 2063
2048 if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { 2064 if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) {
2049 reset_regdomains(); 2065 reset_regdomains(false);
2050 cfg80211_regdomain = rd; 2066 cfg80211_regdomain = rd;
2051 return 0; 2067 return 0;
2052 } 2068 }
@@ -2067,7 +2083,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2067 if (r) 2083 if (r)
2068 return r; 2084 return r;
2069 2085
2070 reset_regdomains(); 2086 reset_regdomains(false);
2071 cfg80211_regdomain = rd; 2087 cfg80211_regdomain = rd;
2072 return 0; 2088 return 0;
2073 } 2089 }
@@ -2092,7 +2108,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2092 2108
2093 rd = NULL; 2109 rd = NULL;
2094 2110
2095 reset_regdomains(); 2111 reset_regdomains(false);
2096 cfg80211_regdomain = intersected_rd; 2112 cfg80211_regdomain = intersected_rd;
2097 2113
2098 return 0; 2114 return 0;
@@ -2112,7 +2128,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2112 kfree(rd); 2128 kfree(rd);
2113 rd = NULL; 2129 rd = NULL;
2114 2130
2115 reset_regdomains(); 2131 reset_regdomains(false);
2116 cfg80211_regdomain = intersected_rd; 2132 cfg80211_regdomain = intersected_rd;
2117 2133
2118 return 0; 2134 return 0;
@@ -2265,11 +2281,8 @@ void /* __init_or_exit */ regulatory_exit(void)
2265 mutex_lock(&cfg80211_mutex); 2281 mutex_lock(&cfg80211_mutex);
2266 mutex_lock(&reg_mutex); 2282 mutex_lock(&reg_mutex);
2267 2283
2268 reset_regdomains(); 2284 reset_regdomains(true);
2269
2270 kfree(last_request);
2271 2285
2272 last_request = NULL;
2273 dev_set_uevent_suppress(&reg_pdev->dev, true); 2286 dev_set_uevent_suppress(&reg_pdev->dev, true);
2274 2287
2275 platform_device_unregister(reg_pdev); 2288 platform_device_unregister(reg_pdev);