|
@@ -65,7 +65,7 @@ void udp_dump ( struct udp_header *udphdr ) {
|
65
|
65
|
* This function stores the socket address within the connection
|
66
|
66
|
*/
|
67
|
67
|
void udp_connect ( struct udp_connection *conn, struct sockaddr *peer ) {
|
68
|
|
- copy_sockaddr ( peer, &conn->sin );
|
|
68
|
+ copy_sockaddr ( peer, &conn->sa );
|
69
|
69
|
|
70
|
70
|
/* Not sure if this should add the connection to udp_conns; If it does,
|
71
|
71
|
* uncomment the following code
|
|
@@ -142,8 +142,15 @@ int udp_sendto ( struct udp_connection *conn, struct sockaddr *peer,
|
142
|
142
|
udphdr->dest_port = *dest;
|
143
|
143
|
udphdr->source_port = conn->local_port;
|
144
|
144
|
udphdr->len = htons ( pkb_len ( conn->tx_pkb ) );
|
145
|
|
- udphdr->chksum = htons ( calc_chksum ( udphdr, sizeof ( *udphdr ) ) );
|
|
145
|
+ /**
|
|
146
|
+ * Calculate the partial checksum. Note this is stored in host byte
|
|
147
|
+ * order.
|
|
148
|
+ */
|
|
149
|
+ udphdr->chksum = calc_chksum ( udphdr, sizeof ( *udphdr ) + len );
|
146
|
150
|
|
|
151
|
+ /**
|
|
152
|
+ * Dump the contents of the UDP header
|
|
153
|
+ */
|
147
|
154
|
udp_dump ( udphdr );
|
148
|
155
|
|
149
|
156
|
/* Send it to the next layer for processing */
|
|
@@ -158,7 +165,7 @@ int udp_sendto ( struct udp_connection *conn, struct sockaddr *peer,
|
158
|
165
|
* @v len Length of data
|
159
|
166
|
*/
|
160
|
167
|
int udp_send ( struct udp_connection *conn, const void *data, size_t len ) {
|
161
|
|
- return udp_sendto ( conn, &conn->sin, data, len );
|
|
168
|
+ return udp_sendto ( conn, &conn->sa, data, len );
|
162
|
169
|
}
|
163
|
170
|
|
164
|
171
|
/**
|