Hi, ifconfig doesn't print ipv6 addresses if its used with media option.
# ifconfig -A vio0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ... inet 10.0.1.65 netmask 0xffffff00 broadcast 10.0.1.255 inet6 fe80::5054:ff:fe6a:b6fd%vio0 prefixlen 64 scopeid 0x1 inet6 fc00:1::1 prefixlen 64 inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 # ifconfig -A media vio0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ... supported media: media autoselect inet 10.0.1.65 netmask 0xffffff00 broadcast 10.0.1.255 inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 As the diff below shows, afp is NULL by default, but set to inet if there is an additional program parameter. At the end, no specific address family is assumed if afp is NULL. Thus, the diff below introduces a new variable to remember if a specific address family was set by the user or not for printing all interface addresses. The regression test of ifconfig(8) is passing with the diff below. ok? bye, Jan Index: ifconfig.c =================================================================== RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.461 diff -u -p -r1.461 ifconfig.c --- ifconfig.c 18 Jan 2023 21:57:10 -0000 1.461 +++ ifconfig.c 23 Jan 2023 12:11:30 -0000 @@ -746,6 +746,7 @@ const struct afswtch { }; const struct afswtch *afp; /*the address family being set or asked about*/ +const struct afswtch *pafp; /*the address family being used for printing*/ char joinname[IEEE80211_NWID_LEN]; size_t joinlen; @@ -840,7 +841,7 @@ main(int argc, char *argv[]) if (argc > 0) { for (afp = rafp = afs; rafp->af_name; rafp++) if (strcmp(rafp->af_name, *argv) == 0) { - afp = rafp; + pafp = afp = rafp; argc--; argv++; break; @@ -1216,7 +1217,7 @@ printif(char *name, int ifaliases) (ifa->ifa_addr->sa_family == AF_INET && ifaliases == 0 && noinet == 0)) continue; - if ((p = afp) != NULL) { + if ((p = pafp) != NULL) { if (ifa->ifa_addr->sa_family == p->af_af) p->af_status(1); } else { @@ -3514,7 +3515,7 @@ status(int link, struct sockaddr_dl *sdl proto_status: if (link == 0) { - if ((p = afp) != NULL) { + if ((p = pafp) != NULL) { p->af_status(1); } else for (p = afs; p->af_name; p++) { ifr.ifr_addr.sa_family = p->af_af;