mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 17:04:35 +04:00
luci-base: add odhcpd feature detection
For dnsmasq, feature detection is currently supported like this:
L.hasSystemFeature('dnsmasq', 'dhcpv6')
while for odhcpd, only a basic check is supported:
L.hasSystemFeature('odhcpd')
With this patch, a similar feature check is also possible for odhcpd,
e.g.:
L.hasSystemFeature('odhcpd', 'dhcpv6')
Signed-off-by: David Härdeman <david@hardeman.nu>
This commit is contained in:
committed by
Paul Donald
parent
e6dc9ac18c
commit
90f10d6980
@@ -229,7 +229,6 @@ const methods = {
|
||||
offloading: access('/sys/module/xt_FLOWOFFLOAD/refcnt') == true || access('/sys/module/nft_flow_offload/refcnt') == true,
|
||||
br2684ctl: access('/usr/sbin/br2684ctl') == true,
|
||||
swconfig: access('/sbin/swconfig') == true,
|
||||
odhcpd: access('/usr/sbin/odhcpd') == true,
|
||||
zram: access('/sys/class/zram-control') == true,
|
||||
sysntpd: readlink('/usr/sbin/ntpd') != null,
|
||||
ipv6: access('/proc/net/ipv6_route') == true,
|
||||
@@ -273,6 +272,25 @@ const methods = {
|
||||
fd.close();
|
||||
}
|
||||
|
||||
result.odhcpd = false;
|
||||
fd = popen('odhcpd -h 2>/dev/null');
|
||||
|
||||
if (fd) {
|
||||
const output = fd.read('all');
|
||||
|
||||
if (output) {
|
||||
result.odhcpd = {};
|
||||
const m = match(output, /^Features: (.+)$/s);
|
||||
|
||||
for (let opt in split(m?.[1], ' ')) {
|
||||
let f = replace(opt, 'no-', '', 1);
|
||||
result.odhcpd[lc(f)] = (f == opt);
|
||||
}
|
||||
}
|
||||
|
||||
fd.close();
|
||||
}
|
||||
|
||||
// This check can be removed after v25 release
|
||||
result.netifd_vrf = match(callPackageVersionCheck('netifd'), /^20[0-9][0-9]/s)?.[0] >= 2025;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user