Release based on lldpd 1.0.13

driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/ub-lldpd/issues/I86D0D
CVE: NA

----------------------------------------------------------------------

Release based on lldpd 1.0.13

Signed-off-by: Jeiwei Li <lijiewei5@huawei.com>
This commit is contained in:
Zhou Juan 2023-10-11 11:00:56 +08:00 committed by Jeiwei Li
parent 13a849ecf3
commit 545983df86
6 changed files with 417 additions and 73 deletions

View File

@ -1,36 +0,0 @@
# ub-lldpd
#### Description
ub-lldpd is an ISC-licensed implementation of Linux LLDP for ub device.
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,37 +0,0 @@
# ub-lldpd
#### 介绍
ub-lldpd is an ISC-licensed implementation of Linux LLDP for ub device.
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

BIN
ub-lldpd-1.0.0.tar.gz Normal file

Binary file not shown.

121
ub-lldpd.init Normal file
View File

@ -0,0 +1,121 @@
#!/bin/bash
# ub-lldpd init file
#
# chkconfig: 2345 60 20
# description: 802.1ab (LLDP) daemon
#
# processname: ub-lldpd
# pidfile: /var/run/ub-lldpd.pid
### BEGIN INIT INFO
# Provides: ub-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-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: LLDP daemon
# Description: UB (LLDP) daemon
### END INIT INFO
# source function library
. /etc/rc.d/init.d/functions
LLDPD_OPTIONS=""
[ -e /etc/sysconfig/ub-lldpd ] && . /etc/sysconfig/ub-lldpd
RETVAL=0
prog="ub-lldpd"
binary=/usr/sbin/ub-lldpd
pidfile=/var/run/ub-lldpd.pid
lockfile=/var/lock/subsys/$prog
# Determine if we can use the -p option to daemon, killproc, and status.
# RHEL < 5 can't.
if status | grep -q -- '-p' 2>/dev/null; then
daemonopts="--pidfile $pidfile"
pidopts="-p $pidfile"
fi
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
daemon $daemonopts $binary $LLDPD_OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc $pidopts $binary
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile
fi;
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e $lockfile ] && restart
return 0
}
rh_status_q(){
status $pidopts $prog >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
start
RETVAL=$?
;;
stop)
rh_status_q || exit 0
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload)
rh_status_q || exit 7
exit 3
;;
force-reload)
restart
RETVAL=$?
;;
condrestart|try-restart)
rh_status_q || exit 0
condrestart
RETVAL=$?
;;
status)
status $pidopts $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|force-reload}"
RETVAL=2
esac
exit $RETVAL

288
ub-lldpd.spec Normal file
View File

@ -0,0 +1,288 @@
%define lldpd_user _ub_lldpd
%define lldpd_group _ub_lldpd
%define lldpd_chroot /var/run/ub_lldpd
Summary: Implementation of UB (LLDP)
Name: ub-lldpd
Version: 1.0.0
Release: 1
License: ISC
Group: System/Management
URL: https://lldpd.github.io/
Source0: %{name}-%{version}.tar.gz
Source1: ub-lldpd.init
Source2: ub-lldpd.sysconfig
BuildRequires: pkgconfig
BuildRequires: libevent-devel
BuildRequires: readline-devel
BuildRequires: libcap-devel
BuildRequires: libxml2-devel
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd-units
Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
%description
This implementation provides LLDP sending and reception.
%package devel
Summary: Implementation of LLDP(UB) - Tools and header files for developers
Group: Development/Libraries/C
BuildRequires: pkgconfig
Requires: ub-lldpd = %{version}-%{release}
%description devel
This package is required to develop alternate clients for lldpd.
LLDP is an industry standard protocol designed to supplant proprietary
Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
inter-vendor compatible mechanism to deliver Link-Layer notifications
to adjacent network devices.
%prep
%setup -q
%build
%configure \
--with-xml \
--with-privsep-user=%lldpd_user \
--with-privsep-group=%lldpd_group \
--with-privsep-chroot=%lldpd_chroot \
--with-systemdsystemunitdir=%{_unitdir} \
--with-sysusersdir=no \
--prefix=%{_usr} \
--localstatedir=%{_localstatedir} \
--sysconfdir=%{_sysconfdir} \
--libdir=%{_libdir} \
--docdir=%{_docdir}/ub-lldpd \
--enable-pie \
--with-embedded-libevent=no
make
%install
make install DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc/sysconfig
install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ub-lldpd
%pre
# Create ub-lldpd user/group
if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
%{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
%{_sbindir}/useradd -g %lldpd_group -M -r -s /sbin/nologin \
-c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
|| exit 1 ; fi
%post
/sbin/ldconfig
%systemd_post ub-lldpd.service
%preun
%systemd_preun ub-lldpd.service
%postun
%systemd_postun_with_restart ub-lldpd.service
/sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%dir %{_docdir}/ub-lldpd
%doc %{_docdir}/ub-lldpd/NEWS
%doc %{_docdir}/ub-lldpd/LICENSE
%{_sbindir}/ub-lldpd
%{_sbindir}/ub-lldpctl
%attr(4750,%lldpd_user,adm) %{_sbindir}/ub-lldpcli
%{_libdir}/libublldpctl.so.*
%{_datadir}/zsh
%{_datadir}/bash-completion
%doc %{_mandir}/man8/ub-lldp*
%config %{_sysconfdir}/ub-lldpd.d
%{_unitdir}/ub-lldpd.service
%config(noreplace) %{_sysconfdir}/sysconfig/ub-lldpd
%files devel
%defattr(-,root,root)
%{_libdir}/libublldpctl.so
%{_libdir}/libublldpctl.a
%{_libdir}/libublldpctl.la
%{_libdir}/pkgconfig/ub-lldpctl.pc
%{_includedir}/lldpctl.h
%{_includedir}/lldp-const.h
%changelog
* Tue Oct 10 2023 Jeiwei Li <lijiewei5@huawei.com> - 1.0.0-1
- Release based on lldpd 1.0.13.
* Sat Nov 13 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.13-1
- New upstream version.
* Fri Aug 20 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.12-1
- New upstream version.
* Sat May 01 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.11-1
- New upstream version.
* Fri Apr 09 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.10-1
- New upstream version.
* Fri Apr 02 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.9-1
- New upstream version.
* Wed Jan 13 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.8-1
- New upstream version.
* Sat Oct 31 2020 Vincent Bernat <bernat@luffy.cx> - 1.0.7-1
- New upstream version.
* Sat Sep 05 2020 Vincent Bernat <bernat@luffy.cx> - 1.0.6-1
- New upstream version.
* Sat Feb 01 2020 Vincent Bernat <bernat@luffy.cx> - 1.0.5-1
- New upstream version.
* Sun Jun 15 2019 Vincent Bernat <bernat@luffy.cx> - 1.0.4-1
- New upstream version.
* Mon Dec 10 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.3-1
- New upstream version.
* Sat Dec 01 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.2-1
- New upstream version.
* Mon Apr 09 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.1-1
- New upstream version.
* Sun Apr 08 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.0-1
- New upstream version.
* Tue Nov 21 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.9-1
- New upstream version.
* Sun Aug 20 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.8-1
- New upstream version.
* Sun Mar 19 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.7-1
- New upstream version.
* Sat Jan 21 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.6-1
- New upstream version.
* Fri Sep 30 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.5-1
- New upstream version.
* Fri Jun 17 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.4-1
- New upstream version.
* Sat May 21 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.3-1
- New upstream version.
* Sat Mar 19 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.2-1
- New upstream version.
* Sat Feb 20 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.1-1
- New upstream version.
* Fri Jan 01 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.0-1
- New upstream version.
- Do not rely on libnl3.
* Sun Dec 27 2015 Vincent Bernat <bernat@luffy.cx> - 0.8.0-1
- New upstream version.
- Use system libnl3 when possible.
- Use system libevent when possible.
* Wed Sep 09 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.17-1
- New upstream version.
* Fri Aug 07 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.16-1
- New upstream version.
* Wed May 20 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.15-1
- New upstream version.
* Sat Apr 04 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.14-1
- New upstream version.
* Tue Dec 30 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.13-1
- New upstream version.
* Sat Nov 22 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.12-1
- New upstream version.
- Completion for bash and zsh.
* Wed Oct 08 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.11-1
- New upstream version.
- Completion for bash and zsh.
* Mon Jul 21 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.10-1
- New upstream version.
* Wed May 28 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.9-1
- New upstream version.
* Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1
- New upstream version.
* Sun Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1
- New upstream version.
* Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1
- New upstream version.
* Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1
- New upstream version.
* Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1
- New upstream version.
* Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1
- New upstream version.
* Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1
- New upstream version.
* Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
- New upstream version.
- Requires readline-devel.
- Ships lldpcli.
* Thu Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
- New upstream version
- Do not require libevent, use embedded copy.
- Provide a -devel package.
* Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
- New upstream version
- Define bcond_without and with macros if not defined to be compatible
with RHEL
- Requires useradd and groupadd
- Adapt to make it work with SuSE
- Provide an init script targetted at SuSE
- Build require lm_sensors-devel on RHEL
* Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
- New upstream version
- Add XML support
* Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
- Add variables
- Enable SNMP support
- Add _lldpd user creation
- Add initscript
- New upstream version
* Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
- Initial attempt

8
ub-lldpd.sysconfig Normal file
View File

@ -0,0 +1,8 @@
## Path: Network/Discovery
## Description: ub-lldpd configuration
## Type: string(-x,-c,-s,-e,-f)
## Default: ""
## ServiceRestart: ub-lldpd
# Parameters for ub-lldpd. See the manual page for the
# accepted parameters.
LLDPD_OPTIONS=""