def _masq_config(masq):
 if (masq is None):
  masq = []
 lines = [MASQ_HEADER]
 for entry in masq:
  entry.setdefault('interface', 'eth0')
  entry.setdefault('address', '-')
  entry.setdefault('proto', '-')
  entry.setdefault('port', '-')
  if isinstance(entry['source'], list):
   entry['source'] = ','.join(entry['source'])
  lines.append((MASQ_FORMAT % entry))
 file('/etc/shorewall/masq', contents=''.join(lines), use_sudo=True)

def _masq_config ( masq ) : if ( masq is None ) : masq = [ ] lines = [ MASQ_HEADER ] for entry in masq : entry . setdefault ( 'interface' , 'eth0' ) entry . setdefault ( 'address' , '-' ) entry . setdefault ( 'proto' , '-' ) entry . setdefault ( 'port' , '-' ) if isinstance ( entry [ 'source' ] , list ) : entry [ 'source' ] = ',' . join ( entry [ 'source' ] ) lines . append ( ( MASQ_FORMAT % entry ) ) file ( '/etc/shorewall/masq' , contents = '' . join ( lines ) , use_sudo = True )
masquerading/snat configuration .