From 229b70a796da094e314df9b161d48b188b7588f2 Mon Sep 17 00:00:00 2001 From: StressOzz <131419324+StressOzz@users.noreply.github.com> Date: Mon, 14 Sep 2026 20:36:15 +0500 Subject: [PATCH] =?UTF-8?q?fix=20=D0=98=D1=81=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=83=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D1=81=D1=82=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZapretManager_LuCI.sh | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ZapretManager_LuCI.sh b/ZapretManager_LuCI.sh index 197119c..352b4ee 100644 --- a/ZapretManager_LuCI.sh +++ b/ZapretManager_LuCI.sh @@ -1370,7 +1370,7 @@ _excl_write() { exclusions_status() { [ -f /etc/init.d/zapret ] || { echo '{"error":"Zapret не установлен"}'; return 1; } - local current devjson="" first=1 ip name ts mac rest + local current devjson="" first=1 ip name ts mac rest aip ahw aflags amac amask adev aname current=$(_excl_current) @@ -1386,6 +1386,38 @@ exclusions_status() { done < /tmp/dhcp.leases fi + local lan_dev arp_tmp + lan_dev=$(uci -q get network.lan.device) + [ -z "$lan_dev" ] && lan_dev="br-lan" + arp_tmp="$JOBS_DIR/excl_arp_tmp" + rm -f "$arp_tmp" + if [ -f /proc/net/arp ]; then + tail -n +2 /proc/net/arp | while read -r aip ahw aflags amac amask adev; do + [ -z "$aip" ] && continue + [ "$adev" = "$lan_dev" ] || continue + echo "$aip" | grep -qE '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' || continue + [ "$aflags" = "0x0" ] && continue + printf '%s' "$devjson" | grep -q "\"ip\":\"$aip\"" && continue + aname="" + [ -f /tmp/dhcp.leases ] && aname=$(awk -v mac="$amac" 'tolower($2)==tolower(mac){print $4; exit}' /tmp/dhcp.leases) + if [ -z "$aname" ] || [ "$aname" = "*" ]; then + aname=$(logread 2>/dev/null | grep -i "DHCPACK" | grep -i "$aip" | grep -i "$amac" | tail -n1 | awk '{print $NF}') + fi + [ "$aname" = "$amac" ] && aname="" + [ -n "$aname" ] || aname="Неизвестное устройство" + printf '%s|%s\n' "$aip" "$aname" >> "$arp_tmp" + done + fi + if [ -f "$arp_tmp" ]; then + while IFS='|' read -r aip aname; do + [ -z "$aip" ] && continue + [ "$first" -eq 1 ] || devjson="$devjson," + first=0 + devjson="$devjson{\"ip\":\"$aip\",\"name\":\"$(esc "$aname")\",\"excluded\":$(printf '%s\n' "$current" | grep -qx "$aip" && echo true || echo false)}" + done < "$arp_tmp" + rm -f "$arp_tmp" + fi + local ip2 for ip2 in $current; do [ -z "$ip2" ] && continue