[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFERDQ0mfFYBWunXR1RCztsGr9CUMwUt7QEUZXW8T2NfAqq6+w@mail.gmail.com>
Date: Wed, 3 May 2023 12:13:39 +0200
From: Martin Wetterwald <martin@...terwald.eu>
To: davem@...emloft.net, dsahern@...nel.org
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] net: ipconfig: Allow DNS to be overwritten by DHCPACK
On Wed, May 3, 2023 at 12:06 PM Martin Wetterwald <martin@...terwald.eu> wrote:
> diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
> index e90bc0aa85c7..c125095453da 100644
> --- a/net/ipv4/ipconfig.c
> +++ b/net/ipv4/ipconfig.c
> @@ -937,9 +937,11 @@ static void __init ic_do_bootp_ext(u8 *ext)
> servers= *ext/4;
> if (servers > CONF_NAMESERVERS_MAX)
> servers = CONF_NAMESERVERS_MAX;
> - for (i = 0; i < servers; i++) {
> - if (ic_nameservers[i] == NONE)
> + for (i = 0; i < CONF_NAMESERVERS_MAX; i++) {
> + if (i < servers)
> memcpy(&ic_nameservers[i], ext+1+4*i, 4);
> + else
> + ic_nameservers[i] = NONE;
> }
> break;
> case 12: /* Host name */
> --
I reset the whole DNS array every time because, in case we have a DHCPOFFER
containing more DNS servers than the DHCPACK, we probably don't want to have a
"mix" between DNS servers from the DHCPOFFER and from the DHCPACK at the same
time.
But this could break users having a DHCP server sending only DNS information in
the DHCPOFFER and nothing in the DHCPACK.
Do such kind of DHCP server implementation exist?
Do you see a better way than resetting the whole array every time?
Powered by blists - more mailing lists