summaryrefslogtreecommitdiffstats
path: root/src/net/udp/dhcp.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-15 09:49:10 +0100
committerMichael Brown2007-01-15 09:49:10 +0100
commit4e20d73bb52326261f8cf49c20d6de2edea309ee (patch)
tree3d24466a78c4c8f53294384b76e62e871eb96def /src/net/udp/dhcp.c
parentAdd missing include (diff)
downloadipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.tar.gz
ipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.tar.xz
ipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.zip
Gave asynchronous operations approximate POSIX signal semantics. This
will enable us to cascade async operations, which is necessary in order to properly support DNS. (For example, an HTTP request may have to redirect to a new location and will have to perform a new DNS lookup, so we can't just rely on doing the name lookup at the time of parsing the initial URL). Anything other than HTTP is probably broken right now; I'll fix the others up asap.
Diffstat (limited to 'src/net/udp/dhcp.c')
-rw-r--r--src/net/udp/dhcp.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 8f829701..a2d3db6b 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -517,7 +517,7 @@ static void dhcp_done ( struct dhcp_session *dhcp, int rc ) {
ref_del ( &dhcp->netdev_ref );
/* Mark async operation as complete */
- async_done ( &dhcp->aop, rc );
+ async_done ( &dhcp->async, rc );
}
/** Address for transmitting DHCP requests */
@@ -713,14 +713,15 @@ static void dhcp_forget_netdev ( struct reference *ref ) {
* Initiate DHCP on a network interface
*
* @v dhcp DHCP session
- * @ret aop Asynchronous operation
+ * @v parent Parent asynchronous operation
+ * @ret rc Return status code
*
* If the DHCP operation completes successfully, the
* dhcp_session::options field will be filled in with the resulting
* options block. The caller takes responsibility for eventually
* calling free_dhcp_options().
*/
-struct async_operation * start_dhcp ( struct dhcp_session *dhcp ) {
+int start_dhcp ( struct dhcp_session *dhcp, struct async *parent ) {
int rc;
/* Initialise DHCP session */
@@ -729,10 +730,8 @@ struct async_operation * start_dhcp ( struct dhcp_session *dhcp ) {
dhcp->state = DHCPDISCOVER;
/* Bind to local port */
- if ( ( rc = udp_open ( &dhcp->udp, htons ( BOOTPC_PORT ) ) ) != 0 ) {
- async_done ( &dhcp->aop, rc );
- goto out;
- }
+ if ( ( rc = udp_open ( &dhcp->udp, htons ( BOOTPC_PORT ) ) ) != 0 )
+ return rc;
/* Add persistent reference to net device */
dhcp->netdev_ref.forget = dhcp_forget_netdev;
@@ -741,6 +740,6 @@ struct async_operation * start_dhcp ( struct dhcp_session *dhcp ) {
/* Proof of concept: just send a single DHCPDISCOVER */
dhcp_send_request ( dhcp );
- out:
- return &dhcp->aop;
+ async_init ( &dhcp->async, &default_async_operations, parent );
+ return 0;
}