summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/lldpd/files
diff options
context:
space:
mode:
authorFabio Berton <fabio.berton@ossystems.com.br>2015-09-18 14:23:35 -0300
committerJoe MacDonald <joe_macdonald@mentor.com>2015-10-21 15:57:26 -0400
commit0289eac721085563ff727515022e8c61b2ecf30d (patch)
tree2c9745482d515b75c4ca2a1ef755aa4671a74a86 /meta-networking/recipes-daemons/lldpd/files
parent395519075d3b713f13e8b695b3783c9ca5c7f821 (diff)
downloadmeta-openembedded-0289eac721085563ff727515022e8c61b2ecf30d.tar.gz
lldpd: Add recipe
lldpd is a 802.1AB implementation, a L2 network discovery protocol. It also supports CDP, EDP and various other protocols. Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-daemons/lldpd/files')
-rw-r--r--meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch39
-rw-r--r--meta-networking/recipes-daemons/lldpd/files/lldpd.default2
-rw-r--r--meta-networking/recipes-daemons/lldpd/files/lldpd.init.d128
3 files changed, 169 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch b/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch
new file mode 100644
index 000000000..42d6b290a
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch
@@ -0,0 +1,39 @@
1Upstream-Status: Submitted [https://github.com/vincentbernat/lldpd/issues/133]
2
3Subject: [PATCH] fix libevent configure
4
5Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
6---
7 m4/libevent.m4 | 4 ++--
8 1 file changed, 2 insertions(+), 2 deletions(-)
9
10diff --git a/m4/libevent.m4 b/m4/libevent.m4
11index 275e5a5..dcd3309 100644
12--- a/m4/libevent.m4
13+++ b/m4/libevent.m4
14@@ -45,13 +45,11 @@ AC_DEFUN([lldp_CHECK_LIBEVENT], [
15 AC_MSG_ERROR([*** libevent not found])
16 fi
17 ])
18- fi
19
20 if test x"$LIBEVENT_EMBEDDED" != x; then
21 unset LIBEVENT_LIBS
22 LIBEVENT_CFLAGS="-I\$(top_srcdir)/libevent/include -I\$(top_builddir)/libevent/include"
23 LIBEVENT_LDFLAGS="\$(top_builddir)/libevent/libevent.la"
24- fi
25
26 # Call ./configure in libevent. Need it for make dist...
27 libevent_configure_args="$libevent_configure_args --disable-libevent-regress"
28@@ -64,6 +62,8 @@ AC_DEFUN([lldp_CHECK_LIBEVENT], [
29 libevent_configure_args="$libevent_configure_args --with-pic"
30 libevent_configure_args="$libevent_configure_args --enable-static"
31 lldp_CONFIG_SUBDIRS([libevent], [$libevent_configure_args])
32+ fi
33+ fi
34
35 AM_CONDITIONAL([LIBEVENT_EMBEDDED], [test x"$LIBEVENT_EMBEDDED" != x])
36 AC_SUBST([LIBEVENT_LIBS])
37--
382.1.4
39
diff --git a/meta-networking/recipes-daemons/lldpd/files/lldpd.default b/meta-networking/recipes-daemons/lldpd/files/lldpd.default
new file mode 100644
index 000000000..3acacfd90
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/files/lldpd.default
@@ -0,0 +1,2 @@
1# Uncomment to start SNMP subagent and enable CDP, SONMP and EDP protocol
2#DAEMON_ARGS="-x -c -s -e"
diff --git a/meta-networking/recipes-daemons/lldpd/files/lldpd.init.d b/meta-networking/recipes-daemons/lldpd/files/lldpd.init.d
new file mode 100644
index 000000000..88bf95898
--- /dev/null
+++ b/meta-networking/recipes-daemons/lldpd/files/lldpd.init.d
@@ -0,0 +1,128 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: lldpd
4# Required-Start: $remote_fs $network $syslog
5# Required-Stop: $network $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: LLDP daemon
9# Description: lldpd is a 802.1AB implementation, a L2 network
10# discovery protocol. It also supports CDP, EDP and
11# various other protocols.
12### END INIT INFO
13
14# Do NOT "set -e"
15
16log_daemon_msg() {
17 echo $*
18}
19
20log_end_msg() {
21 if [ $1 -eq 0 ]; then
22 success $*
23 else
24 failure $*
25 fi
26}
27
28log_failure_msg() {
29 echo $*
30}
31
32log_success_msg() {
33 echo $*
34}
35
36
37# PATH should only include /usr/* if it runs after the mountnfs.sh script
38PATH=/sbin:/usr/sbin:/bin:/usr/bin
39DESC="LLDP daemon"
40NAME=lldpd
41DAEMON=/usr/sbin/$NAME
42DAEMON_ARGS=""
43PIDFILE=/var/run/$NAME.pid
44SCRIPTNAME=/etc/init.d/$NAME
45CHROOT=/var/run/$NAME
46
47# Exit if the package is not installed
48[ -x "$DAEMON" ] || exit 0
49
50# Read configuration variable file if it is present
51[ -r /etc/default/$NAME ] && . /etc/default/$NAME
52
53# LSB log_* functions
54. /etc/init.d/functions
55
56do_start()
57{
58 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
59 $DAEMON_ARGS \
60 || return 2
61}
62
63do_stop()
64{
65 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
66 RETVAL="$?"
67 [ "$RETVAL" = 2 ] && return 2
68 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
69 [ "$?" = 2 ] && return 2
70 rm -f $PIDFILE
71 return "$RETVAL"
72}
73
74do_reload() {
75 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
76 return 0
77}
78
79case "$1" in
80 start)
81 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
82 do_start
83 case "$?" in
84 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
85 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
86 esac
87 ;;
88 stop)
89 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
90 do_stop
91 case "$?" in
92 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
93 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
94 esac
95 ;;
96 reload)
97 log_daemon_msg "Reloading $DESC" "$NAME"
98 do_reload
99 log_end_msg $?
100 ;;
101 restart|force-reload)
102 log_daemon_msg "Restarting $DESC" "$NAME"
103 do_stop
104 case "$?" in
105 0|1)
106 do_start
107 case "$?" in
108 0) log_end_msg 0 ;;
109 1) log_end_msg 1 ;; # Old process is still running
110 *) log_end_msg 1 ;; # Failed to start
111 esac
112 ;;
113 *)
114 # Failed to stop
115 log_end_msg 1
116 ;;
117 esac
118 ;;
119 status)
120 status_of_proc $DAEMON $NAME -p $PIDFILE && exit 0 || exit $?
121 ;;
122 *)
123 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
124 exit 3
125 ;;
126esac
127
128: