interfaces: convert vlan assignments

This commit is contained in:
Franco Fichtner 2022-08-29 08:44:28 +02:00
parent b9bdf760b8
commit 56f8bae72a
2 changed files with 17 additions and 2 deletions

View File

@ -191,6 +191,23 @@ function core_devices()
'type' => 'gre',
];
$vlan_names = [];
foreach (config_read_array('vlans', 'vlan') as $dev) {
$vlan_names[$dev['vlanif']] = [
'descr' => sprintf(gettext('%s %s (Parent: %s, Tag: %s)'), $dev['vlanif'], $dev['descr'], $dev['if'], $dev['tag']),
'ifdescr' => sprintf('%s', $dev['descr']),
'name' => $dev['vlanif'],
];
}
$devices[] = [
'pattern' => '_vlan|^vlan|^qinq',
'names' => $vlan_names,
'volatile' => true,
'type' => 'vlan',
];
$wlan_names = [];
foreach (config_read_array('wireless', 'clone') as $dev) {
@ -245,7 +262,6 @@ function core_devices()
$devices[] = array('pattern' => '^wg', 'volatile' => true);
$devices[] = array('pattern' => '^zt', 'volatile' => true);
$devices[] = array('pattern' => '_stf', 'volatile' => true);
$devices[] = array('pattern' => '_vlan|^vlan|^qinq', 'volatile' => true);
return $devices;
}

View File

@ -62,7 +62,6 @@ function list_interfaces($devices)
/* XXX suppose this should plug into plugins_devices() eventually */
$config_sections['laggs.lagg'] = ['descr' => 'laggif,descr', 'key' => 'laggif', 'format' => '%s (%s)', 'fields' => 'members'];
$config_sections['ppps.ppp'] = ['descr' => 'if,ports,descr,username', 'key' => 'if','format' => '%s (%s) - %s %s', 'fields' => 'type'];
$config_sections['vlans.vlan'] = ['descr' => 'vlanif,descr,if,tag', 'key' => 'vlanif', 'format' => gettext('%s %s (Parent: %s, Tag: %s)')];
// add physical network interfaces
foreach (get_interface_list() as $key => $intf_item) {