luci-base, luci-mod-network: migrate getDUIDHints method to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
b3681bd9dc
commit
392ba53eff
3 changed files with 4 additions and 24 deletions
|
@ -160,26 +160,6 @@ local methods = {
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
getDUIDHints = {
|
|
||||||
call = function()
|
|
||||||
local fp = io.open('/var/hosts/odhcpd')
|
|
||||||
local result = { }
|
|
||||||
if fp then
|
|
||||||
for line in fp:lines() do
|
|
||||||
local dev, duid, name = string.match(line, '# (%S+)%s+(%S+)%s+%d+%s+(%S+)')
|
|
||||||
if dev and duid and name then
|
|
||||||
result[duid] = {
|
|
||||||
name = (name ~= "-") and name or nil,
|
|
||||||
device = dev
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
fp:close()
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
getConntrackHelpers = {
|
getConntrackHelpers = {
|
||||||
call = function()
|
call = function()
|
||||||
local ok, fd = pcall(io.open, "/usr/share/fw3/helpers.conf", "r")
|
local ok, fd = pcall(io.open, "/usr/share/fw3/helpers.conf", "r")
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
"ubus": {
|
"ubus": {
|
||||||
"file": [ "list", "read", "stat" ],
|
"file": [ "list", "read", "stat" ],
|
||||||
"iwinfo": [ "assoclist", "freqlist", "txpowerlist", "countrylist" ],
|
"iwinfo": [ "assoclist", "freqlist", "txpowerlist", "countrylist" ],
|
||||||
"luci": [ "getConntrackList", "getDUIDHints", "getInitList", "getLocaltime", "getProcessList", "getRealtimeStats", "getTimezones", "getLEDs", "getUSBDevices", "getSwconfigFeatures", "getSwconfigPortState", "getBlockDevices", "getMountPoints" ],
|
"luci": [ "getConntrackList", "getInitList", "getLocaltime", "getProcessList", "getRealtimeStats", "getTimezones", "getLEDs", "getUSBDevices", "getSwconfigFeatures", "getSwconfigPortState", "getBlockDevices", "getMountPoints" ],
|
||||||
"luci-rpc": [ "getBoardJSON", "getDHCPLeases", "getDSLStatus", "getHostHints", "getNetworkDevices", "getWirelessDevices" ],
|
"luci-rpc": [ "getBoardJSON", "getDHCPLeases", "getDSLStatus", "getDUIDHints", "getHostHints", "getNetworkDevices", "getWirelessDevices" ],
|
||||||
"network.interface": [ "dump" ],
|
"network.interface": [ "dump" ],
|
||||||
"network.rrdns": [ "lookup" ],
|
"network.rrdns": [ "lookup" ],
|
||||||
"network": [ "get_proto_handlers" ],
|
"network": [ "get_proto_handlers" ],
|
||||||
|
|
|
@ -12,7 +12,7 @@ callHostHints = rpc.declare({
|
||||||
});
|
});
|
||||||
|
|
||||||
callDUIDHints = rpc.declare({
|
callDUIDHints = rpc.declare({
|
||||||
object: 'luci',
|
object: 'luci-rpc',
|
||||||
method: 'getDUIDHints',
|
method: 'getDUIDHints',
|
||||||
expect: { '': {} }
|
expect: { '': {} }
|
||||||
});
|
});
|
||||||
|
@ -394,7 +394,7 @@ return L.view.extend({
|
||||||
so = ss.option(form.Value, 'duid', _('<abbr title="The DHCP Unique Identifier">DUID</abbr>'));
|
so = ss.option(form.Value, 'duid', _('<abbr title="The DHCP Unique Identifier">DUID</abbr>'));
|
||||||
so.datatype = 'and(rangelength(20,36),hexstring)';
|
so.datatype = 'and(rangelength(20,36),hexstring)';
|
||||||
Object.keys(duids).forEach(function(duid) {
|
Object.keys(duids).forEach(function(duid) {
|
||||||
so.value(duid, '%s (%s)'.format(duid, duids[duid].name || '?'));
|
so.value(duid, '%s (%s)'.format(duid, duids[duid].hostname || duids[duid].macaddr || duids[duid].ip6addr || '?'));
|
||||||
});
|
});
|
||||||
|
|
||||||
so = ss.option(form.Value, 'hostid', _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Suffix (hex)'));
|
so = ss.option(form.Value, 'hostid', _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Suffix (hex)'));
|
||||||
|
|
Loading…
Reference in a new issue