summaryrefslogtreecommitdiffstats
path: root/src/net/udp.c
diff options
context:
space:
mode:
authorMichael Brown2006-07-20 01:38:05 +0200
committerMichael Brown2006-07-20 01:38:05 +0200
commit2c0eb6eb1dc2b3828adad19ff46aeffae95b0102 (patch)
tree37de4267c2cf9d1df9fd233de0dab9b7fa57df4d /src/net/udp.c
parentudp_open() takes ports in network-endian order. (diff)
downloadipxe-2c0eb6eb1dc2b3828adad19ff46aeffae95b0102.tar.gz
ipxe-2c0eb6eb1dc2b3828adad19ff46aeffae95b0102.tar.xz
ipxe-2c0eb6eb1dc2b3828adad19ff46aeffae95b0102.zip
Correct TCP/IP checksum generation.
Diffstat (limited to 'src/net/udp.c')
-rw-r--r--src/net/udp.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/net/udp.c b/src/net/udp.c
index 87795d4d..d04c94bb 100644
--- a/src/net/udp.c
+++ b/src/net/udp.c
@@ -142,11 +142,8 @@ int udp_sendto ( struct udp_connection *conn, struct sockaddr *peer,
udphdr->dest_port = *dest;
udphdr->source_port = conn->local_port;
udphdr->len = htons ( pkb_len ( conn->tx_pkb ) );
- /**
- * Calculate the partial checksum. Note this is stored in host byte
- * order.
- */
- udphdr->chksum = calc_chksum ( udphdr, sizeof ( *udphdr ) + len );
+ udphdr->chksum = 0;
+ udphdr->chksum = tcpip_chksum ( udphdr, sizeof ( *udphdr ) + len );
/**
* Dump the contents of the UDP header
@@ -238,7 +235,7 @@ void udp_rx ( struct pk_buff *pkb, struct in_addr *src_net_addr __unused,
}
/* Verify the checksum */
- chksum = calc_chksum ( pkb->data, pkb_len ( pkb ) );
+ chksum = tcpip_chksum ( pkb->data, pkb_len ( pkb ) );
if ( chksum != 0xffff ) {
DBG ( "Bad checksum %d\n", chksum );
return;