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