Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions applications/luci-app-arpbind/Makefile
Original file line number Diff line number Diff line change
@@ -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 ../../luci.mk

# call BuildPackage - OpenWrt buildroot signature
Original file line number Diff line number Diff line change
@@ -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 changes: 38 additions & 0 deletions applications/luci-app-arpbind/po/templates/arpbind.pot
Original file line number Diff line number Diff line change
@@ -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 ""
53 changes: 53 additions & 0 deletions applications/luci-app-arpbind/po/zh_Hans/arpbind.po
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions applications/luci-app-arpbind/root/etc/config/arpbind
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

config arpbind
option enabled '0'
option ipaddr ''
option macaddr ''
option ifname ''

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

[ "$ACTION" = "ifup" ] && /etc/init.d/arpbind start
exit 0
48 changes: 48 additions & 0 deletions applications/luci-app-arpbind/root/etc/init.d/arpbind
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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 }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"luci-app-arpbind": {
"description": "Grant UCI access for luci-app-arpbind",
"read": {
"uci": [ "arpbind" ]
},
"write": {
"uci": [ "arpbind" ]
}
}
}
52 changes: 52 additions & 0 deletions applications/luci-app-diskman/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-diskman
PKG_VERSION:=0.2.13
PKG_RELEASE:=1

PKG_MAINTAINER:=lisaac <lisaac.cn@gmail.com>
PKG_LICENSE:=AGPL-3.0

LUCI_TITLE:=Disk Manager interface for LuCI
LUCI_DEPENDS:= \
+luci-compat +blkid +e2fsprogs +parted +smartmontools +dosfstools \
+kmod-fs-msdos +kmod-fs-ntfs3 +kmod-fs-exfat +exfat-mkfs \
+exfat-fsck +kmod-nls-cp932 +kmod-nls-cp936 +kmod-nls-cp950 \
+PACKAGE_$(PKG_NAME)_INCLUDE_btrfs_progs:btrfs-progs \
+PACKAGE_$(PKG_NAME)_INCLUDE_lsblk:lsblk \
+PACKAGE_$(PKG_NAME)_INCLUDE_mdadm:mdadm \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:mdadm \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:kmod-md-raid456 \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:mdadm \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:kmod-md-linear

define Package/luci-app-diskman/config
config PACKAGE_$(PKG_NAME)_INCLUDE_btrfs_progs
depends on PACKAGE_$(PKG_NAME)
bool "Include btrfs-progs"
default y

config PACKAGE_$(PKG_NAME)_INCLUDE_lsblk
depends on PACKAGE_$(PKG_NAME)
bool "Include lsblk"
default y

config PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
depends on PACKAGE_$(PKG_NAME)
bool "Include mdadm"
default n

config PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456
depends on PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
bool "Include kmod-md-raid456"
default n

config PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears
depends on PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
bool "Include kmod-md-linear"
default n
endef

include ../../luci.mk

# call BuildPackage - OpenWrt buildroot signature
Loading
Loading