Skip to content

Commit

Permalink
core/pxe: Allow DHCP option 54 Server Identifier
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
geneC committed Oct 8, 2015
1 parent 779a4c8 commit d27385b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/fs/pxe/dhcp_option.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d27385b

Please sign in to comment.