diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/atm/lec.c | 2 | ||||
-rw-r--r-- | net/core/drop_monitor.c | 39 | ||||
-rw-r--r-- | net/core/filter.c | 6 | ||||
-rw-r--r-- | net/core/flow_dissector.c | 5 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 6 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 2 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 7 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 8 | ||||
-rw-r--r-- | net/ipv4/route.c | 3 | ||||
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 14 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 2 | ||||
-rw-r--r-- | net/l2tp/l2tp_ip.c | 19 | ||||
-rw-r--r-- | net/l2tp/l2tp_ip6.c | 24 | ||||
-rw-r--r-- | net/mac80211/tx.c | 3 | ||||
-rw-r--r-- | net/openvswitch/datapath.c | 1 | ||||
-rw-r--r-- | net/openvswitch/flow.c | 54 | ||||
-rw-r--r-- | net/sched/cls_api.c | 4 | ||||
-rw-r--r-- | net/sched/cls_flower.c | 4 | ||||
-rw-r--r-- | net/socket.c | 2 | ||||
-rw-r--r-- | net/tipc/socket.c | 24 |
21 files changed, 131 insertions, 102 deletions
diff --git a/net/atm/lec.c b/net/atm/lec.c index 019557d0a11d..09cfe87f0a44 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -1059,7 +1059,9 @@ static void __exit lane_module_cleanup(void) | |||
1059 | { | 1059 | { |
1060 | int i; | 1060 | int i; |
1061 | 1061 | ||
1062 | #ifdef CONFIG_PROC_FS | ||
1062 | remove_proc_entry("lec", atm_proc_root); | 1063 | remove_proc_entry("lec", atm_proc_root); |
1064 | #endif | ||
1063 | 1065 | ||
1064 | deregister_atm_ioctl(&lane_ioctl_ops); | 1066 | deregister_atm_ioctl(&lane_ioctl_ops); |
1065 | 1067 | ||
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 8e0c0635ee97..fb55327dcfea 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -75,6 +75,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
75 | struct nlattr *nla; | 75 | struct nlattr *nla; |
76 | struct sk_buff *skb; | 76 | struct sk_buff *skb; |
77 | unsigned long flags; | 77 | unsigned long flags; |
78 | void *msg_header; | ||
78 | 79 | ||
79 | al = sizeof(struct net_dm_alert_msg); | 80 | al = sizeof(struct net_dm_alert_msg); |
80 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); | 81 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
@@ -82,21 +83,41 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
82 | 83 | ||
83 | skb = genlmsg_new(al, GFP_KERNEL); | 84 | skb = genlmsg_new(al, GFP_KERNEL); |
84 | 85 | ||
85 | if (skb) { | 86 | if (!skb) |
86 | genlmsg_put(skb, 0, 0, &net_drop_monitor_family, | 87 | goto err; |
87 | 0, NET_DM_CMD_ALERT); | 88 | |
88 | nla = nla_reserve(skb, NLA_UNSPEC, | 89 | msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family, |
89 | sizeof(struct net_dm_alert_msg)); | 90 | 0, NET_DM_CMD_ALERT); |
90 | msg = nla_data(nla); | 91 | if (!msg_header) { |
91 | memset(msg, 0, al); | 92 | nlmsg_free(skb); |
92 | } else { | 93 | skb = NULL; |
93 | mod_timer(&data->send_timer, jiffies + HZ / 10); | 94 | goto err; |
95 | } | ||
96 | nla = nla_reserve(skb, NLA_UNSPEC, | ||
97 | sizeof(struct net_dm_alert_msg)); | ||
98 | if (!nla) { | ||
99 | nlmsg_free(skb); | ||
100 | skb = NULL; | ||
101 | goto err; | ||
94 | } | 102 | } |
103 | msg = nla_data(nla); | ||
104 | memset(msg, 0, al); | ||
105 | goto out; | ||
95 | 106 | ||
107 | err: | ||
108 | mod_timer(&data->send_timer, jiffies + HZ / 10); | ||
109 | out: | ||
96 | spin_lock_irqsave(&data->lock, flags); | 110 | spin_lock_irqsave(&data->lock, flags); |
97 | swap(data->skb, skb); | 111 | swap(data->skb, skb); |
98 | spin_unlock_irqrestore(&data->lock, flags); | 112 | spin_unlock_irqrestore(&data->lock, flags); |
99 | 113 | ||
114 | if (skb) { | ||
115 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data; | ||
116 | struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh); | ||
117 | |||
118 | genlmsg_end(skb, genlmsg_data(gnlh)); | ||
119 | } | ||
120 | |||
100 | return skb; | 121 | return skb; |
101 | } | 122 | } |
102 | 123 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index e6c412b94dec..1969b3f118c1 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -2972,12 +2972,6 @@ void bpf_warn_invalid_xdp_action(u32 act) | |||
2972 | } | 2972 | } |
2973 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); | 2973 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); |
2974 | 2974 | ||
2975 | void bpf_warn_invalid_xdp_buffer(void) | ||
2976 | { | ||
2977 | WARN_ONCE(1, "Illegal XDP buffer encountered, expect throughput degradation\n"); | ||
2978 | } | ||
2979 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_buffer); | ||
2980 | |||
2981 | static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg, | 2975 | static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg, |
2982 | int src_reg, int ctx_off, | 2976 | int src_reg, int ctx_off, |
2983 | struct bpf_insn *insn_buf, | 2977 | struct bpf_insn *insn_buf, |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index d6447dc10371..fe4e1531976c 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -468,8 +468,9 @@ ip_proto_again: | |||
468 | if (hdr->flags & GRE_ACK) | 468 | if (hdr->flags & GRE_ACK) |
469 | offset += sizeof(((struct pptp_gre_header *)0)->ack); | 469 | offset += sizeof(((struct pptp_gre_header *)0)->ack); |
470 | 470 | ||
471 | ppp_hdr = skb_header_pointer(skb, nhoff + offset, | 471 | ppp_hdr = __skb_header_pointer(skb, nhoff + offset, |
472 | sizeof(_ppp_hdr), _ppp_hdr); | 472 | sizeof(_ppp_hdr), |
473 | data, hlen, _ppp_hdr); | ||
473 | if (!ppp_hdr) | 474 | if (!ppp_hdr) |
474 | goto out_bad; | 475 | goto out_bad; |
475 | 476 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 18b5aae99bec..75e3ea7bda08 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -3898,6 +3898,9 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
3898 | u32 filter_mask; | 3898 | u32 filter_mask; |
3899 | int err; | 3899 | int err; |
3900 | 3900 | ||
3901 | if (nlmsg_len(nlh) < sizeof(*ifsm)) | ||
3902 | return -EINVAL; | ||
3903 | |||
3901 | ifsm = nlmsg_data(nlh); | 3904 | ifsm = nlmsg_data(nlh); |
3902 | if (ifsm->ifindex > 0) | 3905 | if (ifsm->ifindex > 0) |
3903 | dev = __dev_get_by_index(net, ifsm->ifindex); | 3906 | dev = __dev_get_by_index(net, ifsm->ifindex); |
@@ -3947,6 +3950,9 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
3947 | 3950 | ||
3948 | cb->seq = net->dev_base_seq; | 3951 | cb->seq = net->dev_base_seq; |
3949 | 3952 | ||
3953 | if (nlmsg_len(cb->nlh) < sizeof(*ifsm)) | ||
3954 | return -EINVAL; | ||
3955 | |||
3950 | ifsm = nlmsg_data(cb->nlh); | 3956 | ifsm = nlmsg_data(cb->nlh); |
3951 | filter_mask = ifsm->filter_mask; | 3957 | filter_mask = ifsm->filter_mask; |
3952 | if (!filter_mask) | 3958 | if (!filter_mask) |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3ff8938893ec..eae0332b0e8c 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id) | |||
85 | if (tb) | 85 | if (tb) |
86 | return tb; | 86 | return tb; |
87 | 87 | ||
88 | if (id == RT_TABLE_LOCAL) | 88 | if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules) |
89 | alias = fib_new_table(net, RT_TABLE_MAIN); | 89 | alias = fib_new_table(net, RT_TABLE_MAIN); |
90 | 90 | ||
91 | tb = fib_trie_table(id, alias); | 91 | tb = fib_trie_table(id, alias); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 68d622133f53..5b15459955f8 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -219,9 +219,14 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | |||
219 | static void igmp_gq_start_timer(struct in_device *in_dev) | 219 | static void igmp_gq_start_timer(struct in_device *in_dev) |
220 | { | 220 | { |
221 | int tv = prandom_u32() % in_dev->mr_maxdelay; | 221 | int tv = prandom_u32() % in_dev->mr_maxdelay; |
222 | unsigned long exp = jiffies + tv + 2; | ||
223 | |||
224 | if (in_dev->mr_gq_running && | ||
225 | time_after_eq(exp, (in_dev->mr_gq_timer).expires)) | ||
226 | return; | ||
222 | 227 | ||
223 | in_dev->mr_gq_running = 1; | 228 | in_dev->mr_gq_running = 1; |
224 | if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) | 229 | if (!mod_timer(&in_dev->mr_gq_timer, exp)) |
225 | in_dev_hold(in_dev); | 230 | in_dev_hold(in_dev); |
226 | } | 231 | } |
227 | 232 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 57e1405e8282..53ae0c6315ad 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1225,8 +1225,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) | |||
1225 | * which has interface index (iif) as the first member of the | 1225 | * which has interface index (iif) as the first member of the |
1226 | * underlying inet{6}_skb_parm struct. This code then overlays | 1226 | * underlying inet{6}_skb_parm struct. This code then overlays |
1227 | * PKTINFO_SKB_CB and in_pktinfo also has iif as the first | 1227 | * PKTINFO_SKB_CB and in_pktinfo also has iif as the first |
1228 | * element so the iif is picked up from the prior IPCB | 1228 | * element so the iif is picked up from the prior IPCB. If iif |
1229 | * is the loopback interface, then return the sending interface | ||
1230 | * (e.g., process binds socket to eth0 for Tx which is | ||
1231 | * redirected to loopback in the rtable/dst). | ||
1229 | */ | 1232 | */ |
1233 | if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX) | ||
1234 | pktinfo->ipi_ifindex = inet_iif(skb); | ||
1235 | |||
1230 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); | 1236 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); |
1231 | } else { | 1237 | } else { |
1232 | pktinfo->ipi_ifindex = 0; | 1238 | pktinfo->ipi_ifindex = 0; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a82a11747b3f..0fcac8e7a2b2 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1914,7 +1914,8 @@ local_input: | |||
1914 | } | 1914 | } |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type, | 1917 | rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev, |
1918 | flags | RTCF_LOCAL, res.type, | ||
1918 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); | 1919 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); |
1919 | if (!rth) | 1920 | if (!rth) |
1920 | goto e_nobufs; | 1921 | goto e_nobufs; |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 80bc36b25de2..22cbd61079b5 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -433,13 +433,6 @@ static struct ctl_table ipv4_table[] = { | |||
433 | .extra2 = &tcp_adv_win_scale_max, | 433 | .extra2 = &tcp_adv_win_scale_max, |
434 | }, | 434 | }, |
435 | { | 435 | { |
436 | .procname = "tcp_tw_reuse", | ||
437 | .data = &sysctl_tcp_tw_reuse, | ||
438 | .maxlen = sizeof(int), | ||
439 | .mode = 0644, | ||
440 | .proc_handler = proc_dointvec | ||
441 | }, | ||
442 | { | ||
443 | .procname = "tcp_frto", | 436 | .procname = "tcp_frto", |
444 | .data = &sysctl_tcp_frto, | 437 | .data = &sysctl_tcp_frto, |
445 | .maxlen = sizeof(int), | 438 | .maxlen = sizeof(int), |
@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = { | |||
960 | .mode = 0644, | 953 | .mode = 0644, |
961 | .proc_handler = proc_dointvec, | 954 | .proc_handler = proc_dointvec, |
962 | }, | 955 | }, |
956 | { | ||
957 | .procname = "tcp_tw_reuse", | ||
958 | .data = &init_net.ipv4.sysctl_tcp_tw_reuse, | ||
959 | .maxlen = sizeof(int), | ||
960 | .mode = 0644, | ||
961 | .proc_handler = proc_dointvec | ||
962 | }, | ||
963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
964 | { | 964 | { |
965 | .procname = "fib_multipath_use_neigh", | 965 | .procname = "fib_multipath_use_neigh", |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 30d81f533ada..fe9da4fb96bf 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -84,7 +84,6 @@ | |||
84 | #include <crypto/hash.h> | 84 | #include <crypto/hash.h> |
85 | #include <linux/scatterlist.h> | 85 | #include <linux/scatterlist.h> |
86 | 86 | ||
87 | int sysctl_tcp_tw_reuse __read_mostly; | ||
88 | int sysctl_tcp_low_latency __read_mostly; | 87 | int sysctl_tcp_low_latency __read_mostly; |
89 | 88 | ||
90 | #ifdef CONFIG_TCP_MD5SIG | 89 | #ifdef CONFIG_TCP_MD5SIG |
@@ -120,7 +119,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) | |||
120 | and use initial timestamp retrieved from peer table. | 119 | and use initial timestamp retrieved from peer table. |
121 | */ | 120 | */ |
122 | if (tcptw->tw_ts_recent_stamp && | 121 | if (tcptw->tw_ts_recent_stamp && |
123 | (!twp || (sysctl_tcp_tw_reuse && | 122 | (!twp || (sock_net(sk)->ipv4.sysctl_tcp_tw_reuse && |
124 | get_seconds() - tcptw->tw_ts_recent_stamp > 1))) { | 123 | get_seconds() - tcptw->tw_ts_recent_stamp > 1))) { |
125 | tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; | 124 | tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; |
126 | if (tp->write_seq == 0) | 125 | if (tp->write_seq == 0) |
@@ -2456,6 +2455,7 @@ static int __net_init tcp_sk_init(struct net *net) | |||
2456 | net->ipv4.sysctl_tcp_orphan_retries = 0; | 2455 | net->ipv4.sysctl_tcp_orphan_retries = 0; |
2457 | net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT; | 2456 | net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT; |
2458 | net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; | 2457 | net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; |
2458 | net->ipv4.sysctl_tcp_tw_reuse = 0; | ||
2459 | 2459 | ||
2460 | return 0; | 2460 | return 0; |
2461 | fail: | 2461 | fail: |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 70d0de404197..38122d04fadc 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1373,7 +1373,7 @@ emsgsize: | |||
1373 | */ | 1373 | */ |
1374 | 1374 | ||
1375 | cork->length += length; | 1375 | cork->length += length; |
1376 | if (((length > mtu) || | 1376 | if ((((length + fragheaderlen) > mtu) || |
1377 | (skb && skb_is_gso(skb))) && | 1377 | (skb && skb_is_gso(skb))) && |
1378 | (sk->sk_protocol == IPPROTO_UDP) && | 1378 | (sk->sk_protocol == IPPROTO_UDP) && |
1379 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && | 1379 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 8938b6ba57a0..3d73278b86ca 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -47,7 +47,8 @@ static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk) | |||
47 | return (struct l2tp_ip_sock *)sk; | 47 | return (struct l2tp_ip_sock *)sk; |
48 | } | 48 | } |
49 | 49 | ||
50 | static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) | 50 | static struct sock *__l2tp_ip_bind_lookup(const struct net *net, __be32 laddr, |
51 | __be32 raddr, int dif, u32 tunnel_id) | ||
51 | { | 52 | { |
52 | struct sock *sk; | 53 | struct sock *sk; |
53 | 54 | ||
@@ -61,6 +62,7 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif | |||
61 | if ((l2tp->conn_id == tunnel_id) && | 62 | if ((l2tp->conn_id == tunnel_id) && |
62 | net_eq(sock_net(sk), net) && | 63 | net_eq(sock_net(sk), net) && |
63 | !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && | 64 | !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && |
65 | (!inet->inet_daddr || !raddr || inet->inet_daddr == raddr) && | ||
64 | (!sk->sk_bound_dev_if || !dif || | 66 | (!sk->sk_bound_dev_if || !dif || |
65 | sk->sk_bound_dev_if == dif)) | 67 | sk->sk_bound_dev_if == dif)) |
66 | goto found; | 68 | goto found; |
@@ -71,15 +73,6 @@ found: | |||
71 | return sk; | 73 | return sk; |
72 | } | 74 | } |
73 | 75 | ||
74 | static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) | ||
75 | { | ||
76 | struct sock *sk = __l2tp_ip_bind_lookup(net, laddr, dif, tunnel_id); | ||
77 | if (sk) | ||
78 | sock_hold(sk); | ||
79 | |||
80 | return sk; | ||
81 | } | ||
82 | |||
83 | /* When processing receive frames, there are two cases to | 76 | /* When processing receive frames, there are two cases to |
84 | * consider. Data frames consist of a non-zero session-id and an | 77 | * consider. Data frames consist of a non-zero session-id and an |
85 | * optional cookie. Control frames consist of a regular L2TP header | 78 | * optional cookie. Control frames consist of a regular L2TP header |
@@ -183,8 +176,8 @@ pass_up: | |||
183 | struct iphdr *iph = (struct iphdr *) skb_network_header(skb); | 176 | struct iphdr *iph = (struct iphdr *) skb_network_header(skb); |
184 | 177 | ||
185 | read_lock_bh(&l2tp_ip_lock); | 178 | read_lock_bh(&l2tp_ip_lock); |
186 | sk = __l2tp_ip_bind_lookup(net, iph->daddr, inet_iif(skb), | 179 | sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr, |
187 | tunnel_id); | 180 | inet_iif(skb), tunnel_id); |
188 | if (!sk) { | 181 | if (!sk) { |
189 | read_unlock_bh(&l2tp_ip_lock); | 182 | read_unlock_bh(&l2tp_ip_lock); |
190 | goto discard; | 183 | goto discard; |
@@ -280,7 +273,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
280 | inet->inet_saddr = 0; /* Use device */ | 273 | inet->inet_saddr = 0; /* Use device */ |
281 | 274 | ||
282 | write_lock_bh(&l2tp_ip_lock); | 275 | write_lock_bh(&l2tp_ip_lock); |
283 | if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, | 276 | if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 0, |
284 | sk->sk_bound_dev_if, addr->l2tp_conn_id)) { | 277 | sk->sk_bound_dev_if, addr->l2tp_conn_id)) { |
285 | write_unlock_bh(&l2tp_ip_lock); | 278 | write_unlock_bh(&l2tp_ip_lock); |
286 | ret = -EADDRINUSE; | 279 | ret = -EADDRINUSE; |
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index f092ac441fdd..331ccf5a7bad 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -59,12 +59,14 @@ static inline struct l2tp_ip6_sock *l2tp_ip6_sk(const struct sock *sk) | |||
59 | 59 | ||
60 | static struct sock *__l2tp_ip6_bind_lookup(struct net *net, | 60 | static struct sock *__l2tp_ip6_bind_lookup(struct net *net, |
61 | struct in6_addr *laddr, | 61 | struct in6_addr *laddr, |
62 | const struct in6_addr *raddr, | ||
62 | int dif, u32 tunnel_id) | 63 | int dif, u32 tunnel_id) |
63 | { | 64 | { |
64 | struct sock *sk; | 65 | struct sock *sk; |
65 | 66 | ||
66 | sk_for_each_bound(sk, &l2tp_ip6_bind_table) { | 67 | sk_for_each_bound(sk, &l2tp_ip6_bind_table) { |
67 | const struct in6_addr *addr = inet6_rcv_saddr(sk); | 68 | const struct in6_addr *sk_laddr = inet6_rcv_saddr(sk); |
69 | const struct in6_addr *sk_raddr = &sk->sk_v6_daddr; | ||
68 | struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); | 70 | struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); |
69 | 71 | ||
70 | if (l2tp == NULL) | 72 | if (l2tp == NULL) |
@@ -72,7 +74,8 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, | |||
72 | 74 | ||
73 | if ((l2tp->conn_id == tunnel_id) && | 75 | if ((l2tp->conn_id == tunnel_id) && |
74 | net_eq(sock_net(sk), net) && | 76 | net_eq(sock_net(sk), net) && |
75 | (!addr || ipv6_addr_equal(addr, laddr)) && | 77 | (!sk_laddr || ipv6_addr_any(sk_laddr) || ipv6_addr_equal(sk_laddr, laddr)) && |
78 | (!raddr || ipv6_addr_any(sk_raddr) || ipv6_addr_equal(sk_raddr, raddr)) && | ||
76 | (!sk->sk_bound_dev_if || !dif || | 79 | (!sk->sk_bound_dev_if || !dif || |
77 | sk->sk_bound_dev_if == dif)) | 80 | sk->sk_bound_dev_if == dif)) |
78 | goto found; | 81 | goto found; |
@@ -83,17 +86,6 @@ found: | |||
83 | return sk; | 86 | return sk; |
84 | } | 87 | } |
85 | 88 | ||
86 | static inline struct sock *l2tp_ip6_bind_lookup(struct net *net, | ||
87 | struct in6_addr *laddr, | ||
88 | int dif, u32 tunnel_id) | ||
89 | { | ||
90 | struct sock *sk = __l2tp_ip6_bind_lookup(net, laddr, dif, tunnel_id); | ||
91 | if (sk) | ||
92 | sock_hold(sk); | ||
93 | |||
94 | return sk; | ||
95 | } | ||
96 | |||
97 | /* When processing receive frames, there are two cases to | 89 | /* When processing receive frames, there are two cases to |
98 | * consider. Data frames consist of a non-zero session-id and an | 90 | * consider. Data frames consist of a non-zero session-id and an |
99 | * optional cookie. Control frames consist of a regular L2TP header | 91 | * optional cookie. Control frames consist of a regular L2TP header |
@@ -197,8 +189,8 @@ pass_up: | |||
197 | struct ipv6hdr *iph = ipv6_hdr(skb); | 189 | struct ipv6hdr *iph = ipv6_hdr(skb); |
198 | 190 | ||
199 | read_lock_bh(&l2tp_ip6_lock); | 191 | read_lock_bh(&l2tp_ip6_lock); |
200 | sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, inet6_iif(skb), | 192 | sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr, |
201 | tunnel_id); | 193 | inet6_iif(skb), tunnel_id); |
202 | if (!sk) { | 194 | if (!sk) { |
203 | read_unlock_bh(&l2tp_ip6_lock); | 195 | read_unlock_bh(&l2tp_ip6_lock); |
204 | goto discard; | 196 | goto discard; |
@@ -330,7 +322,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
330 | rcu_read_unlock(); | 322 | rcu_read_unlock(); |
331 | 323 | ||
332 | write_lock_bh(&l2tp_ip6_lock); | 324 | write_lock_bh(&l2tp_ip6_lock); |
333 | if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, bound_dev_if, | 325 | if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, NULL, bound_dev_if, |
334 | addr->l2tp_conn_id)) { | 326 | addr->l2tp_conn_id)) { |
335 | write_unlock_bh(&l2tp_ip6_lock); | 327 | write_unlock_bh(&l2tp_ip6_lock); |
336 | err = -EADDRINUSE; | 328 | err = -EADDRINUSE; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 2c21b7039136..0d8b716e509e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -3287,7 +3287,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | |||
3287 | int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); | 3287 | int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); |
3288 | int hw_headroom = sdata->local->hw.extra_tx_headroom; | 3288 | int hw_headroom = sdata->local->hw.extra_tx_headroom; |
3289 | struct ethhdr eth; | 3289 | struct ethhdr eth; |
3290 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 3290 | struct ieee80211_tx_info *info; |
3291 | struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; | 3291 | struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; |
3292 | struct ieee80211_tx_data tx; | 3292 | struct ieee80211_tx_data tx; |
3293 | ieee80211_tx_result r; | 3293 | ieee80211_tx_result r; |
@@ -3351,6 +3351,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | |||
3351 | memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); | 3351 | memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); |
3352 | memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); | 3352 | memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); |
3353 | 3353 | ||
3354 | info = IEEE80211_SKB_CB(skb); | ||
3354 | memset(info, 0, sizeof(*info)); | 3355 | memset(info, 0, sizeof(*info)); |
3355 | info->band = fast_tx->band; | 3356 | info->band = fast_tx->band; |
3356 | info->control.vif = &sdata->vif; | 3357 | info->control.vif = &sdata->vif; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 2d4c4d3911c0..9c62b6325f7a 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -606,7 +606,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
606 | rcu_assign_pointer(flow->sf_acts, acts); | 606 | rcu_assign_pointer(flow->sf_acts, acts); |
607 | packet->priority = flow->key.phy.priority; | 607 | packet->priority = flow->key.phy.priority; |
608 | packet->mark = flow->key.phy.skb_mark; | 608 | packet->mark = flow->key.phy.skb_mark; |
609 | packet->protocol = flow->key.eth.type; | ||
610 | 609 | ||
611 | rcu_read_lock(); | 610 | rcu_read_lock(); |
612 | dp = get_dp_rcu(net, ovs_header->dp_ifindex); | 611 | dp = get_dp_rcu(net, ovs_header->dp_ifindex); |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 08aa926cd5cf..2c0a00f7f1b7 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -312,7 +312,8 @@ static bool icmp6hdr_ok(struct sk_buff *skb) | |||
312 | * Returns 0 if it encounters a non-vlan or incomplete packet. | 312 | * Returns 0 if it encounters a non-vlan or incomplete packet. |
313 | * Returns 1 after successfully parsing vlan tag. | 313 | * Returns 1 after successfully parsing vlan tag. |
314 | */ | 314 | */ |
315 | static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh) | 315 | static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh, |
316 | bool untag_vlan) | ||
316 | { | 317 | { |
317 | struct vlan_head *vh = (struct vlan_head *)skb->data; | 318 | struct vlan_head *vh = (struct vlan_head *)skb->data; |
318 | 319 | ||
@@ -330,7 +331,20 @@ static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh) | |||
330 | key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT); | 331 | key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT); |
331 | key_vh->tpid = vh->tpid; | 332 | key_vh->tpid = vh->tpid; |
332 | 333 | ||
333 | __skb_pull(skb, sizeof(struct vlan_head)); | 334 | if (unlikely(untag_vlan)) { |
335 | int offset = skb->data - skb_mac_header(skb); | ||
336 | u16 tci; | ||
337 | int err; | ||
338 | |||
339 | __skb_push(skb, offset); | ||
340 | err = __skb_vlan_pop(skb, &tci); | ||
341 | __skb_pull(skb, offset); | ||
342 | if (err) | ||
343 | return err; | ||
344 | __vlan_hwaccel_put_tag(skb, key_vh->tpid, tci); | ||
345 | } else { | ||
346 | __skb_pull(skb, sizeof(struct vlan_head)); | ||
347 | } | ||
334 | return 1; | 348 | return 1; |
335 | } | 349 | } |
336 | 350 | ||
@@ -351,13 +365,13 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key) | |||
351 | key->eth.vlan.tpid = skb->vlan_proto; | 365 | key->eth.vlan.tpid = skb->vlan_proto; |
352 | } else { | 366 | } else { |
353 | /* Parse outer vlan tag in the non-accelerated case. */ | 367 | /* Parse outer vlan tag in the non-accelerated case. */ |
354 | res = parse_vlan_tag(skb, &key->eth.vlan); | 368 | res = parse_vlan_tag(skb, &key->eth.vlan, true); |
355 | if (res <= 0) | 369 | if (res <= 0) |
356 | return res; | 370 | return res; |
357 | } | 371 | } |
358 | 372 | ||
359 | /* Parse inner vlan tag. */ | 373 | /* Parse inner vlan tag. */ |
360 | res = parse_vlan_tag(skb, &key->eth.cvlan); | 374 | res = parse_vlan_tag(skb, &key->eth.cvlan, false); |
361 | if (res <= 0) | 375 | if (res <= 0) |
362 | return res; | 376 | return res; |
363 | 377 | ||
@@ -800,29 +814,15 @@ int ovs_flow_key_extract_userspace(struct net *net, const struct nlattr *attr, | |||
800 | if (err) | 814 | if (err) |
801 | return err; | 815 | return err; |
802 | 816 | ||
803 | if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) { | 817 | /* key_extract assumes that skb->protocol is set-up for |
804 | /* key_extract assumes that skb->protocol is set-up for | 818 | * layer 3 packets which is the case for other callers, |
805 | * layer 3 packets which is the case for other callers, | 819 | * in particular packets received from the network stack. |
806 | * in particular packets recieved from the network stack. | 820 | * Here the correct value can be set from the metadata |
807 | * Here the correct value can be set from the metadata | 821 | * extracted above. |
808 | * extracted above. | 822 | * For L2 packet key eth type would be zero. skb protocol |
809 | */ | 823 | * would be set to correct value later during key-extact. |
810 | skb->protocol = key->eth.type; | 824 | */ |
811 | } else { | ||
812 | struct ethhdr *eth; | ||
813 | |||
814 | skb_reset_mac_header(skb); | ||
815 | eth = eth_hdr(skb); | ||
816 | |||
817 | /* Normally, setting the skb 'protocol' field would be | ||
818 | * handled by a call to eth_type_trans(), but it assumes | ||
819 | * there's a sending device, which we may not have. | ||
820 | */ | ||
821 | if (eth_proto_is_802_3(eth->h_proto)) | ||
822 | skb->protocol = eth->h_proto; | ||
823 | else | ||
824 | skb->protocol = htons(ETH_P_802_2); | ||
825 | } | ||
826 | 825 | ||
826 | skb->protocol = key->eth.type; | ||
827 | return key_extract(skb, key); | 827 | return key_extract(skb, key); |
828 | } | 828 | } |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 3fbba79a4ef0..1ecdf809b5fa 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -148,13 +148,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) | |||
148 | unsigned long cl; | 148 | unsigned long cl; |
149 | unsigned long fh; | 149 | unsigned long fh; |
150 | int err; | 150 | int err; |
151 | int tp_created = 0; | 151 | int tp_created; |
152 | 152 | ||
153 | if ((n->nlmsg_type != RTM_GETTFILTER) && | 153 | if ((n->nlmsg_type != RTM_GETTFILTER) && |
154 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) | 154 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
155 | return -EPERM; | 155 | return -EPERM; |
156 | 156 | ||
157 | replay: | 157 | replay: |
158 | tp_created = 0; | ||
159 | |||
158 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL); | 160 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL); |
159 | if (err < 0) | 161 | if (err < 0) |
160 | return err; | 162 | return err; |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 333f8e268431..970db7a41684 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -153,10 +153,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
153 | 153 | ||
154 | switch (ip_tunnel_info_af(info)) { | 154 | switch (ip_tunnel_info_af(info)) { |
155 | case AF_INET: | 155 | case AF_INET: |
156 | skb_key.enc_control.addr_type = | ||
157 | FLOW_DISSECTOR_KEY_IPV4_ADDRS; | ||
156 | skb_key.enc_ipv4.src = key->u.ipv4.src; | 158 | skb_key.enc_ipv4.src = key->u.ipv4.src; |
157 | skb_key.enc_ipv4.dst = key->u.ipv4.dst; | 159 | skb_key.enc_ipv4.dst = key->u.ipv4.dst; |
158 | break; | 160 | break; |
159 | case AF_INET6: | 161 | case AF_INET6: |
162 | skb_key.enc_control.addr_type = | ||
163 | FLOW_DISSECTOR_KEY_IPV6_ADDRS; | ||
160 | skb_key.enc_ipv6.src = key->u.ipv6.src; | 164 | skb_key.enc_ipv6.src = key->u.ipv6.src; |
161 | skb_key.enc_ipv6.dst = key->u.ipv6.dst; | 165 | skb_key.enc_ipv6.dst = key->u.ipv6.dst; |
162 | break; | 166 | break; |
diff --git a/net/socket.c b/net/socket.c index 8487bf136e5c..a8c2307590b8 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -537,7 +537,7 @@ int sockfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
537 | { | 537 | { |
538 | int err = simple_setattr(dentry, iattr); | 538 | int err = simple_setattr(dentry, iattr); |
539 | 539 | ||
540 | if (!err) { | 540 | if (!err && (iattr->ia_valid & ATTR_UID)) { |
541 | struct socket *sock = SOCKET_I(d_inode(dentry)); | 541 | struct socket *sock = SOCKET_I(d_inode(dentry)); |
542 | 542 | ||
543 | sock->sk->sk_uid = iattr->ia_uid; | 543 | sock->sk->sk_uid = iattr->ia_uid; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 333c5dae0072..800caaa699a1 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -441,15 +441,19 @@ static void __tipc_shutdown(struct socket *sock, int error) | |||
441 | while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 441 | while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
442 | if (TIPC_SKB_CB(skb)->bytes_read) { | 442 | if (TIPC_SKB_CB(skb)->bytes_read) { |
443 | kfree_skb(skb); | 443 | kfree_skb(skb); |
444 | } else { | 444 | continue; |
445 | if (!tipc_sk_type_connectionless(sk) && | 445 | } |
446 | sk->sk_state != TIPC_DISCONNECTING) { | 446 | if (!tipc_sk_type_connectionless(sk) && |
447 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); | 447 | sk->sk_state != TIPC_DISCONNECTING) { |
448 | tipc_node_remove_conn(net, dnode, tsk->portid); | 448 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); |
449 | } | 449 | tipc_node_remove_conn(net, dnode, tsk->portid); |
450 | tipc_sk_respond(sk, skb, error); | ||
451 | } | 450 | } |
451 | tipc_sk_respond(sk, skb, error); | ||
452 | } | 452 | } |
453 | |||
454 | if (tipc_sk_type_connectionless(sk)) | ||
455 | return; | ||
456 | |||
453 | if (sk->sk_state != TIPC_DISCONNECTING) { | 457 | if (sk->sk_state != TIPC_DISCONNECTING) { |
454 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, | 458 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, |
455 | TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, | 459 | TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, |
@@ -457,10 +461,8 @@ static void __tipc_shutdown(struct socket *sock, int error) | |||
457 | tsk->portid, error); | 461 | tsk->portid, error); |
458 | if (skb) | 462 | if (skb) |
459 | tipc_node_xmit_skb(net, skb, dnode, tsk->portid); | 463 | tipc_node_xmit_skb(net, skb, dnode, tsk->portid); |
460 | if (!tipc_sk_type_connectionless(sk)) { | 464 | tipc_node_remove_conn(net, dnode, tsk->portid); |
461 | tipc_node_remove_conn(net, dnode, tsk->portid); | 465 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); |
462 | tipc_set_sk_state(sk, TIPC_DISCONNECTING); | ||
463 | } | ||
464 | } | 466 | } |
465 | } | 467 | } |
466 | 468 | ||