[ipxe-devel] [PATCH] IPv6 checksum invalid for UDP packets

Yoshinobu Takenaga (takenaga) takenaga at cisco.com
Sun Jul 19 22:08:52 UTC 2015


Hi,

We found a bug in IPv6 code. Issue was realized when TFTP
download stopped while chsum value was being rolled over.

Problem is in IPv6/UDP cksum calculation logic.
Made it compliant to RFC2460 fixed the issue.


Signed-off-by: TAKENAGA Yoshinobu <takenaga at cisco.com>
---
src/net/ipv6.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/net/ipv6.c b/src/net/ipv6.c
index c5bead1..5fc61df 100644
--- a/src/net/ipv6.c
+++ b/src/net/ipv6.c
@@ -523,6 +523,9 @@ static int ipv6_tx ( struct io_buffer *iobuf,
                *trans_csum = ipv6_pshdr_chksum ( iphdr, len,
                                                  tcpip_protocol->tcpip_proto,
                                                  *trans_csum );
+               /* RFC 2460 8.1: IPV6/UDP csum can't be zero */
+               if ( *trans_csum == 0 && tcpip_protocol->tcpip_proto == IP_UDP )
+                       *trans_csum = 0xFFFF;
        }

        /* Print IPv6 header for debugging */
--
1.9.1



// Thanks,
// Takenaga




More information about the ipxe-devel mailing list