From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.86_2) id 1huv4x-0002WC-TJ for mharc-grub-devel@gnu.org; Tue, 06 Aug 2019 04:44:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55558) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huv4v-0002TZ-PV for grub-devel@gnu.org; Tue, 06 Aug 2019 04:44:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1huv4u-0002Pa-Je for grub-devel@gnu.org; Tue, 06 Aug 2019 04:44:21 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:51923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1huv4t-0002Oo-0P for grub-devel@gnu.org; Tue, 06 Aug 2019 04:44:20 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 207so77335581wma.1 for ; Tue, 06 Aug 2019 01:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OLq1U/Kv3dL1gR9OB0l1J1elUkebryVY8RibtZhumcI=; b=jmmfeSuV9pPahoUu1kOTHwKKUQcOEBJ9dUGyLTX3ybcO3eKAho9ntKb2oKmsXxaG8J QrHxHUMBU4iXfM3MhV7JJugIVadP5uUL9nlmoJsH8BssDSgMGdBAJWvEjK7LFKqNhsDF G4PtV/+hVCuCqJuTSuho855at6wXk6syBaPxaNdDpZT8u7L9jJz/RgCVPPbm4BolINGa QwH0FTagHubV6PIJu9cHZOJoVEGRYyhwSuaqns++J9tz3OHUvguM2J8rZjCJesI+c16T yZyE7ZQTCGh2o5fA5QYkb42lk8SS3U2yhhBtH1OD9GHRUPGJiMls5zKGGYNixfzNy1rf Pe2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OLq1U/Kv3dL1gR9OB0l1J1elUkebryVY8RibtZhumcI=; b=JKyaLrwrBJ+RSElcfCySji9McO7sodK0awaGH7/Q1zXc2FZqv+VsfRgmO/bN8cw7T/ rmAGY5ebI2vs8KxrD+98sms6D1JvHH6xxwVzJ/U0JuzaOx1h4yuy5Qhwh14WbZThKwFI gkATCUEf4rLls1ta/TLMX7deydLLqxgOWQKkU/dNUmfPTBgNATQVoRXTTHDv53smffqK pDdiEwKcf5Oojc4k7PbZBSUBZyenoiCXYrEl3thy2Bw6xlFBF86Akad1xA2thuZNLpvs IALLlF+06Hw4SMDnfg68LF+aNhuT7sf9yxMRX41QY0h2r7dZe2MgxOXsfTBmEfl4u4Cc F8Hw== X-Gm-Message-State: APjAAAU7Lu8XEGR+h4yBVGOVmnkMRkhVei+QrO3cf2TeguFoFy5vkoqp 3KdZvycCfTFPi11WNy94ss70mQ== X-Google-Smtp-Source: APXvYqz3UzI08vq6+TKkQsAUBYy0MbSfQPvnKrPH7Rmpo63+nAg3iwu9dzvMVWdT7rwbKyhKI5xdLw== X-Received: by 2002:a7b:cc86:: with SMTP id p6mr3141770wma.123.1565081056852; Tue, 06 Aug 2019 01:44:16 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id n14sm167311104wra.75.2019.08.06.01.44.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 01:44:16 -0700 (PDT) Date: Tue, 6 Aug 2019 09:44:14 +0100 From: Leif Lindholm To: Heinrich Schuchardt Cc: Patrick Wildt , Alexander Graf , u-boot@lists.denx.de, Simon Glass , AKASHI Takahiro , GRUB development mailing list , pjones@redhat.com Subject: Re: EFI_PXE_BASE_CODE_PROTOCOL Message-ID: <20190806084414.GD25813@bivouac.eciton.net> References: <20190131142525.GA37117@nyx.local> <22d7dfc2-6013-00e4-b477-0c7d4151dceb@suse.de> <20190131145423.GA37343@nyx.local> <12c99515-030e-3cd6-1eca-cb839d47b00b@gmx.de> <20190410092035.GA96616@thor.local> <20190410092453.GA96737@thor.local> <20190802192639.GA4631@nyx.fritz.box> <3b958976-1801-c3cc-196d-606293a06938@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3b958976-1801-c3cc-196d-606293a06938@gmx.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 08:44:22 -0000 +Peter Jones (sorry Peter) On Tue, Aug 06, 2019 at 08:34:58AM +0200, Heinrich Schuchardt wrote: > iPXE uses the EFI simple network protocol to execute DHCP. OK. > Can GRUB already do the same when the EFI_PXE_BASE_CODE_PROTOCOL is not > present? Yes. As of very recently (proper* DHCP support was only merged in March 2019, so is included in 2.04 release, prior to that it technically performed BOOTP). SNP means you do your own networking - it gives you access to the raw (usually) Ethernet packets. * proper as in "it now conceptually does the correct thing", not as in "I have extensively tested this". > What I do not understand about GRUB's grub_net_configure_by_dhcp_ack() > is that it silently assumes IPv4 being used without even checking. This > contradicts the definition of the PXE base code protocol in the UEFI > standard: Well, it would not surprise me if this function predates GRUB's UEFI support. It actually gets even slightly messier when you look at what GRUB does when netbooting itself; it starts out using MNP (and hence IP addresses assigned by UEFI) to load its modules, switching to SNP once it loads efinet.mod. > EFI_PXE_BASE_CODE_PACKET DhcpAck is a union: > > typedef union { > UINT8 Raw[1472]; > EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4; > EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; > } EFI_PXE_BASE_CODE_PACKET; > > Should the check be done in grub_efi_net_config_real()? Possibly. I've cc:d Peter since he's the last person I know who took a proper look at this. Certainly, it would be useful if you could raise a bug on Savannah on the ipv4 assumption. Best Regards, Leif From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leif Lindholm Date: Tue, 6 Aug 2019 09:44:14 +0100 Subject: [U-Boot] EFI_PXE_BASE_CODE_PROTOCOL In-Reply-To: <3b958976-1801-c3cc-196d-606293a06938@gmx.de> References: <20190131142525.GA37117@nyx.local> <22d7dfc2-6013-00e4-b477-0c7d4151dceb@suse.de> <20190131145423.GA37343@nyx.local> <12c99515-030e-3cd6-1eca-cb839d47b00b@gmx.de> <20190410092035.GA96616@thor.local> <20190410092453.GA96737@thor.local> <20190802192639.GA4631@nyx.fritz.box> <3b958976-1801-c3cc-196d-606293a06938@gmx.de> Message-ID: <20190806084414.GD25813@bivouac.eciton.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de +Peter Jones (sorry Peter) On Tue, Aug 06, 2019 at 08:34:58AM +0200, Heinrich Schuchardt wrote: > iPXE uses the EFI simple network protocol to execute DHCP. OK. > Can GRUB already do the same when the EFI_PXE_BASE_CODE_PROTOCOL is not > present? Yes. As of very recently (proper* DHCP support was only merged in March 2019, so is included in 2.04 release, prior to that it technically performed BOOTP). SNP means you do your own networking - it gives you access to the raw (usually) Ethernet packets. * proper as in "it now conceptually does the correct thing", not as in "I have extensively tested this". > What I do not understand about GRUB's grub_net_configure_by_dhcp_ack() > is that it silently assumes IPv4 being used without even checking. This > contradicts the definition of the PXE base code protocol in the UEFI > standard: Well, it would not surprise me if this function predates GRUB's UEFI support. It actually gets even slightly messier when you look at what GRUB does when netbooting itself; it starts out using MNP (and hence IP addresses assigned by UEFI) to load its modules, switching to SNP once it loads efinet.mod. > EFI_PXE_BASE_CODE_PACKET DhcpAck is a union: > > typedef union { > UINT8 Raw[1472]; > EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4; > EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; > } EFI_PXE_BASE_CODE_PACKET; > > Should the check be done in grub_efi_net_config_real()? Possibly. I've cc:d Peter since he's the last person I know who took a proper look at this. Certainly, it would be useful if you could raise a bug on Savannah on the ipv4 assumption. Best Regards, Leif