aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/flow_dissector.c12
-rw-r--r--net/core/neighbour.c39
-rw-r--r--net/core/rtnetlink.c4
-rw-r--r--net/core/scm.c2
-rw-r--r--net/core/skbuff.c5
-rw-r--r--net/core/sock.c6
-rw-r--r--net/core/sysctl_net_core.c8
7 files changed, 47 insertions, 29 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 00ee068efc1c..d12e3a9a5356 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -65,6 +65,7 @@ ipv6:
65 nhoff += sizeof(struct ipv6hdr); 65 nhoff += sizeof(struct ipv6hdr);
66 break; 66 break;
67 } 67 }
68 case __constant_htons(ETH_P_8021AD):
68 case __constant_htons(ETH_P_8021Q): { 69 case __constant_htons(ETH_P_8021Q): {
69 const struct vlan_hdr *vlan; 70 const struct vlan_hdr *vlan;
70 struct vlan_hdr _vlan; 71 struct vlan_hdr _vlan;
@@ -345,14 +346,9 @@ u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb)
345 if (new_index < 0) 346 if (new_index < 0)
346 new_index = skb_tx_hash(dev, skb); 347 new_index = skb_tx_hash(dev, skb);
347 348
348 if (queue_index != new_index && sk) { 349 if (queue_index != new_index && sk &&
349 struct dst_entry *dst = 350 rcu_access_pointer(sk->sk_dst_cache))
350 rcu_dereference_check(sk->sk_dst_cache, 1); 351 sk_tx_queue_set(sk, queue_index);
351
352 if (dst && skb_dst(skb) == dst)
353 sk_tx_queue_set(sk, queue_index);
354
355 }
356 352
357 queue_index = new_index; 353 queue_index = new_index;
358 } 354 }
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index b7de821f98df..60533db8b72d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1441,16 +1441,18 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
1441 atomic_set(&p->refcnt, 1); 1441 atomic_set(&p->refcnt, 1);
1442 p->reachable_time = 1442 p->reachable_time =
1443 neigh_rand_reach_time(p->base_reachable_time); 1443 neigh_rand_reach_time(p->base_reachable_time);
1444 dev_hold(dev);
1445 p->dev = dev;
1446 write_pnet(&p->net, hold_net(net));
1447 p->sysctl_table = NULL;
1444 1448
1445 if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { 1449 if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) {
1450 release_net(net);
1451 dev_put(dev);
1446 kfree(p); 1452 kfree(p);
1447 return NULL; 1453 return NULL;
1448 } 1454 }
1449 1455
1450 dev_hold(dev);
1451 p->dev = dev;
1452 write_pnet(&p->net, hold_net(net));
1453 p->sysctl_table = NULL;
1454 write_lock_bh(&tbl->lock); 1456 write_lock_bh(&tbl->lock);
1455 p->next = tbl->parms.next; 1457 p->next = tbl->parms.next;
1456 tbl->parms.next = p; 1458 tbl->parms.next = p;
@@ -2767,6 +2769,7 @@ EXPORT_SYMBOL(neigh_app_ns);
2767 2769
2768#ifdef CONFIG_SYSCTL 2770#ifdef CONFIG_SYSCTL
2769static int zero; 2771static int zero;
2772static int int_max = INT_MAX;
2770static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); 2773static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
2771 2774
2772static int proc_unres_qlen(struct ctl_table *ctl, int write, 2775static int proc_unres_qlen(struct ctl_table *ctl, int write,
@@ -2819,19 +2822,25 @@ static struct neigh_sysctl_table {
2819 .procname = "mcast_solicit", 2822 .procname = "mcast_solicit",
2820 .maxlen = sizeof(int), 2823 .maxlen = sizeof(int),
2821 .mode = 0644, 2824 .mode = 0644,
2822 .proc_handler = proc_dointvec, 2825 .extra1 = &zero,
2826 .extra2 = &int_max,
2827 .proc_handler = proc_dointvec_minmax,
2823 }, 2828 },
2824 [NEIGH_VAR_UCAST_PROBE] = { 2829 [NEIGH_VAR_UCAST_PROBE] = {
2825 .procname = "ucast_solicit", 2830 .procname = "ucast_solicit",
2826 .maxlen = sizeof(int), 2831 .maxlen = sizeof(int),
2827 .mode = 0644, 2832 .mode = 0644,
2828 .proc_handler = proc_dointvec, 2833 .extra1 = &zero,
2834 .extra2 = &int_max,
2835 .proc_handler = proc_dointvec_minmax,
2829 }, 2836 },
2830 [NEIGH_VAR_APP_PROBE] = { 2837 [NEIGH_VAR_APP_PROBE] = {
2831 .procname = "app_solicit", 2838 .procname = "app_solicit",
2832 .maxlen = sizeof(int), 2839 .maxlen = sizeof(int),
2833 .mode = 0644, 2840 .mode = 0644,
2834 .proc_handler = proc_dointvec, 2841 .extra1 = &zero,
2842 .extra2 = &int_max,
2843 .proc_handler = proc_dointvec_minmax,
2835 }, 2844 },
2836 [NEIGH_VAR_RETRANS_TIME] = { 2845 [NEIGH_VAR_RETRANS_TIME] = {
2837 .procname = "retrans_time", 2846 .procname = "retrans_time",
@@ -2874,7 +2883,9 @@ static struct neigh_sysctl_table {
2874 .procname = "proxy_qlen", 2883 .procname = "proxy_qlen",
2875 .maxlen = sizeof(int), 2884 .maxlen = sizeof(int),
2876 .mode = 0644, 2885 .mode = 0644,
2877 .proc_handler = proc_dointvec, 2886 .extra1 = &zero,
2887 .extra2 = &int_max,
2888 .proc_handler = proc_dointvec_minmax,
2878 }, 2889 },
2879 [NEIGH_VAR_ANYCAST_DELAY] = { 2890 [NEIGH_VAR_ANYCAST_DELAY] = {
2880 .procname = "anycast_delay", 2891 .procname = "anycast_delay",
@@ -2916,19 +2927,25 @@ static struct neigh_sysctl_table {
2916 .procname = "gc_thresh1", 2927 .procname = "gc_thresh1",
2917 .maxlen = sizeof(int), 2928 .maxlen = sizeof(int),
2918 .mode = 0644, 2929 .mode = 0644,
2919 .proc_handler = proc_dointvec, 2930 .extra1 = &zero,
2931 .extra2 = &int_max,
2932 .proc_handler = proc_dointvec_minmax,
2920 }, 2933 },
2921 [NEIGH_VAR_GC_THRESH2] = { 2934 [NEIGH_VAR_GC_THRESH2] = {
2922 .procname = "gc_thresh2", 2935 .procname = "gc_thresh2",
2923 .maxlen = sizeof(int), 2936 .maxlen = sizeof(int),
2924 .mode = 0644, 2937 .mode = 0644,
2925 .proc_handler = proc_dointvec, 2938 .extra1 = &zero,
2939 .extra2 = &int_max,
2940 .proc_handler = proc_dointvec_minmax,
2926 }, 2941 },
2927 [NEIGH_VAR_GC_THRESH3] = { 2942 [NEIGH_VAR_GC_THRESH3] = {
2928 .procname = "gc_thresh3", 2943 .procname = "gc_thresh3",
2929 .maxlen = sizeof(int), 2944 .maxlen = sizeof(int),
2930 .mode = 0644, 2945 .mode = 0644,
2931 .proc_handler = proc_dointvec, 2946 .extra1 = &zero,
2947 .extra2 = &int_max,
2948 .proc_handler = proc_dointvec_minmax,
2932 }, 2949 },
2933 {}, 2950 {},
2934 }, 2951 },
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3de740834d1f..ca198c1d1d30 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2156,7 +2156,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm,
2156 /* If aging addresses are supported device will need to 2156 /* If aging addresses are supported device will need to
2157 * implement its own handler for this. 2157 * implement its own handler for this.
2158 */ 2158 */
2159 if (ndm->ndm_state & NUD_PERMANENT) { 2159 if (!(ndm->ndm_state & NUD_PERMANENT)) {
2160 pr_info("%s: FDB only supports static addresses\n", dev->name); 2160 pr_info("%s: FDB only supports static addresses\n", dev->name);
2161 return -EINVAL; 2161 return -EINVAL;
2162 } 2162 }
@@ -2384,7 +2384,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
2384 struct nlattr *extfilt; 2384 struct nlattr *extfilt;
2385 u32 filter_mask = 0; 2385 u32 filter_mask = 0;
2386 2386
2387 extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct rtgenmsg), 2387 extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg),
2388 IFLA_EXT_MASK); 2388 IFLA_EXT_MASK);
2389 if (extfilt) 2389 if (extfilt)
2390 filter_mask = nla_get_u32(extfilt); 2390 filter_mask = nla_get_u32(extfilt);
diff --git a/net/core/scm.c b/net/core/scm.c
index 03795d0147f2..b4da80b1cc07 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -54,7 +54,7 @@ static __inline__ int scm_check_creds(struct ucred *creds)
54 return -EINVAL; 54 return -EINVAL;
55 55
56 if ((creds->pid == task_tgid_vnr(current) || 56 if ((creds->pid == task_tgid_vnr(current) ||
57 ns_capable(current->nsproxy->pid_ns->user_ns, CAP_SYS_ADMIN)) && 57 ns_capable(task_active_pid_ns(current)->user_ns, CAP_SYS_ADMIN)) &&
58 ((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) || 58 ((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) ||
59 uid_eq(uid, cred->suid)) || nsown_capable(CAP_SETUID)) && 59 uid_eq(uid, cred->suid)) || nsown_capable(CAP_SETUID)) &&
60 ((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) || 60 ((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 20e02d2605ec..2c3d0f53d198 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -309,7 +309,8 @@ EXPORT_SYMBOL(__alloc_skb);
309 * @frag_size: size of fragment, or 0 if head was kmalloced 309 * @frag_size: size of fragment, or 0 if head was kmalloced
310 * 310 *
311 * Allocate a new &sk_buff. Caller provides space holding head and 311 * Allocate a new &sk_buff. Caller provides space holding head and
312 * skb_shared_info. @data must have been allocated by kmalloc() 312 * skb_shared_info. @data must have been allocated by kmalloc() only if
313 * @frag_size is 0, otherwise data should come from the page allocator.
313 * The return is the new skb buffer. 314 * The return is the new skb buffer.
314 * On a failure the return is %NULL, and @data is not freed. 315 * On a failure the return is %NULL, and @data is not freed.
315 * Notes : 316 * Notes :
@@ -739,7 +740,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
739 740
740 skb_copy_secmark(new, old); 741 skb_copy_secmark(new, old);
741 742
742#ifdef CONFIG_NET_LL_RX_POLL 743#ifdef CONFIG_NET_RX_BUSY_POLL
743 new->napi_id = old->napi_id; 744 new->napi_id = old->napi_id;
744#endif 745#endif
745} 746}
diff --git a/net/core/sock.c b/net/core/sock.c
index 548d716c5f62..2c097c5a35dd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -900,7 +900,7 @@ set_rcvbuf:
900 sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); 900 sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool);
901 break; 901 break;
902 902
903#ifdef CONFIG_NET_LL_RX_POLL 903#ifdef CONFIG_NET_RX_BUSY_POLL
904 case SO_BUSY_POLL: 904 case SO_BUSY_POLL:
905 /* allow unprivileged users to decrease the value */ 905 /* allow unprivileged users to decrease the value */
906 if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) 906 if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN))
@@ -1170,7 +1170,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
1170 v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); 1170 v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE);
1171 break; 1171 break;
1172 1172
1173#ifdef CONFIG_NET_LL_RX_POLL 1173#ifdef CONFIG_NET_RX_BUSY_POLL
1174 case SO_BUSY_POLL: 1174 case SO_BUSY_POLL:
1175 v.val = sk->sk_ll_usec; 1175 v.val = sk->sk_ll_usec;
1176 break; 1176 break;
@@ -2292,7 +2292,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
2292 2292
2293 sk->sk_stamp = ktime_set(-1L, 0); 2293 sk->sk_stamp = ktime_set(-1L, 0);
2294 2294
2295#ifdef CONFIG_NET_LL_RX_POLL 2295#ifdef CONFIG_NET_RX_BUSY_POLL
2296 sk->sk_napi_id = 0; 2296 sk->sk_napi_id = 0;
2297 sk->sk_ll_usec = sysctl_net_busy_read; 2297 sk->sk_ll_usec = sysctl_net_busy_read;
2298#endif 2298#endif
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 660968616637..31107abd2783 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -21,7 +21,9 @@
21#include <net/net_ratelimit.h> 21#include <net/net_ratelimit.h>
22#include <net/busy_poll.h> 22#include <net/busy_poll.h>
23 23
24static int zero = 0;
24static int one = 1; 25static int one = 1;
26static int ushort_max = USHRT_MAX;
25 27
26#ifdef CONFIG_RPS 28#ifdef CONFIG_RPS
27static int rps_sock_flow_sysctl(struct ctl_table *table, int write, 29static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
@@ -298,7 +300,7 @@ static struct ctl_table net_core_table[] = {
298 .proc_handler = flow_limit_table_len_sysctl 300 .proc_handler = flow_limit_table_len_sysctl
299 }, 301 },
300#endif /* CONFIG_NET_FLOW_LIMIT */ 302#endif /* CONFIG_NET_FLOW_LIMIT */
301#ifdef CONFIG_NET_LL_RX_POLL 303#ifdef CONFIG_NET_RX_BUSY_POLL
302 { 304 {
303 .procname = "busy_poll", 305 .procname = "busy_poll",
304 .data = &sysctl_net_busy_poll, 306 .data = &sysctl_net_busy_poll,
@@ -339,7 +341,9 @@ static struct ctl_table netns_core_table[] = {
339 .data = &init_net.core.sysctl_somaxconn, 341 .data = &init_net.core.sysctl_somaxconn,
340 .maxlen = sizeof(int), 342 .maxlen = sizeof(int),
341 .mode = 0644, 343 .mode = 0644,
342 .proc_handler = proc_dointvec 344 .extra1 = &zero,
345 .extra2 = &ushort_max,
346 .proc_handler = proc_dointvec_minmax
343 }, 347 },
344 { } 348 { }
345}; 349};