Blame SOURCES/0293-efi-net-Allow-to-specify-a-port-number-in-addresses.patch

c4e390
From e38e81e73ca86b80d0a90be44d0bd257ad0148ff Mon Sep 17 00:00:00 2001
c4e390
From: Javier Martinez Canillas <javierm@redhat.com>
c4e390
Date: Mon, 9 Mar 2020 15:29:45 +0100
c4e390
Subject: [PATCH 293/335] efi/net: Allow to specify a port number in addresses
c4e390
c4e390
The grub_efi_net_parse_address() function is not covering the case where a
c4e390
port number is specified in an IPv4 or IPv6 address, so will fail to parse
c4e390
the network address.
c4e390
c4e390
For most cases the issue is harmless, because the function is only used to
c4e390
match an address with a network interface and if fails the default is used.
c4e390
c4e390
But still is a bug that has to be fixed and it causes error messages to be
c4e390
printed like the following:
c4e390
c4e390
error: net/efi/net.c:782:unrecognised network address '192.168.122.1:8080'
c4e390
c4e390
error: net/efi/net.c:781:unrecognised network address '[2000:dead:beef:a::1]:8080'
c4e390
c4e390
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
c4e390
---
c4e390
 grub-core/net/efi/net.c | 4 ++--
c4e390
 1 file changed, 2 insertions(+), 2 deletions(-)
c4e390
c4e390
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
c4e390
index f208d1b180c..8981abcb83d 100644
c4e390
--- a/grub-core/net/efi/net.c
c4e390
+++ b/grub-core/net/efi/net.c
c4e390
@@ -742,7 +742,7 @@ grub_efi_net_parse_address (const char *address,
c4e390
 	      return GRUB_ERR_NONE;
c4e390
 	    }
c4e390
 	}
c4e390
-      else if (*rest == 0)
c4e390
+      else if (*rest == 0 || *rest == ':')
c4e390
 	{
c4e390
 	  grub_uint32_t subnet_mask = 0xffffffffU;
c4e390
 	  grub_memcpy (ip4->subnet_mask, &subnet_mask, sizeof (ip4->subnet_mask));
c4e390
@@ -768,7 +768,7 @@ grub_efi_net_parse_address (const char *address,
c4e390
 	      return GRUB_ERR_NONE;
c4e390
 	    }
c4e390
 	}
c4e390
-      else if (*rest == 0)
c4e390
+      else if (*rest == 0 || *rest == ':')
c4e390
 	{
c4e390
 	  ip6->prefix_length = 128;
c4e390
 	  ip6->is_anycast = 0;
c4e390
-- 
c4e390
2.26.2
c4e390