Add TAG_VENDOR_INDENTIFIER (option 60) to our DHCP request done by the
kernel BOOTP option. The format will be: FreeBSD:<MACHINE>:<osrelease> this way people can tune their DHCP server to server up root file systems via the OS, machine type and version. Obtained from: NetBSD MFC after: 3 weeks
This commit is contained in:
parent
80b0d5d606
commit
0f6f0cccbe
@ -205,6 +205,8 @@ struct bootpc_globalcontext {
|
||||
#define TAG_DHCP_SERVERID 54
|
||||
#define TAG_DHCP_LEASETIME 51
|
||||
|
||||
#define TAG_VENDOR_INDENTIFIER 60
|
||||
|
||||
#define DHCP_NOMSG 0
|
||||
#define DHCP_DISCOVER 1
|
||||
#define DHCP_OFFER 2
|
||||
@ -1309,7 +1311,9 @@ bootpc_compose_query(struct bootpc_ifcontext *ifctx,
|
||||
struct bootpc_globalcontext *gctx, struct thread *td)
|
||||
{
|
||||
unsigned char *vendp;
|
||||
unsigned char vendor_client[64];
|
||||
uint32_t leasetime;
|
||||
uint8_t vendor_client_len;
|
||||
|
||||
ifctx->gotrootpath = 0;
|
||||
|
||||
@ -1334,6 +1338,14 @@ bootpc_compose_query(struct bootpc_ifcontext *ifctx,
|
||||
*vendp++ = 2;
|
||||
*vendp++ = (sizeof(struct bootp_packet) >> 8) & 255;
|
||||
*vendp++ = sizeof(struct bootp_packet) & 255;
|
||||
|
||||
snprintf(vendor_client, sizeof(vendor_client), "%s:%s:%s",
|
||||
ostype, MACHINE, osrelease);
|
||||
vendor_client_len = strlen(vendor_client);
|
||||
*vendp++ = TAG_VENDOR_INDENTIFIER;
|
||||
*vendp++ = vendor_client_len;
|
||||
memcpy(vendp, vendor_client, vendor_client_len);
|
||||
vendp += vendor_client_len;;
|
||||
ifctx->dhcpquerytype = DHCP_NOMSG;
|
||||
switch (ifctx->state) {
|
||||
case IF_DHCP_UNRESOLVED:
|
||||
|
Loading…
Reference in New Issue
Block a user