SHA256
1
0
forked from pool/open-lldp

- Update to v1.0.1 (FATE#318849)

* vpd22 updates
  * Include vpdtool
  * Support for OUI infrastructure in vpd22
  * Support for OUI infrastructure in vpdtool
  * Support for Cisco-specific OUI extensions in vpd22
  * Add vpdtool manpage
  * Add open-lldp-1.0.1.tar.gz
  * Remove open-lldp-0.9.46.tar.gz
  * Patches merged with upstream
  * Remove 0001-lldpad-print-verbose-error-messages.patch
  * Remove 0002-Move-to-libnl3.patch
- Update to latest git version
  * Automake fixes
  * Fix DCBX event generation from lldpad
  * Make TTL TLV configurable
  * Update open-lldp-git-update.patch.bz2
- Correctly process return value in get_perm_hwaddr (bsc#929171)
  * Add 0001-l2_linux_packet-correctly-process-return-value-of-ge.patch
- lldpad: Only set Tx adminStatus if interface is not managed
  (bsc#929171)
  * Add 0002-lldpad-Only-set-Tx-adminStatus-if-interface-is-not-m.patch

OBS-URL: https://build.opensuse.org/package/show/network:fcoe/open-lldp?expand=0&rev=20
This commit is contained in:
Hannes Reinecke 2015-08-03 14:18:29 +00:00 committed by Git OBS Bridge
parent 3c348baeb9
commit 29676c838f
9 changed files with 125 additions and 380 deletions

View File

@ -0,0 +1,35 @@
From 795b363c15d145e8cad21e8ba11d817efc329bf7 Mon Sep 17 00:00:00 2001
From: Johannes Thumshirn <jthumshirn@suse.de>
Date: Tue, 19 May 2015 15:34:46 +0200
Subject: l2_linux_packet: correctly process return value of get_perm_hwaddr
On success get_perm_hwaddr() returns the number of bytes read from the
netlink socket.
However, l2_packet_init() only checks for 0 as a successful return value.
Adopt get_perm_hwaddr() to return 0 on success.
Reference: bsc#929171
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
lldp_rtnl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lldp_rtnl.c b/lldp_rtnl.c
index 33b4d19..8d4f0cc 100644
--- a/lldp_rtnl.c
+++ b/lldp_rtnl.c
@@ -322,6 +322,8 @@ int get_perm_hwaddr(const char *ifname, u8 *buf_perm, u8 *buf_san)
memcpy(buf_perm, RTA_DATA(rta), ETH_ALEN);
memcpy(buf_san, RTA_DATA(rta) + ETH_ALEN, ETH_ALEN);
+
+ rc = 0;
out:
close(s);
out_nosock:
--
1.8.4.5

View File

@ -1,44 +0,0 @@
From 76abae2f76ae02cd0af19bd7ff4d52e2f9c46bf4 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
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 <hare@suse.de>
---
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

View File

@ -1,327 +0,0 @@
From d6239987b6616e86f00b48912c18370b318738ae Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 14 May 2014 10:29:13 +0200
Subject: Move to libnl3
libnl1 is obsolete.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
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

View File

@ -0,0 +1,54 @@
From 9b4bcd1631cdd8dd4fd9421c3a2fd662fb9f3478 Mon Sep 17 00:00:00 2001
From: Johannes Thumshirn <jthumshirn@suse.de>
Date: Wed, 20 May 2015 15:16:36 +0200
Subject: lldpad: Only set Tx adminStatus if interface is not managed
Only set the adminStatus of an interface to Tx if its DCB status
is not managed by the LLDD itself.
Reference: bsc#929171
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
lldp_8021qaz.c | 4 ++++
lldp_dcbx.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c
index 094676d..a26422e 100644
--- a/lldp_8021qaz.c
+++ b/lldp_8021qaz.c
@@ -1973,13 +1973,17 @@ int ieee8021qaz_rchange(struct port *port, struct lldp_agent *agent,
* if current configuration is RXOnly and
* not persistant (i.e. default)
*/
+ __u8 dcbx = 0;
int adminstatus;
+
+ (void) get_dcbx_hw(qaz_tlvs->ifname, &dcbx);
if (qaz_tlvs->ieee8021qazdu &&
get_config_setting(qaz_tlvs->ifname,
agent->type,
ARG_ADMINSTATUS,
&adminstatus,
CONFIG_TYPE_INT) &&
+ !(dcbx & DCB_CAP_DCBX_LLD_MANAGED) &&
get_lldp_agent_admin(qaz_tlvs->ifname,
agent->type) ==
enabledRxOnly) {
diff --git a/lldp_dcbx.c b/lldp_dcbx.c
index 9999e33..026ed83 100644
--- a/lldp_dcbx.c
+++ b/lldp_dcbx.c
@@ -354,7 +354,7 @@ struct packed_tlv* dcbx_gettlv(struct port *port, struct lldp_agent *agent)
if (agent->type != NEAREST_BRIDGE)
return NULL;
- if (!check_port_dcb_mode(port->ifname))
+ if (!check_port_dcb_mode(port->ifname))
return NULL;
tlvs = dcbx_data(port->ifname);
--
1.8.4.5

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c7b4abc970bf4cc12617b8124de0b440e69fc2a9f680973d2c313301802def14
size 341218

3
open-lldp-1.0.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a630fcd806750a37d63518b269abd1ff749fd573ed00b878222a426a3aa6131a
size 400712

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63b2fd3cd5e372b9a544c631e8e35b6768aa0f3daa9da421442c5ddf42dce555
size 149620
oid sha256:05fee39fe4edd1901dafee09cdef599080ee6213a161a0be58f72505d725a8ac
size 37737

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Mon Aug 3 10:24:33 CEST 2015 - hare@suse.de
- Update to v1.0.1 (FATE#318849)
* vpd22 updates
* Include vpdtool
* Support for OUI infrastructure in vpd22
* Support for OUI infrastructure in vpdtool
* Support for Cisco-specific OUI extensions in vpd22
* Add vpdtool manpage
* Add open-lldp-1.0.1.tar.gz
* Remove open-lldp-0.9.46.tar.gz
* Patches merged with upstream
* Remove 0001-lldpad-print-verbose-error-messages.patch
* Remove 0002-Move-to-libnl3.patch
- Update to latest git version
* Automake fixes
* Fix DCBX event generation from lldpad
* Make TTL TLV configurable
* Update open-lldp-git-update.patch.bz2
- Correctly process return value in get_perm_hwaddr (bsc#929171)
* Add 0001-l2_linux_packet-correctly-process-return-value-of-ge.patch
- lldpad: Only set Tx adminStatus if interface is not managed
(bsc#929171)
* Add 0002-lldpad-Only-set-Tx-adminStatus-if-interface-is-not-m.patch
-------------------------------------------------------------------
Mon Mar 23 23:23:27 UTC 2015 - crrodriguez@opensuse.org

View File

@ -1,7 +1,7 @@
#
# spec file for package open-lldp
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -21,7 +21,7 @@ Name: open-lldp
Summary: Link Layer Discovery Protocol (LLDP) Agent
License: GPL-2.0
Group: System/Daemons
Version: 0.9.46
Version: 1.0.1
Release: 0
BuildRequires: bison
BuildRequires: flex
@ -33,8 +33,8 @@ 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
Patch1: 0001-l2_linux_packet-correctly-process-return-value-of-ge.patch
Patch2: 0002-lldpad-Only-set-Tx-adminStatus-if-interface-is-not-m.patch
Patch3: open-lldp-gcc5.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: dcbd = %{version}
@ -118,6 +118,7 @@ ln -s service %{buildroot}%{_sbindir}/rclldpad
%dir /var/lib/lldpad
%{_unitdir}/*
%{_sbindir}/*
%{_mandir}/man3/*
%{_mandir}/man8/*
%config /etc/bash_completion.d/*