def _in6_getifaddr(ifname):
 try:
  f = os.popen(('%s %s' % (conf.prog.ifconfig, ifname)))
 except OSError as msg:
  log_interactive.warning('Failed to execute ifconfig.')
  return []
 ret = []
 for line in f:
  if ('inet6' in line):
   addr = line.rstrip().split(None, 2)[1]
  else:
   continue
  if ('%' in line):
   addr = addr.split('%', 1)[0]
  try:
   socket.inet_pton(socket.AF_INET6, addr)
  except:
   continue
  scope = in6_getscope(addr)
  ret.append((addr, scope, ifname))
 return ret

def _in6_getifaddr ( ifname ) : try : f = os . popen ( ( '%s %s' % ( conf . prog . ifconfig , ifname ) ) ) except OSError as msg : log_interactive . warning ( 'Failed to execute ifconfig.' ) return [ ] ret = [ ] for line in f : if ( 'inet6' in line ) : addr = line . rstrip ( ) . split ( None , 2 ) [ 1 ] else : continue if ( '%' in line ) : addr = addr . split ( '%' , 1 ) [ 0 ] try : socket . inet_pton ( socket . AF_INET6 , addr ) except : continue scope = in6_getscope ( addr ) ret . append ( ( addr , scope , ifname ) ) return ret
returns a list of ipv6 addresses configured on the interface ifname .