luci-0.9: drop luci_ethers, static lease mgmnt. is now covered by /etc/config/dhcp

This commit is contained in:
Jo-Philipp Wich 2010-03-08 01:07:02 +00:00
parent 7ae301e92c
commit 773e6b78c3
3 changed files with 6 additions and 42 deletions

View file

@ -1,37 +0,0 @@
#!/bin/sh /etc/rc.common
START=59
apply_lease() {
local cfg="$1"
config_get macaddr "$cfg" macaddr
config_get ipaddr "$cfg" ipaddr
[ -n "$macaddr" -a -n "$ipaddr" ] || return 0
echo "$macaddr $ipaddr" >> /var/etc/ethers
}
start() {
if [ ! -L /etc/ethers ]; then
test -f /etc/ethers && mv /etc/ethers /etc/ethers.local
ln -s /var/etc/ethers /etc/ethers
fi
test -d /var/etc || mkdir -p /var/etc
echo "# This file is autogenerated, use /etc/ethers.local instead" > /var/etc/ethers
config_load luci_ethers
config_foreach apply_lease static_lease
test -f /etc/ethers.local && cat /etc/ethers.local >> /var/etc/ethers
return 0
}
stop() {
test -f /var/etc/ethers && rm -f /var/etc/ethers
return 0
}

View file

@ -2,6 +2,7 @@
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -17,7 +18,7 @@ local sys = require "luci.sys"
local wa = require "luci.tools.webadmin"
local fs = require "nixio.fs"
m2 = Map("luci_ethers", translate("dhcp_leases"))
m2 = Map("dhcp", translate("dhcp_leases"))
local leasefn, leasefp, leases
uci:foreach("dhcp", "dnsmasq",
@ -46,13 +47,14 @@ if leases then
end
end
s = m2:section(TypedSection, "static_lease", translate("luci_ethers"))
s = m2:section(TypedSection, "host", translate("luci_ethers"))
s.addremove = true
s.anonymous = true
s.template = "cbi/tblsection"
mac = s:option(Value, "macaddr", translate("macaddress"))
ip = s:option(Value, "ipaddr", translate("ipaddress"))
name = s:option(Value, "name", translate("hostname"))
mac = s:option(Value, "mac", translate("macaddress"))
ip = s:option(Value, "ip", translate("ipaddress"))
sys.net.arptable(function(entry)
ip:value(entry["IP address"])
mac:value(