[syslinux:master] core/pxe: Allow DHCP option 54 Server Identifier

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Fri Oct 9 02:51:04 PDT 2015


Commit-ID:  d27385b833820d1b9d0df5d4b9e3feea84b86cdc
Gitweb:     http://www.syslinux.org/commit/d27385b833820d1b9d0df5d4b9e3feea84b86cdc
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Thu, 8 Oct 2015 06:20:58 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Thu, 8 Oct 2015 06:20:58 -0400

core/pxe: Allow DHCP option 54 Server Identifier

Apparently some servers don't bother setting siaddr when pointing to
itself for TFTP.  Re-allow 54 but always set IPInfo.serverip from
siaddr/dhcp->sip in packet #3 (PXEReply/proxyDHCP).

Always set from siaddr if good in case parsing after-DHCP options.

Reported-by: Celelibi <celelibi at gmail.com>
Signed-off-by: Gene Cumm <gene.cumm at gmail.com>

---
 core/fs/pxe/dhcp_option.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/fs/pxe/dhcp_option.c b/core/fs/pxe/dhcp_option.c
index 5cc0ef7..17f8034 100644
--- a/core/fs/pxe/dhcp_option.c
+++ b/core/fs/pxe/dhcp_option.c
@@ -72,9 +72,12 @@ static void server(const void *data, int opt_len)
     if (opt_len != 4)
 	return;
 
+    if (IPInfo.serverip)
+	return;
+
     ip = *(uint32_t *)data;
     if (ip_ok(ip))
-        IPInfo.serverip = ip;
+	IPInfo.serverip = ip;
 }
 
 static void client_identifier(const void *data, int opt_len)
@@ -143,6 +146,7 @@ static const struct dhcp_options dhcp_opts[] = {
     {15,  local_domain},
     {43,  vendor_encaps},
     {52,  option_overload},
+    {54,  server},
     {61,  client_identifier},
     {67,  bootfile_name},
     {97,  uuid_client_identifier},
@@ -237,7 +241,7 @@ void parse_dhcp(const void *pkt, size_t pkt_len, int pkt_type)
     if ((pkt_type == 2) && ip_ok(dhcp->yip))
         IPInfo.myip = dhcp->yip;
 
-    if (ip_ok(dhcp->sip))
+    if (ip_ok(dhcp->sip) || pkt_type == 3)
         IPInfo.serverip = dhcp->sip;
 
     opt_len = (char *)dhcp + pkt_len - (char *)&dhcp->options;


More information about the Syslinux-commits mailing list