From 1a4148b4d06039b3865ca518eb59196150bed84f406c1078602ed6d14b35826a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 19 May 2014 21:35:06 +0000 Subject: [PATCH] Accepting request 233838 from home:hreinecke:branches:network:fcoe - Update to latest git version: * Include upstream version of VEPA migration issue (bnc#866282) * evb 22 test cases * vdp22 fixes * error message fixes * Fix interop issues with Juniper switches - Fixup error messages in lldpad * Add 0001-lldpad-print-verbose-error-messages.patch - Move to libnl3 * Add 0002-Move-to-libnl3.patch OBS-URL: https://build.opensuse.org/request/show/233838 OBS-URL: https://build.opensuse.org/package/show/network:fcoe/open-lldp?expand=0&rev=14 --- ...-lldpad-print-verbose-error-messages.patch | 44 +++ 0002-Move-to-libnl3.patch | 327 ++++++++++++++++++ mkinitrd-boot.sh | 4 - mkinitrd-setup.sh | 35 -- open-lldp-git-update.patch.bz2 | 4 +- open-lldp.changes | 14 + open-lldp.spec | 6 +- 7 files changed, 392 insertions(+), 42 deletions(-) create mode 100644 0001-lldpad-print-verbose-error-messages.patch create mode 100644 0002-Move-to-libnl3.patch delete mode 100644 mkinitrd-boot.sh delete mode 100644 mkinitrd-setup.sh diff --git a/0001-lldpad-print-verbose-error-messages.patch b/0001-lldpad-print-verbose-error-messages.patch new file mode 100644 index 0000000..e2ab1fe --- /dev/null +++ b/0001-lldpad-print-verbose-error-messages.patch @@ -0,0 +1,44 @@ +From 76abae2f76ae02cd0af19bd7ff4d52e2f9c46bf4 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 14 May 2014 09:03:43 +0200 +Subject: lldpad: print verbose error messages + +When lldpad is started while another instance is running it'll +abort with the cryptic error message +'bind(AF_LOCAL): address in use' +This patch updates the error message with the more instructive +'another lldpad instance is running'. + +Signed-off-by: Hannes Reinecke +--- + ctrl_iface.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/ctrl_iface.c b/ctrl_iface.c +index fbacfac..e4fd0b7 100644 +--- a/ctrl_iface.c ++++ b/ctrl_iface.c +@@ -466,7 +466,7 @@ int ctrl_iface_init(struct clif_data *clifd) + } + s = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (s < 0) { +- perror("socket(AF_LOCAL)"); ++ LLDPAD_WARN("failed to create CLI socket: %m\n"); + goto fail; + } + /* enable receiving of the sender credentials */ +@@ -479,7 +479,10 @@ int ctrl_iface_init(struct clif_data *clifd) + "%s", LLDP_CLIF_SOCK); + addrlen = sizeof(sa_family_t) + strlen(addr.sun_path + 1) + 1; + if (bind(s, (struct sockaddr *) &addr, addrlen) < 0) { +- perror("bind(AF_LOCAL)"); ++ if (errno == EADDRINUSE) ++ LLDPAD_WARN("another lldpad instance is running\n"); ++ else ++ LLDPAD_WARN("failed to bind CLI socket address: %m"); + goto fail; + } + /* enable receiving of the sender credentials */ +-- +1.8.5.2 + diff --git a/0002-Move-to-libnl3.patch b/0002-Move-to-libnl3.patch new file mode 100644 index 0000000..b5d4873 --- /dev/null +++ b/0002-Move-to-libnl3.patch @@ -0,0 +1,327 @@ +From d6239987b6616e86f00b48912c18370b318738ae Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 14 May 2014 10:29:13 +0200 +Subject: Move to libnl3 + +libnl1 is obsolete. + +Signed-off-by: Hannes Reinecke +--- + Makefile.am | 6 ++-- + configure.ac | 4 +-- + lldp_8021qaz.c | 112 ++++++++++++++++++++++++++++----------------------------- + 3 files changed, 61 insertions(+), 61 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index bece6ae..4889d32 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -16,8 +16,8 @@ ACLOCAL_AMFLAGS = -I m4 + parse_cli.o: CFLAGS+=-U_FORTIFY_SOURCE -Wno-error + + ## system requires a shared libconfig +-AM_CFLAGS = -Wall -Werror -Wextra -Wformat=2 $(LIBCONFIG_CFLAGS) +-AM_LDFLAGS = $(LIBCONFIG_LIBS) ++AM_CFLAGS = -Wall -Werror -Wextra -Wformat=2 $(LIBCONFIG_CFLAGS) $(LIBNL_CFLAGS) ++AM_LDFLAGS = $(LIBCONFIG_LIBS) $(LIBNL_LIBS) + + ## header files to be installed, for programs using the client interface to lldpad + lldpad_includedir= ${includedir}/lldpad +@@ -88,7 +88,7 @@ lldptool_SOURCES = lldptool.c lldptool_cmds.c lldp_rtnl.c \ + lldp_orgspec_clif.c lldp_cisco_clif.c lldp_evb22_clif.c \ + weak_readline.c $(lldpad_include_HEADERS) $(noinst_HEADERS) + lldptool_LDADD = ${srcdir}/liblldp_clif.la +-lldptool_LDFLAGS = -ldl -llldp_clif ++lldptool_LDFLAGS = -ldl -llldp_clif $(LIBNL_LIBS) + + if BUILD_DEBUG + nltest_SOURCES = test/nltest.c test/nltest.h +diff --git a/configure.ac b/configure.ac +index c5d72b3..8d65d26 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -26,12 +26,12 @@ then + fi + + PKG_CHECK_MODULES([LIBCONFIG], [libconfig >= 1.3.2]) +-PKG_CHECK_MODULES([LIBNL], [libnl-1 >= 1.1]) ++PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.2]) + + AC_SUBST(LIBNL_CFLAGS) + AC_SUBST(LIBNL_LIBS) + +-AC_CHECK_LIB(nl, rtnl_link_get_by_name) ++AC_CHECK_LIB(nl3, rtnl_link_get_by_name) + + AC_CHECK_FUNCS([alarm]) + AC_CHECK_FUNCS([gettimeofday]) +diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c +index a8a2e0b..094676d 100644 +--- a/lldp_8021qaz.c ++++ b/lldp_8021qaz.c +@@ -424,7 +424,7 @@ int get_dcbx_hw(const char *ifname, __u8 *dcbx) + int err = 0; + struct nlattr *attr; + struct sockaddr_nl dest_addr; +- static struct nl_handle *nlhandle; ++ static struct nl_sock *nlsocket; + struct nl_msg *nlm = NULL; + unsigned char *msg = NULL; + struct nlmsghdr *hdr; +@@ -434,28 +434,28 @@ int get_dcbx_hw(const char *ifname, __u8 *dcbx) + .dcb_pad = 0 + }; + +- if (!nlhandle) { +- nlhandle = nl_handle_alloc(); +- if (!nlhandle) { +- LLDPAD_WARN("%s: %s: nl_handle_alloc failed, %s\n", +- __func__, ifname, nl_geterror()); ++ if (!nlsocket) { ++ nlsocket = nl_socket_alloc(); ++ if (!nlsocket) { ++ LLDPAD_WARN("%s: %s: nl_socket_alloc failed\n", ++ __func__, ifname); + err = -ENOMEM; + goto out; + } +- nl_socket_set_local_port(nlhandle, 0); ++ nl_socket_set_local_port(nlsocket, 0); + } + +- err = nl_connect(nlhandle, NETLINK_ROUTE); ++ err = nl_connect(nlsocket, NETLINK_ROUTE); + if (err < 0) { + LLDPAD_WARN("%s: %s nlconnect failed abort get ieee, %s\n", +- __func__, ifname, nl_geterror()); ++ __func__, ifname, nl_geterror(err)); + goto out; + } + + nlm = nlmsg_alloc_simple(RTM_GETDCB, NLM_F_REQUEST); + if (!nlm) { +- LLDPAD_WARN("%s: %s nlmsg_alloc failed abort get ieee, %s\n", +- __func__, ifname, nl_geterror()); ++ LLDPAD_WARN("%s: %s nlmsg_alloc failed abort get ieee\n", ++ __func__, ifname); + err = -ENOMEM; + goto out; + } +@@ -472,14 +472,14 @@ int get_dcbx_hw(const char *ifname, __u8 *dcbx) + if (err < 0) + goto out; + +- err = nl_send_auto_complete(nlhandle, nlm); ++ err = nl_send_auto_complete(nlsocket, nlm); + if (err <= 0) { + LLDPAD_WARN("%s: %s 802.1Qaz get app attributes failed\n", + __func__, ifname); + goto out; + } + +- err = nl_recv(nlhandle, &dest_addr, &msg, NULL); ++ err = nl_recv(nlsocket, &dest_addr, &msg, NULL); + if (err <= 0) { + LLDPAD_WARN("%s: %s: nl_recv returned %d\n", __func__, ifname, + err); +@@ -500,8 +500,8 @@ int get_dcbx_hw(const char *ifname, __u8 *dcbx) + out: + nlmsg_free(nlm); + free(msg); +- if (nlhandle) +- nl_close(nlhandle); ++ if (nlsocket) ++ nl_close(nlsocket); + return err; + } + +@@ -790,7 +790,7 @@ static int get_ieee_hw(const char *ifname, struct ieee_ets **ets, + int rem; + int itr = 0; + struct sockaddr_nl dest_addr; +- static struct nl_handle *nlhandle; ++ struct nl_sock *nlsocket = NULL; + struct nl_msg *nlm; + unsigned char *msg = NULL; + struct nlmsghdr *hdr; +@@ -801,20 +801,19 @@ static int get_ieee_hw(const char *ifname, struct ieee_ets **ets, + .dcb_pad = 0 + }; + +- if (!nlhandle) { +- nlhandle = nl_handle_alloc(); +- if (!nlhandle) { +- LLDPAD_WARN("%s: %s: nl_handle_alloc failed, %s\n", +- __func__, ifname, nl_geterror()); +- *cnt = 0; +- return -ENOMEM; +- } +- nl_socket_set_local_port(nlhandle, 0); ++ nlsocket = nl_socket_alloc(); ++ if (!nlsocket) { ++ LLDPAD_WARN("%s: %s: nl_handle_alloc failed\n", ++ __func__, ifname); ++ *cnt = 0; ++ return -ENOMEM; + } ++ nl_socket_set_local_port(nlsocket, 0); + +- if (nl_connect(nlhandle, NETLINK_ROUTE) < 0) { ++ err = nl_connect(nlsocket, NETLINK_ROUTE); ++ if (err < 0) { + LLDPAD_WARN("%s: %s nlconnect failed abort get ieee, %s\n", +- __func__, ifname, nl_geterror()); ++ __func__, ifname, nl_geterror(err)); + goto out1; + } + +@@ -836,14 +835,14 @@ static int get_ieee_hw(const char *ifname, struct ieee_ets **ets, + if (err < 0) + goto out; + +- err = nl_send_auto_complete(nlhandle, nlm); ++ err = nl_send_auto_complete(nlsocket, nlm); + if (err <= 0) { + LLDPAD_WARN("%s: %s 802.1Qaz get app attributes failed\n", + __func__, ifname); + goto out; + } + +- err = nl_recv(nlhandle, &dest_addr, &msg, NULL); ++ err = nl_recv(nlsocket, &dest_addr, &msg, NULL); + if (err <= 0) { + LLDPAD_WARN("%s: %s: nl_recv returned %d\n", __func__, ifname, + err); +@@ -940,7 +939,8 @@ static int get_ieee_hw(const char *ifname, struct ieee_ets **ets, + out: + nlmsg_free(nlm); + free(msg); +- nl_close(nlhandle); ++ nl_close(nlsocket); ++ nl_socket_free(nlsocket); + out1: + *cnt = itr; + return err; +@@ -951,7 +951,7 @@ static int del_ieee_hw(const char *ifname, struct dcb_app *app_data) + int err = 0; + struct nlattr *ieee, *app; + struct sockaddr_nl dest_addr; +- static struct nl_handle *nlhandle; ++ struct nl_sock *nlsocket; + struct nl_msg *nlm; + struct dcbmsg d = { + .dcb_family = AF_UNSPEC, +@@ -959,19 +959,18 @@ static int del_ieee_hw(const char *ifname, struct dcb_app *app_data) + .dcb_pad = 0 + }; + +- if (!nlhandle) { +- nlhandle = nl_handle_alloc(); +- if (!nlhandle) { +- LLDPAD_WARN("%s: %s: nl_handle_alloc failed, %s\n", +- __func__, ifname, nl_geterror()); +- return -ENOMEM; +- } +- nl_socket_set_local_port(nlhandle, 0); ++ nlsocket = nl_socket_alloc(); ++ if (!nlsocket) { ++ LLDPAD_WARN("%s: %s: nl_handle_alloc failed\n", ++ __func__, ifname); ++ return -ENOMEM; + } ++ nl_socket_set_local_port(nlsocket, 0); + +- if (nl_connect(nlhandle, NETLINK_ROUTE) < 0) { ++ err = nl_connect(nlsocket, NETLINK_ROUTE); ++ if (err < 0) { + LLDPAD_WARN("%s: %s nlconnect failed abort hardware set, %s\n", +- __func__, ifname, nl_geterror()); ++ __func__, ifname, nl_geterror(err)); + err = -EIO; + goto out1; + } +@@ -1013,7 +1012,7 @@ static int del_ieee_hw(const char *ifname, struct dcb_app *app_data) + nla_nest_end(nlm, app); + } + nla_nest_end(nlm, ieee); +- err = nl_send_auto_complete(nlhandle, nlm); ++ err = nl_send_auto_complete(nlsocket, nlm); + if (err <= 0) + LLDPAD_WARN("%s: %s 802.1Qaz set attributes failed\n", + __func__, ifname); +@@ -1021,7 +1020,8 @@ static int del_ieee_hw(const char *ifname, struct dcb_app *app_data) + out: + nlmsg_free(nlm); + out2: +- nl_close(nlhandle); ++ nl_close(nlsocket); ++ nl_socket_free(nlsocket); + out1: + return err; + +@@ -1034,7 +1034,7 @@ static int set_ieee_hw(const char *ifname, struct ieee_ets *ets_data, + int err = 0; + struct nlattr *ieee, *app; + struct sockaddr_nl dest_addr; +- static struct nl_handle *nlhandle; ++ struct nl_sock *nlsocket; + struct nl_msg *nlm; + struct dcbmsg d = { + .dcb_family = AF_UNSPEC, +@@ -1042,15 +1042,13 @@ static int set_ieee_hw(const char *ifname, struct ieee_ets *ets_data, + .dcb_pad = 0 + }; + +- if (!nlhandle) { +- nlhandle = nl_handle_alloc(); +- if (!nlhandle) { +- LLDPAD_WARN("%s: %s: nl_handle_alloc failed, %s\n", +- __func__, ifname, nl_geterror()); +- return -ENOMEM; +- } +- nl_socket_set_local_port(nlhandle, 0); ++ nlsocket = nl_socket_alloc(); ++ if (!nlsocket) { ++ LLDPAD_WARN("%s: %s: nl_handle_alloc failed\n", ++ __func__, ifname); ++ return -ENOMEM; + } ++ nl_socket_set_local_port(nlsocket, 0); + + if (!ets_data && !pfc_data && !app_data) { + err = 0; +@@ -1064,9 +1062,10 @@ static int set_ieee_hw(const char *ifname, struct ieee_ets *ets_data, + print_pfc(pfc_data); + #endif + +- if (nl_connect(nlhandle, NETLINK_ROUTE) < 0) { ++ err = nl_connect(nlsocket, NETLINK_ROUTE); ++ if (err < 0) { + LLDPAD_WARN("%s: %s nlconnect failed abort hardware set, %s\n", +- __func__, ifname, nl_geterror()); ++ __func__, ifname, nl_geterror(err)); + err = -EIO; + goto out1; + } +@@ -1122,7 +1121,7 @@ static int set_ieee_hw(const char *ifname, struct ieee_ets *ets_data, + nla_nest_end(nlm, app); + } + nla_nest_end(nlm, ieee); +- err = nl_send_auto_complete(nlhandle, nlm); ++ err = nl_send_auto_complete(nlsocket, nlm); + if (err <= 0) + LLDPAD_WARN("%s: %s 802.1Qaz set attributes failed\n", + __func__, ifname); +@@ -1130,7 +1129,8 @@ static int set_ieee_hw(const char *ifname, struct ieee_ets *ets_data, + out: + nlmsg_free(nlm); + out2: +- nl_close(nlhandle); ++ nl_close(nlsocket); ++ nl_socket_free(nlsocket); + out1: + return err; + } +-- +1.8.5.2 + diff --git a/mkinitrd-boot.sh b/mkinitrd-boot.sh deleted file mode 100644 index fe0aed6..0000000 --- a/mkinitrd-boot.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -#%stage: device -#%depends: network -#%programs: lldpad dcbtool diff --git a/mkinitrd-setup.sh b/mkinitrd-setup.sh deleted file mode 100644 index 77f95f5..0000000 --- a/mkinitrd-setup.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -#%stage: device -#%depends: fcoe -# - -# -# Check if DCBX is active for FCoE traffic -# -dcbd_check_app_fcoe() { - local if=$1 - local dcberr=1 - - . /etc/fcoe/cfg-${if} - if [ "$DCB_REQUIRED" = "yes" ] ; then - echo "active" - fi -} - -if [ "${root_fcoe}" ] ; then - dcb_status=$(dcbd_check_app_fcoe $fcoe_vif) - if [ "$dcb_status" = "active" ] ; then - root_dcbd=1 - fi -fi - -save_var root_dcbd - -if [ "${root_dcbd}" ] ; then - mkdir -p ${tmp_mnt}/var/lib/lldpad - if [ -f /var/lib/lldpad/lldpad.conf ] ; then - # copy the dcbd configuration - cp -p /var/lib/lldpad/lldpad.conf ${tmp_mnt}/var/lib/lldpad - fi -fi diff --git a/open-lldp-git-update.patch.bz2 b/open-lldp-git-update.patch.bz2 index dc50ebf..9ac9de5 100644 --- a/open-lldp-git-update.patch.bz2 +++ b/open-lldp-git-update.patch.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a639f549eef3d59d67c84a6cbe28767cdfea887050e054a2f3f23c4f72523ab -size 137330 +oid sha256:63b2fd3cd5e372b9a544c631e8e35b6768aa0f3daa9da421442c5ddf42dce555 +size 149620 diff --git a/open-lldp.changes b/open-lldp.changes index bba7e55..77e2eb9 100644 --- a/open-lldp.changes +++ b/open-lldp.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Wed May 14 09:09:11 CEST 2014 - hare@suse.de + +- Update to latest git version: + * Include upstream version of VEPA migration issue (bnc#866282) + * evb 22 test cases + * vdp22 fixes + * error message fixes + * Fix interop issues with Juniper switches +- Fixup error messages in lldpad + * Add 0001-lldpad-print-verbose-error-messages.patch +- Move to libnl3 + * Add 0002-Move-to-libnl3.patch + ------------------------------------------------------------------- Fri Mar 21 15:28:19 CET 2014 - hare@suse.de diff --git a/open-lldp.spec b/open-lldp.spec index fc28929..a2256cb 100644 --- a/open-lldp.spec +++ b/open-lldp.spec @@ -26,13 +26,15 @@ Release: 0 BuildRequires: bison BuildRequires: flex BuildRequires: libconfig-devel -BuildRequires: libnl-1_1-devel +BuildRequires: libnl3-devel BuildRequires: libtool BuildRequires: pkgconfig BuildRequires: readline-devel Url: http://open-lldp.org/ Source: http://ftp-osl.osuosl.org/pub/%{name}/%{name}-%{version}.tar.gz Patch0: %{name}-git-update.patch.bz2 +Patch1: 0001-lldpad-print-verbose-error-messages.patch +Patch2: 0002-Move-to-libnl3.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Provides: dcbd = %{version} Obsoletes: dcbd < %{version} @@ -71,6 +73,8 @@ with Data Center Bridging (DCB) for Intel(R) Network Connections %prep %setup %patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build autoreconf -vi