Index: tools/genesis-to-yaml.pl
===================================================================
--- tools/genesis-to-yaml.pl	(revision 10053)
+++ tools/genesis-to-yaml.pl	(revision 10054)
@@ -82,5 +82,5 @@
 }
 
-foreach $key  ('internalif', 'nat', 'internalroute', 'remote_access', 'gateway', 'firewall_block') {
+foreach $key  ('internalif', 'nat', 'internalroute', 'remote_access', 'gateway', 'firewall_block', 'proxyid') {
   if ($$key) {
     print "$key: $$key\n";
Index: tools/gformat.py
===================================================================
--- tools/gformat.py	(revision 10053)
+++ tools/gformat.py	(revision 10054)
@@ -56,5 +56,5 @@
     'rc.conf.local',
     'resolv.conf',
-    'wleiden.yaml'
+    'wleiden.yaml',
     ]
 
@@ -262,5 +262,5 @@
   output = generate_header("#");
   output += """\
-hostname='%(nodetype)s%(nodename)s.%(domain)s'
+hostname='%(autogen_fqdn)s.%(domain)s'
 location='%(location)s'
 """ % datadump
@@ -278,10 +278,35 @@
 
   # Extra Proxy configuration
+  datadump['ileiden_enable'] = 'yes' if datadump['ileiden'] else 'no'
   if datadump['nodetype'] == 'Proxy':
-    output += '\n# Disable routing\ngateway_enable="no"\n'
-
-  output += '\ninternalif="%s"\n' % datadump['internalif']
-
-  output += '\n'
+    output += """
+#
+# PROXY Configuration
+#
+sshtun_enable="YES"
+sshtun_flags="-R 22%(proxyid)02i:localhost:22"
+
+static_routes="wleiden"
+route_wleiden="-net 172.16.0.0/12 %(internalroute)s"
+
+internalif="%(internalif)s"
+
+# PROXY iLeiden Configuration
+ileiden_enable="%(ileiden_enable)s"
+gateway_enable="%(ileiden_enable)s"
+firewall_enable="%(ileiden_enable)s"
+firewall_script="/etc/ipfw.sh"
+firewall_nat_enable="%(ileiden_enable)s"
+""" % datadump
+
+  if datadump['nodetype'] == 'CNode' and datadump['ileiden']:
+    output += """
+# NODE iLeiden Configuration
+ileiden_enable="%(ileiden_enable)s"
+
+captive_portal_whitelist=""
+captive_portal_interfaces="%(autogen_dhcp_interfaces)s"
+""" % datadump
+
   # lo0 configuration:
   # - 172.32.255.1/32 is the proxy.wleiden.net deflector
@@ -299,5 +324,4 @@
     addrs_list['lo0'].append(datadump['masterip'] + "/32")
 
-  wlan_count = 0
   for iface_key in datadump['iface_keys']:
     ifacedump = datadump[iface_key]
@@ -320,9 +344,4 @@
     # XXX: Might want to deduct type directly from interface name
     if ifacedump['type'] in ['11a', '11b', '11g', 'wireless']:
-      # Create wlanX interface
-      ifacedump['wlanif'] ="wlan%i" % wlan_count
-      iface_map[interface] = ifacedump['wlanif']
-      wlan_count += 1
-
       # Default to station (client) mode
       ifacedump['wlanmode'] = "sta"
@@ -344,6 +363,6 @@
         ifacedump['extra'] = 'regdomain ETSI country NL'
 
-      output += "wlans_%(interface)s='%(wlanif)s'\n" % ifacedump
-      output += ("create_args_%(wlanif)s='wlanmode %(wlanmode)s mode " +\
+      output += "wlans_%(interface)s='%(autogen_ifname)s'\n" % ifacedump
+      output += ("create_args_%(autogen_ifname)s='wlanmode %(wlanmode)s mode " +\
         "%(mode)s ssid %(ssid)s %(extra)s channel %(channel)s'\n") % ifacedump
 
@@ -372,5 +391,18 @@
   datadump = yaml.load(f,Loader=Loader)
   datadump['autogen_iface_keys'] = get_interface_keys(datadump)
+
+  wlan_count=0
+  for key in datadump['autogen_iface_keys']:
+    if datadump[key]['type'] in ['11a', '11b', '11g', 'wireless']:
+      datadump[key]['autogen_ifname'] = 'wlan%i' % wlan_count
+      wlan_count += 1
+    else:
+      datadump[key]['autogen_ifname'] = datadump[key]['interface']
+
+
+  dhcp_interfaces = [datadump[key]['autogen_ifname'] for key in datadump['autogen_iface_keys'] if datadump[key]['dhcp'] != 'no']
+  datadump['autogen_dhcp_interfaces'] = ' '.join(dhcp_interfaces)
   datadump['autogen_item'] = item
+  datadump['autogen_fqdn'] = get_fqdn(datadump)
   f.close()
 
@@ -399,5 +431,5 @@
 def get_interface_keys(config):
   """ Quick hack to get all interface keys, later stage convert this to a iterator """
-  return [elem for elem in config.keys() if (elem.startswith('iface_') and not "lo0" in elem)]
+  return sorted([elem for elem in config.keys() if (elem.startswith('iface_') and not "lo0" in elem)])
 
 
@@ -485,4 +517,10 @@
     if key.startswith('autogen_'):
       del datadump[key]
+    # Interface autogen cleanups
+    elif type(datadump[key]) == dict:
+      for key2 in datadump[key].keys():
+        if key2.startswith('autogen_'):
+          del datadump[key][key2]
+      
 
   output = generate_header("#")
