Skip to content

Commit b7e7f62

Browse files
committed
[efi] Avoid dragging in IPv4, IPv6, and DNS support unconditionally
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>
1 parent e31dc79 commit b7e7f62

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/interface/efi/efi_path.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,16 @@ static int efi_path_fetch_dns ( struct efi_path_setting *pathset,
994994
return ( count * pathset->len );
995995
}
996996

997+
/* Avoid dragging in IPv4, IPv6, and DNS support if not otherwise used */
998+
extern const struct setting ip_setting __attribute__ (( weak ));
999+
extern const struct setting netmask_setting __attribute__ (( weak ));
1000+
extern const struct setting gateway_setting __attribute__ (( weak ));
1001+
extern const struct setting ip6_setting __attribute__ (( weak ));
1002+
extern const struct setting len6_setting __attribute__ (( weak ));
1003+
extern const struct setting gateway6_setting __attribute__ (( weak ));
1004+
extern const struct setting dns_setting __attribute__ (( weak ));
1005+
extern const struct setting dns6_setting __attribute__ (( weak ));
1006+
9971007
/** EFI device path settings */
9981008
static struct efi_path_setting efi_path_settings[] = {
9991009
{ &ip_setting, efi_path_fetch_fixed, MESSAGING_DEVICE_PATH,
@@ -1047,6 +1057,8 @@ static int efi_path_fetch ( struct settings *settings, struct setting *setting,
10471057

10481058
/* Check for a matching setting */
10491059
pathset = &efi_path_settings[i];
1060+
if ( ! pathset->setting )
1061+
continue;
10501062
if ( setting_cmp ( setting, pathset->setting ) != 0 )
10511063
continue;
10521064

0 commit comments

Comments
 (0)