🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
# Copyright (C) 2025 ImmortalWrt.org
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for ARP binding
LUCI_DEPENDS:=+ip
define Package/luci-app-arpbind/conffiles
/etc/config/arpbind
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,69 @@
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
* Copyright (C) 2025 ImmortalWrt.org
*/
'use strict';
'require form';
'require network';
'require view';
'require tools.widgets as widgets';
return view.extend({
load: function() {
return Promise.all([
network.getHostHints()
]);
},
render: function (data) {
let m, s, o;
let hosts = data[0]?.hosts;
let ipaddrs = {};
m = new form.Map('arpbind', _('IP/MAC Binding'),
_('ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.<br />Here you can add some static ARP binding rules.'));
s = m.section(form.TableSection, 'arpbind', _('Rules'));
s.addremove = true;
s.anonymous = true;
s.sortable = true;
s.rowcolors = true;
o = s.option(form.Flag, 'enabled', _('Disable'));
o.enabled = '0';
o.disabled = '1';
o.default = o.disabled;
o = s.option(form.Value, 'ipaddr', _('IP Address'));
o.datatype = 'ipaddr';
Object.keys(hosts).forEach(function(mac) {
let addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
for (let i = 0; i < addrs.length; i++)
ipaddrs[addrs[i]] = hosts[mac].name || mac;
});
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
o.value(ipv4, '%s (%s)'.format(ipv4, ipaddrs[ipv4]));
});
o.rmempty = false;
o = s.option(form.Value, 'macaddr', _('MAC Address'));
o.datatype = 'macaddr';
Object.keys(hosts).forEach(function(mac) {
let hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
o.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
});
o.rmempty = false;
o = s.option(widgets.DeviceSelect, 'ifname', _('Interface'));
o.multiple = false;
o.noaliases = true;
o.nocreate = true;
o.rmempty = false;
return m.render();
}
});
+38
View File
@@ -0,0 +1,38 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:27
msgid ""
"ARP is used to convert a network address (e.g. an IPv4 address) to a "
"physical address such as a MAC address.<br />Here you can add some static "
"ARP binding rules."
msgstr ""
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:35
msgid "Disable"
msgstr ""
#: applications/luci-app-arpbind/root/usr/share/rpcd/acl.d/luci-app-arpbind.json:3
msgid "Grant UCI access for luci-app-arpbind"
msgstr ""
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:40
msgid "IP Address"
msgstr ""
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:26
#: applications/luci-app-arpbind/root/usr/share/luci/menu.d/luci-app-arpbind.json:3
msgid "IP/MAC Binding"
msgstr ""
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:61
msgid "Interface"
msgstr ""
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:53
msgid "MAC Address"
msgstr ""
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:29
msgid "Rules"
msgstr ""
+1
View File
@@ -0,0 +1 @@
zh_Hans
+53
View File
@@ -0,0 +1,53 @@
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_Hans\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"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:27
msgid ""
"ARP is used to convert a network address (e.g. an IPv4 address) to a "
"physical address such as a MAC address.<br />Here you can add some static "
"ARP binding rules."
msgstr ""
"ARP协议是用于实现网络地址到物理地址转换的协议。<br />在这里,你可以设置静态"
"ARP绑定规则。"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:35
msgid "Disable"
msgstr "禁用"
#: applications/luci-app-arpbind/root/usr/share/rpcd/acl.d/luci-app-arpbind.json:3
msgid "Grant UCI access for luci-app-arpbind"
msgstr "授予 luci-app-arpbind 访问 UCI 配置的权限"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:40
msgid "IP Address"
msgstr "IP 地址"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:26
#: applications/luci-app-arpbind/root/usr/share/luci/menu.d/luci-app-arpbind.json:3
msgid "IP/MAC Binding"
msgstr "IP/MAC绑定"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:61
msgid "Interface"
msgstr "接口"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:53
msgid "MAC Address"
msgstr "MAC 地址"
#: applications/luci-app-arpbind/htdocs/luci-static/resources/view/arpbind.js:29
msgid "Rules"
msgstr "规则"
+7
View File
@@ -0,0 +1,7 @@
config arpbind
option enabled '0'
option ipaddr ''
option macaddr ''
option ifname ''
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
[ "$ACTION" = "ifup" ] && /etc/init.d/arpbind start
exit 0
+48
View File
@@ -0,0 +1,48 @@
#!/bin/sh /etc/rc.common
# OpenWrt 静态ARP绑定 启动脚本
# Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
START=80
STOP=20
USE_PROCD=1
setup_arp() {
local cfg="$1"
local enabled ipaddr macaddr ifname
config_get_bool enabled "$cfg" "enabled" "1"
[ "$enabled" -eq "1" ] || return 1
config_get ipaddr "$cfg" "ipaddr"
config_get macaddr "$cfg" "macaddr"
config_get ifname "$cfg" "ifname"
if [ -z "$ipaddr" ] || [ -z "$macaddr" ] || [ -z "$ifname" ]; then
return 1
fi
ip neigh add "$ipaddr" lladdr "$macaddr" nud permanent dev "$ifname" || \
ip neigh change "$ipaddr" lladdr "$macaddr" nud permanent dev "$ifname"
}
start_service() {
config_load "arpbind"
config_foreach setup_arp "arpbind"
}
stop_service() {
ls "/sys/class/net" | while IFS= read -r ifname; do
ip link set arp off dev "$ifname"
ip link set arp on dev "$ifname"
done
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger "arpbind"
}
@@ -0,0 +1,14 @@
{
"admin/network/arpbind": {
"title": "IP/MAC Binding",
"order": 45,
"action": {
"type": "view",
"path": "arpbind"
},
"depends": {
"acl": [ "luci-app-arpbind" ],
"uci": { "arpbind": true }
}
}
}
@@ -0,0 +1,11 @@
{
"luci-app-arpbind": {
"description": "Grant UCI access for luci-app-arpbind",
"read": {
"uci": [ "arpbind" ]
},
"write": {
"uci": [ "arpbind" ]
}
}
}