diff mbox

[01/10] tcp: force mss equality with the next skb too.

Message ID 1228510736-3655-2-git-send-email-ilpo.jarvinen@helsinki.fi
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ilpo Järvinen Dec. 5, 2008, 8:58 p.m. UTC
Also make if-goto forest nicer looking.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/tcp_input.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

Comments

Andi Kleen Dec. 5, 2008, 10:13 p.m. UTC | #1
"Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi> writes:
> +++ b/net/ipv4/tcp_input.c
> @@ -1575,11 +1575,10 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
>  		goto out;
>  	skb = tcp_write_queue_next(sk, prev);
>  
> -	if (!skb_can_shift(skb))
> -		goto out;
> -	if (skb == tcp_send_head(sk))
> -		goto out;
> -	if ((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED)
> +	if (!skb_can_shift(skb) ||
> +	    (skb == tcp_send_head(sk)) ||
> +	    ((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) ||
> +	    (mss != tcp_shift_mss(skb)))
>  		goto out;

Perhaps it's just me, but I think the code was far more readable
before your change.

-Andi
diff mbox

Patch

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index d67b6e9..63c3ef6 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1575,11 +1575,10 @@  static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
 		goto out;
 	skb = tcp_write_queue_next(sk, prev);
 
-	if (!skb_can_shift(skb))
-		goto out;
-	if (skb == tcp_send_head(sk))
-		goto out;
-	if ((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED)
+	if (!skb_can_shift(skb) ||
+	    (skb == tcp_send_head(sk)) ||
+	    ((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) ||
+	    (mss != tcp_shift_mss(skb)))
 		goto out;
 
 	len = skb->len;