From owner-freebsd-bugs@FreeBSD.ORG Tue Aug 11 18:40:05 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8F231065670 for ; Tue, 11 Aug 2009 18:40:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B40C18FC44 for ; Tue, 11 Aug 2009 18:40:05 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7BIe5vL038333 for ; Tue, 11 Aug 2009 18:40:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7BIe566038332; Tue, 11 Aug 2009 18:40:05 GMT (envelope-from gnats) Resent-Date: Tue, 11 Aug 2009 18:40:05 GMT Resent-Message-Id: <200908111840.n7BIe566038332@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tom Judge Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59211106566C for ; Tue, 11 Aug 2009 18:32:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 3D7168FC41 for ; Tue, 11 Aug 2009 18:32:18 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7BIWHc4018471 for ; Tue, 11 Aug 2009 18:32:17 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n7BIWHT4018469; Tue, 11 Aug 2009 18:32:17 GMT (envelope-from nobody) Message-Id: <200908111832.n7BIWHT4018469@www.freebsd.org> Date: Tue, 11 Aug 2009 18:32:17 GMT From: Tom Judge To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/137678: [patch]Libstands bootp/dhcp code always uses PXEClient as the vendor identifyer this adds cpu type and FreeBSD version to the identifer. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2009 18:40:06 -0000 >Number: 137678 >Category: misc >Synopsis: [patch]Libstands bootp/dhcp code always uses PXEClient as the vendor identifyer this adds cpu type and FreeBSD version to the identifer. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 11 18:40:05 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Tom Judge >Release: 7.1 >Organization: Mintel >Environment: FreeBSD dev-tj-7-1.XXXXXXXX 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 14:37:25 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: When the pxeboot loader sends the dhcp request to the server to get the configuration it currently always sets the vendor identifier to PXEClient. This is not very useful when trying to setup PXE environment to install multiple releases on different architectures. The attached patch changes the idetifier to look like: PXEClient:FBSD:i386:701000 i386 is substituted for amd64 on amd64 hosts and omited on other architectures. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: bootp.c =================================================================== --- bootp.c (revision 723) +++ bootp.c (revision 727) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -75,6 +76,7 @@ #ifdef SUPPORT_DHCP static char expected_dhcpmsgtype = -1, dhcp_ok; struct in_addr dhcp_serverip; +static void vend_ident(u_char *); #endif /* Fetch required bootp infomation */ @@ -93,7 +95,9 @@ u_char header[HEADER_SIZE]; struct bootp rbootp; } rbuf; - +#ifdef SUPPORT_DHCP + char *vendor_ident; +#endif #ifdef BOOTP_DEBUG if (debug) printf("bootp: socket=%d\n", sock); @@ -132,9 +136,12 @@ */ if (flag & BOOTP_PXE) { bp->bp_vend[7] = TAG_CLASSID; - bp->bp_vend[8] = 9; - bcopy("PXEFBSD71", &bp->bp_vend[9], 9); - bp->bp_vend[18] = TAG_END; + vendor_ident=malloc(1024); + vend_ident(vendor_ident); + bp->bp_vend[8] = strlen(vendor_ident); + bcopy(vendor_ident, &bp->bp_vend[9], bp->bp_vend[8]); + free(vendor_ident); + bp->bp_vend[(9 + bp->bp_vend[8])] = TAG_END; } else bp->bp_vend[7] = TAG_END; #else @@ -175,9 +182,12 @@ bcopy(&leasetime, &bp->bp_vend[21], 4); if (flag & BOOTP_PXE) { bp->bp_vend[25] = TAG_CLASSID; - bp->bp_vend[26] = 9; - bcopy("PXEClient", &bp->bp_vend[27], 9); - bp->bp_vend[36] = TAG_END; + vendor_ident=malloc(1024); + vend_ident(vendor_ident); + bp->bp_vend[8] = strlen(vendor_ident); + bcopy(vendor_ident, &bp->bp_vend[27], bp->bp_vend[26]); + free(vendor_ident); + bp->bp_vend[(27 + bp->bp_vend[26])] = TAG_END; } else bp->bp_vend[25] = TAG_END; @@ -390,6 +400,21 @@ } return(0); } +#ifdef SUPPORT_DHCP +static void +vend_ident(cp) + u_char *cp; +{ + char default_vendor_ident[] = "PXEClient:FBSD"; +#ifdef __i386__ + sprintf(cp,"%s:i386:%d",default_vendor_ident,__FreeBSD_version); +#elif __amd64__ + sprintf(cp,"%s:amd64:%d",default_vendor_ident,__FreeBSD_version); +#else + sprintf(cp,"%s:%d",default_vendor_ident,__FreeBSD_version); +#endif +} +#endif #ifdef BOOTP_VEND_CMU static void >Release-Note: >Audit-Trail: >Unformatted: