mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 19:22:47 +00:00
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
424cbfd989
commit
c6b12feb29
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96825
@ -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