From owner-freebsd-net Mon Apr 8 13: 3:30 2002 Delivered-To: freebsd-net@freebsd.org Received: from ambrisko.com (adsl-64-174-51-42.dsl.snfc21.pacbell.net [64.174.51.42]) by hub.freebsd.org (Postfix) with ESMTP id 88BCB37B416 for ; Mon, 8 Apr 2002 13:03:21 -0700 (PDT) Received: (from ambrisko@localhost) by ambrisko.com (8.11.6/8.11.6) id g38K3IF74682 for freebsd-net@freebsd.org; Mon, 8 Apr 2002 13:03:18 -0700 (PDT) (envelope-from ambrisko) From: Doug Ambrisko Message-Id: <200204082003.g38K3IF74682@ambrisko.com> Subject: Review for BOOTP/DHCP Vendor identifier To: freebsd-net@ambrisko.com Date: Mon, 8 Apr 2002 13:00:41 -0700 (PDT) X-Mailer: ELM [version 2.4ME+ PL94b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org I put together a patch that adds option 60 to the FreeBSD kernel BOOTP code. I fill in the vendor indentifier string as: :: partially based on how NetBSD does it. However, NetBSD uses this format: ::kernel: 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 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 #include #include +#include #include #include @@ -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