summaryrefslogtreecommitdiff
path: root/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-connectivity/dhcp/files')
-rw-r--r--meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch30
-rw-r--r--meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/default-relay12
-rw-r--r--meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service10
-rw-r--r--meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/init-relay44
4 files changed, 96 insertions, 0 deletions
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
new file mode 100644
index 000000000..fed85d2a8
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
@@ -0,0 +1,30 @@
+From 17cc080e58894644dd18664ac6f3451096d5f065 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <yi.zhao@windriver.com>
+Date: Thu, 13 May 2021 15:23:16 +0800
+Subject: [PATCH] Makefile.am: only build dhcrelay
+
+Drop client and server build as we don't need them.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index ed692a5..34f9772 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -38,7 +38,7 @@ endif
+
+ # Use an autoconf substitution vs an automake conditional here
+ # to fool automake when the bind directory does not exist.
+-SUBDIRS = @BINDSUBDIR@ includes tests common omapip client dhcpctl relay server
++SUBDIRS = @BINDSUBDIR@ includes common omapip relay
+
+ DIST_SUBDIRS = $(SUBDIRS) keama
+
+--
+2.17.1
+
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/default-relay b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/default-relay
new file mode 100644
index 000000000..7961f014b
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/default-relay
@@ -0,0 +1,12 @@
+# Defaults for dhcp-relay initscript
+# sourced by /etc/init.d/dhcp-relay
+
+# What servers should the DHCP relay forward requests to?
+# e.g: SERVERS="192.168.0.1"
+SERVERS=""
+
+# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
+INTERFACES=""
+
+# Additional options that are passed to the DHCP relay daemon?
+OPTIONS=""
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
new file mode 100644
index 000000000..15ff927d3
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=DHCP Relay Agent Daemon
+After=network.target
+
+[Service]
+EnvironmentFile=@SYSCONFDIR@/default/dhcp-relay
+ExecStart=@SBINDIR@/dhcrelay -d --no-pid -q $SERVERS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/init-relay b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/init-relay
new file mode 100644
index 000000000..019a7e84c
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/init-relay
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $Id: dhcp3-relay,v 1.1 2004/04/16 15:41:08 ml Exp $
+#
+
+# It is not safe to start if we don't have a default configuration...
+if [ ! -f /etc/default/dhcp-relay ]; then
+ echo "/etc/default/dhcp-relay does not exist! - Aborting..."
+ echo "create this file to fix the problem."
+ exit 1
+fi
+
+# Read init script configuration (interfaces the daemon should listen on
+# and the DHCP server we should forward requests to.)
+. /etc/default/dhcp-relay
+
+# Build command line for interfaces (will be passed to dhrelay below.)
+IFCMD=""
+if test "$INTERFACES" != ""; then
+ for I in $INTERFACES; do
+ IFCMD=${IFCMD}"-i "${I}" "
+ done
+fi
+
+DHCRELAYPID=/var/run/dhcrelay.pid
+
+case "$1" in
+ start)
+ start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS
+ ;;
+ stop)
+ start-stop-daemon -K -x /usr/sbin/dhcrelay
+ ;;
+ restart | force-reload)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/dhcp-relay {start|stop|restart|force-reload}"
+ exit 1
+esac
+
+exit 0