misc/137678: [patch]Libstands bootp/dhcp code always uses PXEClient
as the vendor identifyer this adds cpu type and FreeBSD
version to the identifer.
Tom Judge
tom at tomjudge.com
Tue Aug 11 18:40:06 UTC 2009
>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 at 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 <sys/types.h>
+#include <osreldate.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -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:
More information about the freebsd-bugs
mailing list