summaryrefslogtreecommitdiffstats
path: root/src/net/udp/dhcp.c
diff options
context:
space:
mode:
authorMichael Brown2006-08-04 01:10:14 +0200
committerMichael Brown2006-08-04 01:10:14 +0200
commitffe0e24249d1dbec59f7b2454974a5855043ba95 (patch)
tree891adef4bdc493cc66e2430b600aa8edf1ef1deb /src/net/udp/dhcp.c
parentUpdated PXE UDP implementation to use the new Etherboot UDP API. (diff)
downloadipxe-ffe0e24249d1dbec59f7b2454974a5855043ba95.tar.gz
ipxe-ffe0e24249d1dbec59f7b2454974a5855043ba95.tar.xz
ipxe-ffe0e24249d1dbec59f7b2454974a5855043ba95.zip
Make the UDP senddata() methods return a status code.
udp_connect() now follows the standard BSD sockets semantics and simply sets the default address for outgoing packets; it doesn't filter incoming packets.
Diffstat (limited to 'src/net/udp/dhcp.c')
-rw-r--r--src/net/udp/dhcp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index c2a90973..800e9b38 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -508,9 +508,10 @@ static union {
* @v conn UDP connection
* @v buf Temporary data buffer
* @v len Length of temporary data buffer
+ * @ret rc Return status code
*/
-static void dhcp_senddata ( struct udp_connection *conn,
- void *buf, size_t len ) {
+static int dhcp_senddata ( struct udp_connection *conn,
+ void *buf, size_t len ) {
struct dhcp_session *dhcp = udp_to_dhcp ( conn );
struct dhcp_packet dhcppkt;
int rc;
@@ -524,14 +525,14 @@ static void dhcp_senddata ( struct udp_connection *conn,
if ( ( rc = create_dhcp_packet ( dhcp, dhcp->state, buf, len,
&dhcppkt ) ) != 0 ) {
DBG ( "Could not create DHCP packet\n" );
- return;
+ return rc;
}
/* Copy in options common to all requests */
if ( ( rc = copy_dhcp_packet_options ( &dhcppkt,
&dhcp_request_options ) ) != 0){
DBG ( "Could not set common DHCP options\n" );
- return;
+ return rc;
}
/* Copy any required options from previous server repsonse */
@@ -540,13 +541,13 @@ static void dhcp_senddata ( struct udp_connection *conn,
DHCP_SERVER_IDENTIFIER,
DHCP_SERVER_IDENTIFIER ) ) != 0 ) {
DBG ( "Could not set server identifier option\n" );
- return;
+ return rc;
}
if ( ( rc = copy_dhcp_packet_option ( &dhcppkt, dhcp->options,
DHCP_EB_YIADDR,
DHCP_REQUESTED_ADDRESS ) ) != 0 ) {
DBG ( "Could not set requested address option\n" );
- return;
+ return rc;
}
}
@@ -554,8 +555,10 @@ static void dhcp_senddata ( struct udp_connection *conn,
if ( ( rc = udp_sendto ( conn, &sa_dhcp_server.st,
dhcppkt.dhcphdr, dhcppkt.len ) ) != 0 ) {
DBG ( "Could not transmit UDP packet\n" );
- return;
+ return rc;
}
+
+ return 0;
}
/**