nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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