Please forget this patch, it is slightly incompatible with the version
that already exists in trunk... I will update trunk instead.
bruno
On 10/10/2013 01:16 PM, Bruno Randolf wrote:
Signed-off-by: Bruno Randolf <b...@einfach.org>
---
net/isc-dhcp/Makefile | 6 +++--
net/isc-dhcp/files/dhcrelay.config | 15 +++++++++++
net/isc-dhcp/files/dhcrelay.init | 51 ++++++++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+), 2 deletions(-)
create mode 100644 net/isc-dhcp/files/dhcrelay.config
create mode 100755 net/isc-dhcp/files/dhcrelay.init
diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile
index 798ee32..d3aa397 100644
--- a/net/isc-dhcp/Makefile
+++ b/net/isc-dhcp/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=isc-dhcp
UPSTREAM_NAME:=dhcp
PKG_VERSION:=4.2.4
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(UPSTREAM_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/$(PKG_VERSION)
@@ -171,8 +171,10 @@ define Build/Compile
endef
define Package/isc-dhcp-relay-$(BUILD_VARIANT)/install
- $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhcrelay $(1)/usr/sbin
+ $(INSTALL_BIN) ./files/dhcrelay.init $(1)/etc/init.d/dhcrelay
+ $(INSTALL_BIN) ./files/dhcrelay.config $(1)/etc/config/dhcrelay
endef
define Package/isc-dhcp-server-$(BUILD_VARIANT)/install
diff --git a/net/isc-dhcp/files/dhcrelay.config
b/net/isc-dhcp/files/dhcrelay.config
new file mode 100644
index 0000000..a303a60
--- /dev/null
+++ b/net/isc-dhcp/files/dhcrelay.config
@@ -0,0 +1,15 @@
+config 'dhcrelay'
+ option 'enabled' '0'
+
+ # IP address of the server
+ option 'server' ''
+
+ # 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' ''
diff --git a/net/isc-dhcp/files/dhcrelay.init b/net/isc-dhcp/files/dhcrelay.init
new file mode 100755
index 0000000..e66d34b
--- /dev/null
+++ b/net/isc-dhcp/files/dhcrelay.init
@@ -0,0 +1,51 @@
+#!/bin/sh /etc/rc.common
+START=75
+
+BIN="/usr/sbin/dhcrelay"
+
+dhcrelay_start() {
+ local cfg="$1"
+ local args=""
+
+ local enabled
+ config_get_bool enabled "$cfg" enabled 0
+ [ "${enabled}" -eq 0 ] && return 0
+
+ # listen interfaces
+ local interfaces
+ config_get interfaces "$cfg" interfaces
+ if [ -n "${interfaces}" ]; then
+ for net in $interfaces; do
+ local ifname
+ config_get ifname "$net" ifname
+ [ -n "$ifname" ] && append args "-i $ifname"
+ done
+ else
+ return 0
+ fi
+
+ # relay mode
+ local relay_mode
+ config_get relay_mode "$cfg" relay_mode
+ [ -n "$relay_mode" ] && append args "-m $relay_mode"
+
+ # dhcp server address
+ local server
+ config_get server "$cfg" server
+ [ -n "${server}" ] || return 0
+ append args "${server}"
+
+ start-stop-daemon -S -x ${BIN} -- -q ${args}
+ return $?
+}
+
+start() {
+ include /lib/network
+ scan_interfaces
+ config_load dhcrelay
+ config_foreach dhcrelay_start dhcrelay
+}
+
+stop() {
+ start-stop-daemon -K -x ${BIN}
+}
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel