diff options
Diffstat (limited to 'meta-networking')
5 files changed, 158 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb new file mode 100644 index 0000000000..bd816106c5 --- /dev/null +++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | SECTION = "console/network" | ||
| 2 | SUMMARY = "Internet Software Consortium DHCP Relay Agent" | ||
| 3 | DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \ | ||
| 4 | LAN to another, so that a DHCP server is not needed on every LAN." | ||
| 5 | |||
| 6 | HOMEPAGE = "http://www.isc.org/" | ||
| 7 | |||
| 8 | LICENSE = "ISC" | ||
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01" | ||
| 10 | |||
| 11 | DEPENDS = "openssl libcap zlib" | ||
| 12 | |||
| 13 | SRC_URI = "https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \ | ||
| 14 | file://default-relay \ | ||
| 15 | file://init-relay \ | ||
| 16 | file://dhcrelay.service \ | ||
| 17 | file://0001-Makefile.am-only-build-dhcrelay.patch \ | ||
| 18 | " | ||
| 19 | |||
| 20 | SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1" | ||
| 21 | SRC_URI[sha256sum] = "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521" | ||
| 22 | |||
| 23 | UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/" | ||
| 24 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/" | ||
| 25 | |||
| 26 | S = "${WORKDIR}/dhcp-${PV}" | ||
| 27 | |||
| 28 | inherit autotools-brokensep systemd | ||
| 29 | |||
| 30 | SYSTEMD_SERVICE_${PN} = "dhcrelay.service" | ||
| 31 | SYSTEMD_AUTO_ENABLE_${PN} = "disable" | ||
| 32 | |||
| 33 | CFLAGS += "-D_GNU_SOURCE -fcommon" | ||
| 34 | LDFLAGS_append = " -pthread" | ||
| 35 | |||
| 36 | EXTRA_OECONF = "--enable-paranoia \ | ||
| 37 | --disable-static \ | ||
| 38 | --enable-libtool \ | ||
| 39 | --with-randomdev=/dev/random \ | ||
| 40 | " | ||
| 41 | |||
| 42 | # Enable shared libs per dhcp README | ||
| 43 | do_configure_prepend () { | ||
| 44 | cp configure.ac+lt configure.ac | ||
| 45 | } | ||
| 46 | |||
| 47 | do_install_append () { | ||
| 48 | install -d ${D}${sysconfdir}/default | ||
| 49 | install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay | ||
| 50 | |||
| 51 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
| 52 | install -d ${D}${systemd_unitdir}/system | ||
| 53 | install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system | ||
| 54 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcrelay.service | ||
| 55 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service | ||
| 56 | else | ||
| 57 | install -d ${D}${sysconfdir}/init.d | ||
| 58 | install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay | ||
| 59 | fi | ||
| 60 | } | ||
| 61 | |||
| 62 | PARALLEL_MAKE = "" | ||
diff --git a/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch b/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch new file mode 100644 index 0000000000..fed85d2a8c --- /dev/null +++ b/meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From 17cc080e58894644dd18664ac6f3451096d5f065 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
| 3 | Date: Thu, 13 May 2021 15:23:16 +0800 | ||
| 4 | Subject: [PATCH] Makefile.am: only build dhcrelay | ||
| 5 | |||
| 6 | Drop client and server build as we don't need them. | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [embedded specific] | ||
| 9 | |||
| 10 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
| 11 | --- | ||
| 12 | Makefile.am | 2 +- | ||
| 13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/Makefile.am b/Makefile.am | ||
| 16 | index ed692a5..34f9772 100644 | ||
| 17 | --- a/Makefile.am | ||
| 18 | +++ b/Makefile.am | ||
| 19 | @@ -38,7 +38,7 @@ endif | ||
| 20 | |||
| 21 | # Use an autoconf substitution vs an automake conditional here | ||
| 22 | # to fool automake when the bind directory does not exist. | ||
| 23 | -SUBDIRS = @BINDSUBDIR@ includes tests common omapip client dhcpctl relay server | ||
| 24 | +SUBDIRS = @BINDSUBDIR@ includes common omapip relay | ||
| 25 | |||
| 26 | DIST_SUBDIRS = $(SUBDIRS) keama | ||
| 27 | |||
| 28 | -- | ||
| 29 | 2.17.1 | ||
| 30 | |||
diff --git a/meta-networking/recipes-connectivity/dhcp/files/default-relay b/meta-networking/recipes-connectivity/dhcp/files/default-relay new file mode 100644 index 0000000000..7961f014be --- /dev/null +++ b/meta-networking/recipes-connectivity/dhcp/files/default-relay | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # Defaults for dhcp-relay initscript | ||
| 2 | # sourced by /etc/init.d/dhcp-relay | ||
| 3 | |||
| 4 | # What servers should the DHCP relay forward requests to? | ||
| 5 | # e.g: SERVERS="192.168.0.1" | ||
| 6 | SERVERS="" | ||
| 7 | |||
| 8 | # On what interfaces should the DHCP relay (dhrelay) serve DHCP requests? | ||
| 9 | INTERFACES="" | ||
| 10 | |||
| 11 | # Additional options that are passed to the DHCP relay daemon? | ||
| 12 | OPTIONS="" | ||
diff --git a/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service new file mode 100644 index 0000000000..15ff927d34 --- /dev/null +++ b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=DHCP Relay Agent Daemon | ||
| 3 | After=network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | EnvironmentFile=@SYSCONFDIR@/default/dhcp-relay | ||
| 7 | ExecStart=@SBINDIR@/dhcrelay -d --no-pid -q $SERVERS | ||
| 8 | |||
| 9 | [Install] | ||
| 10 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-connectivity/dhcp/files/init-relay b/meta-networking/recipes-connectivity/dhcp/files/init-relay new file mode 100644 index 0000000000..019a7e84cf --- /dev/null +++ b/meta-networking/recipes-connectivity/dhcp/files/init-relay | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # $Id: dhcp3-relay,v 1.1 2004/04/16 15:41:08 ml Exp $ | ||
| 4 | # | ||
| 5 | |||
| 6 | # It is not safe to start if we don't have a default configuration... | ||
| 7 | if [ ! -f /etc/default/dhcp-relay ]; then | ||
| 8 | echo "/etc/default/dhcp-relay does not exist! - Aborting..." | ||
| 9 | echo "create this file to fix the problem." | ||
| 10 | exit 1 | ||
| 11 | fi | ||
| 12 | |||
| 13 | # Read init script configuration (interfaces the daemon should listen on | ||
| 14 | # and the DHCP server we should forward requests to.) | ||
| 15 | . /etc/default/dhcp-relay | ||
| 16 | |||
| 17 | # Build command line for interfaces (will be passed to dhrelay below.) | ||
| 18 | IFCMD="" | ||
| 19 | if test "$INTERFACES" != ""; then | ||
| 20 | for I in $INTERFACES; do | ||
| 21 | IFCMD=${IFCMD}"-i "${I}" " | ||
| 22 | done | ||
| 23 | fi | ||
| 24 | |||
| 25 | DHCRELAYPID=/var/run/dhcrelay.pid | ||
| 26 | |||
| 27 | case "$1" in | ||
| 28 | start) | ||
| 29 | start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS | ||
| 30 | ;; | ||
| 31 | stop) | ||
| 32 | start-stop-daemon -K -x /usr/sbin/dhcrelay | ||
| 33 | ;; | ||
| 34 | restart | force-reload) | ||
| 35 | $0 stop | ||
| 36 | sleep 2 | ||
| 37 | $0 start | ||
| 38 | ;; | ||
| 39 | *) | ||
| 40 | echo "Usage: /etc/init.d/dhcp-relay {start|stop|restart|force-reload}" | ||
| 41 | exit 1 | ||
| 42 | esac | ||
| 43 | |||
| 44 | exit 0 | ||
