update 2026-07-28 01:38:11

This commit is contained in:
action committed 2026-07-28 01:38:11 +08:00
1 parent 20b786ab77
commit 25d570431d
6243 files changed
+2850542

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=ARP Binding
LUCI_DEPENDS:=+ip-full
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-arpbind
PKG_VERSION:=1
PKG_RELEASE:=4
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,14 @@
--[[
静态ARP绑定 Luci页面 Controller
Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
]]--
module("luci.controller.arpbind", package.seeall)
function index()
if not nixio.fs.access("/etc/config/arpbind") then
return
end
entry({"admin", "network", "arpbind"}, cbi("arpbind"), _("IP/MAC Binding"), 45).dependent = true
end
@@ -0,0 +1,40 @@
local sys = require "luci.sys"
local ifaces = sys.net:devices()
m = Map("arpbind")
m.title = translate("IP/MAC Binding")
m.description = translatef("ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.Here you can add some static ARP binding rules.")
s = m:section(TypedSection, "arpbind", translate("Rules"))
s.template = "cbi/tblsection"
s.anonymous = true
s.addremove = true
a = s:option(Value, "ipaddr", translate("IP Address"))
a.optional = false
a.datatype = "ipaddr"
luci.ip.neighbors({ family = 4 }, function(entry)
if entry.reachable then
a:value(entry.dest:string())
end
end)
a = s:option(Value, "macaddr", translate("MAC Address"))
a.datatype = "macaddr"
a.optional = false
luci.ip.neighbors({family = 4}, function(neighbor)
if neighbor.reachable then
a:value(neighbor.mac, "%s (%s)" %{neighbor.mac, neighbor.dest:string()})
end
end)
a = s:option(ListValue, "ifname", translate("Interface"))
for _, iface in ipairs(ifaces) do
if iface ~= "lo" then
a:value(iface)
end
end
a.default = "br-lan"
a.rmempty = false
return m
+30
View File
@@ -0,0 +1,30 @@
msgid ""
msgstr ""
"Project-Id-Version: Luci ARP Bind\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-23 20:16+0800\n"
"PO-Revision-Date: 2015-06-23 20:17+0800\n"
"Last-Translator: 981213 <gch981213@gmail.com>\n"
"Language-Team: PandoraBox Team\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.8.1\n"
"X-Poedit-SourceCharset: UTF-8\n"
msgid "IP/MAC Binding"
msgstr "IP/MAC 绑定"
msgid "IP Address"
msgstr "IP 地址"
msgid "MAC Address"
msgstr "MAC 地址"
msgid "ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.Here you can add some static ARP binding rules."
msgstr "ARP 协议是用于实现网络地址到物理地址转换的协议。在这里,你可以设置静态 ARP 绑定规则。"
msgid "Rules"
msgstr "规则"
+1
View File
@@ -0,0 +1 @@
zh-cn
@@ -0,0 +1,2 @@
#!/bin/sh
[ "$ACTION" = "ifup" ] && /etc/init.d/arpbind start
+55
View File
@@ -0,0 +1,55 @@
#!/bin/sh /etc/rc.common
# OpenWrt 静态ARP绑定 启动脚本
# Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
START=80
STOP=20
#清除单接口ARP
#参数:$1:接口名称
if_clean_arp()
{
[ -z "$1" ] && return
ip link set arp off dev $1
ip link set arp on dev $1
}
#清除系统所有ARP
#参数:无
clean_arp()
{
for i in $(ls /sys/class/net)
do
if_clean_arp $i
done
}
#添加静态ARP绑定
#参数:$1:IP地址 $2:MAC地址 $3:接口名称
add_arp()
{
[ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] && return
echo "Adding ARP:IP Addr:$1 MAC Addr:$2 Interface:$3"
ip neigh add $1 lladdr $2 nud permanent dev $3 || \
ip neigh change $1 lladdr $2 nud permanent dev $3
}
arpconf_foreach()
{
config_get ipaddr "$1" 'ipaddr'
config_get macaddr "$1" 'macaddr'
config_get ifname "$1" 'ifname'
[ -z "$ifname" ] && return
add_arp $ipaddr $macaddr $ifname
}
start()
{
config_load 'arpbind'
config_foreach arpconf_foreach 'arpbind'
}
stop()
{
clean_arp
}
@@ -0,0 +1,12 @@
#!/bin/sh
touch /etc/config/arpbind
uci -q batch <<-EOF >/dev/null
delete ucitrack.@arpbind[-1]
add ucitrack arpbind
set ucitrack.@arpbind[-1].init=arpbind
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0
@@ -0,0 +1,11 @@
{
"luci-app-arpbind": {
"description": "Grant UCI access for luci-app-arpbind",
"read": {
"uci": [ "arpbind" ]
},
"write": {
"uci": [ "arpbind" ]
}
}
}
@@ -0,0 +1,4 @@
{
"config": "arpbind",
"init": "arpbind"
}