nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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