diff options
author | Gene Cumm <gene.cumm@gmail.com> | 2015-10-08 06:20:58 -0400 |
---|---|---|
committer | Gene Cumm <gene.cumm@gmail.com> | 2015-10-08 06:20:58 -0400 |
commit | d27385b833820d1b9d0df5d4b9e3feea84b86cdc (patch) | |
tree | 5d5f21df701d28261cd8d04aa9ce95634393dc8b | |
parent | 779a4c85252de59b3134d39961c3f63c99d0ea2e (diff) | |
download | syslinux-d27385b833820d1b9d0df5d4b9e3feea84b86cdc.tar.gz syslinux-d27385b833820d1b9d0df5d4b9e3feea84b86cdc.tar.xz syslinux-d27385b833820d1b9d0df5d4b9e3feea84b86cdc.zip |
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@gmail.com>
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
-rw-r--r-- | core/fs/pxe/dhcp_option.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/fs/pxe/dhcp_option.c b/core/fs/pxe/dhcp_option.c index 5cc0ef75..17f8034f 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; |