Changeset 13503 in genesis for tools


Ignore:
Timestamp:
Nov 25, 2015, 9:37:32 AM (9 years ago)
Author:
rick
Message:

Major Change: Combine accesspoint interfaces to a shared bridge interfaces
allowing users to roam between accesspoints of local node.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r13435 r13503  
    516516    if not datadump[iface_key].has_key('comment'):
    517517      datadump[iface_key]['comment'] = None
    518     dhcp_out[ifname].append("  ## %(autogen_ifname)s - %(comment)s\n" % datadump[iface_key])
     518
     519    if dhcp_type(datadump[iface_key]) != DHCP_SERVER:
     520      dhcp_out[iface_key].append("  ## %(autogen_ifname)s - %(comment)s\n" % datadump[iface_key])
     521    else:
     522      dhcp_out[ifname].append("  ## %(autogen_ifname)s - %(comment)s\n" % datadump[iface_key])
    519523
    520524    (addr, mask) = datadump[iface_key]['ip'].split('/')
     
    523527    datadump[iface_key]['autogen_subnet'] = get_network(addr, mask)
    524528    if dhcp_type(datadump[iface_key]) != DHCP_SERVER:
    525       dhcp_out[ifname].append("  subnet %(autogen_subnet)s netmask %(autogen_netmask)s {\n    ### not autoritive\n  }\n" % \
     529      dhcp_out[iface_key].append("  subnet %(autogen_subnet)s netmask %(autogen_netmask)s {\n    ### not autoritive\n  }\n" % \
    526530        datadump[iface_key])
    527531      continue
     
    630634      dhclient_if[ifname] = dhcp_type(ifacedump) == DHCP_CLIENT
    631635
     636    # DHCP interfaces are to be added to bridge0
     637    if ifname.replace('_','.') in datadump['autogen_dhcp_interfaces']:
     638      ifname_base = 'bridge0'
     639    else:
     640      ifname_base = ifname
     641
    632642    # Add interface IP to list
    633643    item = (ifacedump['ip'], ifacedump['comment'])
    634     if addrs_list.has_key(ifname):
    635       addrs_list[ifname].append(item)
     644    if addrs_list.has_key(ifname_base):
     645      addrs_list[ifname_base].append(item)
    636646    else:
    637       addrs_list[ifname] = [item]
     647      addrs_list[ifname_base] = [item]
    638648
    639649    # Alias only needs IP assignment for now, this might change if we
     
    765775  "
    766776
    767   captive_portal_interfaces="{{ autogen_dhcp_interfaces|join(',')|default('none', true) }}"
     777  captive_portal_interfaces="bridge0"
    768778  externalif="{{ externalif|default('vr0', true) }}"
    769779  masterip="{{ masterip }}"
     
    832842    {% if autogen_dhcp_interfaces -%}
    833843    dhcpd_enable="YES"
    834     dhcpd_flags="$dhcpd_flags {{ autogen_dhcp_interfaces|join(' ') }}"
     844    dhcpd_flags="$dhcpd_flags bridge0"
    835845    {% endif -%}
    836846  {% elif board == "apu1d" %}
     
    842852    {% if autogen_dhcp_interfaces -%}
    843853    dhcpd_enable="YES"
    844     dhcpd_flags="$dhcpd_flags {{ autogen_dhcp_interfaces|join(' ') }}"
     854    dhcpd_flags="$dhcpd_flags bridge0"
    845855    {% endif -%}
    846856  {% endif -%}
     
    868878      output += "ifconfig_%s='up'\n" % iface
    869879
     880  output += "\n"
     881  output += "cloned_interfaces='bridge0'\n"
     882  output += "ifconfig_bridge0='addm %s up'\n" % ' addm '.join(datadump['autogen_dhcp_interfaces'])
     883
    870884  # Details like SSID
    871885  if extra_ouput:
     
    879893
    880894    # Write DHCLIENT entry
    881     if dhclient_if[iface]:
     895    if iface in dhclient_if and dhclient_if[iface]:
    882896      output += "ifconfig_%s='SYNCDHCP'\n\n" % (iface)
    883897   
Note: See TracChangeset for help on using the changeset viewer.