Changeset 13930 in genesis for tools/gformat.py


Ignore:
Timestamp:
Jun 21, 2017, 10:35:31 PM (8 years ago)
Author:
rick
Message:

Fix adding of interface members of bridge(4)

create_args_ is not supported for bridge creation, how-ever when using
ifconfig_ some trickery is required to support IP assignments as all needs to
be 'shifted' to aliasX interfacing.

Note alias creation is flawed by design as they all have to have unique keys,
thus we rely on _aliasX definitions for alias creation, where-as we should
parse the entries instead. Thus make_interface_list has to hack support for
bridge aliases which do require this tooling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r13929 r13930  
    225225        datadump[key]['autogen_bridge_member'] = datadump[key].has_key('parent')
    226226        datadump[key]['autogen_bridge'] = datadump[key]['autogen_ifbase'].startswith('bridge')
     227        datadump[key]['autogen_bridge_alias'] = datadump[key]['autogen_ifbase'].startswith('bridge') and '_alias' in key
    227228
    228229        if datadump[key].has_key('parent'):
     
    701702  for iface_key in get_interface_keys(datadump):
    702703    ifacedump = datadump[iface_key]
    703     ifname = ifacedump['autogen_ifname']
     704    if ifacedump['autogen_bridge_alias']:
     705      ifname = ifacedump['autogen_ifbase']
     706    else:
     707      ifname = ifacedump['autogen_ifname']
    704708
    705709    # If defined as vlan interface
     
    710714    if ifacedump['autogen_bridge_member']:
    711715      bridge_list[ifacedump['parent']].append(ifacedump['autogen_iface'])
     716
    712717
    713718    # Flag dhclient is possible
     
    980985   
    981986  for iface in bridge_list.keys():
    982     output += "create_args_%s='%s'\n" % (iface, ' '.join(['addm %(iface)s private %(iface)s' % {'iface': x} for x in bridge_list[iface]]))
     987    output += "ifconfig_%s='%s up'\n" % (iface, ' '.join(['addm %(iface)s private %(iface)s' % {'iface': x} for x in bridge_list[iface]]))
    983988
    984989  # Bridge member interfaces not containing a configuration should be marked active explcitly.
     
    10171022    if flags_if[iface].has_key('ether'):
    10181023      output += "ifconfig_%s='link %s'\n" % (iface, flags_if[iface]['ether'])
     1024      output += "ifconfig_%s_alias0='inet %s'\n" % (iface, addrs[0][0])
     1025      idx_offset += 1
     1026    elif iface in bridge_list: 
    10191027      output += "ifconfig_%s_alias0='inet %s'\n" % (iface, addrs[0][0])
    10201028      idx_offset += 1
Note: See TracChangeset for help on using the changeset viewer.