Browse Source

Minor edits

tags/v0.9.3
Nikhil Chandru Rao 19 years ago
parent
commit
13dbf5494d
2 changed files with 11 additions and 4 deletions
  1. 1
    1
      src/include/gpxe/udp.h
  2. 10
    3
      src/net/udp.c

+ 1
- 1
src/include/gpxe/udp.h View File

75
  */
75
  */
76
 struct udp_connection {
76
 struct udp_connection {
77
        /** Address of the remote end of the connection */
77
        /** Address of the remote end of the connection */
78
-	struct sockaddr sin;
78
+	struct sockaddr sa;
79
 	/** Local port on which the connection receives packets */
79
 	/** Local port on which the connection receives packets */
80
 	port_t local_port;
80
 	port_t local_port;
81
 	/** Transmit buffer */
81
 	/** Transmit buffer */

+ 10
- 3
src/net/udp.c View File

65
  * This function stores the socket address within the connection
65
  * This function stores the socket address within the connection
66
  */
66
  */
67
 void udp_connect ( struct udp_connection *conn, struct sockaddr *peer ) {
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
 	/* Not sure if this should add the connection to udp_conns; If it does,
70
 	/* Not sure if this should add the connection to udp_conns; If it does,
71
 	 * uncomment the following code
71
 	 * uncomment the following code
142
 	udphdr->dest_port = *dest;
142
 	udphdr->dest_port = *dest;
143
 	udphdr->source_port = conn->local_port;
143
 	udphdr->source_port = conn->local_port;
144
 	udphdr->len = htons ( pkb_len ( conn->tx_pkb ) );
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
 	udp_dump ( udphdr );
154
 	udp_dump ( udphdr );
148
 
155
 
149
 	/* Send it to the next layer for processing */
156
 	/* Send it to the next layer for processing */
158
  * @v len       Length of data
165
  * @v len       Length of data
159
  */
166
  */
160
 int udp_send ( struct udp_connection *conn, const void *data, size_t len ) {
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
 /**

Loading…
Cancel
Save