pike.git / lib / modules / NetUtils.pmod

version» Context lines:

pike.git/lib/modules/NetUtils.pmod:639:   {    if( __interfaces )    return __interfaces;       mapping(string:array(string)) next__interfaces = ([]);       mapping(string:array(string)) next__broadcast_addresses = ([]);    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) ||    (sscanf( q, "inet %[^ ]%*snetmask %[^ ]", i, m )==3))    {    ips += ({i+"/"+netmask_to_cidr(m)});    ips += ({ "::ffff:"+i+"/"+(96+netmask_to_cidr(m)) });    }    else if( (sscanf( q, "inet6 addr: %[^ ]", i ) ) ||    (sscanf( q, "inet6 %[^ ] ", i )) )