summaryrefslogtreecommitdiffstats
path: root/lib/libstand/bootp.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2000-08-11 08:36:17 +0000
committerps <ps@FreeBSD.org>2000-08-11 08:36:17 +0000
commit1dd134848fb77eeb60abfde6ac6c912a97a40a92 (patch)
tree6b4cf526523ea9ea5b7c7279e1adbc3a6c25784c /lib/libstand/bootp.c
parentbf1837571fcf12844f15bc71088fee668425d7b1 (diff)
downloadFreeBSD-src-1dd134848fb77eeb60abfde6ac6c912a97a40a92.zip
FreeBSD-src-1dd134848fb77eeb60abfde6ac6c912a97a40a92.tar.gz
Add support to send the string 'PXEClient' as the Vendor class
identifier to the DHCP server. Now you can check for this string in your dhcp configuration to decide whether you will hand out a lease to the client or not.
Diffstat (limited to 'lib/libstand/bootp.c')
-rw-r--r--lib/libstand/bootp.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 35ccf7a..c440c98 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -37,6 +37,7 @@
* SUCH DAMAGE.
*
* @(#) Header: bootp.c,v 1.4 93/09/11 03:13:51 leres Exp (LBL)
+ * $FreeBSD$
*/
#include <sys/types.h>
@@ -80,8 +81,9 @@ struct in_addr dhcp_serverip;
/* Fetch required bootp infomation */
void
-bootp(sock)
+bootp(sock, flag)
int sock;
+ int flag;
{
struct iodesc *d;
register struct bootp *bp;
@@ -124,7 +126,19 @@ bootp(sock)
bp->bp_vend[4] = TAG_DHCP_MSGTYPE;
bp->bp_vend[5] = 1;
bp->bp_vend[6] = DHCPDISCOVER;
- bp->bp_vend[7] = TAG_END;
+
+ /*
+ * If we are booting from PXE, we want to send the string
+ * 'PXEClient' to the DHCP server so you have the option of
+ * only responding to PXE aware dhcp requests.
+ */
+ if (flag & BOOTP_PXE) {
+ bp->bp_vend[7] = TAG_CLASSID;
+ bp->bp_vend[8] = 9;
+ bcopy("PXEClient", &bp->bp_vend[9], 9);
+ bp->bp_vend[18] = TAG_END;
+ } else
+ bp->bp_vend[7] = TAG_END;
#else
bp->bp_vend[4] = TAG_END;
#endif
@@ -161,7 +175,13 @@ bootp(sock)
bp->bp_vend[20] = 4;
leasetime = htonl(300);
bcopy(&leasetime, &bp->bp_vend[21], 4);
- bp->bp_vend[25] = TAG_END;
+ 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;
+ } else
+ bp->bp_vend[25] = TAG_END;
expected_dhcpmsgtype = DHCPACK;
OpenPOWER on IntegriCloud