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

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