From ef1e3502c9431a789a6b2c4a3e9290b6a4611e6f Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Fri, 2 Feb 2024 11:50:56 +0000
Subject: [PATCH] Revert "Implement --uri option for use with --ifname"

This reverts commit 5ce076c88670eeb63dea80fcaec60e79f0e57ac6.
---
 efibootmgr.spec.in       |  2 +-
 src/efi.c                | 47 +++++++++++++++++++---------------------
 src/efibootmgr.c         |  9 +-------
 src/include/efibootmgr.h |  1 -
 4 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/efibootmgr.spec.in b/efibootmgr.spec.in
index ec90e2a..f20e405 100644
--- a/efibootmgr.spec.in
+++ b/efibootmgr.spec.in
@@ -6,7 +6,7 @@ Group: System Environment/Base
 License: GPLv2+
 URL: https://github.com/rhboot/%{name}/
 BuildRequires: git, popt-devel
-BuildRequires: efivar-libs >= 39-1, efivar-devel >= 39-1
+BuildRequires: efivar-libs >= 30-1, efivar-devel >= 30-1
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXXXX)
 # EFI/UEFI don't exist on PPC
 ExclusiveArch: %{ix86} x86_64 aarch64 arm
diff --git a/src/efi.c b/src/efi.c
index 26a3211..4302b5c 100644
--- a/src/efi.c
+++ b/src/efi.c
@@ -174,40 +174,37 @@ make_linux_load_option(uint8_t **data, size_t *data_size,
 	efidp dp = NULL;
 
 	if (opts.iface && opts.ip_version == EFIBOOTMGR_IPV4) {
-		needed = efi_generate_ipv4_device_path_with_uri(
-					NULL, 0, opts.iface,
-					opts.local_ip_addr,
-					opts.remote_ip_addr,
-					opts.gateway_ip_addr,
-					opts.ip_netmask,
-					opts.ip_local_port,
-					opts.ip_remote_port,
-					opts.ip_protocol,
-					opts.ip_addr_origin,
-					opts.uri);
+		needed = efi_generate_ipv4_device_path(NULL, 0, opts.iface,
+						       opts.local_ip_addr,
+						       opts.remote_ip_addr,
+						       opts.gateway_ip_addr,
+						       opts.ip_netmask,
+						       opts.ip_local_port,
+						       opts.ip_remote_port,
+						       opts.ip_protocol,
+						       opts.ip_addr_origin);
 		if (needed < 0) {
-			efi_error("efi_generate_ipv4_device_path_with_uri() = %zd (failed)",
+			efi_error("efi_generate_ipv4_device_path() = %zd (failed)",
 					needed);
 			return -1;
 		}
 		if (data_size && *data_size) {
 			dp = malloc(needed);
 
-			needed = efi_generate_ipv4_device_path_with_uri(
-					(uint8_t *)dp, needed,
-					opts.iface,
-					opts.local_ip_addr,
-					opts.remote_ip_addr,
-					opts.gateway_ip_addr,
-					opts.ip_netmask,
-					opts.ip_local_port,
-					opts.ip_remote_port,
-					opts.ip_protocol,
-					opts.ip_addr_origin,
-					opts.uri);
+			needed = efi_generate_ipv4_device_path(
+							(uint8_t *)dp, needed,
+							opts.iface,
+							opts.local_ip_addr,
+							opts.remote_ip_addr,
+							opts.gateway_ip_addr,
+							opts.ip_netmask,
+							opts.ip_local_port,
+							opts.ip_remote_port,
+							opts.ip_protocol,
+							opts.ip_addr_origin);
 			if (needed < 0) {
 				free(dp);
-				efi_error("efi_generate_ipv4_device_path_with_uri() = %zd (failed)",
+				efi_error("efi_generate_ipv4_device_path() = %zd (failed)",
 						needed);
 				return -1;
 			}
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index 6f51d33..3ba4d1b 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1410,9 +1410,8 @@ usage()
 	printf("\t-f | --reconnect      Re-connect devices after driver is loaded.\n");
 	printf("\t-F | --no-reconnect   Do not re-connect devices after driver is loaded.\n");
 	printf("\t-g | --gpt            Force disk with invalid PMBR to be treated as GPT.\n");
-	printf("\t-i | --iface name     Create a netboot entry for the named interface (IPv4+DHCP support only).\n");
+	printf("\t-i | --iface name     Create a netboot entry for the named interface.\n");
 	printf("\t-I | --index number   When creating an entry, insert it in bootorder at specified position (default: 0).\n");
-	printf("\t     --uri Uri        Specify an Uri (for use with --iface option).\n");
 	printf("\t-l | --loader name     (Defaults to \""DEFAULT_LOADER"\").\n");
 	printf("\t-L | --label label     Boot manager display label (defaults to \"Linux\").\n");
 	printf("\t-m | --mirror-below-4G t|f Mirror memory below 4GB.\n");
@@ -1483,7 +1482,6 @@ parse_opts(int argc, char **argv)
 			{"gpt",                    no_argument, 0, 'g'},
 			{"iface",            required_argument, 0, 'i'},
 			{"index",            required_argument, 0, 'I'},
-			{"uri",	             required_argument, 0, 0},
 			{"keep",                   no_argument, 0, 'k'},
 			{"loader",           required_argument, 0, 'l'},
 			{"label",            required_argument, 0, 'L'},
@@ -1767,8 +1765,6 @@ parse_opts(int argc, char **argv)
 				    opts.abbreviate_path != EFIBOOTMGR_PATH_ABBREV_FILE)
 					errx(41, "contradicting --full-dev-path/--file-dev-path/-e options");
 				opts.abbreviate_path = EFIBOOTMGR_PATH_ABBREV_FILE;
-			} else if (!strcmp(long_options[option_index].name, "uri")) {
-				opts.uri = optarg;
 			} else {
 				usage();
 				exit(1);
@@ -1811,9 +1807,6 @@ main(int argc, char **argv)
 
 	verbose = opts.verbose;
 
-	if (opts.uri && !opts.iface)
-		errx(25, "--uri is supported only with --iface option.");
-
 	if (opts.sysprep && opts.driver)
 		errx(25, "--sysprep and --driver may not be used together.");
 
diff --git a/src/include/efibootmgr.h b/src/include/efibootmgr.h
index 05e9216..dc2a48b 100644
--- a/src/include/efibootmgr.h
+++ b/src/include/efibootmgr.h
@@ -59,7 +59,6 @@ typedef struct {
 	uint16_t ip_remote_port;
 	uint16_t ip_protocol;
 	uint8_t ip_addr_origin;
-	char *uri;
 
 	char *loader;
 	unsigned char *label;
-- 
2.43.0

