aboutsummaryrefslogtreecommitdiff
path: root/net/isc-dhcp/files/dhcrelay4.init
diff options
context:
space:
mode:
authorAntony Antony <antony@phenome.org>2016-03-25 13:17:46 +0100
committerAntony Antony <antony@phenome.org>2016-03-25 13:17:46 +0100
commit7f594309bfcc18db17a7214eed0f63f3d1bb2e59 (patch)
tree450dc77511474d3d5474ec398119b6b24f15c00c /net/isc-dhcp/files/dhcrelay4.init
parent4457604f3b1c5fa4e76ddf23dc69bf0c312bc923 (diff)
isc-dhcp: update to 4.3.3. Migrate from oldplackages
Signed-off-by: Antony Antony <antony@phenome.org>
Diffstat (limited to 'net/isc-dhcp/files/dhcrelay4.init')
-rw-r--r--net/isc-dhcp/files/dhcrelay4.init53
1 files changed, 53 insertions, 0 deletions
diff --git a/net/isc-dhcp/files/dhcrelay4.init b/net/isc-dhcp/files/dhcrelay4.init
new file mode 100644
index 000000000..9af0f84e1
--- /dev/null
+++ b/net/isc-dhcp/files/dhcrelay4.init
@@ -0,0 +1,53 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+
+START=91
+
+SERVICE_SIG="KILL"
+SERVICE_PID_FILE="/var/run/dhcrelay4.pid"
+SERVICE_USE_PID=1
+
+start() {
+ . /lib/functions/network.sh
+ config_load dhcrelay
+ local args=""
+
+ local enabled
+ config_get_bool enabled ipv4 enabled 0
+ [ "$enabled" -eq 0 ] && return 0
+
+ # listen interfaces
+ 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
+
+ # link selection sub-option (RFC3527)
+ local link_selection
+ config_get link_selection ipv4 link_selection
+ if network_get_device ifname "$link_selection"; then
+ append args "-l $ifname"
+ fi
+
+ # 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() {
+ service_stop /usr/sbin/dhcrelay
+}