Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c9FfS-0000zU-De for mharc-grub-devel@gnu.org; Tue, 22 Nov 2016 13:19:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9FfL-0000sI-Vd for grub-devel@gnu.org; Tue, 22 Nov 2016 13:19:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9FfI-00071b-QW for grub-devel@gnu.org; Tue, 22 Nov 2016 13:19:35 -0500 Received: from boksu.net-space.pl ([185.15.1.105]:57531) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1c9FfI-00070P-EH for grub-devel@gnu.org; Tue, 22 Nov 2016 13:19:32 -0500 Received: (from localhost user: 'dkiper' uid#4000 fake: STDIN (dkiper@boksu.net-space.pl)) by router-fw-old.local.net-space.pl id S1673228AbcKVST3 (ORCPT ); Tue, 22 Nov 2016 19:19:29 +0100 Date: Tue, 22 Nov 2016 19:19:29 +0100 From: Daniel Kiper To: arvidjaar@gmail.com, grub-devel@gnu.org Cc: dkiper@net-space.pl, phcoder@gmail.com, nikunj@linux.vnet.ibm.com Subject: Re: [2.02][PATCH] bootp: export server IP as environment variable Message-ID: <20161122181929.GG4706@router-fw-old.local.net-space.pl> References: <1458322920-5131-1-git-send-email-arvidjaar@gmail.com> <20161117190234.GA7245@router-fw-old.local.net-space.pl> <8dcbe77f-6075-b4dc-933f-6b7a30be3742@gmail.com> <20161121130948.GA22877@router-fw-old.local.net-space.pl> <96d20900-fb5a-189b-d01b-c8cd041f248b@gmail.com> <20161121220205.GF22877@router-fw-old.local.net-space.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.15.1.105 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 18:19:40 -0000 On Tue, Nov 22, 2016 at 08:21:12PM +0300, Andrei Borzenkov wrote: > 22.11.2016 01:02, Daniel Kiper ??????????: > > On Mon, Nov 21, 2016 at 10:52:24PM +0300, Andrei Borzenkov wrote: > >> 21.11.2016 16:09, Daniel Kiper ??????????: > >>> On Fri, Nov 18, 2016 at 09:11:47PM +0300, Andrei Borzenkov wrote: > >>>> 17.11.2016 22:02, Daniel Kiper ??????????: > >>>>> On Fri, Mar 18, 2016 at 08:42:00PM +0300, Andrei Borzenkov wrote: > >>>>>> Network boot autoconfiguration sets default server to next server IP > >>>>>> (siaddr) from BOOTP/DHCP reply, but manual configuration using net_bootp > >>>>>> exports only server name. Unfortunately semantic of server name is not > >>>>>> clearly defined. BOOTP RFC 951 defines it only for client request, and > >>>>>> DHCP RFC 1541 only mentions it, without any implied usage. It looks like > >>>>>> this field is mostly empty in server replies. > >>>>>> > >>>>>> Export next server IP as net__server_ip variable. This allows > >>>>>> grub configuration script to set $root/$prefix based on information obtained > >>>>>> by net_bootp. > >>>>>> > >>>>>> Reported and tested by: Nikunj A Dadhania > >>>>>> Cc: nikunj@linux.vnet.ibm.com > >>>>>> > >>>>>> --- > >>>>>> > >>>>>> @Nikunj: cosmetic changes comparing with version you tested - no need to > >>>>>> allocate small buffer dynamically. > >>>>>> > >>>>>> @Vladimir: I think this is useful; I will update networking documentation > >>>>>> in followup patch. > >>>>> > >>>>> Vladimir, Andrei, could you take care of it? > >>>>> > >>>>> Daniel > >>>>> > >>>> > >>>> I added documentation (not worth separate patch); if there are no > >>>> objections I commit. > >>>> > >>>> > >>>> From: Andrei Borzenkov > >>>> Subject: [2.02][PATCH] bootp: export server IP as environment variable > >>>> > >>>> Network boot autoconfiguration sets default server to next server IP > >>>> (siaddr) from BOOTP/DHCP reply, but manual configuration using net_bootp > >>>> exports only server name. Unfortunately semantic of server name is not > >>>> clearly defined. BOOTP RFC 951 defines it only for client request, and > >>>> DHCP RFC 1541 only mentions it, without any implied usage. It looks like > >>>> this field is mostly empty in server replies. > >>>> > >>>> Export next server IP as net__server_ip variable. This allows > >>>> grub configuration script to set $root/$prefix based on information obtained > >>>> by net_bootp. > >>>> > >>>> Reported and tested by: Nikunj A Dadhania > >>>> Cc: nikunj@linux.vnet.ibm.com > >>>> > >>>> --- > >>>> docs/grub.texi | 11 +++++++++++ > >>>> grub-core/net/bootp.c | 24 ++++++++++++++---------- > >>>> 2 files changed, 25 insertions(+), 10 deletions(-) > >>>> > >>>> diff --git a/docs/grub.texi b/docs/grub.texi > >>>> index 82f6fa4..bb03875 100644 > >>>> --- a/docs/grub.texi > >>>> +++ b/docs/grub.texi > >>>> @@ -2446,6 +2446,10 @@ The boot file name provided by DHCP. Read-only. > >>>> The name of the DHCP server responsible for these boot parameters. > >>>> Read-only. > >>>> > >>>> +@item net_@var{}_server_ip > >>>> +The IP address of the next (usually, TFTP) server provided by DHCP. > >>> > >>> BOOTP instead of DHCP? However, then we should change DHCP everywhere too... > >>> > >> > >> Yes. Sorry, it was probably my fault to refer to DHCP in the first place. > >> > >>>> +Read-only. > >>>> + > >>>> @item net_default_interface > >>>> Initially set to name of network interface that was used to load grub. > >>>> Read-write, although setting it affects only interpretation of > >>>> @@ -3062,6 +3066,7 @@ These variables have special meaning to GRUB. > >>>> * net_@var{}_hostname:: > >>>> * net_@var{}_ip:: > >>>> * net_@var{}_mac:: > >>>> +* net_@var{}_server_ip:: > >>> > >>> There is something known as net_default_server which contains next IP address. > >>> Should not we be more consistent and use "net_@var{}_server" instead > >>> of "net_@var{}_server_ip" here and there. > >>> > >> > >> Well, net_default_server is not really tied to any BOOTP/DHCP at all, > >> although it may be initially set based on content of ACK packet. I was > >> confused by dhcp_server_name, but they it is unrelated to next server. > >> > >> I'd rather used net__next_server for clarity, both "server" > >> and "server_ip" are indeed too vague in this case. > > > > net__next_server is OK for me. Should not we introduce > > net_default_next_server as RO then too? At first its value will be > > equal net_default_server but only net_default_server could be > > changed by user. Does it make sense? > > I would wait until someone has use case for it. I do not see it now. OK, so, let's leave net__next_server only right now. Thanks for committing this stuff. Daniel