def _parse_routes():
 with salt.utils.fopen('/proc/net/route', 'r') as fp_:
  out = fp_.read()
 ret = {}
 for line in out.splitlines():
  tmp = {}
  if (not line.strip()):
   continue
  if line.startswith('Iface'):
   continue
  comps = line.split()
  tmp['iface'] = comps[0]
  tmp['destination'] = _hex_to_octets(comps[1])
  tmp['gateway'] = _hex_to_octets(comps[2])
  tmp['flags'] = _route_flags(int(comps[3]))
  tmp['refcnt'] = comps[4]
  tmp['use'] = comps[5]
  tmp['metric'] = comps[6]
  tmp['mask'] = _hex_to_octets(comps[7])
  tmp['mtu'] = comps[8]
  tmp['window'] = comps[9]
  tmp['irtt'] = comps[10]
  if (comps[0] not in ret):
   ret[comps[0]] = []
  ret[comps[0]].append(tmp)
 return ret

def _parse_routes ( ) : with salt . utils . fopen ( '/proc/net/route' , 'r' ) as fp_ : out = fp_ . read ( ) ret = { } for line in out . splitlines ( ) : tmp = { } if ( not line . strip ( ) ) : continue if line . startswith ( 'Iface' ) : continue comps = line . split ( ) tmp [ 'iface' ] = comps [ 0 ] tmp [ 'destination' ] = _hex_to_octets ( comps [ 1 ] ) tmp [ 'gateway' ] = _hex_to_octets ( comps [ 2 ] ) tmp [ 'flags' ] = _route_flags ( int ( comps [ 3 ] ) ) tmp [ 'refcnt' ] = comps [ 4 ] tmp [ 'use' ] = comps [ 5 ] tmp [ 'metric' ] = comps [ 6 ] tmp [ 'mask' ] = _hex_to_octets ( comps [ 7 ] ) tmp [ 'mtu' ] = comps [ 8 ] tmp [ 'window' ] = comps [ 9 ] tmp [ 'irtt' ] = comps [ 10 ] if ( comps [ 0 ] not in ret ) : ret [ comps [ 0 ] ] = [ ] ret [ comps [ 0 ] ] . append ( tmp ) return ret
filters given options and outputs valid settings for the route settings file .