diff options
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a97450e9eb34..804458712d88 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -642,7 +642,7 @@ static inline int select_size(struct sock *sk, struct tcp_sock *tp) | |||
642 | int tmp = tp->mss_cache; | 642 | int tmp = tp->mss_cache; |
643 | 643 | ||
644 | if (sk->sk_route_caps & NETIF_F_SG) { | 644 | if (sk->sk_route_caps & NETIF_F_SG) { |
645 | if (sk->sk_route_caps & NETIF_F_TSO) | 645 | if (sk_can_gso(sk)) |
646 | tmp = 0; | 646 | tmp = 0; |
647 | else { | 647 | else { |
648 | int pgbreak = SKB_MAX_HEAD(MAX_TCP_HEADER); | 648 | int pgbreak = SKB_MAX_HEAD(MAX_TCP_HEADER); |
@@ -2165,13 +2165,19 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2165 | if (!pskb_may_pull(skb, thlen)) | 2165 | if (!pskb_may_pull(skb, thlen)) |
2166 | goto out; | 2166 | goto out; |
2167 | 2167 | ||
2168 | segs = NULL; | ||
2169 | if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) | ||
2170 | goto out; | ||
2171 | |||
2172 | oldlen = (u16)~skb->len; | 2168 | oldlen = (u16)~skb->len; |
2173 | __skb_pull(skb, thlen); | 2169 | __skb_pull(skb, thlen); |
2174 | 2170 | ||
2171 | if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) { | ||
2172 | /* Packet is from an untrusted source, reset gso_segs. */ | ||
2173 | int mss = skb_shinfo(skb)->gso_size; | ||
2174 | |||
2175 | skb_shinfo(skb)->gso_segs = (skb->len + mss - 1) / mss; | ||
2176 | |||
2177 | segs = NULL; | ||
2178 | goto out; | ||
2179 | } | ||
2180 | |||
2175 | segs = skb_segment(skb, features); | 2181 | segs = skb_segment(skb, features); |
2176 | if (IS_ERR(segs)) | 2182 | if (IS_ERR(segs)) |
2177 | goto out; | 2183 | goto out; |
@@ -2208,6 +2214,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2208 | out: | 2214 | out: |
2209 | return segs; | 2215 | return segs; |
2210 | } | 2216 | } |
2217 | EXPORT_SYMBOL(tcp_tso_segment); | ||
2211 | 2218 | ||
2212 | extern void __skb_cb_too_small_for_tcp(int, int); | 2219 | extern void __skb_cb_too_small_for_tcp(int, int); |
2213 | extern struct tcp_congestion_ops tcp_reno; | 2220 | extern struct tcp_congestion_ops tcp_reno; |