mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
remove dns forward check
This commit is contained in:
parent
bc9117a3f3
commit
d02277c710
11 changed files with 4585 additions and 0 deletions
46
luci-mod-network/root/usr/libexec/luci-peeraddr
Executable file
46
luci-mod-network/root/usr/libexec/luci-peeraddr
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
NL="
|
||||
"
|
||||
|
||||
function ifaces_by_device() {
|
||||
ubus call network.interface dump 2>/dev/null | \
|
||||
jsonfilter -e "@.interface[@.device='$1' || @.l3_device='$1'].interface"
|
||||
}
|
||||
|
||||
function device_by_addr() {
|
||||
set -- $(ip route get "$1" ${2:+from "$2"} 2>/dev/null)
|
||||
echo "$5"
|
||||
}
|
||||
|
||||
for inbound_device in $(device_by_addr "$REMOTE_ADDR" "$SERVER_ADDR"); do
|
||||
inbound_devices="$inbound_device"
|
||||
inbound_interfaces=""
|
||||
|
||||
for iface in $(ifaces_by_device "$inbound_device"); do
|
||||
inbound_interfaces="${inbound_interfaces:+$inbound_interfaces$NL}$iface"
|
||||
|
||||
for peeraddr in $(uci get "network.$iface.peeraddr"); do
|
||||
for ipaddr in $(resolveip -t 1 "$peeraddr" 2>/dev/null); do
|
||||
for peerdev in $(device_by_addr "$ipaddr"); do
|
||||
for iface in $(ifaces_by_device "$peerdev"); do
|
||||
inbound_devices="${inbound_devices:+$inbound_devices$NL}$peerdev"
|
||||
inbound_interfaces="${inbound_interfaces:+$inbound_interfaces$NL}$iface"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
inbound_devices="$(echo "$inbound_devices" | sort -u | sed ':a;N;$!ba;s/\n/", "/g')"
|
||||
inbound_interfaces="$(echo "$inbound_interfaces" | sort -u | sed ':a;N;$!ba;s/\n/", "/g')"
|
||||
|
||||
cat <<JSON
|
||||
{
|
||||
"remote_addr": "$REMOTE_ADDR",
|
||||
"server_addr": "$SERVER_ADDR",
|
||||
"inbound_devices": [ ${inbound_devices:+\"$inbound_devices\"} ],
|
||||
"inbound_interfaces": [ ${inbound_interfaces:+\"$inbound_interfaces\"} ]
|
||||
}
|
||||
JSON
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"admin/network/switch": {
|
||||
"title": "Switch",
|
||||
"order": 20,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/switch"
|
||||
},
|
||||
"depends": {
|
||||
"fs": { "/sbin/swconfig": "executable" },
|
||||
"uci": { "network": { "@switch": true } }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/wireless": {
|
||||
"title": "Wireless",
|
||||
"order": 15,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/wireless"
|
||||
},
|
||||
"depends": {
|
||||
"uci": { "wireless": { "@wifi-device": true } }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/remote_addr/*": {
|
||||
"action": {
|
||||
"type": "call",
|
||||
"module": "luci.controller.admin.network",
|
||||
"function": "remote_addr"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/network": {
|
||||
"title": "Interfaces",
|
||||
"order": 10,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/interfaces"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/dhcp": {
|
||||
"title": "DHCP and DNS",
|
||||
"order": 30,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/dhcp"
|
||||
},
|
||||
"depends": {
|
||||
"uci": { "dhcp": true }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/hosts": {
|
||||
"title": "Hostnames",
|
||||
"order": 40,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/hosts"
|
||||
},
|
||||
"depends": {
|
||||
"uci": { "dhcp": true }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/routes": {
|
||||
"title": "Static Routes",
|
||||
"order": 50,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/routes"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/diagnostics": {
|
||||
"title": "Diagnostics",
|
||||
"order": 60,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/diagnostics"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue