the problem is that the config file is not in conventional uci format. If you format the "/etc/config/nodogsplash" file correctly you can use the uci.lua model. I have provided the config file in proper format ( i get it off the net so I am not sure if it is current ??) and a fully working code snippet the demonstrate
-- /usr/lib/lua/luci/model/uci_list_demo.lua
--[[ uci_list example ]]--
local uci = require "luci.model.uci"
local _uci_real, _uci_state
local function print_uci_list(config, section, option)
_uci_real = uci.cursor()
_uci_state = _uci_real:substate()
local tbl = {}
tbl = _uci_real:get_list(config, section, option)
print("\nsize of "..option.." ["..section.."] ".."list: "..#tbl)
for i,v in pairs(tbl) do
print(i,v)
end
return
end
print_uci_list("nodogsplash", "block", "authenticated_users")
print_uci_list("nodogsplash", "allow", "authenticated_users")
print_uci_list("nodogsplash", "allow", "preauthenticated_users")
print_uci_list("nodogsplash", "allow", "users_to_router")
and the config in the proper format ...
"/etc/config/nodogsplash"
config instance
# Set to 1 to enable nodogsplash
option enabled 1
# Use plain configuration file as well
option config '/etc/nodogsplash/nodogsplash.conf'
option network 'wlan'
option gatewayname 'OpenWrt Nodogsplash'
option maxclients '250'
option idletimeout '1200'
# Your router may have several interfaces, and you
# probably want to keep them private from the network/gatewayinterface.
# If so, you should block the entire subnets on those interfaces, e.g.:
config users_to_router 'block'
list authenticated_users 'block to 192.168.0.0/16'
list authenticated_users 'block to 10.0.0.0/8'
# Typical ports you will probably want to open up.
config users_to_router 'allow'
list authenticated_users 'allow tcp port 22'
list authenticated_users 'allow tcp port 53'
list authenticated_users 'allow udp port 53'
list authenticated_users 'allow tcp port 80'
list authenticated_users 'allow tcp port 443'
# For preauthenticated users to resolve IP addresses in their
# initial request not using the router itself as a DNS server,
config list preauthenticated_users 'allow'
list preauthenticated_users 'allow tcp port 53'
list preauthenticated_users 'allow udp port 53'
# Allow ports for SSH/Telnet/DNS/DHCP/HTTP/HTTPS
config users_to_router 'allow'
list users_to_router 'allow tcp port 22'
list users_to_router 'allow tcp port 23'
list users_to_router 'allow tcp port 53'
list users_to_router 'allow udp port 53'
list users_to_router 'allow udp port 67'
list users_to_router 'allow tcp port 80'
list users_to_router 'allow tcp port 443'
# See https://github.com/nodogsplash for a full list of available options.
if you save the code snippet from above to "/usr/lib/lua/luci/mode/uci_list_demo.lua" and update you config file with the one above or just add the sections as i did above ("config <section>) then you can execute it from cmd line like ...
lua /usr/lib/lua/luci/model/uci_list_demo.lua
that should give you the idea
(Last edited by hostle19 on 10 Jan 2016, 01:06)