* - `bridge` if it is a bridge device (e.g. `br-lan`)
* - `tunnel` if it is a tun or tap device (e.g. `tun0`)
* - `vlan` if it is a vlan device (e.g. `eth0.1`)
+ * - `vrf` if it is a Virtual Routing and Forwarding type (e.g. `vrf0`)
* - `switch` if it is a switch device (e.g.`eth1` connected to switch0)
* - `ethernet` for all other device types
*/
return 'vlan';
else if (this.config.type == 'bridge')
return 'bridge';
+ else if (this.config.type == 'vrf')
+ return 'vrf';
else
return 'ethernet';
},
case 'bridge':
return _('Bridge');
+ case 'vrf':
+ return _('Virtual Routing and Forwarding (VRF)');
+
case 'switch':
return (_state.netdevs[this.device] && _state.netdevs[this.device].devtype == 'dsa')
? _('Switch port') : _('Ethernet Switch');
return `'${replace(s, "'", "'\\''")}'`;
}
+function callPackageVersionCheck(pkg) {
+ let version = "";
+
+ if ( access('/bin/opkg') ) {
+ // <= v24.10
+ let fd = popen('opkg list-installed ' + pkg + ' 2>/dev/null');
+ if (fd) {
+ const re = regexp('^' + pkg + ' - (.+)$', 's');
+ const m = match(fd.read('all'), re);
+ version = m?.[1];
+
+ fd.close();
+ }
+ }
+ else if ( access('/usr/bin/apk') ) {
+ // > v24.10
+ let fd = popen('apk list -I ' + pkg + ' 2>/dev/null');
+ if (fd) {
+ const re = regexp('^' + pkg + '-(.+)$', 's');
+ const m = match(fd.read('all'), re);
+ version = m?.[1];
+
+ fd.close();
+ }
+ }
+ return version;
+}
+
const methods = {
getVersion: {
call: function(request) {
relayd: access('/usr/sbin/relayd') == true,
apk: access('/usr/bin/apk') == true,
wifi: access('/sbin/wifi') == true,
+ vrf: access('/sys/module/vrf/refcnt') == true, // vrf.ko is loaded
+ netifd_vrf: false,
};
const wifi_features = [ 'eap', '11ac', '11ax', '11be', '11r', 'acs', 'sae', 'owe', 'suiteb192', 'wep', 'wps', 'ocv' ];
fd.close();
}
+ // This check can be removed after v25 release
+ result.netifd_vrf = match(callPackageVersionCheck('netifd'), /^20[0-9][0-9]/s)?.[0] >= 2025;
+
fd = popen('ipset --help 2>/dev/null');
if (fd) {
return { result: ports };
}
+ },
+
+ packageVersionCheck: {
+ args: { name: 'netifd' },
+ call: function(request) {
+ let version = "";
+ const pkg = request?.args?.name;
+
+ version = callPackageVersionCheck(pkg);
+
+ return { result: version };
+ }
}
};