diff options
| author | Gary Lin <glin@suse.com> | 2018-05-28 17:42:56 +0800 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2020-07-23 20:51:18 -0400 |
| commit | 80e52895f206fcb40a60f031e7b721627bb193ca (patch) | |
| tree | eb90d78120f95532c3333ddf5c999a5f6f2df5ae | |
| parent | 0ba6c87bdf55f749a0ec1c3b0fd24ebb8200d537 (diff) | |
| download | efi-boot-shim-80e52895f206fcb40a60f031e7b721627bb193ca.tar.gz efi-boot-shim-80e52895f206fcb40a60f031e7b721627bb193ca.zip | |
httpboot: allow the IPv4 gateway to be empty
The gateway is not mandatory.
Signed-off-by: Gary Lin <glin@suse.com>
Upstream-commit-id: 69089e9c678
| -rw-r--r-- | httpboot.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -299,7 +299,7 @@ out: } static BOOLEAN -is_unspecified_addr (EFI_IPv6_ADDRESS ip6) +is_unspecified_ip6addr (EFI_IPv6_ADDRESS ip6) { UINT8 i; @@ -351,7 +351,7 @@ set_ip6(EFI_HANDLE *nic, IPv6_DEVICE_PATH *ip6node) } gateway = ip6node->GatewayIpAddress; - if (is_unspecified_addr(gateway)) + if (is_unspecified_ip6addr(gateway)) return EFI_SUCCESS; efi_status = ip6cfg->SetData(ip6cfg, Ip6ConfigDataTypeGateway, @@ -365,6 +365,19 @@ set_ip6(EFI_HANDLE *nic, IPv6_DEVICE_PATH *ip6node) return EFI_SUCCESS; } +static BOOLEAN +is_unspecified_ip4addr (EFI_IPv4_ADDRESS ip4) +{ + UINT8 i; + + for (i = 0; i<4; i++) { + if (ip4.Addr[i] != 0) + return FALSE; + } + + return TRUE; +} + static inline void print_ip4_addr(EFI_IPv4_ADDRESS ip4addr) { @@ -399,6 +412,9 @@ set_ip4(EFI_HANDLE *nic, IPv4_DEVICE_PATH *ip4node) } gateway = ip4node->GatewayIpAddress; + if (is_unspecified_ip4addr(gateway)) + return EFI_SUCCESS; + efi_status = ip4cfg2->SetData(ip4cfg2, Ip4Config2DataTypeGateway, sizeof(gateway), &gateway); if (EFI_ERROR(efi_status)) { |
