aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-08-30 00:54:02 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-30 00:54:02 -0400
commit6abdd5f5935fff978f950561f3c5175eb34dad73 (patch)
tree6f3ed3a4f4af9e74436ec9355ebf8201357f1c40 /net/ipv4
parent0b498a52778368ff501557d68c7b50878ab1701e (diff)
parente4e98c460ad38c78498622a164fd5ef09a2dc9cb (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
All three conflicts were cases of simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_trie.c4
-rw-r--r--net/ipv4/ip_tunnel_core.c8
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_diag.c7
-rw-r--r--net/ipv4/tcp_ipv4.c8
-rw-r--r--net/ipv4/udp.c13
-rw-r--r--net/ipv4/udplite.c1
7 files changed, 26 insertions, 17 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index febca0f1008c..e2ffc2a5c7db 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -249,7 +249,7 @@ static inline unsigned long get_index(t_key key, struct key_vector *kv)
249 * index into the parent's child array. That is, they will be used to find 249 * index into the parent's child array. That is, they will be used to find
250 * 'n' among tp's children. 250 * 'n' among tp's children.
251 * 251 *
252 * The bits from (n->pos + n->bits) to (tn->pos - 1) - "S" - are skipped bits 252 * The bits from (n->pos + n->bits) to (tp->pos - 1) - "S" - are skipped bits
253 * for the node n. 253 * for the node n.
254 * 254 *
255 * All the bits we have seen so far are significant to the node n. The rest 255 * All the bits we have seen so far are significant to the node n. The rest
@@ -258,7 +258,7 @@ static inline unsigned long get_index(t_key key, struct key_vector *kv)
258 * The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into 258 * The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into
259 * n's child array, and will of course be different for each child. 259 * n's child array, and will of course be different for each child.
260 * 260 *
261 * The rest of the bits, from 0 to (n->pos + n->bits), are completely unknown 261 * The rest of the bits, from 0 to (n->pos -1) - "u" - are completely unknown
262 * at this point. 262 * at this point.
263 */ 263 */
264 264
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 9d847c302551..0f227db0e9ac 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -73,9 +73,11 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
73 skb_dst_set(skb, &rt->dst); 73 skb_dst_set(skb, &rt->dst);
74 memset(IPCB(skb), 0, sizeof(*IPCB(skb))); 74 memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
75 75
76 if (skb_iif && proto == IPPROTO_UDP) { 76 if (skb_iif && !(df & htons(IP_DF))) {
77 /* Arrived from an ingress interface and got udp encapuslated. 77 /* Arrived from an ingress interface, got encapsulated, with
78 * The encapsulated network segment length may exceed dst mtu. 78 * fragmentation of encapulating frames allowed.
79 * If skb is gso, the resulting encapsulated network segments
80 * may exceed dst mtu.
79 * Allow IP Fragmentation of segments. 81 * Allow IP Fragmentation of segments.
80 */ 82 */
81 IPCB(skb)->flags |= IPSKB_FRAG_SEGS; 83 IPCB(skb)->flags |= IPSKB_FRAG_SEGS;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 60a438864f32..77311a92275c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3182,7 +3182,6 @@ int tcp_abort(struct sock *sk, int err)
3182 local_bh_enable(); 3182 local_bh_enable();
3183 return 0; 3183 return 0;
3184 } 3184 }
3185 sock_gen_put(sk);
3186 return -EOPNOTSUPP; 3185 return -EOPNOTSUPP;
3187 } 3186 }
3188 3187
@@ -3211,7 +3210,6 @@ int tcp_abort(struct sock *sk, int err)
3211 bh_unlock_sock(sk); 3210 bh_unlock_sock(sk);
3212 local_bh_enable(); 3211 local_bh_enable();
3213 release_sock(sk); 3212 release_sock(sk);
3214 sock_put(sk);
3215 return 0; 3213 return 0;
3216} 3214}
3217EXPORT_SYMBOL_GPL(tcp_abort); 3215EXPORT_SYMBOL_GPL(tcp_abort);
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 4d610934fb39..a748c74aa8b7 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -54,11 +54,16 @@ static int tcp_diag_destroy(struct sk_buff *in_skb,
54{ 54{
55 struct net *net = sock_net(in_skb->sk); 55 struct net *net = sock_net(in_skb->sk);
56 struct sock *sk = inet_diag_find_one_icsk(net, &tcp_hashinfo, req); 56 struct sock *sk = inet_diag_find_one_icsk(net, &tcp_hashinfo, req);
57 int err;
57 58
58 if (IS_ERR(sk)) 59 if (IS_ERR(sk))
59 return PTR_ERR(sk); 60 return PTR_ERR(sk);
60 61
61 return sock_diag_destroy(sk, ECONNABORTED); 62 err = sock_diag_destroy(sk, ECONNABORTED);
63
64 sock_gen_put(sk);
65
66 return err;
62} 67}
63#endif 68#endif
64 69
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 53e80cd004b6..a75bf48d7950 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -814,8 +814,14 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
814 u32 seq = (sk->sk_state == TCP_LISTEN) ? tcp_rsk(req)->snt_isn + 1 : 814 u32 seq = (sk->sk_state == TCP_LISTEN) ? tcp_rsk(req)->snt_isn + 1 :
815 tcp_sk(sk)->snd_nxt; 815 tcp_sk(sk)->snd_nxt;
816 816
817 /* RFC 7323 2.3
818 * The window field (SEG.WND) of every outgoing segment, with the
819 * exception of <SYN> segments, MUST be right-shifted by
820 * Rcv.Wind.Shift bits:
821 */
817 tcp_v4_send_ack(sock_net(sk), skb, seq, 822 tcp_v4_send_ack(sock_net(sk), skb, seq,
818 tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, 823 tcp_rsk(req)->rcv_nxt,
824 req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale,
819 tcp_time_stamp, 825 tcp_time_stamp,
820 req->ts_recent, 826 req->ts_recent,
821 0, 827 0,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index f0ebb0bd1e11..058c31286ce1 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1183,13 +1183,13 @@ out:
1183 * @sk: socket 1183 * @sk: socket
1184 * 1184 *
1185 * Drops all bad checksum frames, until a valid one is found. 1185 * Drops all bad checksum frames, until a valid one is found.
1186 * Returns the length of found skb, or 0 if none is found. 1186 * Returns the length of found skb, or -1 if none is found.
1187 */ 1187 */
1188static unsigned int first_packet_length(struct sock *sk) 1188static int first_packet_length(struct sock *sk)
1189{ 1189{
1190 struct sk_buff_head list_kill, *rcvq = &sk->sk_receive_queue; 1190 struct sk_buff_head list_kill, *rcvq = &sk->sk_receive_queue;
1191 struct sk_buff *skb; 1191 struct sk_buff *skb;
1192 unsigned int res; 1192 int res;
1193 1193
1194 __skb_queue_head_init(&list_kill); 1194 __skb_queue_head_init(&list_kill);
1195 1195
@@ -1204,7 +1204,7 @@ static unsigned int first_packet_length(struct sock *sk)
1204 __skb_unlink(skb, rcvq); 1204 __skb_unlink(skb, rcvq);
1205 __skb_queue_tail(&list_kill, skb); 1205 __skb_queue_tail(&list_kill, skb);
1206 } 1206 }
1207 res = skb ? skb->len : 0; 1207 res = skb ? skb->len : -1;
1208 spin_unlock_bh(&rcvq->lock); 1208 spin_unlock_bh(&rcvq->lock);
1209 1209
1210 if (!skb_queue_empty(&list_kill)) { 1210 if (!skb_queue_empty(&list_kill)) {
@@ -1233,7 +1233,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
1233 1233
1234 case SIOCINQ: 1234 case SIOCINQ:
1235 { 1235 {
1236 unsigned int amount = first_packet_length(sk); 1236 int amount = max_t(int, 0, first_packet_length(sk));
1237 1237
1238 return put_user(amount, (int __user *)arg); 1238 return put_user(amount, (int __user *)arg);
1239 } 1239 }
@@ -2185,7 +2185,7 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
2185 2185
2186 /* Check for false positives due to checksum errors */ 2186 /* Check for false positives due to checksum errors */
2187 if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) && 2187 if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) &&
2188 !(sk->sk_shutdown & RCV_SHUTDOWN) && !first_packet_length(sk)) 2188 !(sk->sk_shutdown & RCV_SHUTDOWN) && first_packet_length(sk) == -1)
2189 mask &= ~(POLLIN | POLLRDNORM); 2189 mask &= ~(POLLIN | POLLRDNORM);
2190 2190
2191 return mask; 2191 return mask;
@@ -2231,7 +2231,6 @@ struct proto udp_prot = {
2231 .sysctl_wmem = &sysctl_udp_wmem_min, 2231 .sysctl_wmem = &sysctl_udp_wmem_min,
2232 .sysctl_rmem = &sysctl_udp_rmem_min, 2232 .sysctl_rmem = &sysctl_udp_rmem_min,
2233 .obj_size = sizeof(struct udp_sock), 2233 .obj_size = sizeof(struct udp_sock),
2234 .slab_flags = SLAB_DESTROY_BY_RCU,
2235 .h.udp_table = &udp_table, 2234 .h.udp_table = &udp_table,
2236#ifdef CONFIG_COMPAT 2235#ifdef CONFIG_COMPAT
2237 .compat_setsockopt = compat_udp_setsockopt, 2236 .compat_setsockopt = compat_udp_setsockopt,
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 67fc9d96e67d..af817158d830 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -55,7 +55,6 @@ struct proto udplite_prot = {
55 .unhash = udp_lib_unhash, 55 .unhash = udp_lib_unhash,
56 .get_port = udp_v4_get_port, 56 .get_port = udp_v4_get_port,
57 .obj_size = sizeof(struct udp_sock), 57 .obj_size = sizeof(struct udp_sock),
58 .slab_flags = SLAB_DESTROY_BY_RCU,
59 .h.udp_table = &udplite_table, 58 .h.udp_table = &udplite_table,
60#ifdef CONFIG_COMPAT 59#ifdef CONFIG_COMPAT
61 .compat_setsockopt = compat_udp_setsockopt, 60 .compat_setsockopt = compat_udp_setsockopt,