Skip to content

Commit

Permalink
Revert "Implement --uri option for use with --ifname"
Browse files Browse the repository at this point in the history
This reverts commit 5ce076c.

This commit uses functionality which is not present in efivar-39.
See #204.
  • Loading branch information
pvxe committed Feb 27, 2024
1 parent 9dc1f01 commit e22a7d7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 34 deletions.
2 changes: 1 addition & 1 deletion efibootmgr.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 22 additions & 25 deletions src/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
12 changes: 5 additions & 7 deletions src/efibootmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ 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-j | --json Enable JSON output\n");
printf("\t --uri Uri Specify an Uri (for use with --iface option).\n");
Expand Down Expand Up @@ -1475,7 +1475,6 @@ parse_opts(int argc, char **argv)
{"iface", required_argument, 0, 'i'},
{"index", required_argument, 0, 'I'},
{"json", no_argument, 0, 'j'},
{"uri", required_argument, 0, 0},
{"keep", no_argument, 0, 'k'},
{"loader", required_argument, 0, 'l'},
{"label", required_argument, 0, 'L'},
Expand Down Expand Up @@ -1762,8 +1761,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);
Expand Down Expand Up @@ -1806,9 +1803,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.");

Expand Down Expand Up @@ -1923,6 +1917,10 @@ main(int argc, char **argv)
}

if (opts.delete_bootnext) {
if (!is_current_entry(opts.delete_bootnext))
errorx(17, "Boot entry %04X does not exist",
opts.delete_bootnext);

ret = efi_del_variable(EFI_GLOBAL_GUID, "BootNext");
if (ret < 0)
error(10, "Could not delete BootNext");
Expand Down
1 change: 0 additions & 1 deletion src/include/efibootmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ typedef struct {
uint16_t ip_remote_port;
uint16_t ip_protocol;
uint8_t ip_addr_origin;
char *uri;

char *loader;
unsigned char *label;
Expand Down

0 comments on commit e22a7d7

Please sign in to comment.