dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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