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