def in6_getifaddr():
 if OPENBSD:
  try:
   f = os.popen(('%s' % conf.prog.ifconfig))
  except OSError as msg:
   log_interactive.warning('Failed to execute ifconfig.')
   return []
  splitted_line = []
  for l in f:
   if ('flags' in l):
    iface = l.split()[0].rstrip(':')
    splitted_line.append(iface)
 else:
  try:
   f = os.popen(('%s -l' % conf.prog.ifconfig))
  except OSError as msg:
   log_interactive.warning('Failed to execute ifconfig.')
   return []
  splitted_line = f.readline().rstrip().split()
 ret = []
 for i in splitted_line:
  ret += _in6_getifaddr(i)
 return ret

def in6_getifaddr ( ) : if OPENBSD : try : f = os . popen ( ( '%s' % conf . prog . ifconfig ) ) except OSError as msg : log_interactive . warning ( 'Failed to execute ifconfig.' ) return [ ] splitted_line = [ ] for l in f : if ( 'flags' in l ) : iface = l . split ( ) [ 0 ] . rstrip ( ':' ) splitted_line . append ( iface ) else : try : f = os . popen ( ( '%s -l' % conf . prog . ifconfig ) ) except OSError as msg : log_interactive . warning ( 'Failed to execute ifconfig.' ) return [ ] splitted_line = f . readline ( ) . rstrip ( ) . split ( ) ret = [ ] for i in splitted_line : ret += _in6_getifaddr ( i ) return ret
returns a list of 3-tuples of the form where addr is the address of scope scope associated to the interface iface .