[PATCH] MD5: Fix MD5 signatures on certain ACK packets

Subsystems: networking [general], networking [tcp], the rest

STALE6583d

2 messages, 2 authors, 2008-08-01 · open the first message on its own page

[PATCH] MD5: Fix MD5 signatures on certain ACK packets

From: Adam Langley <hidden>
Date: 2008-08-01 02:58:15

I noticed, looking at tcpdumps, that timewait ACKs were getting sent with an
incorrect MD5 signature when signatures were enabled.

I broke this in 49a72dfb8814c2d65bd9f8c9c6daf6395a1ec58d. I didn't take into
account that the skb passed to tcp_*_send_ack was the inbound packet, thus the
source and dest addresses need to be swapped when calculating the MD5
pseudoheader.

Signed-off-by: Adam Langley <redacted>
---

 net/ipv4/tcp_ipv4.c |    4 ++--
 net/ipv6/tcp_ipv6.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b3875c0..91a8cfd 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -655,8 +655,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
 		rep.th.doff = arg.iov[0].iov_len/4;
 
 		tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset],
-				    key, ip_hdr(skb)->daddr,
-				    ip_hdr(skb)->saddr, &rep.th);
+				    key, ip_hdr(skb)->saddr,
+				    ip_hdr(skb)->daddr, &rep.th);
 	}
 #endif
 	arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 1db4521..1bcdcbc 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1094,8 +1094,8 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
 		*topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
 				(TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
 		tcp_v6_md5_hash_hdr((__u8 *)topt, key,
-				    &ipv6_hdr(skb)->daddr,
-				    &ipv6_hdr(skb)->saddr, t1);
+				    &ipv6_hdr(skb)->saddr,
+				    &ipv6_hdr(skb)->daddr, t1);
 	}
 #endif
 

Re: [PATCH] MD5: Fix MD5 signatures on certain ACK packets

From: David Miller <davem@davemloft.net>
Date: 2008-08-01 03:50:39

From: "Adam Langley" <redacted>
Date: Thu, 31 Jul 2008 19:56:31 -0700
I noticed, looking at tcpdumps, that timewait ACKs were getting sent with an
incorrect MD5 signature when signatures were enabled.

I broke this in 49a72dfb8814c2d65bd9f8c9c6daf6395a1ec58d. I didn't take into
account that the skb passed to tcp_*_send_ack was the inbound packet, thus the
source and dest addresses need to be swapped when calculating the MD5
pseudoheader.

Signed-off-by: Adam Langley <redacted>
Applied.

But please provide commit header line text when referencing SHA IDs.
Here is the final fixed up commit message I used when applying this.

    tcp: MD5: Fix MD5 signatures on certain ACK packets
    
    I noticed, looking at tcpdumps, that timewait ACKs were getting sent
    with an incorrect MD5 signature when signatures were enabled.
    
    I broke this in 49a72dfb8814c2d65bd9f8c9c6daf6395a1ec58d ("tcp: Fix
    MD5 signatures for non-linear skbs"). I didn't take into account that
    the skb passed to tcp_*_send_ack was the inbound packet, thus the
    source and dest addresses need to be swapped when calculating the MD5
    pseudoheader.
    
    Signed-off-by: Adam Langley [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help