summaryrefslogtreecommitdiffstats
path: root/src/net/ipv6.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-03 21:48:52 +0100
committerMichael Brown2007-01-03 21:48:52 +0100
commita0525a4ed36a28260d6dee4723bd6a1eb29020be (patch)
tree720037999566f4a80c7873f173938fddf2942d5e /src/net/ipv6.c
parentTidy up debug messages (diff)
downloadipxe-a0525a4ed36a28260d6dee4723bd6a1eb29020be.tar.gz
ipxe-a0525a4ed36a28260d6dee4723bd6a1eb29020be.tar.xz
ipxe-a0525a4ed36a28260d6dee4723bd6a1eb29020be.zip
Verify checksums on the RX datapath.
Simplify checksum generation on the TX datapath.
Diffstat (limited to 'src/net/ipv6.c')
-rw-r--r--src/net/ipv6.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/net/ipv6.c b/src/net/ipv6.c
index d00562a0..8422da67 100644
--- a/src/net/ipv6.c
+++ b/src/net/ipv6.c
@@ -103,11 +103,9 @@ void del_ipv6_address ( struct net_device *netdev ) {
* This function constructs the pseudo header and completes the checksum in the
* upper layer header.
*/
-static void ipv6_tx_csum ( struct pk_buff *pkb, struct tcpip_protocol *tcpip ) {
+static uint16_t ipv6_tx_csum ( struct pk_buff *pkb, uint16_t csum ) {
struct ip6_header *ip6hdr = pkb->data;
struct ipv6_pseudo_header pshdr;
- uint16_t *csum = ( ( ( void * ) ip6hdr ) + sizeof ( *ip6hdr ) +
- tcpip->csum_offset );
/* Calculate pseudo header */
memset ( &pshdr, 0, sizeof ( pshdr ) );
@@ -117,7 +115,7 @@ static void ipv6_tx_csum ( struct pk_buff *pkb, struct tcpip_protocol *tcpip ) {
pshdr.nxt_hdr = ip6hdr->nxt_hdr;
/* Update checksum value */
- *csum = tcpip_continue_chksum ( *csum, &pshdr, sizeof ( pshdr ) );
+ return tcpip_continue_chksum ( csum, &pshdr, sizeof ( pshdr ) );
}
/**
@@ -142,7 +140,8 @@ void ipv6_dump ( struct ip6_header *ip6hdr ) {
*/
static int ipv6_tx ( struct pk_buff *pkb,
struct tcpip_protocol *tcpip,
- struct sockaddr_tcpip *st_dest ) {
+ struct sockaddr_tcpip *st_dest,
+ uint16_t *trans_csum ) {
struct sockaddr_in6 *dest = ( struct sockaddr_in6* ) st_dest;
struct in6_addr next_hop;
struct ipv6_miniroute *miniroute;
@@ -184,9 +183,8 @@ static int ipv6_tx ( struct pk_buff *pkb,
}
/* Complete the transport layer checksum */
- if ( tcpip->csum_offset > 0 ) {
- ipv6_tx_csum ( pkb, tcpip );
- }
+ if ( trans_csum )
+ *trans_csum = ipv6_tx_csum ( pkb, *trans_csum );
/* Print IPv6 header */
ipv6_dump ( ip6hdr );
@@ -244,7 +242,7 @@ static int ipv6_process_nxt_hdr ( struct pk_buff *pkb, uint8_t nxt_hdr,
return 0;
}
/* Next header is not a IPv6 extension header */
- return tcpip_rx ( pkb, nxt_hdr, src, dest );
+ return tcpip_rx ( pkb, nxt_hdr, src, dest, 0 /* fixme */ );
}
/**