summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorambrisko <ambrisko@FreeBSD.org>2002-05-17 20:18:48 +0000
committerambrisko <ambrisko@FreeBSD.org>2002-05-17 20:18:48 +0000
commit0f6f0cccbed821ac5d188519f9d022757dd9909e (patch)
tree77da62477178e09cf72281c5e2d1491335ec2c93 /sys/nfsclient
parent80b0d5d606c793fff5ac6fe334a0cd9e81c83e61 (diff)
downloadFreeBSD-src-0f6f0cccbed821ac5d188519f9d022757dd9909e.zip
FreeBSD-src-0f6f0cccbed821ac5d188519f9d022757dd9909e.tar.gz
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
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/bootp_subr.c12
1 files changed, 12 insertions, 0 deletions
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:
OpenPOWER on IntegriCloud