Skip to content

Commit

Permalink
ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX name servers
Browse files Browse the repository at this point in the history
When ipconfig is autoconfigured via BOOTP, the request packet
initialised by ic_bootp_init_ext() always allocates 8 bytes for the name
server option, limiting the BOOTP server to responding with at most 2
name servers even though ipconfig in fact supports an arbitrary number
of name servers (as defined by CONF_NAMESERVERS_MAX, which is currently
3).

Only request name servers in the request packet if CONF_NAMESERVERS_MAX
is positive (to comply with [1, §3.8]), and allocate enough space in the
packet for CONF_NAMESERVERS_MAX name servers to indicate the maximum
number we can accept in response.

[1] RFC 2132, "DHCP Options and BOOTP Vendor Extensions":
    https://tools.ietf.org/rfc/rfc2132.txt

Signed-off-by: Chris Novakovic <chris@chrisn.me.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chris Novakovic authored and David S. Miller committed Apr 24, 2018
1 parent 4e1a8af commit de1fa15
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,11 @@ static void __init ic_bootp_init_ext(u8 *e)
*e++ = 3; /* Default gateway request */
*e++ = 4;
e += 4;
#if CONF_NAMESERVERS_MAX > 0
*e++ = 6; /* (DNS) name server request */
*e++ = 8;
e += 8;
*e++ = 4 * CONF_NAMESERVERS_MAX;
e += 4 * CONF_NAMESERVERS_MAX;
#endif
*e++ = 12; /* Host name request */
*e++ = 32;
e += 32;
Expand Down

0 comments on commit de1fa15

Please sign in to comment.