Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iuDm9-000759-4W for mharc-grub-devel@gnu.org; Wed, 22 Jan 2020 06:02:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuDm6-00074D-IA for grub-devel@gnu.org; Wed, 22 Jan 2020 06:02:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuDm4-0001EO-0Y for grub-devel@gnu.org; Wed, 22 Jan 2020 06:02:17 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39574 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuDm3-0001EC-So for grub-devel@gnu.org; Wed, 22 Jan 2020 06:02:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579690935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q4u8D43qHP9sehKOLfXxyuVl/jI6xzYIqHyqHQu7cFQ=; b=PHuR+SAZxa6sH6f0Iko5NRIIxB8Lj12A0mvNdrGn0YP87PstY2qOjGcQILxQr1eNkrcwqJ HO4wHgijtWQGjxcpNmQyMsRXmtYQ34R1KQMfHcly9YTB2YlimZERO4xCXjSm23TxKVjNz7 uTV1dAX1IiiRtsGjoUuMNc2WoVpxs/I= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-aHIBB33BMQebeRJ0pdsutA-1; Wed, 22 Jan 2020 06:02:13 -0500 Received: by mail-wr1-f70.google.com with SMTP id y7so2870287wrm.3 for ; Wed, 22 Jan 2020 03:02:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KmEpQpwaGmhtF0Vfqah1OMEDxDSlRYG87aoZv1n8gds=; b=GtZ4Lh0OJEJTTSxz+pLtHLViNX4sZUaCdzADr0lCSVdtZoW9v2NKtY+dvWfzCbHhxL TnlbCtp5WR6Y2gCvwrXAjm2rgWJga/Kf98Gijta6miV9QsgJ4VAsXmMACCNRkQ6NEI6f bUlXApur0mu7mzJrCk4crdJXek+x9b1U/WSs9jRegq3c6inEaLuvwNIdM68iH9Jczvqs bNsi272CFiFfx3HCMDHWS5a+zW81x9sXbJ2eBFKNsHNVn+wkOhjLTEtlDuwFatKsVfd6 v9MzP/6VkbGE6uEploFr5SygUqTixLhkuwqSBK2VNGmaxOznJOVWHCUDQr9LV9PxUhgG byqw== X-Gm-Message-State: APjAAAWK5iNrD28r5MIhdGbha3Kt9i2YMhQPe76m63AG2brKVMxEucvl 4V0/kCYuwkvaye8cpzySJZH9PC2vTKph+hm4b6+BYcntgyW9KCGibGiNKWjHVxtvCqVty1Ac8X8 KIIQCXS1GAIM= X-Received: by 2002:a5d:6703:: with SMTP id o3mr10107739wru.235.1579690931539; Wed, 22 Jan 2020 03:02:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwpuJzOsIaLldA7T/J7qHS+yVIgJbu2xYahu9+BS2xeFisEwDYV1H+JYjXo82CI83K8xNmpLA== X-Received: by 2002:a5d:6703:: with SMTP id o3mr10107701wru.235.1579690931213; Wed, 22 Jan 2020 03:02:11 -0800 (PST) Received: from minerva.redhat.com ([2a01:c50f:ab80:6700:527f:85b3:5615:ff0b]) by smtp.gmail.com with ESMTPSA id c2sm56546692wrp.46.2020.01.22.03.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 03:02:10 -0800 (PST) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Daniel Kiper , Paulo Flabiano Smorigo , Vladimir Serbinenko , Javier Martinez Canillas Subject: [PATCH v6 0/5] Search for specific config files using UUID, MAC and IP Date: Wed, 22 Jan 2020 12:01:51 +0100 Message-Id: <20200122110157.1062269-1-javierm@redhat.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-MC-Unique: aHIBB33BMQebeRJ0pdsutA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Wed, 22 Jan 2020 11:02:19 -0000 Hello, This is a v6 of a series that have been carried in Fedora (and other distro= s) for a long time. It allows to fetch GRUB configurations that are customized to each machine by using the client UUID, MAC and IP as grub.cfg suffixes. The procedure is similar to what is used by pxelinux and yaboot, i.e: http://www.syslinux.org/wiki/index.php/PXELINUX#config Patch #1 adds a %X format specifier to make the grub_printf() function more similar to printf() and not require to use %x plus grub_toupper(). Patch #2 is just a cleanup of the bootp/dhcp options enum to consistently u= se hexadecimal numbers for all the values. Patch #3 sets net__client{id,uuid} environment variables by usin= g the DHCP client ID and UUID options if these are found. Patch #4 adds the support to fetch the config files using the UUID, MAC and= IP as suffixes. If these aren't found, the default GRUB config filename is use= d as a fallback. Patch #5 adds documentation that specifies the order netboot clients use to select a GRUB configuration file and explains how the feature can be disabl= ed. Best regards, Javier Changes in v6: - Allow the feature to be disabled by setting feature_net_search_cfg=3Dn. - Remove Reviewed-by tag from Daniel Kiper since the patch #4 changed. - Explain in the GRUB manual that the feature is enabled by default and how can be disabled by setting a variable in an embedded configuration file. Changes in v5: - Add Reviewed-by from Daniel Kiper to patch #2. - Don't mix variable declaration and code. - Don't initialize variable without need. - Check for memory allocation failure. - Add missing grub_free(). - Don't mix varible declarations and code. - Don't use variable length arrays. - Fix coding style issues. - Fix function prototype. - Include missing header. - Add Reviewed-by tag from Daniel Kiper to patch #5. Changes in v4: - Use decimal instead of hexadecimal numbers to be consistent with RFC 2132= . - Mention that the UUID is unique to the machine and not the NIC and also refer to the RFC 4578 where the client UUID DHCP option is specified. Changes in v3: - Add patch to cleanup bootp/dhcp options enum. - Use decimal numbers for the newly added DHCP client ID and UUID options. - Add Reviewed-by tag from Daniel Kiper. - Add a patch documenting the grub.cfg netboot selection order. Changes in v2: - Put patch that adds the %X format specifier first in the series. - Use the existing grub_env_set_net_property() and remove duplicated code. Javier Martinez Canillas (1): net/dhcp: Consistently use decimal numbers for DHCP/BOOTP options enum Paulo Flabiano Smorigo (3): Add %X option to printf functions net/dhcp: Set net__client{id,uuid} variables from DHCP options normal/main: Search for specific config files for netboot Robert Marshall (1): docs: Update info with grub.cfg netboot selection order docs/grub.texi | 51 ++++++++++++++++ grub-core/kern/misc.c | 7 ++- grub-core/net/bootp.c | 52 +++++++++++++--- grub-core/net/net.c | 131 ++++++++++++++++++++++++++++++++++++++++ grub-core/normal/main.c | 26 ++++++-- include/grub/net.h | 22 ++++--- 6 files changed, 266 insertions(+), 23 deletions(-) --=20 2.24.1