|
@@ -24,6 +24,7 @@
|
24
|
24
|
#include <byteswap.h>
|
25
|
25
|
#include <gpxe/if_ether.h>
|
26
|
26
|
#include <gpxe/netdevice.h>
|
|
27
|
+#include <gpxe/device.h>
|
27
|
28
|
#include <gpxe/xfer.h>
|
28
|
29
|
#include <gpxe/open.h>
|
29
|
30
|
#include <gpxe/job.h>
|
|
@@ -480,6 +481,16 @@ static struct dhcp_option_block * dhcp_parse ( const struct dhcphdr *dhcphdr,
|
480
|
481
|
*
|
481
|
482
|
*/
|
482
|
483
|
|
|
484
|
+/** DHCP network device descriptor */
|
|
485
|
+struct dhcp_netdev_desc {
|
|
486
|
+ /** Bus type ID */
|
|
487
|
+ uint8_t type;
|
|
488
|
+ /** Vendor ID */
|
|
489
|
+ uint16_t vendor;
|
|
490
|
+ /** Device ID */
|
|
491
|
+ uint16_t device;
|
|
492
|
+} __attribute__ (( packed ));
|
|
493
|
+
|
483
|
494
|
/**
|
484
|
495
|
* Create DHCP request
|
485
|
496
|
*
|
|
@@ -495,6 +506,8 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
|
495
|
506
|
struct dhcp_option_block *options,
|
496
|
507
|
void *data, size_t max_len,
|
497
|
508
|
struct dhcp_packet *dhcppkt ) {
|
|
509
|
+ struct device_description *desc = &netdev->dev->desc;
|
|
510
|
+ struct dhcp_netdev_desc dhcp_desc;
|
498
|
511
|
int rc;
|
499
|
512
|
|
500
|
513
|
/* Create DHCP packet */
|
|
@@ -531,6 +544,18 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
|
531
|
544
|
}
|
532
|
545
|
}
|
533
|
546
|
|
|
547
|
+ /* Add options to identify the network device */
|
|
548
|
+ dhcp_desc.type = desc->bus_type;
|
|
549
|
+ dhcp_desc.vendor = htons ( desc->vendor );
|
|
550
|
+ dhcp_desc.device = htons ( desc->device );
|
|
551
|
+ if ( ( rc = set_dhcp_packet_option ( dhcppkt, DHCP_EB_BUS_ID,
|
|
552
|
+ &dhcp_desc,
|
|
553
|
+ sizeof ( dhcp_desc ) ) ) != 0 ) {
|
|
554
|
+ DBG ( "DHCP could not set bus ID option: %s\n",
|
|
555
|
+ strerror ( rc ) );
|
|
556
|
+ return rc;
|
|
557
|
+ }
|
|
558
|
+
|
534
|
559
|
return 0;
|
535
|
560
|
}
|
536
|
561
|
|