]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Avoid dragging in IPv4, IPv6, and DNS support unconditionally
authorMichael Brown <mcb30@ipxe.org>
Wed, 28 Jan 2026 12:25:26 +0000 (12:25 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 28 Jan 2026 12:34:57 +0000 (12:34 +0000)
The efi_path_settings[] array includes symbol references to
&ip_setting, &ip6_setting, &dns_setting (and others) that currently
result in IPv4, IPv6, and DNS support being linked in even if disabled
in the build configuration.

Provide weak versions of these symbols to avoid the unconditional
inclusion of these features.

Reported-by: Pavitter Ghotra <pavitterghotra@yahoo.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_path.c

index 37558c36ed3aebece418c0f1a44429cd5fea41b1..38f6f218433ae231cd893518ea3b6805433e3569 100644 (file)
@@ -994,6 +994,16 @@ static int efi_path_fetch_dns ( struct efi_path_setting *pathset,
        return ( count * pathset->len );
 }
 
+/* Avoid dragging in IPv4, IPv6, and DNS support if not otherwise used */
+extern const struct setting ip_setting __attribute__ (( weak ));
+extern const struct setting netmask_setting __attribute__ (( weak ));
+extern const struct setting gateway_setting __attribute__ (( weak ));
+extern const struct setting ip6_setting __attribute__ (( weak ));
+extern const struct setting len6_setting __attribute__ (( weak ));
+extern const struct setting gateway6_setting __attribute__ (( weak ));
+extern const struct setting dns_setting __attribute__ (( weak ));
+extern const struct setting dns6_setting __attribute__ (( weak ));
+
 /** EFI device path settings */
 static struct efi_path_setting efi_path_settings[] = {
        { &ip_setting, efi_path_fetch_fixed, MESSAGING_DEVICE_PATH,
@@ -1047,6 +1057,8 @@ static int efi_path_fetch ( struct settings *settings, struct setting *setting,
 
                /* Check for a matching setting */
                pathset = &efi_path_settings[i];
+               if ( ! pathset->setting )
+                       continue;
                if ( setting_cmp ( setting, pathset->setting ) != 0 )
                        continue;