|
|
c294fc |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
c294fc |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
c294fc |
Date: Tue, 10 Mar 2020 11:23:49 +0100
|
|
|
c294fc |
Subject: [PATCH] efi/net: Print a debug message if parsing the address fails
|
|
|
c294fc |
|
|
|
c294fc |
Currently if parsing the address fails an error message is printed. But in
|
|
|
c294fc |
most cases this isn't a fatal error since the grub_efi_net_parse_address()
|
|
|
c294fc |
function is only used to match an address with a network interface to use.
|
|
|
c294fc |
|
|
|
c294fc |
And if this fails, the default interface is used which is good enough for
|
|
|
c294fc |
most cases. So instead of printing an error that would pollute the console
|
|
|
c294fc |
just print a debug message if the address is not parsed correctly.
|
|
|
c294fc |
|
|
|
c294fc |
A user can enable debug messages for the efinet driver to have information
|
|
|
c294fc |
about the failure and the fact that the default interface is being used.
|
|
|
c294fc |
|
|
|
c294fc |
Related: rhbz#1811560
|
|
|
c294fc |
|
|
|
c294fc |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
c294fc |
---
|
|
|
c294fc |
grub-core/net/efi/net.c | 18 +++++++++++-------
|
|
|
c294fc |
1 file changed, 11 insertions(+), 7 deletions(-)
|
|
|
c294fc |
|
|
|
c294fc |
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
|
|
|
c294fc |
index c74854a82b7..3ae1fbbe3c8 100644
|
|
|
c294fc |
--- a/grub-core/net/efi/net.c
|
|
|
c294fc |
+++ b/grub-core/net/efi/net.c
|
|
|
c294fc |
@@ -778,9 +778,9 @@ grub_efi_net_parse_address (const char *address,
|
|
|
c294fc |
}
|
|
|
c294fc |
}
|
|
|
c294fc |
|
|
|
c294fc |
- return grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
|
|
c294fc |
- N_("unrecognised network address `%s'"),
|
|
|
c294fc |
- address);
|
|
|
c294fc |
+ grub_dprintf ("efinet", "unrecognised network address '%s'\n", address);
|
|
|
c294fc |
+
|
|
|
c294fc |
+ return GRUB_ERR_NET_BAD_ADDRESS;
|
|
|
c294fc |
}
|
|
|
c294fc |
|
|
|
c294fc |
static grub_efi_net_interface_t *
|
|
|
c294fc |
@@ -795,10 +795,7 @@ match_route (const char *server)
|
|
|
c294fc |
err = grub_efi_net_parse_address (server, &ip4, &ip6, &is_ip6, 0);
|
|
|
c294fc |
|
|
|
c294fc |
if (err)
|
|
|
c294fc |
- {
|
|
|
c294fc |
- grub_print_error ();
|
|
|
c294fc |
return NULL;
|
|
|
c294fc |
- }
|
|
|
c294fc |
|
|
|
c294fc |
if (is_ip6)
|
|
|
c294fc |
{
|
|
|
c294fc |
@@ -1233,8 +1230,15 @@ grub_net_open_real (const char *name __attribute__ ((unused)))
|
|
|
c294fc |
/*FIXME: Use DNS translate name to address */
|
|
|
c294fc |
net_interface = match_route (server);
|
|
|
c294fc |
|
|
|
c294fc |
+ if (!net_interface && net_default_interface)
|
|
|
c294fc |
+ {
|
|
|
c294fc |
+ net_interface = net_default_interface;
|
|
|
c294fc |
+ grub_dprintf ("efinet", "interface lookup failed, using default '%s'\n",
|
|
|
c294fc |
+ net_interface->name);
|
|
|
c294fc |
+ }
|
|
|
c294fc |
+
|
|
|
c294fc |
/*XXX: should we check device with default gateway ? */
|
|
|
c294fc |
- if (!net_interface && !(net_interface = net_default_interface))
|
|
|
c294fc |
+ if (!net_interface)
|
|
|
c294fc |
{
|
|
|
c294fc |
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' no route found"),
|
|
|
c294fc |
name);
|