isc-dhcp: dhcrelay: Add more UCI options
Add more options to dhcrelay UCI and init script: - enabled - interfaces: Listen interfaces - relay_mode: What to do about packets that already have a relay option Also mark /etc/config/dhcrelay as conffile Signed-off-by: Bruno Randolf <br1@einfach.org> git-svn-id: svn://svn.openwrt.org/openwrt/packages@38446 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
8aba712580
commit
a8ce2d5f8c
@ -55,11 +55,19 @@ $(call Package/isc-dhcp-relay-ipv6/description)
|
|||||||
This package is compiled with IPv4 support only.
|
This package is compiled with IPv4 support only.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/isc-dhcp-relay-ipv4/conffiles
|
||||||
|
/etc/config/dhcrelay
|
||||||
|
endef
|
||||||
|
|
||||||
define Package/isc-dhcp-relay-ipv6/description
|
define Package/isc-dhcp-relay-ipv6/description
|
||||||
$(call Package/isc-dhcp-relay/description)
|
$(call Package/isc-dhcp-relay/description)
|
||||||
This package is compiled with IPv4 and IPv6 support.
|
This package is compiled with IPv4 and IPv6 support.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/isc-dhcp-relay-ipv6/conffiles
|
||||||
|
/etc/config/dhcrelay
|
||||||
|
endef
|
||||||
|
|
||||||
define Package/isc-dhcp-client-ipv4
|
define Package/isc-dhcp-client-ipv4
|
||||||
$(call Package/isc-dhcp/Default)
|
$(call Package/isc-dhcp/Default)
|
||||||
TITLE+= client (without IPv6)
|
TITLE+= client (without IPv6)
|
||||||
|
@ -8,15 +8,39 @@ SERVICE_PID_FILE="/var/run/dhcrelay4.pid"
|
|||||||
SERVICE_USE_PID=1
|
SERVICE_USE_PID=1
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
local relay_dhcpserver
|
. /lib/functions/network.sh
|
||||||
|
config_load dhcrelay
|
||||||
|
local args=""
|
||||||
|
|
||||||
config_load dhcrelay
|
local enabled
|
||||||
config_get relay_dhcpserver ipv4 dhcpserver
|
config_get_bool enabled ipv4 enabled 0
|
||||||
|
[ "$enabled" -eq 0 ] && return 0
|
||||||
|
|
||||||
service_start /usr/sbin/dhcrelay -4 -q \
|
# listen interfaces
|
||||||
-pf $SERVICE_PID_FILE $relay_dhcpserver
|
local interfaces
|
||||||
|
local ifname
|
||||||
|
config_get interfaces ipv4 interfaces
|
||||||
|
for net in $interfaces; do
|
||||||
|
if network_get_device ifname "$net"; then
|
||||||
|
append args "-i $ifname"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# relay mode
|
||||||
|
local relay_mode
|
||||||
|
config_get relay_mode ipv4 relay_mode
|
||||||
|
[ -n "$relay_mode" ] && append args "-m $relay_mode"
|
||||||
|
|
||||||
|
# dhcp server address
|
||||||
|
local server
|
||||||
|
config_get server ipv4 dhcpserver
|
||||||
|
[ -n "$server" ] || return 0
|
||||||
|
append args "$server"
|
||||||
|
|
||||||
|
service_start /usr/sbin/dhcrelay -4 -q \
|
||||||
|
-pf $SERVICE_PID_FILE $args
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
service_stop /usr/sbin/dhcrelay
|
service_stop /usr/sbin/dhcrelay
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,24 @@
|
|||||||
|
|
||||||
config dhcrelay ipv4
|
config dhcrelay ipv4
|
||||||
option dhcpserver '192.0.2.10'
|
option 'enabled' '0'
|
||||||
|
|
||||||
|
# IP address of the server
|
||||||
|
option 'dhcpserver' '192.0.2.10'
|
||||||
|
|
||||||
|
# network interfaces to listen on (e.g. lan or wan)
|
||||||
|
option 'interfaces' ''
|
||||||
|
|
||||||
|
# What to do about packets that already have a relay option:
|
||||||
|
# 'append': Forward and append our own relay option
|
||||||
|
# 'replace': Forward, but replace theirs with ours (default)
|
||||||
|
# 'forward': Forward without changes
|
||||||
|
# 'discard': Don't forward
|
||||||
|
option 'relay_mode' ''
|
||||||
|
|
||||||
|
|
||||||
config dhcrelay ipv6
|
config dhcrelay ipv6
|
||||||
# option dhcpserver '2001:db8:1::1'
|
# option dhcpserver '2001:db8:1::1'
|
||||||
option upper 'eth1'
|
option upper 'eth1'
|
||||||
list lower 'eth0.2'
|
list lower 'eth0.2'
|
||||||
list lower 'eth0.3'
|
list lower 'eth0.3'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user