- client:settimeout(1)
- local srv
- local ip = luci.ip.IPv4((client:getpeername()))
-
- local function find_srv(section)
- if section.ipaddr then
- local net = luci.ip.IPv4(section.ipaddr, section.netmask)
- if ip and net and net:contains(ip) then
- srv = section.ipaddr
- return
- end
- end
- end
-
- uci:foreach("network", "interface", find_srv)
- uci:foreach("network", "alias", find_srv)
+ client:setopt("socket", "rcvtimeo", 1)
+ client:setopt("socket", "sndtimeo", 1)
+ local srv = client:getsockname()