aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-06-16 17:39:24 -0700
committerH. Peter Anvin <hpa@zytor.com>2014-06-16 17:42:36 -0700
commit191e622cdd85271783682ff38f4c307b89cfe040 (patch)
treec3b54bb059d1fd585cf89e7de9441d13688954db /core
parent616d86cb26b13f6dcab511a515eab437ea2cb652 (diff)
downloadsyslinux-191e622cdd85271783682ff38f4c307b89cfe040.tar.gz
syslinux-191e622cdd85271783682ff38f4c307b89cfe040.tar.xz
syslinux-191e622cdd85271783682ff38f4c307b89cfe040.zip
pxe: Re-add support for embedded DHCP optionssyslinux-6.03-pre15
Fix the support for embedded DHCP options. Although we were diligently saving them away, we never actually parsed them. This fixes embedded options for BIOS only -- for EFI we need to modify the encoding scheme so that it can fit inside an EFI PECOFF image. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core')
-rw-r--r--core/fs/pxe/bios.c17
-rw-r--r--core/fs/pxe/dhcp_option.c7
-rw-r--r--core/fs/pxe/pxe.h1
-rw-r--r--core/pxelinux.asm1
4 files changed, 23 insertions, 3 deletions
diff --git a/core/fs/pxe/bios.c b/core/fs/pxe/bios.c
index 6d514df2..6eb37626 100644
--- a/core/fs/pxe/bios.c
+++ b/core/fs/pxe/bios.c
@@ -5,6 +5,7 @@
#include <net.h>
#include <minmax.h>
#include <bios.h>
+#include <dprintf.h>
static uint16_t real_base_mem; /* Amount of DOS memory after freeing */
@@ -385,6 +386,9 @@ cant_free:
return;
}
+extern const char bdhcp_data[], adhcp_data[];
+extern const uint32_t bdhcp_len, adhcp_len;
+
void net_parse_dhcp(void)
{
int pkt_len;
@@ -400,11 +404,18 @@ void net_parse_dhcp(void)
*LocalDomain = 0; /* No LocalDomain received */
/*
+ * Parse any "before" hardcoded options
+ */
+ dprintf("DHCP: bdhcp_len = %d\n", bdhcp_len);
+ parse_dhcp_options(bdhcp_data, bdhcp_len, 0);
+
+ /*
* Get the DHCP client identifiers (query info 1)
*/
ddprintf("Getting cached packet ");
pkt_len = pxe_get_cached_info(1, bp, dhcp_max_packet);
parse_dhcp(bp, pkt_len);
+
/*
* We don't use flags from the request packet, so
* this is a good time to initialize DHCPMagic...
@@ -439,5 +450,11 @@ void net_parse_dhcp(void)
parse_dhcp(bp, pkt_len);
ddprintf("\n");
+ /*
+ * Parse any "after" hardcoded options
+ */
+ dprintf("DHCP: adhcp_len = %d\n", adhcp_len);
+ parse_dhcp_options(adhcp_data, adhcp_len, 0);
+
lfree(bp);
}
diff --git a/core/fs/pxe/dhcp_option.c b/core/fs/pxe/dhcp_option.c
index 3517161a..1fdcc705 100644
--- a/core/fs/pxe/dhcp_option.c
+++ b/core/fs/pxe/dhcp_option.c
@@ -3,6 +3,7 @@
#include <core.h>
#include <sys/cpu.h>
#include <lwip/opt.h> /* DNS_MAX_SERVERS */
+#include <dprintf.h>
#include "pxe.h"
char LocalDomain[256];
@@ -11,8 +12,6 @@ int over_load;
uint8_t uuid_type;
uint8_t uuid[16];
-static void parse_dhcp_options(const void *, int, uint8_t);
-
static void subnet_mask(const void *data, int opt_len)
{
if (opt_len != 4)
@@ -164,7 +163,7 @@ static const struct dhcp_options dhcp_opts[] = {
* filter contains the minimum value for the option to recognize
* -- this is used to restrict parsing to PXELINUX-specific options only.
*/
-static void parse_dhcp_options(const void *option, int size, uint8_t opt_filter)
+void parse_dhcp_options(const void *option, int size, uint8_t opt_filter)
{
int opt_num;
int opt_len;
@@ -189,6 +188,8 @@ static void parse_dhcp_options(const void *option, int size, uint8_t opt_filter)
if (size < 0)
break;
+ dprintf("DHCP: option %d, len %d\n", opt_num, opt_len);
+
if (opt_num >= opt_filter) {
opt = dhcp_opts;
for (i = 0; i < opt_entries; i++) {
diff --git a/core/fs/pxe/pxe.h b/core/fs/pxe/pxe.h
index 279957ac..15252fff 100644
--- a/core/fs/pxe/pxe.h
+++ b/core/fs/pxe/pxe.h
@@ -231,6 +231,7 @@ int undiif_start(uint32_t ip, uint32_t netmask, uint32_t gw);
void undiif_input(t_PXENV_UNDI_ISR *isr);
/* dhcp_options.c */
+void parse_dhcp_options(const void *, int, uint8_t);
void parse_dhcp(const void *, size_t);
/* idle.c */
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index 953a906f..d4b1a07a 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -93,6 +93,7 @@ _start:
hcdhcp_magic dd 0x2983c8ac ; Magic number
hcdhcp_len dd 7*4 ; Size of this structure
hcdhcp_flags dd 0 ; Reserved for the future
+ global bdhcp_len, adhcp_len
; Parameters to be parsed before the ones from PXE
bdhcp_offset dd 0 ; Offset (entered by patcher)
bdhcp_len dd 0 ; Length (entered by patcher)