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 <lijiang@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
This commit is contained in:
Kazuhito Hagio 2023-04-25 09:31:04 +09:00
parent 2c7310aa7c
commit 47216437e7

3
net.c
View File

@ -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);