1 Star 0 Fork 83

dingwei / grub2

forked from src-openEuler / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0198-efi-net-Print-a-debug-message-if-parsing-the-address.patch 2.36 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From 51b1f81e7744031f7b3ad96a8264e493be5b069c Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 10 Mar 2020 11:23:49 +0100
Subject: [PATCH 198/220] efi/net: Print a debug message if parsing the address
fails
Currently if parsing the address fails an error message is printed. But in
most cases this isn't a fatal error since the grub_efi_net_parse_address()
function is only used to match an address with a network interface to use.
And if this fails, the default interface is used which is good enough for
most cases. So instead of printing an error that would pollute the console
just print a debug message if the address is not parsed correctly.
A user can enable debug messages for the efinet driver to have information
about the failure and the fact that the default interface is being used.
Related: rhbz#1732765
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/net/efi/net.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
index 8457393..a3f0535 100644
--- a/grub-core/net/efi/net.c
+++ b/grub-core/net/efi/net.c
@@ -778,9 +778,9 @@ grub_efi_net_parse_address (const char *address,
}
}
- return grub_error (GRUB_ERR_NET_BAD_ADDRESS,
- N_("unrecognised network address `%s'"),
- address);
+ grub_dprintf ("efinet", "unrecognised network address '%s'\n", address);
+
+ return GRUB_ERR_NET_BAD_ADDRESS;
}
static grub_efi_net_interface_t *
@@ -795,10 +795,7 @@ match_route (const char *server)
err = grub_efi_net_parse_address (server, &ip4, &ip6, &is_ip6, 0);
if (err)
- {
- grub_print_error ();
return NULL;
- }
if (is_ip6)
{
@@ -1233,8 +1230,15 @@ grub_net_open_real (const char *name __attribute__ ((unused)))
/*FIXME: Use DNS translate name to address */
net_interface = match_route (server);
+ if (!net_interface && net_default_interface)
+ {
+ net_interface = net_default_interface;
+ grub_dprintf ("efinet", "interface lookup failed, using default '%s'\n",
+ net_interface->name);
+ }
+
/*XXX: should we check device with default gateway ? */
- if (!net_interface && !(net_interface = net_default_interface))
+ if (!net_interface)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' no route found"),
name);
--
1.8.3.1
1
https://gitee.com/dingwei_chinamobile/grub2.git
git@gitee.com:dingwei_chinamobile/grub2.git
dingwei_chinamobile
grub2
grub2
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891