diff options
| author | Michael Brown | 2007-07-31 04:02:21 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-07-31 04:02:21 +0200 |
| commit | 5e26df03251378c2990e74ad0c45eb90e4a98256 (patch) | |
| tree | 6a261b099acabd6f8a46d450d12bbb5dd2a40c68 /src/interface/pxe/pxe_preboot.c | |
| parent | Added the AoE boot information table as used by Vampyre's AoE (diff) | |
| download | ipxe-5e26df03251378c2990e74ad0c45eb90e4a98256.tar.gz ipxe-5e26df03251378c2990e74ad0c45eb90e4a98256.tar.xz ipxe-5e26df03251378c2990e74ad0c45eb90e4a98256.zip | |
Centralise construction of the DHCP request and response packets.
Diffstat (limited to 'src/interface/pxe/pxe_preboot.c')
| -rw-r--r-- | src/interface/pxe/pxe_preboot.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/interface/pxe/pxe_preboot.c b/src/interface/pxe/pxe_preboot.c index b4e2206a9..e5c44067d 100644 --- a/src/interface/pxe/pxe_preboot.c +++ b/src/interface/pxe/pxe_preboot.c @@ -69,10 +69,12 @@ PXENV_EXIT_t pxenv_unload_stack ( struct s_PXENV_UNLOAD_STACK *unload_stack ) { PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO *get_cached_info ) { struct dhcp_packet dhcppkt; + int ( * dhcp_packet_creator ) ( struct net_device *, int, + struct dhcp_option_block *, void *, + size_t, struct dhcp_packet * ); + unsigned int msgtype; void *data = NULL; size_t len; - int msgtype; - struct dhcp_option_block *options; userptr_t buffer; int rc; @@ -102,21 +104,17 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO /* Construct DHCP packet */ if ( get_cached_info->PacketType == PXENV_PACKET_TYPE_DHCP_DISCOVER ) { + dhcp_packet_creator = create_dhcp_request; msgtype = DHCPDISCOVER; - options = &dhcp_request_options; } else { + dhcp_packet_creator = create_dhcp_response; msgtype = DHCPACK; - options = NULL; } - if ( ( rc = create_dhcp_packet ( pxe_netdev, msgtype, data, len, - &dhcppkt ) ) != 0 ) { + if ( ( rc = dhcp_packet_creator ( pxe_netdev, msgtype, NULL, + data, len, &dhcppkt ) ) != 0 ) { DBG ( " failed to build packet" ); goto err; } - if ( ( rc = copy_dhcp_packet_options ( &dhcppkt, options ) ) != 0 ) { - DBG ( " failed to copy options" ); - goto err; - } /* Overwrite filename to work around Microsoft RIS bug */ if ( pxe_ris_filename ) { |
