diff options
author | Fabio Berton <fabio.berton@ossystems.com.br> | 2015-09-18 14:23:35 -0300 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2015-10-21 15:57:26 -0400 |
commit | 0289eac721085563ff727515022e8c61b2ecf30d (patch) | |
tree | 2c9745482d515b75c4ca2a1ef755aa4671a74a86 /meta-networking/recipes-daemons/lldpd | |
parent | 395519075d3b713f13e8b695b3783c9ca5c7f821 (diff) | |
download | meta-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')
4 files changed, 237 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 0000000000..42d6b290ae --- /dev/null +++ b/meta-networking/recipes-daemons/lldpd/files/fix-libevent-configure.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | Upstream-Status: Submitted [https://github.com/vincentbernat/lldpd/issues/133] | ||
2 | |||
3 | Subject: [PATCH] fix libevent configure | ||
4 | |||
5 | Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> | ||
6 | --- | ||
7 | m4/libevent.m4 | 4 ++-- | ||
8 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
9 | |||
10 | diff --git a/m4/libevent.m4 b/m4/libevent.m4 | ||
11 | index 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 | -- | ||
38 | 2.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 0000000000..3acacfd90b --- /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 0000000000..88bf958989 --- /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 | |||
16 | log_daemon_msg() { | ||
17 | echo $* | ||
18 | } | ||
19 | |||
20 | log_end_msg() { | ||
21 | if [ $1 -eq 0 ]; then | ||
22 | success $* | ||
23 | else | ||
24 | failure $* | ||
25 | fi | ||
26 | } | ||
27 | |||
28 | log_failure_msg() { | ||
29 | echo $* | ||
30 | } | ||
31 | |||
32 | log_success_msg() { | ||
33 | echo $* | ||
34 | } | ||
35 | |||
36 | |||
37 | # PATH should only include /usr/* if it runs after the mountnfs.sh script | ||
38 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | ||
39 | DESC="LLDP daemon" | ||
40 | NAME=lldpd | ||
41 | DAEMON=/usr/sbin/$NAME | ||
42 | DAEMON_ARGS="" | ||
43 | PIDFILE=/var/run/$NAME.pid | ||
44 | SCRIPTNAME=/etc/init.d/$NAME | ||
45 | CHROOT=/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 | |||
56 | do_start() | ||
57 | { | ||
58 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ | ||
59 | $DAEMON_ARGS \ | ||
60 | || return 2 | ||
61 | } | ||
62 | |||
63 | do_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 | |||
74 | do_reload() { | ||
75 | start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME | ||
76 | return 0 | ||
77 | } | ||
78 | |||
79 | case "$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 | ;; | ||
126 | esac | ||
127 | |||
128 | : | ||
diff --git a/meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb b/meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb new file mode 100644 index 0000000000..47d3c38ed0 --- /dev/null +++ b/meta-networking/recipes-daemons/lldpd/lldpd_0.7.17.bb | |||
@@ -0,0 +1,68 @@ | |||
1 | SUMMARY = "A 802.1ab implementation (LLDP) to help you locate neighbors of all your equipments" | ||
2 | SECTION = "net/misc" | ||
3 | LICENSE = "ISC" | ||
4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" | ||
5 | |||
6 | DEPENDS = "libbsd libevent" | ||
7 | |||
8 | SRC_URI = "\ | ||
9 | http://media.luffy.cx/files/${PN}/${PN}-${PV}.tar.gz \ | ||
10 | file://lldpd.init.d \ | ||
11 | file://lldpd.default \ | ||
12 | file://fix-libevent-configure.patch \ | ||
13 | " | ||
14 | |||
15 | SRC_URI[md5sum] = "8cb74065956bc32a575ee5203b0e0fb5" | ||
16 | SRC_URI[sha256sum] = "6b50b8aa47d1424a93ba3df55af26da41f7d5718db8d25e99291c4a6cd09c20e" | ||
17 | |||
18 | inherit autotools update-rc.d useradd systemd pkgconfig | ||
19 | |||
20 | USERADD_PACKAGES = "${PN}" | ||
21 | USERADD_PARAM_${PN} = "--system -g lldpd --shell /bin/false lldpd" | ||
22 | GROUPADD_PARAM_${PN} = "--system lldpd" | ||
23 | |||
24 | EXTRA_OECONF += "--without-embedded-libevent \ | ||
25 | --disable-oldies \ | ||
26 | --with-privsep-user=lldpd \ | ||
27 | --with-privsep-group=lldpd" | ||
28 | |||
29 | PACKAGECONFIG ??= "cdp fdp edp sonmp lldpmed dot1 dot3" | ||
30 | PACKAGECONFIG[json] = "--with-json,--without-json,jansson" | ||
31 | PACKAGECONFIG[xml] = "--with-xml,--without-xml,libxm2" | ||
32 | PACKAGECONFIG[snmp] = "--with-snmp,--without-snmp,net-snmp" | ||
33 | PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" | ||
34 | PACKAGECONFIG[seccomp] = "--with-seccomp,--without-seccomp,libseccomp" | ||
35 | PACKAGECONFIG[cdp] = "--enable-cdp,--disable-cdp" | ||
36 | PACKAGECONFIG[fdp] = "--enable-fdp,--disable-fdp" | ||
37 | PACKAGECONFIG[edp] = "--enable-edp,--disable-edp" | ||
38 | PACKAGECONFIG[sonmp] = "--enable-sonmp,--disable-sonmp" | ||
39 | PACKAGECONFIG[lldpmed] = "--enable-lldpmed,--disable-lldpmed" | ||
40 | PACKAGECONFIG[dot1] = "--enable-dot1,--disable-dot1" | ||
41 | PACKAGECONFIG[dot3] = "--enable-dot3,--disable-dot3" | ||
42 | PACKAGECONFIG[custom] = "--enable-custom,--disable-custom" | ||
43 | |||
44 | INITSCRIPT_NAME = "lldpd" | ||
45 | INITSCRIPT_PARAMS = "defaults" | ||
46 | |||
47 | SYSTEMD_SERVICE_${PN} = "lldpd.service" | ||
48 | |||
49 | do_install_append() { | ||
50 | install -Dm 0755 ${WORKDIR}/lldpd.init.d ${D}${sysconfdir}/init.d/lldpd | ||
51 | install -Dm 0644 ${WORKDIR}/lldpd.default ${D}${sysconfdir}/default/lldpd | ||
52 | # Make an empty configuration file | ||
53 | touch ${D}${sysconfdir}/lldpd.conf | ||
54 | } | ||
55 | |||
56 | PACKAGES =+ "${PN}-bash-completion ${PN}-zsh-completion" | ||
57 | |||
58 | FILES_${PN} += "${libdir}/sysusers.d" | ||
59 | RDEPENDS_${PN} += "os-release" | ||
60 | |||
61 | FILES_${PN}-bash-completion += "${sysconfdir}/bash_completion.d/ \ | ||
62 | ${datadir}/bash-completion/ \ | ||
63 | " | ||
64 | RDEPENDS_${PN}-bash-completion += "bash" | ||
65 | |||
66 | FILES_${PN}-zsh-completion += "${datadir}/zsh/" | ||
67 | # FIXME: zsh is broken in meta-oe so this cannot be enabled for now | ||
68 | #RDEPENDS_${PN}-zsh-completion += "zsh" | ||