pike.git / lib / modules / NetUtils.pmod

version» Context lines:

pike.git/lib/modules/NetUtils.pmod:643:       mapping(string:array(string)) next__interfaces = ([]);       mapping(string:array(string)) next__broadcast_addresses = ([]);    foreach( ifconfig("list if" )/"\n", string iface )    {    array ips = ({});    foreach( (ifconfig(iface) + ifconfig(iface + " inet6"))/"\n",    string q )    { -  string i,m; +  string i,m,f;    q = String.trim_whites(q); -  +  if( sscanf( q, "%*sflags=%*x<%s>", f )==3 && +  search(f/",", "UP")<0) { +  // ignore interfaces which are not up +  ips = ({}); +  break; +  }    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: %[^ ] %s", i, m ) ) ||    (sscanf( q, "inet6 %[^ ] %s", i, m )) )    {