Branch: Tag:

2013-11-06

2013-11-06 16:30:33 by Henrik Grubbström (Grubba) <grubba@grubba.org>

NetUtils: Support IPv6 on Solaris 10.

/usr/sbin/ifconfig on Solaris 10 defaults to showing only IPv4 information:

| $ ifconfig lo0
| lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
| inet 127.0.0.1 netmask ff000000

and requires the argument "inet6" to show IPv6 information:

| $ ifconfig lo0 inet6
| lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
| inet6 ::1/128

646:    foreach( ifconfig("list if" )/"\n", string iface )    {    array ips = ({}); -  string i,m; -  foreach( ifconfig(iface)/"\n", string q ) +  foreach( (ifconfig(iface) + ifconfig(iface + " inet6"))/"\n", +  string q )    { -  +  string i,m;    q = String.trim_whites(q);    if( (sscanf( q, "inet addr:%[^ ]%*sMask:%s", i, m )==3) ||    (sscanf( q, "inet %[^ ] mask %[^ ]", i, m )==2) ||