Compare commits
No commits in common. "imports/c10s/lldpd-1.0.19-1.el10" and "c8s" have entirely different histories.
imports/c1
...
c8s
5
.gitignore
vendored
5
.gitignore
vendored
@ -1 +1,4 @@
|
||||
/lldpd-1.*.tar.gz
|
||||
SOURCES/lldpd-1.0.1.tar.gz
|
||||
/lldpd-1.0.1.tar.gz
|
||||
/lldpd-1.0.17.tar.gz
|
||||
/lldpd-1.0.17-free.tar.gz
|
||||
|
@ -1,6 +0,0 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Process a lldpd tarball to remove proprietary source code.
|
||||
#
|
||||
# Yaakov Selkowitz <yselkowi@redhat.com> - 2021
|
||||
#
|
||||
|
||||
SOURCE="$1"
|
||||
NEW_SOURCE=`echo $SOURCE | sed 's/\.tar\.gz/-free&/'`
|
||||
DIRECTORY=`echo $SOURCE | sed 's/\.tar\.gz//'`
|
||||
|
||||
error()
|
||||
{
|
||||
MESSAGE=$1
|
||||
echo $MESSAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
rm -rf $DIRECTORY
|
||||
tar xzf $SOURCE || error "Cannot unpack $SOURCE"
|
||||
pushd $DIRECTORY > /dev/null || error "Cannot open directory \"$DIRECTORY\""
|
||||
|
||||
echo "Remove proprietary source files"
|
||||
find include/osx -type f -delete
|
||||
find debian -type f -delete
|
||||
|
||||
echo
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
tar czf $NEW_SOURCE $DIRECTORY
|
||||
echo "$NEW_SOURCE is ready to use"
|
@ -1,35 +0,0 @@
|
||||
commit 01aee0f3601c60e570aeb9040c036c83d053cc5a
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Dec 8 13:01:07 2022 +0100
|
||||
|
||||
m4/progname.m4: Include <stdio.h> for printf in lldp_CHECK___PROGNAME
|
||||
|
||||
Otherwise the checks always fails with a compiler that does not
|
||||
support implict function declarations.
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 10baaca5824a3568..f43b2fd9beb18847 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -18976,7 +18976,7 @@ else
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
-
|
||||
+#include<stdio.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
diff --git a/m4/progname.m4 b/m4/progname.m4
|
||||
index 031aba65cbf0cc7d..b1a80f7f28c628a8 100644
|
||||
--- a/m4/progname.m4
|
||||
+++ b/m4/progname.m4
|
||||
@@ -4,7 +4,7 @@
|
||||
AC_DEFUN([lldp_CHECK___PROGNAME],[
|
||||
AC_CACHE_CHECK([whether libc defines __progname], lldp_cv_check___progname, [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
- [[]],
|
||||
+ [[#include<stdio.h>]],
|
||||
[[ extern char *__progname; printf("%s", __progname); ]])],
|
||||
[ lldp_cv_check___progname="yes" ],
|
||||
[ lldp_cv_check___progname="no" ])
|
104
lldpd-el6.init
Normal file
104
lldpd-el6.init
Normal file
@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
# lldpd init file
|
||||
#
|
||||
# chkconfig: - 60 20
|
||||
# description: 802.1ab (LLDP) daemon
|
||||
#
|
||||
# processname: lldpd
|
||||
# pidfile: /var/run/lldpd.pid
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: lldpd
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# Should-Start: $syslog $network $net-snmp
|
||||
# Should-Stop: $syslog $network $net-snmp
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: LLDP daemon
|
||||
# Description: 802.1ab (LLDP) daemon
|
||||
### END INIT INFO
|
||||
|
||||
# source function library
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
exec="/usr/sbin/lldpd"
|
||||
prog="lldpd"
|
||||
config="/etc/lldpd.d"
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
start() {
|
||||
[ -x $exec ] || exit 4
|
||||
[ -d $config ] || exit 6
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $exec $LLDPD_OPTIONS
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $exec
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
20
lldpd-el7.service
Normal file
20
lldpd-el7.service
Normal file
@ -0,0 +1,20 @@
|
||||
[Unit]
|
||||
Description=LLDP daemon
|
||||
Documentation=man:lldpd(8)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
EnvironmentFile=-/etc/sysconfig/lldpd
|
||||
ExecStart=/usr/sbin/lldpd $DAEMON_ARGS $LLDPD_OPTIONS
|
||||
Restart=on-failure
|
||||
PrivateTmp=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_PACKET AF_NETLINK AF_UNIX
|
||||
ProtectHome=yes
|
||||
ReadWriteDirectories=/var/run/lldpd
|
||||
ProtectSystem=full
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -12,7 +12,7 @@ Restart=on-failure
|
||||
PrivateTmp=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_PACKET AF_NETLINK AF_UNIX
|
||||
ProtectHome=yes
|
||||
ReadWritePaths=/run/lldpd
|
||||
ReadWritePaths=/var/run/lldpd
|
||||
ProtectSystem=strict
|
||||
ProtectKernelTunables=yes
|
||||
ProtectControlGroups=yes
|
@ -1,2 +0,0 @@
|
||||
#Type Name ID GECOS Home directory Shell
|
||||
u lldpd - "Used by the lldpd daemon" /var/lib/lldpd /sbin/nologin
|
218
lldpd.spec
218
lldpd.spec
@ -1,27 +1,48 @@
|
||||
%if 0%{?el6}
|
||||
%bcond_with systemd
|
||||
%global rundir /var/run/
|
||||
%else
|
||||
%bcond_without systemd
|
||||
%global rundir /run/
|
||||
%endif
|
||||
|
||||
%global gh_owner vincentbernat
|
||||
|
||||
Name: lldpd
|
||||
Version: 1.0.19
|
||||
Release: 1%{?dist}
|
||||
Version: 1.0.17
|
||||
Release: 2%{?dist}
|
||||
Summary: ISC-licensed implementation of LLDP
|
||||
|
||||
License: ISC
|
||||
URL: https://%{name}.github.io/
|
||||
Source0: %{name}-%{version}-free.tar.gz
|
||||
Source1: %{name}.service
|
||||
URL: https://%{gh_owner}.github.io/%{name}/
|
||||
Source0: https://media.luffy.cx/files/lldpd/lldpd-%{version}.tar.gz
|
||||
Source1: %{name}-fedora.service
|
||||
Source2: %{name}-tmpfiles
|
||||
Source3: %{name}.sysconfig
|
||||
Source4: %{name}-systemd-sysusers.conf
|
||||
Source3: %{name}-fedora.sysconfig
|
||||
Source4: %{name}-el6.init
|
||||
Source5: %{name}-el7.service
|
||||
|
||||
Source100: %{name}-cleanup.sh
|
||||
|
||||
BuildRequires: check-devel
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: libevent-devel
|
||||
BuildRequires: make
|
||||
BuildRequires: net-snmp-devel
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: systemd-devel
|
||||
BuildRequires: check-devel
|
||||
BuildRequires: net-snmp-devel
|
||||
BuildRequires: libxml2-devel
|
||||
# EL6 needs libevent2 as the package
|
||||
%if 0%{?el6}
|
||||
BuildRequires: libevent2-devel
|
||||
%else
|
||||
BuildRequires: libevent-devel
|
||||
%endif
|
||||
|
||||
%if 0%{?with_systemd}
|
||||
# For systemd stuff
|
||||
BuildRequires: systemd
|
||||
%{?systemd_requires}
|
||||
%else
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
# This is for /sbin/service
|
||||
Requires(preun): initscripts
|
||||
%endif
|
||||
|
||||
Requires(pre): shadow-utils
|
||||
|
||||
@ -39,71 +60,106 @@ Summary: %{summary}
|
||||
%{name} development libraries and headers
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
%autosetup
|
||||
|
||||
|
||||
%build
|
||||
%configure --disable-static --with-snmp --disable-silent-rules \
|
||||
--with-privsep-user=%{name} --with-privsep-group=%{name} \
|
||||
--with-privsep-chroot=%{_rundir}/%{name}/chroot \
|
||||
--with-lldpd-ctl-socket=%{_rundir}/%{name}/%{name}.socket \
|
||||
--with-privsep-chroot=%{rundir}%{name}/chroot \
|
||||
--with-lldpd-ctl-socket=%{rundir}%{name}/%{name}.socket \
|
||||
%if 0%{?with_systemd}
|
||||
--with-systemdsystemunitdir=%{_unitdir} --with-sysusersdir=no
|
||||
%endif
|
||||
|
||||
%make_build
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%if 0%{?with_systemd}
|
||||
%if 0%{?fedora} >= 26
|
||||
install -p -D -m644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
|
||||
%else
|
||||
install -p -D -m644 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}.service
|
||||
%endif
|
||||
install -p -D -m644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
||||
%else
|
||||
install -p -D -m755 %{SOURCE4} %{buildroot}%{_initddir}/%{name}
|
||||
%endif
|
||||
install -p -D -m644 %{SOURCE3} %{buildroot}/etc/sysconfig/%{name}
|
||||
install -p -D -m644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
|
||||
install -d -D -m 0755 %{buildroot}%{_rundir}/%{name}/chroot
|
||||
install -d -D -m 0755 %{buildroot}%{rundir}%{name}/chroot
|
||||
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
|
||||
# remove the docs from buildroot
|
||||
rm -rf %{buildroot}/usr/share/doc/%{name}
|
||||
|
||||
|
||||
# don't include completion conf yet
|
||||
rm -f %{buildroot}/usr/share/bash-completion/completions/lldpcli
|
||||
rm -f %{buildroot}/usr/share/zsh/vendor-completions/_lldpcli
|
||||
rm -f %{buildroot}/usr/share/zsh/site-functions/_lldpcli
|
||||
|
||||
# remove static libtool archive
|
||||
find %{buildroot} -type f -name "*.la" -delete
|
||||
|
||||
%ldconfig_scriptlets
|
||||
rm -f %{buildroot}%{_libdir}/liblldpctl.la
|
||||
|
||||
%pre
|
||||
%sysusers_create_compat %{SOURCE4}
|
||||
getent group %{name} >/dev/null || groupadd -r %{name}
|
||||
getent passwd %{name} >/dev/null || \
|
||||
useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
|
||||
-c "Used by the %{name} daemon" %{name}
|
||||
exit 0
|
||||
|
||||
%post
|
||||
%systemd_post lldpd.service
|
||||
/sbin/ldconfig
|
||||
%if 0%{?with_systemd}
|
||||
%systemd_post %{name}.service
|
||||
%else
|
||||
# This adds the proper /etc/rc*.d links for the script
|
||||
/sbin/chkconfig --add %{name}
|
||||
%endif
|
||||
|
||||
%preun
|
||||
%systemd_preun lldpd.service
|
||||
%if 0%{?with_systemd}
|
||||
%systemd_preun %{name}.service
|
||||
%else
|
||||
if [ $1 -eq 0 ] ; then
|
||||
/sbin/service %{name} stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}
|
||||
fi
|
||||
%endif
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart lldpd.service
|
||||
/sbin/ldconfig
|
||||
%if 0%{?with_systemd}
|
||||
%systemd_postun_with_restart %{name}.service
|
||||
%else
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc NEWS README.md
|
||||
%config %{_sysconfdir}/%{name}.d
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%license LICENSE
|
||||
%{_sbindir}/lldpcli
|
||||
%{_sbindir}/lldpctl
|
||||
%{_sbindir}/%{name}
|
||||
%config %{_sysconfdir}/%{name}.d
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
%{_mandir}/man8/lldpcli.8*
|
||||
%{_mandir}/man8/lldpctl.8*
|
||||
%{_mandir}/man8/%{name}.8*
|
||||
%{_libdir}/liblldpctl.so.4*
|
||||
%dir %{_rundir}/%{name}
|
||||
%dir %{_rundir}/%{name}/chroot
|
||||
%dir %{rundir}%{name}
|
||||
%dir %{rundir}%{name}/chroot
|
||||
%if 0%{?with_systemd}
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_tmpfilesdir}/%{name}.conf
|
||||
%{_sysusersdir}/%{name}.conf
|
||||
%else
|
||||
%{_initddir}/%{name}
|
||||
%endif
|
||||
%dir %attr(-,lldpd,lldpd) %{_sharedstatedir}/%{name}
|
||||
|
||||
%files devel
|
||||
@ -114,94 +170,14 @@ exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 13 2025 Hangbin Liu <haliu@redhat.com> - 1.0.19-1
|
||||
- Rebased to 1.0.19 (RHEL-73629)
|
||||
* Mon Nov 06 2023 Hangbin Liu <haliu@redhat.com> - 1.0.17-2
|
||||
- Fix liblldpctl version [RHEL-2211]
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.0.18-4
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
* Mon Nov 06 2023 Hangbin Liu <haliu@redhat.com> - 1.0.17-1
|
||||
- Rebased to 1.0.17 [RHEL-2211]
|
||||
|
||||
* Tue Jul 30 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-3
|
||||
- Remove networkd tests from gating test
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.0.18-2
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Wed Apr 24 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-1
|
||||
- Strip ASL/APSL components (RHELMISC-4345)
|
||||
|
||||
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Tue Nov 28 2023 Florian Weimer <fweimer@redhat.com> - 1.0.16-4
|
||||
- Reapply C99 compatibility fix
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue May 2 2023 Peter Hjalmarsson <kanelxake@gmail.com> - 1.0.16-2
|
||||
- Correcting usage of rundir macro
|
||||
- Fix creation of sysuser
|
||||
|
||||
* Tue Apr 11 2023 Peter Robinson <pbrobinson@fedoraproject.org> - 1.0.16-1
|
||||
- Update to 1.0.16
|
||||
- Modernise spec file
|
||||
- CVEs: CVE-2020-27827, CVE-2020-27827, CVE-2021-43612
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Thu Dec 8 2022 Florian Weimer <fweimer@redhat.com> - 1.0.4-11
|
||||
- Port configure script to C99
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0.4-7
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Sep 29 20:35:23 CEST 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0.4-5
|
||||
- Rebuilt for libevent 2.1.12
|
||||
|
||||
* Wed Sep 02 2020 Josef Ridky <jridky@redhat.com> - 1.0.4-4
|
||||
- Rebuilt for new net-snmp release
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Tue Aug 13 2019 James Hogarth <james.hogarth@gmail.com> - 1.0.4-1
|
||||
- Updated to new upstream release 1.0.4
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.0.1-5
|
||||
- Rebuild for readline 8.0
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Tue Jul 24 2018 Adam Williamson <awilliam@redhat.com> - 1.0.1-3
|
||||
- Rebuild for new net-snmp
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
* Thu Aug 09 2018 Josef Ridky <jridky@redhat.com> - 1.0.1-2
|
||||
- Rebuild for Net-SNMP
|
||||
|
||||
* Tue Apr 17 2018 James Hogarth <james.hogarth@gmail.com> - 1.0.1-1
|
||||
- Update to 1.0.1
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (lldpd-1.0.19-free.tar.gz) = d5f38e47df028acf449fa8656a4fcdae3a5877d8c3c5d647983ef90f235271252f6f2993ffae313df295acfc03086b4a8f3213b4e530bd753e9ecac2730e6638
|
||||
SHA512 (lldpd-1.0.17.tar.gz) = 8f6d6ea6a32cc0f238158a2d1f08224224bca250cf61f80e4d8b633c0471e4ff9a17a7a7d7f313f10d557a256c7419f54cbb3b78903b7bba3619f9c5b6c114c8
|
||||
|
@ -1,149 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
# ~~~
|
||||
# lldpd-test.py integration test
|
||||
# Description: Test for lldpd: implementation of IEEE 802.1ab (LLDP)
|
||||
#
|
||||
# Author: Susant Sahani <susant@redhat.com>
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#~~~
|
||||
|
||||
import errno
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
import subprocess
|
||||
import signal
|
||||
import shutil
|
||||
import re
|
||||
import socket
|
||||
|
||||
LLDPD_TCP_DUMP_FILE='/tmp/lldpd-tcp-dump.pcap'
|
||||
LLDPD_PID_FILE='/var/run/lldpd.pid'
|
||||
|
||||
SERVICE_UNITDIR = '/run/systemd/system'
|
||||
NETWORK_UNITDIR = '/run/systemd/network'
|
||||
|
||||
def setUpModule():
|
||||
"""Initialize the environment, and perform sanity checks on it."""
|
||||
|
||||
if shutil.which('lldpd') is None:
|
||||
raise OSError(errno.ENOENT, 'lldpd not found')
|
||||
|
||||
# Ensure the unit directory exists so tests can dump files into it.
|
||||
os.makedirs(NETWORK_UNITDIR, exist_ok=True)
|
||||
|
||||
class lldpdUtilities():
|
||||
"""Provide a set of utility functions start stop lldpd ."""
|
||||
|
||||
def Startlldpd(self):
|
||||
"""Start lldpd interface lldpd-peer """
|
||||
subprocess.check_output(['/usr/sbin/lldpd', '-cfse', '-D', '-C', 'lldpd-peer', '-I', 'lldpd-peer', '-S', 'lldpd-system-name','-m', '192.168.50.6'])
|
||||
|
||||
def Stoplldpd(self):
|
||||
try:
|
||||
with open(LLDPD_PID_FILE, 'r') as f:
|
||||
pid = f.read().rstrip(' \t\r\n\0')
|
||||
os.kill(int(pid), signal.SIGTERM)
|
||||
os.remove(LLDPD_PID_FILE)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
def StartCaptureLLDPPackets(self):
|
||||
"""Start tcpdump to capture packets"""
|
||||
self.WriteServiceFile('tcpdump.service', '''\
|
||||
[Unit]
|
||||
Description=TCPDumpd
|
||||
After=multi-user.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
ExecStart=/usr/sbin/tcpdump -pnnli lldpd ether proto 0x88cc -vvv -w "/tmp/lldpd-tcp-dump.pcap"
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
''')
|
||||
subprocess.check_output(['systemctl','daemon-reload'])
|
||||
subprocess.check_output(['systemctl','restart', 'tcpdump.service'])
|
||||
|
||||
def StopCapturingPackets(self):
|
||||
subprocess.check_output(['systemctl', 'stop', 'tcpdump.service'])
|
||||
time.sleep(3);
|
||||
|
||||
def SetupVethInterface(self):
|
||||
"""Setup veth interface"""
|
||||
subprocess.check_output(['ip', 'link', 'add', 'lldpd', 'type', 'veth', 'peer', 'name', 'lldpd-peer'])
|
||||
subprocess.check_output(['ip', 'link', 'set', 'lldpd', 'address', '02:01:02:03:04:08'])
|
||||
subprocess.check_output(['ip', 'link', 'set', 'lldpd-peer', 'address', '02:01:02:03:04:09'])
|
||||
subprocess.check_output(['ip', 'link', 'set', 'lldpd', 'up'])
|
||||
subprocess.check_output(['ip', 'link', 'set', 'lldpd-peer', 'up'])
|
||||
|
||||
time.sleep(3);
|
||||
|
||||
self.addCleanup(subprocess.call, ['ip', 'link', 'del', 'dev', 'lldpd'])
|
||||
|
||||
def WriteServiceFile(self, unit_name, contents):
|
||||
"""Write a tcpdump unit file, and queue it to be removed."""
|
||||
unit_path = os.path.join(SERVICE_UNITDIR, unit_name)
|
||||
|
||||
with open(unit_path, 'w') as unit:
|
||||
unit.write(contents)
|
||||
self.addCleanup(os.remove, unit_path)
|
||||
|
||||
def FindProtocolFieldsinTCPDump(self, **kwargs):
|
||||
"""Look attributes in lldpd logs."""
|
||||
|
||||
contents = subprocess.check_output(['tcpdump', '-v', '-r', LLDPD_TCP_DUMP_FILE]).rstrip().decode('utf-8')
|
||||
if kwargs is not None:
|
||||
for key in kwargs:
|
||||
self.assertRegex(contents, kwargs[key])
|
||||
|
||||
class lldpdTests(unittest.TestCase, lldpdUtilities):
|
||||
|
||||
def setUp(self):
|
||||
""" Setup """
|
||||
self.SetupVethInterface()
|
||||
|
||||
def tearDown(self):
|
||||
self.Stoplldpd()
|
||||
os.remove(LLDPD_TCP_DUMP_FILE)
|
||||
|
||||
def test_lldpd_trasmitted_lldp_attributes(self):
|
||||
""" verify at the other end of veth received LLDP packets that contains attibutes (link address, hostname, TTL, system desc). tcpdump """
|
||||
|
||||
self.StartCaptureLLDPPackets()
|
||||
time.sleep(5)
|
||||
self.Startlldpd()
|
||||
|
||||
""" capture for 10 seconds """
|
||||
time.sleep(10)
|
||||
|
||||
self.StopCapturingPackets()
|
||||
|
||||
self.FindProtocolFieldsinTCPDump(Chassis='Subtype MAC address \(4\): 02:01:02:03:04:09',
|
||||
Port='Subtype MAC address \(3\): 02:01:02:03:04:09',
|
||||
PortDesc='lldpd-peer',
|
||||
TTL='TTL.*120s',
|
||||
HostName=socket.gethostname() ,
|
||||
System_Description='lldpd-system-name',
|
||||
ManagementAddress='192.168.50.6')
|
||||
|
||||
def test_lldpd_trasmitted_lldp_packets(self):
|
||||
""" verify at the other end of veth ifname lldpd has received LLDP packets. tcpdump """
|
||||
|
||||
self.StartCaptureLLDPPackets()
|
||||
time.sleep(5)
|
||||
self.Startlldpd()
|
||||
|
||||
""" capture for 10 seconds """
|
||||
time.sleep(10)
|
||||
|
||||
self.StopCapturingPackets()
|
||||
self.FindProtocolFieldsinTCPDump(MAC='02:01:02:03:04:09',
|
||||
TTL='TTL 120s')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout,
|
||||
verbosity=2))
|
@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
# ~~~
|
||||
# LLDPD integration test
|
||||
# Description: Test for lldpd:implementation of IEEE 802.1ab (LLDP)
|
||||
#
|
||||
# Author: Susant Sahani <susant@redhat.com>
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="lldpd"
|
||||
LldpdPidFile="/var/run/lldpd.pid"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun "cp lldpd-tests.py /usr/bin/"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlLog "lldpd tests"
|
||||
rlRun "/usr/bin/python3 /usr/bin/lldpd-tests.py"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "rm /usr/bin/lldpd-tests.py"
|
||||
rlLog "lldpd tests done"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
|
||||
rlGetTestState
|
@ -1,13 +0,0 @@
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-beakerlib
|
||||
tags:
|
||||
- classic
|
||||
tests:
|
||||
- miscellaneous-tests
|
||||
required_packages:
|
||||
- lldpd
|
||||
- python3
|
||||
- tcpdump
|
||||
- systemd
|
||||
- iproute
|
Loading…
Reference in New Issue
Block a user