pike.git / lib / modules / NetUtils.pmod

version» Context lines:

pike.git/lib/modules/NetUtils.pmod:651:    {    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 )) ) +  else if( (sscanf( q, "inet6 addr: %[^ ] %s", i, m ) ) || +  (sscanf( q, "inet6 %[^ ] %s", i, m )) )    { -  +  if (!has_value(i, "/")) { +  int bits = -1; +  // ifconfig(1) from Linux net-tools reports +  // the prefix length separately. +  if (sscanf(m, "%*sprefixlen %d", bits) && (bits > 0)) { +  i += "/" + bits; +  } +  }    if( !has_prefix( i, "fe80::" ) )    ips += ({ i });    next__broadcast_addresses[iface] += ({ "ff02::1" });    }    if( (sscanf( q, "%*sBcast:%[^ ]", i ) == 2) ||    (sscanf( q, "%*sbroadcast %s", i ) == 2 ) )    {    next__broadcast_addresses[iface] += ({i});    }    }