All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [oe] [meta-networking][PATCH] dhcp-relay: add recipe
       [not found] <167FC4DDC2069D52.24037@lists.openembedded.org>
@ 2021-05-24  6:36 ` Yi Zhao
  2021-05-24 14:23   ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Yi Zhao @ 2021-05-24  6:36 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 7966 bytes --]

Ping ...


//Yi


On 5/17/21 1:53 PM, Yi Zhao wrote:
> The current default dhcp server kea in oe-core doesn't provide
> dhcp-relay tool. Add a recipe to provide dhcrelay which is from dhcp.
> This patch is picked up from dhcp recipe with some tweaks. In order to
> fix the build dependency, we use bundled bind instead of external bind.
>
> Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
> ---
>   .../dhcp/dhcp-relay_4.4.2.bb                  | 62 +++++++++++++++++++
>   ...0001-Makefile.am-only-build-dhcrelay.patch | 30 +++++++++
>   .../dhcp/files/default-relay                  | 12 ++++
>   .../dhcp/files/dhcrelay.service               | 10 +++
>   .../dhcp/files/init-relay                     | 44 +++++++++++++
>   5 files changed, 158 insertions(+)
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/default-relay
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/init-relay
>
> 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 000000000..bd816106c
> --- /dev/null
> +++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
> @@ -0,0 +1,62 @@
> +SECTION = "console/network"
> +SUMMARY = "Internet Software Consortium DHCP Relay Agent"
> +DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
> +LAN to another, so that a DHCP server is not needed on every LAN."
> +
> +HOMEPAGE = "http://www.isc.org/"
> +
> +LICENSE = "ISC"
> +LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01"
> +
> +DEPENDS = "openssl libcap zlib"
> +
> +SRC_URI = "https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
> +           file://default-relay \
> +           file://init-relay \
> +           file://dhcrelay.service \
> +           file://0001-Makefile.am-only-build-dhcrelay.patch \
> +           "
> +
> +SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
> +SRC_URI[sha256sum] = "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521"
> +
> +UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/"
> +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
> +
> +S = "${WORKDIR}/dhcp-${PV}"
> +
> +inherit autotools-brokensep systemd
> +
> +SYSTEMD_SERVICE_${PN} = "dhcrelay.service"
> +SYSTEMD_AUTO_ENABLE_${PN} = "disable"
> +
> +CFLAGS += "-D_GNU_SOURCE -fcommon"
> +LDFLAGS_append = " -pthread"
> +
> +EXTRA_OECONF = "--enable-paranoia \
> +                --disable-static \
> +                --enable-libtool \
> +                --with-randomdev=/dev/random \
> +               "
> +
> +# Enable shared libs per dhcp README
> +do_configure_prepend () {
> +    cp configure.ac+lt configure.ac
> +}
> +
> +do_install_append () {
> +    install -d ${D}${sysconfdir}/default
> +    install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
> +
> +    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
> +        install -d ${D}${systemd_unitdir}/system
> +        install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
> +        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
> +        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
> +    else
> +        install -d ${D}${sysconfdir}/init.d
> +        install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
> +    fi
> +}
> +
> +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 000000000..fed85d2a8
> --- /dev/null
> +++ b/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-networking/recipes-connectivity/dhcp/files/default-relay b/meta-networking/recipes-connectivity/dhcp/files/default-relay
> new file mode 100644
> index 000000000..7961f014b
> --- /dev/null
> +++ b/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-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
> new file mode 100644
> index 000000000..15ff927d3
> --- /dev/null
> +++ b/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-networking/recipes-connectivity/dhcp/files/init-relay b/meta-networking/recipes-connectivity/dhcp/files/init-relay
> new file mode 100644
> index 000000000..019a7e84c
> --- /dev/null
> +++ b/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
>
> 
>

[-- Attachment #2: Type: text/html, Size: 9827 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [oe] [meta-networking][PATCH] dhcp-relay: add recipe
  2021-05-24  6:36 ` [oe] [meta-networking][PATCH] dhcp-relay: add recipe Yi Zhao
@ 2021-05-24 14:23   ` Khem Raj
  2021-05-25  8:50     ` Yi Zhao
  2021-05-25  8:56     ` [meta-networking][RESEND][PATCH] " Yi Zhao
  0 siblings, 2 replies; 6+ messages in thread
From: Khem Raj @ 2021-05-24 14:23 UTC (permalink / raw)
  To: Yi Zhao, openembedded-devel

Can you resend this patch ? secondly, I worry that since kea is way
to go we are adding a package which perhaps is virtually going to be
dead soon. Is there any work on kea itself providing similar functionality?

On 5/23/21 11:36 PM, Yi Zhao wrote:
> Ping ...
> 
> 
> //Yi
> 
> 
> On 5/17/21 1:53 PM, Yi Zhao wrote:
>> The current default dhcp server kea in oe-core doesn't provide
>> dhcp-relay tool. Add a recipe to provide dhcrelay which is from dhcp.
>> This patch is picked up from dhcp recipe with some tweaks. In order to
>> fix the build dependency, we use bundled bind instead of external bind.
>>
>> Signed-off-by: Yi Zhao<yi.zhao@windriver.com>
>> ---
>>   .../dhcp/dhcp-relay_4.4.2.bb                  | 62 +++++++++++++++++++
>>   ...0001-Makefile.am-only-build-dhcrelay.patch | 30 +++++++++
>>   .../dhcp/files/default-relay                  | 12 ++++
>>   .../dhcp/files/dhcrelay.service               | 10 +++
>>   .../dhcp/files/init-relay                     | 44 +++++++++++++
>>   5 files changed, 158 insertions(+)
>>   create mode 100644 meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
>>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
>>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/default-relay
>>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
>>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/init-relay
>>
>> 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 000000000..bd816106c
>> --- /dev/null
>> +++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
>> @@ -0,0 +1,62 @@
>> +SECTION = "console/network"
>> +SUMMARY = "Internet Software Consortium DHCP Relay Agent"
>> +DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
>> +LAN to another, so that a DHCP server is not needed on every LAN."
>> +
>> +HOMEPAGE ="http://www.isc.org/"
>> +
>> +LICENSE = "ISC"
>> +LIC_FILES_CHKSUM ="file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01"
>> +
>> +DEPENDS = "openssl libcap zlib"
>> +
>> +SRC_URI ="https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \ + 
>> file://default-relay \ + file://init-relay \ + file://dhcrelay.service 
>> \ + file://0001-Makefile.am-only-build-dhcrelay.patch \ + "
>> +
>> +SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
>> +SRC_URI[sha256sum] = "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521"
>> +
>> +UPSTREAM_CHECK_URI ="http://ftp.isc.org/isc/dhcp/"
>> +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
>> +
>> +S = "${WORKDIR}/dhcp-${PV}"
>> +
>> +inherit autotools-brokensep systemd
>> +
>> +SYSTEMD_SERVICE_${PN} = "dhcrelay.service"
>> +SYSTEMD_AUTO_ENABLE_${PN} = "disable"
>> +
>> +CFLAGS += "-D_GNU_SOURCE -fcommon"
>> +LDFLAGS_append = " -pthread"
>> +
>> +EXTRA_OECONF = "--enable-paranoia \
>> +                --disable-static \
>> +                --enable-libtool \
>> +                --with-randomdev=/dev/random \
>> +" + +# Enable shared libs per dhcp README +do_configure_prepend () { + 
>> cp configure.ac+lt configure.ac +} + +do_install_append () { + install 
>> -d ${D}${sysconfdir}/default + install -m 0644 
>> ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay + + if 
>> ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; 
>> then + install -d ${D}${systemd_unitdir}/system + install -m 0644 
>> ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system + sed -i -e 
>> 's,@SBINDIR@,${sbindir},g' 
>> ${D}${systemd_unitdir}/system/dhcrelay.service + sed -i -e 
>> 's,@SYSCONFDIR@,${sysconfdir},g' 
>> ${D}${systemd_unitdir}/system/dhcrelay.service + else + install -d 
>> ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init-relay 
>> ${D}${sysconfdir}/init.d/dhcp-relay + fi +} + +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 000000000..fed85d2a8
>> --- /dev/null
>> +++ b/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-networking/recipes-connectivity/dhcp/files/default-relay b/meta-networking/recipes-connectivity/dhcp/files/default-relay
>> new file mode 100644
>> index 000000000..7961f014b
>> --- /dev/null
>> +++ b/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-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
>> new file mode 100644
>> index 000000000..15ff927d3
>> --- /dev/null
>> +++ b/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-networking/recipes-connectivity/dhcp/files/init-relay b/meta-networking/recipes-connectivity/dhcp/files/init-relay
>> new file mode 100644
>> index 000000000..019a7e84c
>> --- /dev/null
>> +++ b/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
>>
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [oe] [meta-networking][PATCH] dhcp-relay: add recipe
  2021-05-24 14:23   ` Khem Raj
@ 2021-05-25  8:50     ` Yi Zhao
  2021-05-25  8:56     ` [meta-networking][RESEND][PATCH] " Yi Zhao
  1 sibling, 0 replies; 6+ messages in thread
From: Yi Zhao @ 2021-05-25  8:50 UTC (permalink / raw)
  To: Khem Raj, openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 9224 bytes --]


On 5/24/21 10:23 PM, Khem Raj wrote:
> Can you resend this patch ? secondly, I worry that since kea is way
> to go we are adding a package which perhaps is virtually going to be
> dead soon. Is there any work on kea itself providing similar 
> functionality?


The kea doesn't provide a dhcp relay agent. See: 
https://lists.isc.org/pipermail/kea-users/2021-April/003040.html

And kea + dhcrelay + dhcpcd can work without problems in my test.


//Yi


>
> On 5/23/21 11:36 PM, Yi Zhao wrote:
>> Ping ...
>>
>>
>> //Yi
>>
>>
>> On 5/17/21 1:53 PM, Yi Zhao wrote:
>>> The current default dhcp server kea in oe-core doesn't provide
>>> dhcp-relay tool. Add a recipe to provide dhcrelay which is from dhcp.
>>> This patch is picked up from dhcp recipe with some tweaks. In order to
>>> fix the build dependency, we use bundled bind instead of external bind.
>>>
>>> Signed-off-by: Yi Zhao<yi.zhao@windriver.com>
>>> ---
>>>   .../dhcp/dhcp-relay_4.4.2.bb                  | 62 
>>> +++++++++++++++++++
>>>   ...0001-Makefile.am-only-build-dhcrelay.patch | 30 +++++++++
>>>   .../dhcp/files/default-relay                  | 12 ++++
>>>   .../dhcp/files/dhcrelay.service               | 10 +++
>>>   .../dhcp/files/init-relay                     | 44 +++++++++++++
>>>   5 files changed, 158 insertions(+)
>>>   create mode 100644 
>>> meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
>>>   create mode 100644 
>>> meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
>>>   create mode 100644 
>>> meta-networking/recipes-connectivity/dhcp/files/default-relay
>>>   create mode 100644 
>>> meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
>>>   create mode 100644 
>>> meta-networking/recipes-connectivity/dhcp/files/init-relay
>>>
>>> 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 000000000..bd816106c
>>> --- /dev/null
>>> +++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
>>> @@ -0,0 +1,62 @@
>>> +SECTION = "console/network"
>>> +SUMMARY = "Internet Software Consortium DHCP Relay Agent"
>>> +DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
>>> +LAN to another, so that a DHCP server is not needed on every LAN."
>>> +
>>> +HOMEPAGE ="http://www.isc.org/"
>>> +
>>> +LICENSE = "ISC"
>>> +LIC_FILES_CHKSUM 
>>> ="file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01"
>>> +
>>> +DEPENDS = "openssl libcap zlib"
>>> +
>>> +SRC_URI ="https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \ + 
>>> file://default-relay \ + file://init-relay \ + 
>>> file://dhcrelay.service \ + 
>>> file://0001-Makefile.am-only-build-dhcrelay.patch \ + "
>>> +
>>> +SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
>>> +SRC_URI[sha256sum] = 
>>> "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521"
>>> +
>>> +UPSTREAM_CHECK_URI ="http://ftp.isc.org/isc/dhcp/"
>>> +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
>>> +
>>> +S = "${WORKDIR}/dhcp-${PV}"
>>> +
>>> +inherit autotools-brokensep systemd
>>> +
>>> +SYSTEMD_SERVICE_${PN} = "dhcrelay.service"
>>> +SYSTEMD_AUTO_ENABLE_${PN} = "disable"
>>> +
>>> +CFLAGS += "-D_GNU_SOURCE -fcommon"
>>> +LDFLAGS_append = " -pthread"
>>> +
>>> +EXTRA_OECONF = "--enable-paranoia \
>>> +                --disable-static \
>>> +                --enable-libtool \
>>> +                --with-randomdev=/dev/random \
>>> +" + +# Enable shared libs per dhcp README +do_configure_prepend () 
>>> { + cp configure.ac+lt configure.ac +} + +do_install_append () { + 
>>> install -d ${D}${sysconfdir}/default + install -m 0644 
>>> ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay + + if 
>>> ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; 
>>> then + install -d ${D}${systemd_unitdir}/system + install -m 0644 
>>> ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system + sed -i 
>>> -e 's,@SBINDIR@,${sbindir},g' 
>>> ${D}${systemd_unitdir}/system/dhcrelay.service + sed -i -e 
>>> 's,@SYSCONFDIR@,${sysconfdir},g' 
>>> ${D}${systemd_unitdir}/system/dhcrelay.service + else + install -d 
>>> ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init-relay 
>>> ${D}${sysconfdir}/init.d/dhcp-relay + fi +} + +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 000000000..fed85d2a8
>>> --- /dev/null
>>> +++ 
>>> b/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-networking/recipes-connectivity/dhcp/files/default-relay 
>>> b/meta-networking/recipes-connectivity/dhcp/files/default-relay
>>> new file mode 100644
>>> index 000000000..7961f014b
>>> --- /dev/null
>>> +++ b/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-networking/recipes-connectivity/dhcp/files/dhcrelay.service 
>>> b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
>>> new file mode 100644
>>> index 000000000..15ff927d3
>>> --- /dev/null
>>> +++ b/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-networking/recipes-connectivity/dhcp/files/init-relay 
>>> b/meta-networking/recipes-connectivity/dhcp/files/init-relay
>>> new file mode 100644
>>> index 000000000..019a7e84c
>>> --- /dev/null
>>> +++ b/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
>>>
>>
>>
>>
>>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 16467 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [meta-networking][RESEND][PATCH] dhcp-relay: add recipe
  2021-05-24 14:23   ` Khem Raj
  2021-05-25  8:50     ` Yi Zhao
@ 2021-05-25  8:56     ` Yi Zhao
  2021-05-25 14:01       ` Khem Raj
  1 sibling, 1 reply; 6+ messages in thread
From: Yi Zhao @ 2021-05-25  8:56 UTC (permalink / raw)
  To: openembedded-devel, raj.khem

The current default dhcp server kea in oe-core doesn't provide
dhcp-relay tool. Add a recipe to provide dhcrelay which is from dhcp.
This patch is picked up from dhcp recipe with some tweaks. In order to
fix the build dependency, we use bundled bind instead of external bind.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 .../dhcp/dhcp-relay_4.4.2.bb                  | 62 +++++++++++++++++++
 ...0001-Makefile.am-only-build-dhcrelay.patch | 30 +++++++++
 .../dhcp/files/default-relay                  | 12 ++++
 .../dhcp/files/dhcrelay.service               | 10 +++
 .../dhcp/files/init-relay                     | 44 +++++++++++++
 5 files changed, 158 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
 create mode 100644 meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
 create mode 100644 meta-networking/recipes-connectivity/dhcp/files/default-relay
 create mode 100644 meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
 create mode 100644 meta-networking/recipes-connectivity/dhcp/files/init-relay

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 000000000..bd816106c
--- /dev/null
+++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
@@ -0,0 +1,62 @@
+SECTION = "console/network"
+SUMMARY = "Internet Software Consortium DHCP Relay Agent"
+DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
+LAN to another, so that a DHCP server is not needed on every LAN."
+
+HOMEPAGE = "http://www.isc.org/"
+
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01"
+
+DEPENDS = "openssl libcap zlib"
+
+SRC_URI = "https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
+           file://default-relay \
+           file://init-relay \
+           file://dhcrelay.service \
+           file://0001-Makefile.am-only-build-dhcrelay.patch \
+           "
+
+SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
+SRC_URI[sha256sum] = "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521"
+
+UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/"
+UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
+
+S = "${WORKDIR}/dhcp-${PV}"
+
+inherit autotools-brokensep systemd
+
+SYSTEMD_SERVICE_${PN} = "dhcrelay.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "disable"
+
+CFLAGS += "-D_GNU_SOURCE -fcommon"
+LDFLAGS_append = " -pthread"
+
+EXTRA_OECONF = "--enable-paranoia \
+                --disable-static \
+                --enable-libtool \
+                --with-randomdev=/dev/random \
+               "
+
+# Enable shared libs per dhcp README
+do_configure_prepend () {
+    cp configure.ac+lt configure.ac
+}
+
+do_install_append () {
+    install -d ${D}${sysconfdir}/default
+    install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
+
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
+        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
+        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
+    else
+        install -d ${D}${sysconfdir}/init.d
+        install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
+    fi
+}
+
+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 000000000..fed85d2a8
--- /dev/null
+++ b/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-networking/recipes-connectivity/dhcp/files/default-relay b/meta-networking/recipes-connectivity/dhcp/files/default-relay
new file mode 100644
index 000000000..7961f014b
--- /dev/null
+++ b/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-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
new file mode 100644
index 000000000..15ff927d3
--- /dev/null
+++ b/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-networking/recipes-connectivity/dhcp/files/init-relay b/meta-networking/recipes-connectivity/dhcp/files/init-relay
new file mode 100644
index 000000000..019a7e84c
--- /dev/null
+++ b/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
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [meta-networking][RESEND][PATCH] dhcp-relay: add recipe
  2021-05-25  8:56     ` [meta-networking][RESEND][PATCH] " Yi Zhao
@ 2021-05-25 14:01       ` Khem Raj
  2021-05-25 22:46         ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2021-05-25 14:01 UTC (permalink / raw)
  To: Yi Zhao, openembedded-devel



On 5/25/21 1:56 AM, Yi Zhao wrote:
> The current default dhcp server kea in oe-core doesn't provide
> dhcp-relay tool. Add a recipe to provide dhcrelay which is from dhcp.
> This patch is picked up from dhcp recipe with some tweaks. In order to
> fix the build dependency, we use bundled bind instead of external bind.
> 

also send a patch to add it to packagegroups-meta-networking

> Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
> ---
>   .../dhcp/dhcp-relay_4.4.2.bb                  | 62 +++++++++++++++++++
>   ...0001-Makefile.am-only-build-dhcrelay.patch | 30 +++++++++
>   .../dhcp/files/default-relay                  | 12 ++++
>   .../dhcp/files/dhcrelay.service               | 10 +++
>   .../dhcp/files/init-relay                     | 44 +++++++++++++
>   5 files changed, 158 insertions(+)
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/default-relay
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
>   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/init-relay
> 
> 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 000000000..bd816106c
> --- /dev/null
> +++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
> @@ -0,0 +1,62 @@
> +SECTION = "console/network"
> +SUMMARY = "Internet Software Consortium DHCP Relay Agent"
> +DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
> +LAN to another, so that a DHCP server is not needed on every LAN."
> +
> +HOMEPAGE = "http://www.isc.org/"
> +
> +LICENSE = "ISC"
> +LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01"
> +
> +DEPENDS = "openssl libcap zlib"
> +
> +SRC_URI = "https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
> +           file://default-relay \
> +           file://init-relay \
> +           file://dhcrelay.service \
> +           file://0001-Makefile.am-only-build-dhcrelay.patch \
> +           "
> +
> +SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
> +SRC_URI[sha256sum] = "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521"
> +
> +UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/"
> +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
> +
> +S = "${WORKDIR}/dhcp-${PV}"
> +
> +inherit autotools-brokensep systemd
> +
> +SYSTEMD_SERVICE_${PN} = "dhcrelay.service"
> +SYSTEMD_AUTO_ENABLE_${PN} = "disable"
> +
> +CFLAGS += "-D_GNU_SOURCE -fcommon"
> +LDFLAGS_append = " -pthread"
> +
> +EXTRA_OECONF = "--enable-paranoia \
> +                --disable-static \
> +                --enable-libtool \
> +                --with-randomdev=/dev/random \
> +               "
> +
> +# Enable shared libs per dhcp README
> +do_configure_prepend () {
> +    cp configure.ac+lt configure.ac
> +}
> +
> +do_install_append () {
> +    install -d ${D}${sysconfdir}/default
> +    install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
> +
> +    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
> +        install -d ${D}${systemd_unitdir}/system
> +        install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
> +        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
> +        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
> +    else
> +        install -d ${D}${sysconfdir}/init.d
> +        install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
> +    fi
> +}
> +
> +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 000000000..fed85d2a8
> --- /dev/null
> +++ b/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-networking/recipes-connectivity/dhcp/files/default-relay b/meta-networking/recipes-connectivity/dhcp/files/default-relay
> new file mode 100644
> index 000000000..7961f014b
> --- /dev/null
> +++ b/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-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
> new file mode 100644
> index 000000000..15ff927d3
> --- /dev/null
> +++ b/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-networking/recipes-connectivity/dhcp/files/init-relay b/meta-networking/recipes-connectivity/dhcp/files/init-relay
> new file mode 100644
> index 000000000..019a7e84c
> --- /dev/null
> +++ b/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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-networking][RESEND][PATCH] dhcp-relay: add recipe
  2021-05-25 14:01       ` Khem Raj
@ 2021-05-25 22:46         ` Khem Raj
  0 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2021-05-25 22:46 UTC (permalink / raw)
  To: Yi Zhao, openembeded-devel

fails to compile for riscv32
https://errors.yoctoproject.org/Errors/Details/585529/
and rv64 https://errors.yoctoproject.org/Errors/Details/585530/

On Tue, May 25, 2021 at 7:01 AM Khem Raj <raj.khem@gmail.com> wrote:
>
>
>
> On 5/25/21 1:56 AM, Yi Zhao wrote:
> > The current default dhcp server kea in oe-core doesn't provide
> > dhcp-relay tool. Add a recipe to provide dhcrelay which is from dhcp.
> > This patch is picked up from dhcp recipe with some tweaks. In order to
> > fix the build dependency, we use bundled bind instead of external bind.
> >
>
> also send a patch to add it to packagegroups-meta-networking
>
> > Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
> > ---
> >   .../dhcp/dhcp-relay_4.4.2.bb                  | 62 +++++++++++++++++++
> >   ...0001-Makefile.am-only-build-dhcrelay.patch | 30 +++++++++
> >   .../dhcp/files/default-relay                  | 12 ++++
> >   .../dhcp/files/dhcrelay.service               | 10 +++
> >   .../dhcp/files/init-relay                     | 44 +++++++++++++
> >   5 files changed, 158 insertions(+)
> >   create mode 100644 meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
> >   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/0001-Makefile.am-only-build-dhcrelay.patch
> >   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/default-relay
> >   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
> >   create mode 100644 meta-networking/recipes-connectivity/dhcp/files/init-relay
> >
> > 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 000000000..bd816106c
> > --- /dev/null
> > +++ b/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.2.bb
> > @@ -0,0 +1,62 @@
> > +SECTION = "console/network"
> > +SUMMARY = "Internet Software Consortium DHCP Relay Agent"
> > +DESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
> > +LAN to another, so that a DHCP server is not needed on every LAN."
> > +
> > +HOMEPAGE = "http://www.isc.org/"
> > +
> > +LICENSE = "ISC"
> > +LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01"
> > +
> > +DEPENDS = "openssl libcap zlib"
> > +
> > +SRC_URI = "https://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
> > +           file://default-relay \
> > +           file://init-relay \
> > +           file://dhcrelay.service \
> > +           file://0001-Makefile.am-only-build-dhcrelay.patch \
> > +           "
> > +
> > +SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
> > +SRC_URI[sha256sum] = "1a7ccd64a16e5e68f7b5e0f527fd07240a2892ea53fe245620f4f5f607004521"
> > +
> > +UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/"
> > +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
> > +
> > +S = "${WORKDIR}/dhcp-${PV}"
> > +
> > +inherit autotools-brokensep systemd
> > +
> > +SYSTEMD_SERVICE_${PN} = "dhcrelay.service"
> > +SYSTEMD_AUTO_ENABLE_${PN} = "disable"
> > +
> > +CFLAGS += "-D_GNU_SOURCE -fcommon"
> > +LDFLAGS_append = " -pthread"
> > +
> > +EXTRA_OECONF = "--enable-paranoia \
> > +                --disable-static \
> > +                --enable-libtool \
> > +                --with-randomdev=/dev/random \
> > +               "
> > +
> > +# Enable shared libs per dhcp README
> > +do_configure_prepend () {
> > +    cp configure.ac+lt configure.ac
> > +}
> > +
> > +do_install_append () {
> > +    install -d ${D}${sysconfdir}/default
> > +    install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
> > +
> > +    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
> > +        install -d ${D}${systemd_unitdir}/system
> > +        install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
> > +        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
> > +        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
> > +    else
> > +        install -d ${D}${sysconfdir}/init.d
> > +        install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
> > +    fi
> > +}
> > +
> > +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 000000000..fed85d2a8
> > --- /dev/null
> > +++ b/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-networking/recipes-connectivity/dhcp/files/default-relay b/meta-networking/recipes-connectivity/dhcp/files/default-relay
> > new file mode 100644
> > index 000000000..7961f014b
> > --- /dev/null
> > +++ b/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-networking/recipes-connectivity/dhcp/files/dhcrelay.service b/meta-networking/recipes-connectivity/dhcp/files/dhcrelay.service
> > new file mode 100644
> > index 000000000..15ff927d3
> > --- /dev/null
> > +++ b/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-networking/recipes-connectivity/dhcp/files/init-relay b/meta-networking/recipes-connectivity/dhcp/files/init-relay
> > new file mode 100644
> > index 000000000..019a7e84c
> > --- /dev/null
> > +++ b/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
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-25 22:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <167FC4DDC2069D52.24037@lists.openembedded.org>
2021-05-24  6:36 ` [oe] [meta-networking][PATCH] dhcp-relay: add recipe Yi Zhao
2021-05-24 14:23   ` Khem Raj
2021-05-25  8:50     ` Yi Zhao
2021-05-25  8:56     ` [meta-networking][RESEND][PATCH] " Yi Zhao
2021-05-25 14:01       ` Khem Raj
2021-05-25 22:46         ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.