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

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