diff options
| author | Nikhil Chandru Rao | 2006-07-19 23:05:58 +0200 |
|---|---|---|
| committer | Nikhil Chandru Rao | 2006-07-19 23:05:58 +0200 |
| commit | 13dbf5494d749990d5a0f34c561d44e9341021b5 (patch) | |
| tree | 00b715afe9338a2fead00e1f23b50e4ad0ad4c32 | |
| parent | Now capable of sending what, to me, looks like a valid DHCPDISCOVER (diff) | |
| download | ipxe-13dbf5494d749990d5a0f34c561d44e9341021b5.tar.gz ipxe-13dbf5494d749990d5a0f34c561d44e9341021b5.tar.xz ipxe-13dbf5494d749990d5a0f34c561d44e9341021b5.zip | |
Minor edits
| -rw-r--r-- | src/include/gpxe/udp.h | 2 | ||||
| -rw-r--r-- | src/net/udp.c | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/include/gpxe/udp.h b/src/include/gpxe/udp.h index 8c731c13a..006bc0b38 100644 --- a/src/include/gpxe/udp.h +++ b/src/include/gpxe/udp.h @@ -75,7 +75,7 @@ struct udp_operations { */ struct udp_connection { /** Address of the remote end of the connection */ - struct sockaddr sin; + struct sockaddr sa; /** Local port on which the connection receives packets */ port_t local_port; /** Transmit buffer */ diff --git a/src/net/udp.c b/src/net/udp.c index 2505b94b7..87795d4db 100644 --- a/src/net/udp.c +++ b/src/net/udp.c @@ -65,7 +65,7 @@ void udp_dump ( struct udp_header *udphdr ) { * This function stores the socket address within the connection */ void udp_connect ( struct udp_connection *conn, struct sockaddr *peer ) { - copy_sockaddr ( peer, &conn->sin ); + copy_sockaddr ( peer, &conn->sa ); /* Not sure if this should add the connection to udp_conns; If it does, * uncomment the following code @@ -142,8 +142,15 @@ 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 ) ); - udphdr->chksum = htons ( calc_chksum ( udphdr, sizeof ( *udphdr ) ) ); + /** + * Calculate the partial checksum. Note this is stored in host byte + * order. + */ + udphdr->chksum = calc_chksum ( udphdr, sizeof ( *udphdr ) + len ); + /** + * Dump the contents of the UDP header + */ udp_dump ( udphdr ); /* Send it to the next layer for processing */ @@ -158,7 +165,7 @@ int udp_sendto ( struct udp_connection *conn, struct sockaddr *peer, * @v len Length of data */ int udp_send ( struct udp_connection *conn, const void *data, size_t len ) { - return udp_sendto ( conn, &conn->sin, data, len ); + return udp_sendto ( conn, &conn->sa, data, len ); } /** |
