aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 21:07:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 21:07:07 -0500
commit6be35c700f742e911ecedd07fcc43d4439922334 (patch)
treeca9f37214d204465fcc2d79c82efd291e357c53c /net/ipv4/tcp.c
parente37aa63e87bd581f9be5555ed0ba83f5295c92fc (diff)
parent520dfe3a3645257bf83660f672c47f8558f3d4c4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking changes from David Miller: 1) Allow to dump, monitor, and change the bridge multicast database using netlink. From Cong Wang. 2) RFC 5961 TCP blind data injection attack mitigation, from Eric Dumazet. 3) Networking user namespace support from Eric W. Biederman. 4) tuntap/virtio-net multiqueue support by Jason Wang. 5) Support for checksum offload of encapsulated packets (basically, tunneled traffic can still be checksummed by HW). From Joseph Gasparakis. 6) Allow BPF filter access to VLAN tags, from Eric Dumazet and Daniel Borkmann. 7) Bridge port parameters over netlink and BPDU blocking support from Stephen Hemminger. 8) Improve data access patterns during inet socket demux by rearranging socket layout, from Eric Dumazet. 9) TIPC protocol updates and cleanups from Ying Xue, Paul Gortmaker, and Jon Maloy. 10) Update TCP socket hash sizing to be more in line with current day realities. The existing heurstics were choosen a decade ago. From Eric Dumazet. 11) Fix races, queue bloat, and excessive wakeups in ATM and associated drivers, from Krzysztof Mazur and David Woodhouse. 12) Support DOVE (Distributed Overlay Virtual Ethernet) extensions in VXLAN driver, from David Stevens. 13) Add "oops_only" mode to netconsole, from Amerigo Wang. 14) Support set and query of VEB/VEPA bridge mode via PF_BRIDGE, also allow DCB netlink to work on namespaces other than the initial namespace. From John Fastabend. 15) Support PTP in the Tigon3 driver, from Matt Carlson. 16) tun/vhost zero copy fixes and improvements, plus turn it on by default, from Michael S. Tsirkin. 17) Support per-association statistics in SCTP, from Michele Baldessari. And many, many, driver updates, cleanups, and improvements. Too numerous to mention individually. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1722 commits) net/mlx4_en: Add support for destination MAC in steering rules net/mlx4_en: Use generic etherdevice.h functions. net: ethtool: Add destination MAC address to flow steering API bridge: add support of adding and deleting mdb entries bridge: notify mdb changes via netlink ndisc: Unexport ndisc_{build,send}_skb(). uapi: add missing netconf.h to export list pkt_sched: avoid requeues if possible solos-pci: fix double-free of TX skb in DMA mode bnx2: Fix accidental reversions. bna: Driver Version Updated to 3.1.2.1 bna: Firmware update bna: Add RX State bna: Rx Page Based Allocation bna: TX Intr Coalescing Fix bna: Tx and Rx Optimizations bna: Code Cleanup and Enhancements ath9k: check pdata variable before dereferencing it ath5k: RX timestamp is reported at end of frame ath9k_htc: RX timestamp is reported at end of frame ...
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e457c7ab2e28..1ca253635f7a 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -536,13 +536,14 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
536{ 536{
537 struct tcp_sock *tp = tcp_sk(sk); 537 struct tcp_sock *tp = tcp_sk(sk);
538 int answ; 538 int answ;
539 bool slow;
539 540
540 switch (cmd) { 541 switch (cmd) {
541 case SIOCINQ: 542 case SIOCINQ:
542 if (sk->sk_state == TCP_LISTEN) 543 if (sk->sk_state == TCP_LISTEN)
543 return -EINVAL; 544 return -EINVAL;
544 545
545 lock_sock(sk); 546 slow = lock_sock_fast(sk);
546 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) 547 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
547 answ = 0; 548 answ = 0;
548 else if (sock_flag(sk, SOCK_URGINLINE) || 549 else if (sock_flag(sk, SOCK_URGINLINE) ||
@@ -557,7 +558,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
557 answ--; 558 answ--;
558 } else 559 } else
559 answ = tp->urg_seq - tp->copied_seq; 560 answ = tp->urg_seq - tp->copied_seq;
560 release_sock(sk); 561 unlock_sock_fast(sk, slow);
561 break; 562 break;
562 case SIOCATMARK: 563 case SIOCATMARK:
563 answ = tp->urg_data && tp->urg_seq == tp->copied_seq; 564 answ = tp->urg_data && tp->urg_seq == tp->copied_seq;
@@ -1490,15 +1491,19 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1490 copied += used; 1491 copied += used;
1491 offset += used; 1492 offset += used;
1492 } 1493 }
1493 /* 1494 /* If recv_actor drops the lock (e.g. TCP splice
1494 * If recv_actor drops the lock (e.g. TCP splice
1495 * receive) the skb pointer might be invalid when 1495 * receive) the skb pointer might be invalid when
1496 * getting here: tcp_collapse might have deleted it 1496 * getting here: tcp_collapse might have deleted it
1497 * while aggregating skbs from the socket queue. 1497 * while aggregating skbs from the socket queue.
1498 */ 1498 */
1499 skb = tcp_recv_skb(sk, seq-1, &offset); 1499 skb = tcp_recv_skb(sk, seq - 1, &offset);
1500 if (!skb || (offset+1 != skb->len)) 1500 if (!skb)
1501 break; 1501 break;
1502 /* TCP coalescing might have appended data to the skb.
1503 * Try to splice more frags
1504 */
1505 if (offset + 1 != skb->len)
1506 continue;
1502 } 1507 }
1503 if (tcp_hdr(skb)->fin) { 1508 if (tcp_hdr(skb)->fin) {
1504 sk_eat_skb(sk, skb, false); 1509 sk_eat_skb(sk, skb, false);
@@ -2300,7 +2305,7 @@ void tcp_sock_destruct(struct sock *sk)
2300 2305
2301static inline bool tcp_can_repair_sock(const struct sock *sk) 2306static inline bool tcp_can_repair_sock(const struct sock *sk)
2302{ 2307{
2303 return capable(CAP_NET_ADMIN) && 2308 return ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN) &&
2304 ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_ESTABLISHED)); 2309 ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_ESTABLISHED));
2305} 2310}
2306 2311
@@ -3586,8 +3591,7 @@ void __init tcp_init(void)
3586 alloc_large_system_hash("TCP established", 3591 alloc_large_system_hash("TCP established",
3587 sizeof(struct inet_ehash_bucket), 3592 sizeof(struct inet_ehash_bucket),
3588 thash_entries, 3593 thash_entries,
3589 (totalram_pages >= 128 * 1024) ? 3594 17, /* one slot per 128 KB of memory */
3590 13 : 15,
3591 0, 3595 0,
3592 NULL, 3596 NULL,
3593 &tcp_hashinfo.ehash_mask, 3597 &tcp_hashinfo.ehash_mask,
@@ -3603,8 +3607,7 @@ void __init tcp_init(void)
3603 alloc_large_system_hash("TCP bind", 3607 alloc_large_system_hash("TCP bind",
3604 sizeof(struct inet_bind_hashbucket), 3608 sizeof(struct inet_bind_hashbucket),
3605 tcp_hashinfo.ehash_mask + 1, 3609 tcp_hashinfo.ehash_mask + 1,
3606 (totalram_pages >= 128 * 1024) ? 3610 17, /* one slot per 128 KB of memory */
3607 13 : 15,
3608 0, 3611 0,
3609 &tcp_hashinfo.bhash_size, 3612 &tcp_hashinfo.bhash_size,
3610 NULL, 3613 NULL,