netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Novakovic <chris@chrisn.me.uk>
To: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: Chris Novakovic <chris@chrisn.me.uk>
Subject: [PATCH 4/8] ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX name servers
Date: Tue, 17 Apr 2018 21:58:26 +0100	[thread overview]
Message-ID: <20180417205830.1812-5-chris@chrisn.me.uk> (raw)
In-Reply-To: <20180417205830.1812-1-chris@chrisn.me.uk>

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>
---
 net/ipv4/ipconfig.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index bcf3c4f9882d..0f460d6d3cce 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -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;
-- 
2.14.1

  parent reply	other threads:[~2018-04-17 20:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 20:58 [PATCH 0/8] ipconfig: NTP server support, bug fixes, documentation improvements Chris Novakovic
2018-04-17 20:58 ` [PATCH 1/8] ipconfig: Document setting of NIS domain name Chris Novakovic
2018-04-17 20:58 ` [PATCH 2/8] ipconfig: Tidy up reporting of name servers Chris Novakovic
2018-04-17 20:58 ` [PATCH 3/8] ipconfig: BOOTP: Don't request IEN-116 " Chris Novakovic
2018-04-17 20:58 ` Chris Novakovic [this message]
2018-04-17 20:58 ` [PATCH 5/8] ipconfig: Document /proc/net/pnp Chris Novakovic
2018-04-17 20:58 ` [PATCH 6/8] ipconfig: Correctly initialise ic_nameservers Chris Novakovic
2018-04-17 20:58 ` [PATCH 7/8] ipconfig: Write NTP server IPs to /proc/net/ntp Chris Novakovic
2018-04-17 20:58 ` [PATCH 8/8] CREDITS: Add Chris Novakovic Chris Novakovic
2018-04-17 21:08   ` Cong Wang
2018-04-18 17:59 ` [PATCH 0/8] ipconfig: NTP server support, bug fixes, documentation improvements David Miller
2018-04-18 18:06   ` Chris Novakovic
2018-04-18 18:12     ` Chris Novakovic
  -- strict thread matches above, loose matches on Subject: below --
2018-04-07  4:08 Chris Novakovic
2018-04-07  4:08 ` [PATCH 4/8] ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX name servers Chris Novakovic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180417205830.1812-5-chris@chrisn.me.uk \
    --to=chris@chrisn.me.uk \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).