From 0f6f0cccbed821ac5d188519f9d022757dd9909e Mon Sep 17 00:00:00 2001 From: ambrisko Date: Fri, 17 May 2002 20:18:48 +0000 Subject: Add TAG_VENDOR_INDENTIFIER (option 60) to our DHCP request done by the kernel BOOTP option. The format will be: FreeBSD:: 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 --- sys/nfsclient/bootp_subr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys/nfsclient') diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c index bdd51ee..124b09f 100644 --- a/sys/nfsclient/bootp_subr.c +++ b/sys/nfsclient/bootp_subr.c @@ -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: -- cgit v1.1