Skip to content

Commit

Permalink
tcp: allow segment with FIN in tcp_try_coalesce()
Browse files Browse the repository at this point in the history
We can allow a segment with FIN to be aggregated,
if we take care to add tcp flags,
and if skb_try_coalesce() takes care of zero sized skbs.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 15, 2014
1 parent e11ecdd commit e93a043
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -3936,7 +3936,8 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
return false;

if (len <= skb_tailroom(to)) {
BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len));
if (len)
BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len));
*delta_truesize = 0;
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -4143,9 +4143,6 @@ static bool tcp_try_coalesce(struct sock *sk,

*fragstolen = false;

if (tcp_hdr(from)->fin)
return false;

/* Its possible this segment overlaps with prior segment in queue */
if (TCP_SKB_CB(from)->seq != TCP_SKB_CB(to)->end_seq)
return false;
Expand All @@ -4158,6 +4155,7 @@ static bool tcp_try_coalesce(struct sock *sk,
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRCVCOALESCE);
TCP_SKB_CB(to)->end_seq = TCP_SKB_CB(from)->end_seq;
TCP_SKB_CB(to)->ack_seq = TCP_SKB_CB(from)->ack_seq;
TCP_SKB_CB(to)->tcp_flags |= TCP_SKB_CB(from)->tcp_flags;
return true;
}

Expand Down

0 comments on commit e93a043

Please sign in to comment.