Skip to content

Commit

Permalink
Fix "net" command on kernel configured with CONFIG_IPV6=m
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Kazuhito Hagio <[email protected]>
  • Loading branch information
k-hagio committed Apr 25, 2023
1 parent 2c7310a commit 4721643
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4721643

Please sign in to comment.