diff options
| author | Michael Brown | 2010-12-15 19:29:20 +0100 |
|---|---|---|
| committer | Michael Brown | 2010-12-15 19:46:19 +0100 |
| commit | 708c5060b9391eddb06701a175997220072262fe (patch) | |
| tree | 360447d3030c679ea1194d969c35f45912a08be3 /src/usr | |
| parent | [pxe] Improve pxe_udp debug messages (diff) | |
| download | ipxe-708c5060b9391eddb06701a175997220072262fe.tar.gz ipxe-708c5060b9391eddb06701a175997220072262fe.tar.xz ipxe-708c5060b9391eddb06701a175997220072262fe.zip | |
[dhcp] Use Ethernet-compatible chaddr, if possible
For IPoIB, we currently use the hardware address (i.e. the eight-byte
GUID) as the DHCP chaddr. This works, but some PXE servers (notably
Altiris RDP) refuse to respond if the chaddr field is anything other
than six bytes in length.
We already have the notion of an Ethernet-compatible link-layer
address, which is used in the iBFT (the design of which similarly
fails to account for non-Ethernet link layers). Use this as the first
preferred alternative to the actual link-layer address when
constructing the DHCP chaddr field.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr')
| -rw-r--r-- | src/usr/dhcpmgmt.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/usr/dhcpmgmt.c b/src/usr/dhcpmgmt.c index ed8a9fe65..e651dfda1 100644 --- a/src/usr/dhcpmgmt.c +++ b/src/usr/dhcpmgmt.c @@ -37,9 +37,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); */ int dhcp ( struct net_device *netdev ) { - uint8_t *chaddr; - uint8_t hlen; - uint16_t flags; + struct dhcphdr *dhcphdr; + typeof ( dhcphdr->chaddr ) chaddr; + unsigned int hlen; + unsigned int i; int rc; /* Check we can open the interface first */ @@ -51,10 +52,11 @@ int dhcp ( struct net_device *netdev ) { return rc; /* Perform DHCP */ - chaddr = dhcp_chaddr ( netdev, &hlen, &flags ); - printf ( "DHCP (%s ", netdev->name ); - while ( hlen-- ) - printf ( "%02x%c", *(chaddr++), ( hlen ? ':' : ')' ) ); + printf ( "DHCP (%s", netdev->name ); + hlen = dhcp_chaddr ( netdev, chaddr, NULL ); + for ( i = 0 ; i < hlen ; i++ ) + printf ( "%c%02x", ( i ? ':' : ' ' ), chaddr[i] ); + printf ( ")" ); if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 ) { rc = monojob_wait ( "" ); |
