From b386e61d82266bb2ba474cabb8328b3ec449d19f Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sun, 28 Aug 2022 14:18:16 +0200 Subject: [PATCH] interfaces: convert ipsec devices Removes them from get_interface_list() and shows their description on the assignments page. It's already in the interface name but we should adhere to consistency in the select box. --- src/etc/inc/interfaces.lib.inc | 57 +++++++++++++------------- src/etc/inc/plugins.inc.d/ipsec.inc | 11 +++-- src/etc/inc/plugins.inc.d/loopback.inc | 2 +- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/etc/inc/interfaces.lib.inc b/src/etc/inc/interfaces.lib.inc index 92a7b30cf..c2b4d3047 100644 --- a/src/etc/inc/interfaces.lib.inc +++ b/src/etc/inc/interfaces.lib.inc @@ -551,34 +551,35 @@ function get_interface_list($only_active = false, $include_dmesg = false) /* list of virtual interface types */ $vfaces = [ - '_stf', - '_vip', - '_vlan', - '_wlan', - 'bridge', - 'carp', - 'enc', - 'faith', - 'gif', - 'gre', - 'ipfw', - 'l2tp', - 'lagg', - 'lo', - 'ng', - 'ovpnc', - 'ovpns', - 'pflog', - 'pfsync', - 'plip', - 'ppp', - 'pppoe', - 'pptp', - 'qinq', - 'sl', - 'tap', - 'tun', - 'vlan', + '_stf', + '_vip', + '_vlan', + '_wlan', + 'bridge', + 'carp', + 'enc', + 'faith', + 'gif', + 'gre', + 'ipfw', + 'ipsec', + 'l2tp', + 'lagg', + 'lo', + 'ng', + 'ovpnc', + 'ovpns', + 'pflog', + 'pfsync', + 'plip', + 'ppp', + 'pppoe', + 'pptp', + 'qinq', + 'sl', + 'tap', + 'tun', + 'vlan', ]; $ifnames_wlan = legacy_interface_listget('wlan'); diff --git a/src/etc/inc/plugins.inc.d/ipsec.inc b/src/etc/inc/plugins.inc.d/ipsec.inc index 1b93879b6..3ac623a23 100644 --- a/src/etc/inc/plugins.inc.d/ipsec.inc +++ b/src/etc/inc/plugins.inc.d/ipsec.inc @@ -214,8 +214,13 @@ function ipsec_devices() $devices = []; $names = []; - foreach (array_keys(ipsec_get_configured_vtis()) as $device) { - $names[$device] = null; + foreach (ipsec_get_configured_vtis() as $device => $details) { + $names[$device] = [ + 'descr' => sprintf('%s (%s)', $device, $details['descr']), + 'ifdescr' => sprintf('%s', $details['descr']), + 'section' => 'ipsec', + 'name' => $device, + ]; } $devices[] = [ @@ -227,7 +232,7 @@ function ipsec_devices() 'type' => 'ipsec', ]; - $devices[] = ['pattern' => '^enc', 'volatile' => true]; + $devices[] = ['pattern' => '^enc|^ipsec', 'volatile' => true]; return $devices; } diff --git a/src/etc/inc/plugins.inc.d/loopback.inc b/src/etc/inc/plugins.inc.d/loopback.inc index 417d12ec1..0bb9f0c29 100644 --- a/src/etc/inc/plugins.inc.d/loopback.inc +++ b/src/etc/inc/plugins.inc.d/loopback.inc @@ -69,7 +69,7 @@ function loopback_devices() 'pattern' => '^lo', 'volatile' => true, 'type' => 'loopback', - 'names' =>$names, + 'names' => $names, ]]; }