aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 00:06:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 00:06:02 -0400
commit6456a0438b984186a0c9c8ecc9fe3d97b7ac3613 (patch)
tree51e61c1c269cd3647b73d6cf5d2168167f9fb0a6 /net/ipv4
parent158c12948f3012fbe15f066f308db23502d3db0a (diff)
parent6c8f7e70837468da4e658080d4448930fb597e1b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "This fixes the most immediate fallout from yesterday's networking merge: 1) sock_tx_timestamp() must not clear the passed in tx_flags, but rather add to them. Fix from Eric Dumazet. 2) The hyperv driver sendbuf region increase needs to be decreased slightly to handle older backends. From KY Srinivasan. 3) Fix RCU lockdep splats in netlink diag after recent hashing changes, from Thomas Graf. 4) The new IPV6_FLOWLABEL was given a socket option number that overlapped with an existing IP6 tables one, breaking ip6_tables. Fixed by Pablo Neira Ayuso" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: netlink: hold nl_sock_hash_lock during diag dump tcp: md5: check md5 signature without socket lock net: fix USB network driver config option. net: reallocate new socket option number for IPV6_AUTOFLOWLABEL vmxnet3: fix decimal printf format specifiers prefixed with 0x net-timestamp: cumulative tcp timestamping fixes hyperv: Adjust the size of sendbuf region to support ws2008r2 cxgb4: Fix for SR-IOV VF initialization net-timestamp: sock_tx_timestamp() fix
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp.c12
-rw-r--r--net/ipv4/tcp_ipv4.c36
-rw-r--r--net/ipv4/tcp_offload.c8
3 files changed, 36 insertions, 20 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 744af67a5989..181b70ebd964 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -426,13 +426,15 @@ void tcp_init_sock(struct sock *sk)
426} 426}
427EXPORT_SYMBOL(tcp_init_sock); 427EXPORT_SYMBOL(tcp_init_sock);
428 428
429void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb) 429static void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb)
430{ 430{
431 struct skb_shared_info *shinfo = skb_shinfo(skb); 431 if (sk->sk_tsflags) {
432 struct skb_shared_info *shinfo = skb_shinfo(skb);
432 433
433 sock_tx_timestamp(sk, &shinfo->tx_flags); 434 sock_tx_timestamp(sk, &shinfo->tx_flags);
434 if (shinfo->tx_flags & SKBTX_ANY_SW_TSTAMP) 435 if (shinfo->tx_flags & SKBTX_ANY_TSTAMP)
435 shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1; 436 shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1;
437 }
436} 438}
437 439
438/* 440/*
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 992a1f926009..dceff5fe8e66 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1167,7 +1167,8 @@ clear_hash_noput:
1167} 1167}
1168EXPORT_SYMBOL(tcp_v4_md5_hash_skb); 1168EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
1169 1169
1170static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) 1170static bool __tcp_v4_inbound_md5_hash(struct sock *sk,
1171 const struct sk_buff *skb)
1171{ 1172{
1172 /* 1173 /*
1173 * This gets called for each TCP segment that arrives 1174 * This gets called for each TCP segment that arrives
@@ -1220,6 +1221,17 @@ static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
1220 return false; 1221 return false;
1221} 1222}
1222 1223
1224static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
1225{
1226 bool ret;
1227
1228 rcu_read_lock();
1229 ret = __tcp_v4_inbound_md5_hash(sk, skb);
1230 rcu_read_unlock();
1231
1232 return ret;
1233}
1234
1223#endif 1235#endif
1224 1236
1225static void tcp_v4_init_req(struct request_sock *req, struct sock *sk, 1237static void tcp_v4_init_req(struct request_sock *req, struct sock *sk,
@@ -1432,16 +1444,6 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
1432int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) 1444int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
1433{ 1445{
1434 struct sock *rsk; 1446 struct sock *rsk;
1435#ifdef CONFIG_TCP_MD5SIG
1436 /*
1437 * We really want to reject the packet as early as possible
1438 * if:
1439 * o We're expecting an MD5'd packet and this is no MD5 tcp option
1440 * o There is an MD5 option and we're not expecting one
1441 */
1442 if (tcp_v4_inbound_md5_hash(sk, skb))
1443 goto discard;
1444#endif
1445 1447
1446 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ 1448 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
1447 struct dst_entry *dst = sk->sk_rx_dst; 1449 struct dst_entry *dst = sk->sk_rx_dst;
@@ -1644,6 +1646,18 @@ process:
1644 1646
1645 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) 1647 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
1646 goto discard_and_relse; 1648 goto discard_and_relse;
1649
1650#ifdef CONFIG_TCP_MD5SIG
1651 /*
1652 * We really want to reject the packet as early as possible
1653 * if:
1654 * o We're expecting an MD5'd packet and this is no MD5 tcp option
1655 * o There is an MD5 option and we're not expecting one
1656 */
1657 if (tcp_v4_inbound_md5_hash(sk, skb))
1658 goto discard_and_relse;
1659#endif
1660
1647 nf_reset(skb); 1661 nf_reset(skb);
1648 1662
1649 if (sk_filter(sk, skb)) 1663 if (sk_filter(sk, skb))
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index f597119fc4e7..bc1b83cb8309 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -14,12 +14,12 @@
14#include <net/tcp.h> 14#include <net/tcp.h>
15#include <net/protocol.h> 15#include <net/protocol.h>
16 16
17void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq, unsigned int seq, 17static void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq,
18 unsigned int mss) 18 unsigned int seq, unsigned int mss)
19{ 19{
20 while (skb) { 20 while (skb) {
21 if (ts_seq < (__u64) seq + mss) { 21 if (before(ts_seq, seq + mss)) {
22 skb_shinfo(skb)->tx_flags = SKBTX_SW_TSTAMP; 22 skb_shinfo(skb)->tx_flags |= SKBTX_SW_TSTAMP;
23 skb_shinfo(skb)->tskey = ts_seq; 23 skb_shinfo(skb)->tskey = ts_seq;
24 return; 24 return;
25 } 25 }