mirror of
https://github.com/ipxe/ipxe
synced 2026-04-16 03:00:10 +03:00
[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>
This commit is contained in:
+9
-7
@@ -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 ( "" );
|
||||
|
||||
Reference in New Issue
Block a user