aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sock.h10
-rw-r--r--include/net/tcp.h9
-rw-r--r--net/ipv4/ip_output.c7
-rw-r--r--net/ipv4/tcp_ipv4.c12
-rw-r--r--net/ipv4/tcp_minisocks.c1
5 files changed, 17 insertions, 22 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index f91ee82522ff..69d869e41c35 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1025,6 +1025,16 @@ sk_dst_check(struct sock *sk, u32 cookie)
1025 return dst; 1025 return dst;
1026} 1026}
1027 1027
1028static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1029{
1030 __sk_dst_set(sk, dst);
1031 sk->sk_route_caps = dst->dev->features;
1032 if (sk->sk_route_caps & NETIF_F_TSO) {
1033 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
1034 sk->sk_route_caps &= ~NETIF_F_TSO;
1035 }
1036}
1037
1028static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) 1038static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb)
1029{ 1039{
1030 sk->sk_wmem_queued += skb->truesize; 1040 sk->sk_wmem_queued += skb->truesize;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 31984733777b..d95661a3aeeb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1658,15 +1658,6 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1658 return 1; 1658 return 1;
1659} 1659}
1660 1660
1661static inline void tcp_v4_setup_caps(struct sock *sk, struct dst_entry *dst)
1662{
1663 sk->sk_route_caps = dst->dev->features;
1664 if (sk->sk_route_caps & NETIF_F_TSO) {
1665 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
1666 sk->sk_route_caps &= ~NETIF_F_TSO;
1667 }
1668}
1669
1670#define TCP_CHECK_TIMER(sk) do { } while (0) 1661#define TCP_CHECK_TIMER(sk) do { } while (0)
1671 1662
1672static inline int tcp_use_frto(const struct sock *sk) 1663static inline int tcp_use_frto(const struct sock *sk)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index c934f5316c3b..c72fc878f06d 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -69,13 +69,10 @@
69#include <net/ip.h> 69#include <net/ip.h>
70#include <net/protocol.h> 70#include <net/protocol.h>
71#include <net/route.h> 71#include <net/route.h>
72#include <net/tcp.h>
73#include <net/udp.h>
74#include <linux/skbuff.h> 72#include <linux/skbuff.h>
75#include <net/sock.h> 73#include <net/sock.h>
76#include <net/arp.h> 74#include <net/arp.h>
77#include <net/icmp.h> 75#include <net/icmp.h>
78#include <net/raw.h>
79#include <net/checksum.h> 76#include <net/checksum.h>
80#include <net/inetpeer.h> 77#include <net/inetpeer.h>
81#include <net/checksum.h> 78#include <net/checksum.h>
@@ -84,6 +81,7 @@
84#include <linux/netfilter_bridge.h> 81#include <linux/netfilter_bridge.h>
85#include <linux/mroute.h> 82#include <linux/mroute.h>
86#include <linux/netlink.h> 83#include <linux/netlink.h>
84#include <linux/tcp.h>
87 85
88/* 86/*
89 * Shall we try to damage output packets if routing dev changes? 87 * Shall we try to damage output packets if routing dev changes?
@@ -329,8 +327,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
329 if (ip_route_output_flow(&rt, &fl, sk, 0)) 327 if (ip_route_output_flow(&rt, &fl, sk, 0))
330 goto no_route; 328 goto no_route;
331 } 329 }
332 __sk_dst_set(sk, &rt->u.dst); 330 sk_setup_caps(sk, &rt->u.dst);
333 tcp_v4_setup_caps(sk, &rt->u.dst);
334 } 331 }
335 skb->dst = dst_clone(&rt->u.dst); 332 skb->dst = dst_clone(&rt->u.dst);
336 333
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c7c99d336368..4a5daecbd2ac 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -837,8 +837,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
837 goto failure; 837 goto failure;
838 838
839 /* OK, now commit destination to socket. */ 839 /* OK, now commit destination to socket. */
840 __sk_dst_set(sk, &rt->u.dst); 840 sk_setup_caps(sk, &rt->u.dst);
841 tcp_v4_setup_caps(sk, &rt->u.dst);
842 841
843 if (!tp->write_seq) 842 if (!tp->write_seq)
844 tp->write_seq = secure_tcp_sequence_number(inet->saddr, 843 tp->write_seq = secure_tcp_sequence_number(inet->saddr,
@@ -1553,8 +1552,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1553 if (!newsk) 1552 if (!newsk)
1554 goto exit; 1553 goto exit;
1555 1554
1556 newsk->sk_dst_cache = dst; 1555 sk_setup_caps(newsk, dst);
1557 tcp_v4_setup_caps(newsk, dst);
1558 1556
1559 newtp = tcp_sk(newsk); 1557 newtp = tcp_sk(newsk);
1560 newinet = inet_sk(newsk); 1558 newinet = inet_sk(newsk);
@@ -1855,8 +1853,7 @@ static int tcp_v4_reselect_saddr(struct sock *sk)
1855 if (err) 1853 if (err)
1856 return err; 1854 return err;
1857 1855
1858 __sk_dst_set(sk, &rt->u.dst); 1856 sk_setup_caps(sk, &rt->u.dst);
1859 tcp_v4_setup_caps(sk, &rt->u.dst);
1860 1857
1861 new_saddr = rt->rt_src; 1858 new_saddr = rt->rt_src;
1862 1859
@@ -1914,8 +1911,7 @@ int tcp_v4_rebuild_header(struct sock *sk)
1914 err = ip_route_output_flow(&rt, &fl, sk, 0); 1911 err = ip_route_output_flow(&rt, &fl, sk, 0);
1915 } 1912 }
1916 if (!err) { 1913 if (!err) {
1917 __sk_dst_set(sk, &rt->u.dst); 1914 sk_setup_caps(sk, &rt->u.dst);
1918 tcp_v4_setup_caps(sk, &rt->u.dst);
1919 return 0; 1915 return 0;
1920 } 1916 }
1921 1917
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index f8e288c8d693..7c46a553c4af 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -711,6 +711,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
711 bh_lock_sock(newsk); 711 bh_lock_sock(newsk);
712 712
713 rwlock_init(&newsk->sk_dst_lock); 713 rwlock_init(&newsk->sk_dst_lock);
714 newsk->sk_dst_cache = NULL;
714 atomic_set(&newsk->sk_rmem_alloc, 0); 715 atomic_set(&newsk->sk_rmem_alloc, 0);
715 skb_queue_head_init(&newsk->sk_receive_queue); 716 skb_queue_head_init(&newsk->sk_receive_queue);
716 atomic_set(&newsk->sk_wmem_alloc, 0); 717 atomic_set(&newsk->sk_wmem_alloc, 0);