mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 07:25:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,7 @@
|
||||
|
||||
config arpbind
|
||||
option enabled '0'
|
||||
option ipaddr ''
|
||||
option macaddr ''
|
||||
option ifname ''
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = "ifup" ] && /etc/init.d/arpbind start
|
||||
exit 0
|
||||
Executable
+48
@@ -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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user