summaryrefslogtreecommitdiffstats
path: root/src/net/fakedhcp.c
diff options
context:
space:
mode:
authorMichael Brown2008-03-27 17:31:31 +0100
committerMichael Brown2008-03-27 17:45:15 +0100
commitaa74a7d53cb972775efb0f3412f9cbc3b929ee43 (patch)
tree00df302e454b27eb8efcddf5e90fa02864c568e4 /src/net/fakedhcp.c
parent[Settings] find_child_settings() accepts a NULL parent (diff)
downloadipxe-aa74a7d53cb972775efb0f3412f9cbc3b929ee43.tar.gz
ipxe-aa74a7d53cb972775efb0f3412f9cbc3b929ee43.tar.xz
ipxe-aa74a7d53cb972775efb0f3412f9cbc3b929ee43.zip
[DHCP] Add support for ProxyDHCP requests
The PXE spec is (as usual) unclear on precisely when ProxyDHCPREQUESTs should be issued. We adapt the following, slightly paranoid approach: If an offer contains an IP address, then it is a normal DHCPOFFER. If an offer contains an option #60 "PXEClient", then it is a ProxyDHCPOFFER. Note that the same packet can be both a normal DHCPOFFER and a ProxyDHCPOFFER. After receiving the normal DHCPACK, if we have received a ProxyDHCPOFFER, we unicast a ProxyDHCPREQUEST back to the ProxyDHCP server on port 4011. If we time out waiting for a ProxyDHCPACK, we treat this as a non-fatal error.
Diffstat (limited to 'src/net/fakedhcp.c')
-rw-r--r--src/net/fakedhcp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net/fakedhcp.c b/src/net/fakedhcp.c
index c3054db1..a10e442b 100644
--- a/src/net/fakedhcp.c
+++ b/src/net/fakedhcp.c
@@ -108,9 +108,10 @@ static int copy_settings ( struct dhcp_packet *dest,
int create_fakedhcpdiscover ( struct net_device *netdev,
void *data, size_t max_len ) {
struct dhcp_packet dhcppkt;
+ struct in_addr ciaddr = { 0 };
int rc;
- if ( ( rc = create_dhcp_request ( &dhcppkt, netdev, NULL, data,
+ if ( ( rc = dhcp_create_request ( &dhcppkt, netdev, ciaddr, NULL, data,
max_len ) ) != 0 ) {
DBG ( "Could not create DHCPDISCOVER: %s\n",
strerror ( rc ) );
@@ -136,7 +137,7 @@ int create_fakedhcpack ( struct net_device *netdev,
int rc;
/* Create base DHCPACK packet */
- if ( ( rc = create_dhcp_packet ( &dhcppkt, netdev, DHCPACK, NULL,
+ if ( ( rc = dhcp_create_packet ( &dhcppkt, netdev, DHCPACK, NULL,
data, max_len ) ) != 0 ) {
DBG ( "Could not create DHCPACK: %s\n", strerror ( rc ) );
return rc;
@@ -187,7 +188,7 @@ int create_fakeproxydhcpack ( struct net_device *netdev,
}
/* Create base DHCPACK packet */
- if ( ( rc = create_dhcp_packet ( &dhcppkt, netdev, DHCPACK, NULL,
+ if ( ( rc = dhcp_create_packet ( &dhcppkt, netdev, DHCPACK, NULL,
data, max_len ) ) != 0 ) {
DBG ( "Could not create ProxyDHCPACK: %s\n",
strerror ( rc ) );