def list_port_fwd(zone, permanent=True):
 ret = []
 cmd = '--zone={0} --list-forward-ports'.format(zone)
 if permanent:
  cmd += ' --permanent'
 for i in __firewall_cmd(cmd).splitlines():
  (src, proto, dest, addr) = i.split(':')
  ret.append({'Source port': src.split('=')[1], 'Protocol': proto.split('=')[1], 'Destination port': dest.split('=')[1], 'Destination address': addr.split('=')[1]})
 return ret

def list_port_fwd ( zone , permanent = True ) : ret = [ ] cmd = '--zone={0} --list-forward-ports' . format ( zone ) if permanent : cmd += ' --permanent' for i in __firewall_cmd ( cmd ) . splitlines ( ) : ( src , proto , dest , addr ) = i . split ( ':' ) ret . append ( { 'Source port' : src . split ( '=' ) [ 1 ] , 'Protocol' : proto . split ( '=' ) [ 1 ] , 'Destination port' : dest . split ( '=' ) [ 1 ] , 'Destination address' : addr . split ( '=' ) [ 1 ] } ) return ret
list port forwarding .