honwen / luci-app-shadowsocksr

OpenWrt/LEDE LuCI for ShadowsocksR-libev
GNU General Public License v3.0
115 stars 40 forks source link

access-control can not be accessed #2

Closed jack338c closed 7 years ago

jack338c commented 7 years ago

Dear Chen,I make the neweset luci-app-shadowsocksr from your respoitory,everything is ok except the access-control menu

when I click "access-control",it comes following

/usr/lib/lua/luci/dispatcher.lua:469: Failed to execute cbi dispatcher target for entry '/admin/services/shadowsocksr/access-control'. The called action terminated with an exception: ...b/lua/luci/model/cbi/shadowsocksr/access-control.lua:90: attempt to call field 'arptable' (a nil value) stack traceback: [C]: in function 'assert' /usr/lib/lua/luci/dispatcher.lua:469: in function 'dispatch' /usr/lib/lua/luci/dispatcher.lua:121: in function </usr/lib/lua/luci/dispatcher.lua:120>

honwen commented 7 years ago

Which router are u using?

luci/model/cbi/shadowsocksr/access-control.lua:90

Refer to shadowsocks/luci-app-shadowsocks

luci/model/cbi/shadowsocks/access-control.lua:92


OR U can retry after reboot Ur router.

jack338c commented 7 years ago

netgear wndr4300

jack338c commented 7 years ago

sorry ,this one luci/model/cbi/shadowsocksr/access-control.lua:90

honwen commented 7 years ago

have u try reboot?

jack338c commented 7 years ago

yes I do,but it does't work

honwen commented 7 years ago

github is too smart to auto close this issue, please try https://github.com/chenhw2/luci-app-shadowsocksr/commit/bde796bb607b0f5fced9ecd9bf4be1eae4d87e52

jack338c commented 7 years ago

thanks for you fast response

jack338c commented 7 years ago

haha,ok I got it

jack338c commented 7 years ago

unfortunately,I replace /usr/lib/lua/luci/model/cbi/shadowsocksr/access-control.lua in my router

but it still dese't work

/usr/lib/lua/luci/dispatcher.lua:469: Failed to execute cbi dispatcher target for entry '/admin/services/shadowsocksr/access-control'. The called action terminated with an exception: /usr/lib/lua/luci/cbi.lua:53: /usr/lib/lua/luci/model/cbi/shadowsocksr/access-control.lua:90: 'then' expected near '!' stack traceback: [C]: in function 'assert' /usr/lib/lua/luci/dispatcher.lua:469: in function 'dispatch' /usr/lib/lua/luci/dispatcher.lua:121: in function </usr/lib/lua/luci/dispatcher.lua:120>

honwen commented 7 years ago

can u login and run a command arp and show me the result.

honwen commented 7 years ago

U try the old one, please try https://github.com/chenhw2/luci-app-shadowsocksr/commit/4acf0c1fedfddb22c9cd02d7dd3a93414211f439

jack338c commented 7 years ago
BusyBox v1.26.2 () built-in shell (ash)

     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|                      lede-project.org
 \        \   DE /
  \    LE  \    /  -----------------------------------------------------------
   \  DE    \  /    Reboot (SNAPSHOT, r4561-254f0da)
    \________\/    -----------------------------------------------------------

root@LEDE:~# arp
IP address       HW type     Flags       HW address            Mask     Device
192.168.11.185   0x1         0x2         00:21:6a:6d:75:0e     *        br-lan
192.168.11.143   0x1         0x2         58:94:6b:0c:b6:d0     *        br-lan
192.168.11.182   0x1         0x2         f8:f1:b6:57:e4:30     *        br-lan
192.168.11.228   0x1         0x2         60:be:b5:68:d9:ce     *        br-lan
192.168.11.157   0x1         0x2         a4:77:33:fb:80:ba     *        br-lan
root@LEDE:~# 
jack338c commented 7 years ago
o = s:option(Value, "host", translate("Host"))
if luci.sys.net.arptable() ~= nil then
luci.sys.net.arptable(function(x)
o:value(x["IP address"], "%s (%s)" %{x["IP address"], x["HW address"]})
end)
end
o.datatype = "ip4addr"
o.rmempty = false

(did not paste other parts)

I chang to above,then did a save& apply on shadowsocksr menu first, but still got same issue while clicking access-control menu

honwen commented 7 years ago

that's rare, than i look into the offical luci-app-shadowsocks, i find this commit

Can U try this:

o = s:option(Value, "host", translate("Host"))
luci.sys.net.ipv4_hints(function(ip, name)
    o:value(ip, "%s (%s)" %{ip, name})
end)
o.datatype = "ip4addr"
o.rmempty = false
jack338c commented 7 years ago

it works !! thank you Chenhw2,for your patience and help.

honwen commented 7 years ago

Good, but this code may cause https://github.com/shadowsocks/luci-app-shadowsocks/issues/39 & https://github.com/shadowsocks/luci-app-shadowsocks/issues/32

jack338c commented 7 years ago

ok,I got it

aa65535 commented 7 years ago

see https://github.com/openwrt/luci/commit/366707a681459a4d520dc97024ea0a4b3c24a326

jack338c commented 7 years ago

@aa65535 ok,thanks a lot !

jack338c commented 7 years ago

but I'm using trunk version of lede,how to deal with openwrt/luci@366707a?

honwen commented 7 years ago

fixed in https://github.com/chenhw2/luci-app-shadowsocksr/commit/5551ae1b73a89403a79127d09d1e56cb5b85b33c

jack338c commented 7 years ago

Great ! thanks