diff --git a/.gitignore b/.gitignore index 11977bf..c4843f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -/lldpad-0.9.44.tar.gz -/lldpad-0.9.45.tar.gz -/lldpad-0.9.46.tar.gz +/lldpad-*.tar.gz diff --git a/lldpad-0.9.46-libnl3.patch b/lldpad-0.9.46-libnl3.patch new file mode 100644 index 0000000..956458e --- /dev/null +++ b/lldpad-0.9.46-libnl3.patch @@ -0,0 +1,328 @@ +From 48a5f38778b18d6659a672ccb4640f25c6720827 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 14 May 2014 17:28:07 +0000 +Subject: [PATCH 1/1] Move to libnl3 + +libnl1 is obsolete. + +Signed-off-by: Hannes Reinecke +Signed-off-by: John Fastabend +--- + 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.7.1 + diff --git a/lldpad.spec b/lldpad.spec index cf1526b..be5ae3c 100644 --- a/lldpad.spec +++ b/lldpad.spec @@ -1,28 +1,31 @@ +%global _default_patch_fuzz 2 + # https://fedoraproject.org/wiki/Packaging:Guidelines#Compiler_flags %define _hardened_build 1 Name: lldpad Version: 0.9.46 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Intel LLDP Agent Group: System Environment/Daemons License: GPLv2 URL: http://open-lldp.org/ Source0: %{name}-%{version}.tar.gz Patch0: lldpad-0.9.46-subdir-objects.patch +Patch1: lldpad-0.9.46-libnl3.patch + BuildRequires: automake autoconf libtool BuildRequires: flex >= 2.5.33 BuildRequires: kernel-headers >= 2.6.32 BuildRequires: libconfig-devel >= 1.3.2 -BuildRequires: libnl-devel +BuildRequires: libnl3-devel BuildRequires: readline-devel BuildRequires: systemd Requires: readline + Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -Provides: dcbd = %{version}-%{release} -Obsoletes: dcbd < 0.9.26 %description This package contains the Linux user space daemon and configuration tool for @@ -42,6 +45,7 @@ that use %{name}. %prep %setup -q %patch0 -p1 +%patch1 -p1 %build ./bootstrap.sh @@ -70,23 +74,6 @@ rm -f %{buildroot}%{_libdir}/liblldp_clif.la /sbin/ldconfig %systemd_postun_with_restart %{name}.service -%post devel -## provide legacy support for apps that use the old dcbd interface. -if [ ! -e %{_includedir}/dcbd ]; then - ln -T -s %{_includedir}/lldpad %{_includedir}/dcbd -fi -if [ ! -e %{_includedir}/dcbd/clif_cmds.h ]; then - ln -T -s %{_includedir}/lldpad/lldp_dcbx_cmds.h %{_includedir}/dcbd/clif_cmds.h -fi - -%preun devel -if [ -e %{_includedir}/dcbd/clif_cmds.h ]; then - rm -f %{_includedir}/dcbd/clif_cmds.h -fi -if [ -e %{_includedir}/dcbd ]; then - rm -f %{_includedir}/dcbd -fi - %files %doc COPYING README ChangeLog %{_sbindir}/* @@ -103,6 +90,10 @@ fi %{_libdir}/liblldp_clif.so %changelog +* Tue Jul 22 2014 Peter Robinson 0.9.46-6 +- Add upstream patch to build against libnl3 +- Drop legacy dcbd packaging support, we've not shipped it since F-13 + * Sat Jun 07 2014 Fedora Release Engineering - 0.9.46-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild