Blame SOURCES/0006-httpboot-allow-the-IPv4-gateway-to-be-empty.patch

00e791
From 80e52895f206fcb40a60f031e7b721627bb193ca Mon Sep 17 00:00:00 2001
00e791
From: Gary Lin <glin@suse.com>
00e791
Date: Mon, 28 May 2018 17:42:56 +0800
00e791
Subject: [PATCH 06/62] httpboot: allow the IPv4 gateway to be empty
00e791
00e791
The gateway is not mandatory.
00e791
00e791
Signed-off-by: Gary Lin <glin@suse.com>
00e791
Upstream-commit-id: 69089e9c678
00e791
---
00e791
 httpboot.c | 20 ++++++++++++++++++--
00e791
 1 file changed, 18 insertions(+), 2 deletions(-)
00e791
00e791
diff --git a/httpboot.c b/httpboot.c
00e791
index 6f27b01bf71..16dd6621f66 100644
00e791
--- a/httpboot.c
00e791
+++ b/httpboot.c
00e791
@@ -299,7 +299,7 @@ out:
00e791
 }
00e791
 
00e791
 static BOOLEAN
00e791
-is_unspecified_addr (EFI_IPv6_ADDRESS ip6)
00e791
+is_unspecified_ip6addr (EFI_IPv6_ADDRESS ip6)
00e791
 {
00e791
 	UINT8 i;
00e791
 
00e791
@@ -351,7 +351,7 @@ set_ip6(EFI_HANDLE *nic, IPv6_DEVICE_PATH *ip6node)
00e791
 	}
00e791
 
00e791
 	gateway = ip6node->GatewayIpAddress;
00e791
-	if (is_unspecified_addr(gateway))
00e791
+	if (is_unspecified_ip6addr(gateway))
00e791
 		return EFI_SUCCESS;
00e791
 
00e791
 	efi_status = ip6cfg->SetData(ip6cfg, Ip6ConfigDataTypeGateway,
00e791
@@ -365,6 +365,19 @@ set_ip6(EFI_HANDLE *nic, IPv6_DEVICE_PATH *ip6node)
00e791
 	return EFI_SUCCESS;
00e791
 }
00e791
 
00e791
+static BOOLEAN
00e791
+is_unspecified_ip4addr (EFI_IPv4_ADDRESS ip4)
00e791
+{
00e791
+	UINT8 i;
00e791
+
00e791
+	for (i = 0; i<4; i++) {
00e791
+		if (ip4.Addr[i] != 0)
00e791
+			return FALSE;
00e791
+	}
00e791
+
00e791
+	return TRUE;
00e791
+}
00e791
+
00e791
 static inline void
00e791
 print_ip4_addr(EFI_IPv4_ADDRESS ip4addr)
00e791
 {
00e791
@@ -399,6 +412,9 @@ set_ip4(EFI_HANDLE *nic, IPv4_DEVICE_PATH *ip4node)
00e791
 	}
00e791
 
00e791
 	gateway = ip4node->GatewayIpAddress;
00e791
+	if (is_unspecified_ip4addr(gateway))
00e791
+		return EFI_SUCCESS;
00e791
+
00e791
 	efi_status = ip4cfg2->SetData(ip4cfg2, Ip4Config2DataTypeGateway,
00e791
 				      sizeof(gateway), &gateway);
00e791
 	if (EFI_ERROR(efi_status)) {
00e791
-- 
00e791
2.26.2
00e791