aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2017-05-27 12:35:01 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2017-05-27 12:35:01 +0000
commit4dfd16670e09d5d54d5c1b41776bb9aa0b8fab33 (patch)
treececea4ea0d038a76d521f37d9b176647d8001a9a /lib
parent5fe86cd90951e23bffadf92b2506d9a60cb1eb23 (diff)
downloadsrc-4dfd16670e09d5d54d5c1b41776bb9aa0b8fab33.tar.gz
src-4dfd16670e09d5d54d5c1b41776bb9aa0b8fab33.zip
Always issue the pxe request
All the code are now only issueing one single dhcp request at startup of the loader meaning we can always request a the PXE informations from the dhcp server. Previous code lost that information, meaning no option 55 anymore (meaning not working with the kea dhcp server) and no request for rootpath etc, no user class Remove the flags from the bootp function which is not needed anymore Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D10952
Notes
Notes: svn path=/head/; revision=318989
Diffstat (limited to 'lib')
-rw-r--r--lib/libstand/bootp.c56
-rw-r--r--lib/libstand/bootp.h6
-rw-r--r--lib/libstand/net.h2
3 files changed, 26 insertions, 38 deletions
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 365726e61dac..1f5cf9e26461 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -95,7 +95,7 @@ size_t bootp_response_size;
/* Fetch required bootp infomation */
void
-bootp(int sock, int flag)
+bootp(int sock)
{
void *pkt;
struct iodesc *d;
@@ -138,32 +138,29 @@ bootp(int sock, int flag)
bp->bp_vend[6] = DHCPDISCOVER;
/*
- * If we are booting from PXE, we want to send the string
+ * 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_USER_CLASS;
- /* len of each user class + number of user class */
- bp->bp_vend[19] = 8;
- /* len of the first user class */
- bp->bp_vend[20] = 7;
- bcopy("FREEBSD", &bp->bp_vend[21], 7);
- bp->bp_vend[28] = TAG_PARAM_REQ;
- bp->bp_vend[29] = 7;
- bp->bp_vend[30] = TAG_ROOTPATH;
- bp->bp_vend[31] = TAG_HOSTNAME;
- bp->bp_vend[32] = TAG_SWAPSERVER;
- bp->bp_vend[33] = TAG_GATEWAY;
- bp->bp_vend[34] = TAG_SUBNET_MASK;
- bp->bp_vend[35] = TAG_INTF_MTU;
- bp->bp_vend[36] = TAG_SERVERID;
- bp->bp_vend[37] = TAG_END;
- } else
- bp->bp_vend[7] = TAG_END;
+ bp->bp_vend[7] = TAG_CLASSID;
+ bp->bp_vend[8] = 9;
+ bcopy("PXEClient", &bp->bp_vend[9], 9);
+ bp->bp_vend[18] = TAG_USER_CLASS;
+ /* len of each user class + number of user class */
+ bp->bp_vend[19] = 8;
+ /* len of the first user class */
+ bp->bp_vend[20] = 7;
+ bcopy("FREEBSD", &bp->bp_vend[21], 7);
+ bp->bp_vend[28] = TAG_PARAM_REQ;
+ bp->bp_vend[29] = 7;
+ bp->bp_vend[30] = TAG_ROOTPATH;
+ bp->bp_vend[31] = TAG_HOSTNAME;
+ bp->bp_vend[32] = TAG_SWAPSERVER;
+ bp->bp_vend[33] = TAG_GATEWAY;
+ bp->bp_vend[34] = TAG_SUBNET_MASK;
+ bp->bp_vend[35] = TAG_INTF_MTU;
+ bp->bp_vend[36] = TAG_SERVERID;
+ bp->bp_vend[37] = TAG_END;
#else
bp->bp_vend[4] = TAG_END;
#endif
@@ -199,13 +196,10 @@ bootp(int sock, int flag)
bp->bp_vend[20] = 4;
leasetime = htonl(300);
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;
- } else
- bp->bp_vend[25] = TAG_END;
+ bp->bp_vend[25] = TAG_CLASSID;
+ bp->bp_vend[26] = 9;
+ bcopy("PXEClient", &bp->bp_vend[27], 9);
+ bp->bp_vend[36] = TAG_END;
expected_dhcpmsgtype = DHCPACK;
diff --git a/lib/libstand/bootp.h b/lib/libstand/bootp.h
index 1224fd2c6bc5..2e7049b872af 100644
--- a/lib/libstand/bootp.h
+++ b/lib/libstand/bootp.h
@@ -124,12 +124,6 @@ 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 dc2538ca65b7..cc946c15ff5c 100644
--- a/lib/libstand/net.h
+++ b/lib/libstand/net.h
@@ -119,7 +119,7 @@ ssize_t sendrecv(struct iodesc *,
void **, void **);
/* bootp/DHCP */
-void bootp(int, int);
+void bootp(int);
/* Utilities: */
char *ether_sprintf(u_char *);