From 47216437e79ae0076da2594f7352d94aaca5e5d1 Mon Sep 17 00:00:00 2001 From: Kazuhito Hagio Date: Tue, 25 Apr 2023 09:31:04 +0900 Subject: [PATCH] Fix "net" command on kernel configured with CONFIG_IPV6=m On a kernel configured with CONFIG_IPV6=m, struct inet6_ifaddr is not defined in kernel. Without the patch, the "net" command fails with the following error. net: invalid structure member offset: inet6_ifaddr_if_next FILE: net.c LINE: 1017 FUNCTION: get_device_ip6_address() Signed-off-by: Lianbo Jiang Signed-off-by: Kazuhito Hagio --- net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net.c b/net.c index 18c238b..31d3f2b 100644 --- a/net.c +++ b/net.c @@ -996,6 +996,9 @@ get_device_ip6_address(ulong devaddr, char **bufp, long buflen) return; } + if (INVALID_MEMBER(inet6_ifaddr_if_next)) + return; + readmem(ip6_ptr + OFFSET(inet6_dev_addr_list), KVADDR, &addr, sizeof(void *), "inet6_dev.addr_list", FAULT_ON_ERROR);