summaryrefslogtreecommitdiffstats
path: root/src/usr/dhcpmgmt.c
diff options
context:
space:
mode:
authorMichael Brown2009-08-12 00:44:04 +0200
committerMichael Brown2009-08-12 01:27:08 +0200
commit444d5550a70fef7735ed1821a0e6f8410f0e03ef (patch)
treee27ed2974556073e94462b5cde1192aba9776cd0 /src/usr/dhcpmgmt.c
parent[netdevice] Allow the hardware and link-layer addresses to differ in size (diff)
downloadipxe-444d5550a70fef7735ed1821a0e6f8410f0e03ef.tar.gz
ipxe-444d5550a70fef7735ed1821a0e6f8410f0e03ef.tar.xz
ipxe-444d5550a70fef7735ed1821a0e6f8410f0e03ef.zip
[dhcp] Fall back to using the hardware address to populate the chaddr field
For IPoIB, the chaddr field is too small (16 bytes) to contain the 20-byte IPoIB link-layer address. RFC4390 mandates that we should pass an empty chaddr field and rely on the DHCP client identifier instead. This has many problems, not least of which is that a client identifier containing an IPoIB link-layer address is not very useful from the point of view of creating DHCP reservations, since the QPN component is assigned at runtime and may vary between boots. Leave the DHCP client identifier as-is, to avoid breaking existing setups as far as possible, but expose the real hardware address (the port GUID) via the DHCP chaddr field, using the broadcast flag to instruct the DHCP server not to use this chaddr value as a link-layer address. This makes it possible (at least with ISC dhcpd) to create DHCP reservations using host declarations such as: host duckling { fixed-address 10.252.252.99; hardware unknown-32 00:02:c9:02:00:25:a1:b5; }
Diffstat (limited to 'src/usr/dhcpmgmt.c')
-rw-r--r--src/usr/dhcpmgmt.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/usr/dhcpmgmt.c b/src/usr/dhcpmgmt.c
index d98aa9f4..aa969856 100644
--- a/src/usr/dhcpmgmt.c
+++ b/src/usr/dhcpmgmt.c
@@ -37,6 +37,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
int dhcp ( struct net_device *netdev ) {
+ uint8_t *chaddr;
+ uint8_t hlen;
+ uint16_t flags;
int rc;
/* Check we can open the interface first */
@@ -48,7 +51,10 @@ int dhcp ( struct net_device *netdev ) {
return rc;
/* Perform DHCP */
- printf ( "DHCP (%s %s)", netdev->name, netdev_addr ( netdev ) );
+ chaddr = dhcp_chaddr ( netdev, &hlen, &flags );
+ printf ( "DHCP (%s ", netdev->name );
+ while ( hlen-- )
+ printf ( "%02x%c", *(chaddr++), ( hlen ? ':' : ')' ) );
if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )
rc = monojob_wait ( "" );