An unset address (local_ip/remote_ip), now denoted by AF_UNSPEC, currently shows "0.0.0.0" in configfs. Print an empty string instead, which is more clear. In netconsole_print_banner() we can be even more explicit about it, as we don't have the risk of userspace trying to parse it. Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 054c39066043..0418031b6bc9 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -705,14 +705,18 @@ static void netconsole_print_banner(struct netconsole_target *nt) struct netpoll *np = &nt->np; np_info(np, "local port %d\n", nt->local_port); - if (nt->local_ip.family == AF_INET6) + if (nt->local_ip.family == AF_UNSPEC) + np_info(np, "local IP unset\n"); + else if (nt->local_ip.family == AF_INET6) np_info(np, "local IPv6 address %pI6c\n", &nt->local_ip.in6); else np_info(np, "local IPv4 address %pI4\n", &nt->local_ip.ip); np_info(np, "interface name '%s'\n", np->dev_name); np_info(np, "local ethernet address '%pM'\n", np->dev_mac); np_info(np, "remote port %d\n", nt->remote_port); - if (nt->remote_ip.family == AF_INET6) + if (nt->remote_ip.family == AF_UNSPEC) + np_info(np, "remote IP unset\n"); + else if (nt->remote_ip.family == AF_INET6) np_info(np, "remote IPv6 address %pI6c\n", &nt->remote_ip.in6); else np_info(np, "remote IPv4 address %pI4\n", &nt->remote_ip.ip); @@ -850,6 +854,8 @@ static ssize_t local_ip_show(struct config_item *item, char *buf) { struct netconsole_target *nt = to_target(item); + if (nt->local_ip.family == AF_UNSPEC) + return sysfs_emit(buf, "\n"); if (nt->local_ip.family == AF_INET6) return sysfs_emit(buf, "%pI6c\n", &nt->local_ip.in6); else @@ -860,6 +866,8 @@ static ssize_t remote_ip_show(struct config_item *item, char *buf) { struct netconsole_target *nt = to_target(item); + if (nt->remote_ip.family == AF_UNSPEC) + return sysfs_emit(buf, "\n"); if (nt->remote_ip.family == AF_INET6) return sysfs_emit(buf, "%pI6c\n", &nt->remote_ip.in6); else -- 2.55.0