From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c9Eky-0002qk-8R for mharc-grub-devel@gnu.org; Tue, 22 Nov 2016 12:21:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9Ekw-0002qa-F8 for grub-devel@gnu.org; Tue, 22 Nov 2016 12:21:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9Ekt-0007HU-6P for grub-devel@gnu.org; Tue, 22 Nov 2016 12:21:18 -0500 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:33655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c9Ekt-0007HB-0k for grub-devel@gnu.org; Tue, 22 Nov 2016 12:21:15 -0500 Received: by mail-qt0-x244.google.com with SMTP id n6so3401430qtd.0 for ; Tue, 22 Nov 2016 09:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=5J43E3CokcB9Bmm0ptPwffLCq/s3QWlp4FcYztm04pY=; b=SjmODKGwyKBFgwOmxGxXeMXe5CRFA+0dGsm3PJaSSd2zXW+6rDZp7KJAmSvMaN9Wnr /HbEmzRAlwhmhRwJmafICQEt5F+gvSzNxRVZiHvyA+fg2Zt0ILHwECdgP344U0joTWF3 A2RYUq+7nFT+o+q3t600OMHjEmZfYqjgVEtTJJ0tSN2v4vDLYl0ld129+3emOqKm/n+h aZglvJplmbcXqHoQ732lqUY8TT1F5RtGbHR133eUIWe+BIzI2/OXojO2F7Wz6Xc9VFed +QgnCm2N0GrHwXyMb94CuuNAwdYn+BCDN+qH2bSSZV7o/BGDpxdgsoKeyYRH/iQDv7ob FMLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=5J43E3CokcB9Bmm0ptPwffLCq/s3QWlp4FcYztm04pY=; b=XnvZvzdvErAXq/gmoQAOJXRDKQUOhV9qkSujUPzR66y1x2RZZR8v/YAQAYwS3qOOdo 9dDP8FSyRkSXgP1E/TQDicArmy5K9qwFELQntM4qtAs2TeZYqVvCpXzWj7SUF4qy1t32 tHYI4FQgU1lACEvm0hrFIZB2ar1fq5RzRhXeLumriXpTLSllkhPd2LDtXHCVvJXjCagB MNF+UxmTXyF02jK8G+JeeZk/h6HbVpgznfcVBDHm5bGmmJIGLLaKDKNlCdee7E5F3B9/ G5iCk8uXTFtb1s6btdpVkwiVdfVbdVTUU0x40V8iwhNO8Fas++xcQS+JOZFwvKbqyUPJ bKBQ== X-Gm-Message-State: AKaTC00jJb+cJkCswOmWsI2WErL7KzjmJNs3q6XdO/nDpDwhIVzrcGLb8lt1vXdczNgI0g== X-Received: by 10.25.37.134 with SMTP id l128mr4523208lfl.120.1479835274005; Tue, 22 Nov 2016 09:21:14 -0800 (PST) Received: from [192.168.1.44] (ppp109-252-90-55.pppoe.spdop.ru. [109.252.90.55]) by smtp.gmail.com with ESMTPSA id k94sm6409582lfi.5.2016.11.22.09.21.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 09:21:13 -0800 (PST) Subject: Re: [2.02][PATCH] bootp: export server IP as environment variable To: Daniel Kiper , grub-devel@gnu.org 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> Cc: phcoder@gmail.com, nikunj@linux.vnet.ibm.com From: Andrei Borzenkov Message-ID: Date: Tue, 22 Nov 2016 20:21:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161121220205.GF22877@router-fw-old.local.net-space.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::244 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 17:21:19 -0000 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.