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

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