summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Saab <ps@FreeBSD.org>2000-09-10 02:52:19 +0000
committerPaul Saab <ps@FreeBSD.org>2000-09-10 02:52:19 +0000
commit60eeb8b84b40ee910c12b1e40a2b7da492616a12 (patch)
tree00fafe9faa63e3655b17367893ea2d7e3a5bc98d /lib
parent3fb3ca8401971d9216e7b7ce8a92a6ee99f40d07 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libstand/bootp.c26
-rw-r--r--lib/libstand/bootp.h8
-rw-r--r--lib/libstand/net.h2
3 files changed, 32 insertions, 4 deletions
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 35ccf7a74400..c440c982c54d 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;
diff --git a/lib/libstand/bootp.h b/lib/libstand/bootp.h
index 7435e3cdbbb0..ed9101f3ea89 100644
--- a/lib/libstand/bootp.h
+++ b/lib/libstand/bootp.h
@@ -18,6 +18,8 @@
* University. Carnegie Mellon makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
+ *
+ * $FreeBSD$
*/
@@ -118,6 +120,12 @@ struct bootp {
#endif
/*
+ * bootp flags
+ */
+#define BOOTP_NONE 0x0000 /* No flags */
+#define BOOTP_PXE 0x0001 /* Booting from PXE. */
+
+/*
* "vendor" data permitted for CMU bootp clients.
*/
diff --git a/lib/libstand/net.h b/lib/libstand/net.h
index 47ff0a0d2e20..24534afcaaca 100644
--- a/lib/libstand/net.h
+++ b/lib/libstand/net.h
@@ -114,7 +114,7 @@ ssize_t sendrecv(struct iodesc *,
void *, size_t);
/* bootp/DHCP */
-void bootp(int);
+void bootp(int, int);
/* Utilities: */
char *ether_sprintf(u_char *);