Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Apr 2002 13:00:41 -0700 (PDT)
From:      Doug Ambrisko <ambrisko@ambrisko.com>
To:        freebsd-net@ambrisko.com
Subject:   Review for BOOTP/DHCP Vendor identifier
Message-ID:  <200204082003.g38K3IF74682@ambrisko.com>

next in thread | raw e-mail | index | archive | help
I put together a patch that adds option 60 to the FreeBSD kernel BOOTP code.
I fill in the vendor indentifier string as:
	<ostype>:<MACHINE>:<osrelease>
partially based on how NetBSD does it.  However, NetBSD uses this format:
	<ostype>:<MACHINE>:kernel:<osrelease>
I wonder how usefull the "kernel" part is.  Should we just do it to
follow suit with NetBSD.  I'm thinking we probably should do it the 
same way as NetBSD.

Note I started on adding this code and then looked at what NetBSD did.
I can add similar code to the pxeboot loader.

The goal is that via the vendor identifier I can have various OS and
BOOTP/DHCP configured type things get the right info at the right 
time and avoid tag conflicts.  I think the <MACHINE> part would be
useful for those that netboot various different types off one server.

Attached is my patch to -current.  After a review I'd like to commit
something like this.

TIA for a review,

Doug A.

Index: bootp_subr.c
===================================================================
RCS file: /cvs/src/sys/nfsclient/bootp_subr.c,v
retrieving revision 1.35
diff -u -r1.35 bootp_subr.c
--- bootp_subr.c	28 Feb 2002 03:07:35 -0000	1.35
+++ bootp_subr.c	8 Apr 2002 19:44:16 -0000
@@ -55,6 +55,7 @@
 #include <sys/proc.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
+#include <sys/sysctl.h>
 #include <sys/uio.h>
 
 #include <net/if.h>
@@ -203,6 +204,8 @@
 #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
@@ -1303,7 +1306,9 @@
     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;
 
@@ -1328,6 +1333,14 @@
 	*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:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204082003.g38K3IF74682>