From patchwork Tue Jan 16 07:41:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Charpentier X-Patchwork-Id: 861311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zLMcb31yVz9s7v for ; Tue, 16 Jan 2018 18:42:07 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B2E2888807; Tue, 16 Jan 2018 07:42:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0-4fpxmAw5Hv; Tue, 16 Jan 2018 07:41:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 72A69884A9; Tue, 16 Jan 2018 07:41:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 018611C0574 for ; Tue, 16 Jan 2018 07:41:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F234587979 for ; Tue, 16 Jan 2018 07:41:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wsYJ8bVo6kLz for ; Tue, 16 Jan 2018 07:41:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from zimbra1.kalray.eu (zimbra1.kalray.eu [92.103.151.219]) by whitealder.osuosl.org (Postfix) with ESMTPS id A44FB8796D for ; Tue, 16 Jan 2018 07:41:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra1.kalray.eu (Postfix) with ESMTP id 5269F281149; Tue, 16 Jan 2018 08:41:53 +0100 (CET) Received: from zimbra1.kalray.eu ([127.0.0.1]) by localhost (zimbra1.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xPVAAWRCaFph; Tue, 16 Jan 2018 08:41:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra1.kalray.eu (Postfix) with ESMTP id 851AC28114B; Tue, 16 Jan 2018 08:41:52 +0100 (CET) X-Virus-Scanned: amavisd-new at kalray.eu Received: from zimbra1.kalray.eu ([127.0.0.1]) by localhost (zimbra1.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 76gyf06kxB3X; Tue, 16 Jan 2018 08:41:52 +0100 (CET) Received: from japet.kalray.eu (unknown [46.218.112.178]) by zimbra1.kalray.eu (Postfix) with ESMTPSA id 5BFB8281149; Tue, 16 Jan 2018 08:41:52 +0100 (CET) From: Laurent Charpentier To: buildroot@buildroot.org Date: Tue, 16 Jan 2018 08:41:28 +0100 Message-Id: <20180116074128.4251-1-laurent_pubs@yahoo.com> X-Mailer: git-send-email 2.14.3 Subject: [Buildroot] [PATCH v2] open-lldp: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Charpentier MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The lldpad package comes with utilities to manage an LLDP interface with support for reading and configuring TLVs. TLVs and interfaces are individual controlled allowing flexible configuration for TX only, RX only, or TX/RX modes per TLV. http://open-lldp.org/ Signed-off-by: Laurent Charpentier Reviewed-by: Yegor Yefremov --- DEVELOPERS | 3 + package/Config.in | 1 + ...1-vdptool-fixed-compile-error-for-getline.patch | 27 ++++++++ ...-functions-work-with-both-gnu11-and-gnu89.patch | 73 ++++++++++++++++++++++ package/open-lldp/Config.in | 12 ++++ package/open-lldp/open-lldp.hash | 4 ++ package/open-lldp/open-lldp.mk | 24 +++++++ 7 files changed, 144 insertions(+) create mode 100644 package/open-lldp/0001-vdptool-fixed-compile-error-for-getline.patch create mode 100644 package/open-lldp/0002-get-inline-functions-work-with-both-gnu11-and-gnu89.patch create mode 100644 package/open-lldp/Config.in create mode 100644 package/open-lldp/open-lldp.hash create mode 100644 package/open-lldp/open-lldp.mk diff --git a/DEVELOPERS b/DEVELOPERS index 0e754456cb..07c31ce5e4 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -931,6 +931,9 @@ F: package/qt5/ N: Julien Floret F: package/lldpd/ +N: Laurent Charpentier +F: package/open-lldp/ + N: Julien Viard de Galbert F: package/dieharder/ F: package/easy-rsa/ diff --git a/package/Config.in b/package/Config.in index 8e8e7581ce..b515066f6e 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1763,6 +1763,7 @@ endif source "package/odhcp6c/Config.in" source "package/odhcploc/Config.in" source "package/olsr/Config.in" + source "package/open-lldp/Config.in" source "package/open-plc-utils/Config.in" source "package/openntpd/Config.in" source "package/openobex/Config.in" diff --git a/package/open-lldp/0001-vdptool-fixed-compile-error-for-getline.patch b/package/open-lldp/0001-vdptool-fixed-compile-error-for-getline.patch new file mode 100644 index 0000000000..c20267786e --- /dev/null +++ b/package/open-lldp/0001-vdptool-fixed-compile-error-for-getline.patch @@ -0,0 +1,27 @@ +From 3c7887bb8a61a3b49a2989329c756a038023c544 Mon Sep 17 00:00:00 2001 +From: Laurent Charpentier +Date: Fri, 12 Jan 2018 12:25:41 +0100 +Subject: [PATCH] vdptool: fixed compile error for getline() + +vdptool.c was generating an error: implicit declaration for the getline() function. + +Signed-off-by: Laurent Charpentier +--- + vdptool.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/vdptool.c b/vdptool.c +index b805372..4930f6a 100644 +--- a/vdptool.c ++++ b/vdptool.c +@@ -36,6 +36,7 @@ + * set and query VSI profile settings. + */ + ++#define _GNU_SOURCE + #include + #include + #include +-- +2.14.3 + diff --git a/package/open-lldp/0002-get-inline-functions-work-with-both-gnu11-and-gnu89.patch b/package/open-lldp/0002-get-inline-functions-work-with-both-gnu11-and-gnu89.patch new file mode 100644 index 0000000000..57a23b2a70 --- /dev/null +++ b/package/open-lldp/0002-get-inline-functions-work-with-both-gnu11-and-gnu89.patch @@ -0,0 +1,73 @@ +From e186ca9ebda181f62504a1922559ef3ddae5e3b6 Mon Sep 17 00:00:00 2001 +From: Laurent Charpentier +Date: Mon, 15 Jan 2018 11:24:45 +0100 +Subject: [PATCH] get inline functions work with both gnu11 and gnu89 + +After gcc upgraded to gcc5, and if the codes are compiled without optimization(-O0), and the below error will happen: + +./include/lldp_8021qaz.h:237:12: error: inline function 'ieee8021qaz_clif_cmd' declared but never defined [-Werror] + inline int ieee8021qaz_clif_cmd(void *data, struct sockaddr_un *from, + ^ +./include/lldp_8021qaz.h:222:13: error: inline function 'set_prio_map' declared but never defined [-Werror] + inline void set_prio_map(u32 *prio_map, u8 prio, int tc); + ^ +./include/lldp_8021qaz.h:221:12: error: inline function 'get_prio_map' declared but never defined [-Werror] + inline int get_prio_map(u32 prio_map, int tc); + +gcc5 defaults to -std=gnu11 instead of -std=gnu89, and it requires that exactly one C source file has the callable copy of the inline function. + +Signed-off-by: Laurent Charpentier +--- + include/lldp_8021qaz.h | 6 ------ + lldp_8021qaz.c | 4 ++-- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/include/lldp_8021qaz.h b/include/lldp_8021qaz.h +index 55353b8..09dee20 100644 +--- a/include/lldp_8021qaz.h ++++ b/include/lldp_8021qaz.h +@@ -218,9 +218,6 @@ int ieee8021qaz_mod_app(struct app_tlv_head *head, int peer, + u8 prio, u8 sel, u16 proto, u32 ops); + int ieee8021qaz_app_sethw(char *ifname, struct app_tlv_head *head); + +-inline int get_prio_map(u32 prio_map, int tc); +-inline void set_prio_map(u32 *prio_map, u8 prio, int tc); +- + struct ieee8021qaz_tlvs *ieee8021qaz_data(const char *); + + int ieee8021qaz_tlvs_rxed(const char *ifname); +@@ -234,9 +231,6 @@ int ieee8021qaz_rchange(struct port *port, struct lldp_agent *, + void ieee8021qaz_ifup(char *ifname, struct lldp_agent *); + void ieee8021qaz_ifdown(char *ifname, struct lldp_agent *); + u8 ieee8021qaz_mibDeleteObject(struct port *port, struct lldp_agent *); +-inline int ieee8021qaz_clif_cmd(void *data, struct sockaddr_un *from, +- socklen_t fromlen, char *ibuf, int ilen, +- char *rbuf); + int ieee8021qaz_check_operstate(void); + int get_dcbx_hw(const char *ifname, __u8 *dcbx); + +diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c +index 094676d..f154317 100644 +--- a/lldp_8021qaz.c ++++ b/lldp_8021qaz.c +@@ -396,7 +396,7 @@ static int read_cfg_file(char *ifname, struct lldp_agent *agent, + return 0; + } + +-inline int get_prio_map(u32 prio_map, int prio) ++static inline int get_prio_map(u32 prio_map, int prio) + { + if (prio > 7) + return 0; +@@ -404,7 +404,7 @@ inline int get_prio_map(u32 prio_map, int prio) + return (prio_map >> (4 * (7-prio))) & 0xF; + } + +-inline void set_prio_map(u32 *prio_map, u8 prio, int tc) ++static inline void set_prio_map(u32 *prio_map, u8 prio, int tc) + { + u32 mask = ~(0xffffffff & (0xF << (4 * (7-prio)))); + *prio_map &= mask; +-- +2.14.3 + diff --git a/package/open-lldp/Config.in b/package/open-lldp/Config.in new file mode 100644 index 0000000000..79eefee71b --- /dev/null +++ b/package/open-lldp/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_OPEN_LLDP + bool "open-lldp" + depends on BR2_TOOLCHAIN_HAS_THREADS # libnl + select BR2_PACKAGE_LIBCONFIG + select BR2_PACKAGE_LIBNL + select BR2_PACKAGE_READLINE + help + This package contains the Linux user space daemon and + configuration tool for Intel LLDP Agent with Enhanced Ethernet + support for the Data Center. + + http://open-lldp.org/ diff --git a/package/open-lldp/open-lldp.hash b/package/open-lldp/open-lldp.hash new file mode 100644 index 0000000000..623d354aed --- /dev/null +++ b/package/open-lldp/open-lldp.hash @@ -0,0 +1,4 @@ +# Locally computed +sha256 f2c8a3307970374b01ad832ea18cf6d9abce6f00b3d8aed9305aa1428ad8252d open-lldp-036e314bd93602f7388262cc37faf8b626980af1.tar.gz +# Locally computed +sha256 67af5abeb092213cd9c53781503320f635ba28b641e0c3f24d367e8e93a9839b COPYING diff --git a/package/open-lldp/open-lldp.mk b/package/open-lldp/open-lldp.mk new file mode 100644 index 0000000000..76dda52085 --- /dev/null +++ b/package/open-lldp/open-lldp.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# open-lldp +# +################################################################################ + +OPEN_LLDP_VERSION = 036e314bd93602f7388262cc37faf8b626980af1 +OPEN_LLDP_SITE = git://open-lldp.org/open-lldp.git +OPEN_LLDP_DEPENDENCIES = readline libnl libconfig +OPEN_LLDP_LICENSE = GPL-2.0 +OPEN_LLDP_LICENSE_FILES = COPYING + +# Fetching from git, need to generate configure/Makefile.in +OPEN_LLDP_AUTORECONF = YES + +# Create the m4 directory (missing from the archive). +# This is required for autoconf. +define OPEN_LLDP_BOOTSTRAP + mkdir -p $(@D)/m4 +endef + +OPEN_LLDP_PRE_CONFIGURE_HOOKS += OPEN_LLDP_BOOTSTRAP + +$(eval $(autotools-package))