summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-10 03:20:04 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-10 03:20:04 +0200
commit1b8dfe266937a37a4c642f96ceb2347bf4c00a17 (patch)
tree0c6aab146bb3c82efd9c7846a9a4e70dcb0ec84f /meta-networking/recipes-protocols
downloadmeta-openembedded-daisy-140929.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-networking/recipes-protocols')
-rw-r--r--meta-networking/recipes-protocols/accel-ppp/accel-ppp_git.bb41
-rw-r--r--meta-networking/recipes-protocols/net-snmp/files/ifmib.patch66
-rwxr-xr-xmeta-networking/recipes-protocols/net-snmp/files/init63
-rw-r--r--meta-networking/recipes-protocols/net-snmp/files/snmpd.conf422
-rw-r--r--meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf18
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service13
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service13
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch1618
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.bb120
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow.inc35
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow_1.0.bb4
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow_git.bb4
-rw-r--r--meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/fix-parallel-build.patch19
-rw-r--r--meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/options.pptp30
-rw-r--r--meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.7.2.bb31
-rw-r--r--meta-networking/recipes-protocols/quagga/files/0001-doc-fix-makeinfo-errors-and-one-warning.patch61
-rw-r--r--meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch48
-rw-r--r--meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch50
-rw-r--r--meta-networking/recipes-protocols/quagga/files/build-fix-extract.pl-for-cross-compilation.patch31
-rw-r--r--meta-networking/recipes-protocols/quagga/files/fix-for-lib-inpath.patch19
-rw-r--r--meta-networking/recipes-protocols/quagga/files/lingering-IP-address-after-deletion-BZ-486.patch64
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga-0.99.17-libcap.patch64
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch54
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga-fix-CVE-2013-6051.patch29
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga.default13
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga.init200
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga.pam13
-rw-r--r--meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch50
-rw-r--r--meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga3
-rw-r--r--meta-networking/recipes-protocols/quagga/files/watchquagga.default12
-rw-r--r--meta-networking/recipes-protocols/quagga/files/watchquagga.init64
-rw-r--r--meta-networking/recipes-protocols/quagga/files/work-with-new-readline.patch34
-rw-r--r--meta-networking/recipes-protocols/quagga/quagga.inc207
-rw-r--r--meta-networking/recipes-protocols/quagga/quagga_0.99.21.bb15
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/configure_in_cross.patch142
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/discard-use-of-dnl-in-Makefile.am.patch27
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/dont-swallow-errors.patch15
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.default22
-rwxr-xr-xmeta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.init59
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-src-restrictions.patch20
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/top-autoconf.patch27
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/update-config.patch32
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/use-ldflags.patch27
-rw-r--r--meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.8.bb58
-rw-r--r--meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc40
-rw-r--r--meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb5
-rw-r--r--meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch19
-rw-r--r--meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf51
-rw-r--r--meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default17
-rw-r--r--meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb34
50 files changed, 4123 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/accel-ppp/accel-ppp_git.bb b/meta-networking/recipes-protocols/accel-ppp/accel-ppp_git.bb
new file mode 100644
index 0000000000..526818c05e
--- /dev/null
+++ b/meta-networking/recipes-protocols/accel-ppp/accel-ppp_git.bb
@@ -0,0 +1,41 @@
1SUMMARY = "ACCEL-PPP is a high performance VPN server application for linux"
2HOMEPAGE = "http://sourceforge.net/apps/trac/accel-ppp/wiki"
3
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
6
7DEPENDS = "openssl libpcre"
8
9inherit cmake
10
11PR = "r1"
12PV = "1.7.3+git"
13
14SRCREV = "4acfa46c321a344b9a6ce4128e72d1e02828d8a0"
15SRC_URI = "git://accel-ppp.git.sourceforge.net/gitroot/accel-ppp/accel-ppp;branch=1.7"
16
17S = "${WORKDIR}/git"
18
19EXTRA_OECMAKE = " \
20 -DBUILD_DRIVER=FALSE \
21 -DCMAKE_INSTALL_PREFIX=${prefix} \
22 -DCMAKE_BUILD_TYPE=Release \
23 -DLOG_PGSQL=FALSE \
24 -DRADIUS=FALSE \
25 -DNETSNMP=FALSE \
26"
27FILES_${PN}-dbg += "/usr/lib/${BPN}/.debug/*"
28
29PACKAGES =+ "${PN}-libs"
30FILES_${PN}-libs = "${libdir}/${BPN}/*.so /usr/lib/${BPN}/*.so"
31INSANE_SKIP_${PN}-libs = "dev-so"
32RDEPENDS_${PN} += "${PN}-libs"
33
34do_install_prepend() {
35 cmlist=`find ${S} -name CMakeLists.txt`
36 for file in $cmlist; do
37 sed -i -e "s:LIBRARY DESTINATION lib/accel-ppp:LIBRARY DESTINATION ${baselib}/accel-ppp:g" \
38 -e "s:\${CMAKE_INSTALL_PREFIX}/lib/accel-ppp:\${CMAKE_INSTALL_PREFIX}/${baselib}/accel-ppp:g" \
39 $cmlist
40 done
41}
diff --git a/meta-networking/recipes-protocols/net-snmp/files/ifmib.patch b/meta-networking/recipes-protocols/net-snmp/files/ifmib.patch
new file mode 100644
index 0000000000..859c52c3e3
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/files/ifmib.patch
@@ -0,0 +1,66 @@
1Signed-off-by: Jack Mitchell <jack@embed.me.uk>
2Upstream-Status: Pending
3Bug-Report: http://sourceforge.net/p/net-snmp/bugs/2449/
4
5diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c
6index 3419811..d6eb91a 100644
7--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
8+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
9@@ -18,7 +18,31 @@ netsnmp_feature_require(interface_ioctl_flags_set)
10
11 #ifdef HAVE_PCI_LOOKUP_NAME
12 #include <pci/pci.h>
13+#include <setjmp.h>
14 static struct pci_access *pci_access;
15+
16+/* Avoid letting libpci call exit(1) when no PCI bus is available. */
17+static int do_longjmp =0;
18+static jmp_buf err_buf;
19+static void
20+netsnmp_pci_error(char *msg, ...)
21+{
22+ va_list args;
23+ char *buf;
24+ int buflen;
25+
26+ va_start(args, msg);
27+ buflen = strlen("pcilib: ")+strlen(msg)+2;
28+ buf = malloc(buflen);
29+ snprintf(buf, buflen, "pcilib: %s\n", msg);
30+ snmp_vlog(LOG_ERR, buf, args);
31+ free(buf);
32+ va_end(args);
33+ if (do_longjmp)
34+ longjmp(err_buf, 1);
35+ else
36+ exit(1);
37+}
38 #endif
39
40 #ifdef HAVE_LINUX_ETHTOOL_H
41@@ -147,10 +171,22 @@ netsnmp_arch_interface_init(void)
42
43 #ifdef HAVE_PCI_LOOKUP_NAME
44 pci_access = pci_alloc();
45- if (pci_access)
46+ if (!pci_access) {
47+ snmp_log(LOG_ERR, "pcilib: pci_alloc failed\n");
48+ return;
49+ }
50+
51+ pci_access->error = netsnmp_pci_error;
52+
53+ do_longjmp = 1;
54+ if (setjmp(err_buf)) {
55+ pci_cleanup(pci_access);
56+ snmp_log(LOG_ERR, "pcilib: pci_init failed\n");
57+ pci_access = NULL;
58+ }
59+ else if (pci_access)
60 pci_init(pci_access);
61- else
62- snmp_log(LOG_ERR, "Unable to create pci access method\n");
63+ do_longjmp = 0;
64 #endif
65 }
66
diff --git a/meta-networking/recipes-protocols/net-snmp/files/init b/meta-networking/recipes-protocols/net-snmp/files/init
new file mode 100755
index 0000000000..434b2fa3f2
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/files/init
@@ -0,0 +1,63 @@
1#! /bin/sh
2# /etc/init.d/snmpd: start snmp daemon.
3
4test -x /usr/sbin/snmpd || exit 0
5test -x /usr/sbin/snmptrapd || exit 0
6
7# Defaults
8export MIBDIRS=/usr/share/snmp/mibs
9SNMPDRUN=yes
10SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
11TRAPDRUN=no
12TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
13
14# Cd to / before starting any daemons.
15cd /
16
17case "$1" in
18 start)
19 echo -n "Starting network management services:"
20 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
21 start-stop-daemon -S -x /usr/sbin/snmpd \
22 -- $SNMPDOPTS
23 echo -n " snmpd"
24 fi
25 if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
26 start-stop-daemon -S -x /usr/sbin/snmptrapd \
27 -- $TRAPDOPTS
28 echo -n " snmptrapd"
29 fi
30 echo "."
31 ;;
32 stop)
33 echo -n "Stopping network management services:"
34 start-stop-daemon -K -x /usr/sbin/snmpd
35 echo -n " snmpd"
36 start-stop-daemon -K -x /usr/sbin/snmptrapd
37 echo -n " snmptrapd"
38 echo "."
39 ;;
40 restart|reload|force-reload)
41 echo -n "Restarting network management services:"
42 start-stop-daemon -K -x /usr/sbin/snmpd
43 start-stop-daemon -K -x /usr/sbin/snmptrapd
44 # Allow the daemons time to exit completely.
45 sleep 2
46 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
47 start-stop-daemon -S -x /usr/sbin/snmpd -- $SNMPDOPTS
48 echo -n " snmpd"
49 fi
50 if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
51 # Allow snmpd time to start up.
52 sleep 1
53 start-stop-daemon -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS
54 echo -n " snmptrapd"
55 fi
56 echo "."
57 ;;
58 *)
59 echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}"
60 exit 1
61esac
62
63exit 0
diff --git a/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf b/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf
new file mode 100644
index 0000000000..728171c427
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf
@@ -0,0 +1,422 @@
1###############################################################################
2#
3# EXAMPLE.conf:
4# An example configuration file for configuring the ucd-snmp snmpd agent.
5#
6###############################################################################
7#
8# This file is intended to only be an example. If, however, you want
9# to use it, it should be placed in /etc/snmp/snmpd.conf.
10# When the snmpd agent starts up, this is where it will look for it.
11#
12# You might be interested in generating your own snmpd.conf file using
13# the "snmpconf" program (perl script) instead. It's a nice menu
14# based interface to writing well commented configuration files. Try it!
15#
16# Note: This file is automatically generated from EXAMPLE.conf.def.
17# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run
18# configure & make, and then make sure you read the EXAMPLE.conf file
19# instead, as it will tailor itself to your configuration.
20
21# All lines beginning with a '#' are comments and are intended for you
22# to read. All other lines are configuration commands for the agent.
23
24#
25# PLEASE: read the snmpd.conf(5) manual page as well!
26#
27
28
29###############################################################################
30# Access Control
31###############################################################################
32
33# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
34# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
35# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
36
37# By far, the most common question I get about the agent is "why won't
38# it work?", when really it should be "how do I configure the agent to
39# allow me to access it?"
40#
41# By default, the agent responds to the "public" community for read
42# only access, if run out of the box without any configuration file in
43# place. The following examples show you other ways of configuring
44# the agent so that you can change the community names, and give
45# yourself write access as well.
46#
47# The following lines change the access permissions of the agent so
48# that the COMMUNITY string provides read-only access to your entire
49# NETWORK (EG: 10.10.10.0/24), and read/write access to only the
50# localhost (127.0.0.1, not its real ipaddress).
51#
52# For more information, read the FAQ as well as the snmpd.conf(5)
53# manual page.
54
55####
56# First, map the community name (COMMUNITY) into a security name
57# (local and mynetwork, depending on where the request is coming
58# from):
59
60# sec.name source community
61com2sec paranoid default public
62#com2sec readonly default public
63#com2sec readwrite default private
64
65####
66# Second, map the security names into group names:
67
68# sec.model sec.name
69group MyROSystem v1 paranoid
70group MyROSystem v2c paranoid
71group MyROSystem usm paranoid
72group MyROGroup v1 readonly
73group MyROGroup v2c readonly
74group MyROGroup usm readonly
75group MyRWGroup v1 readwrite
76group MyRWGroup v2c readwrite
77group MyRWGroup usm readwrite
78
79####
80# Third, create a view for us to let the groups have rights to:
81
82# incl/excl subtree mask
83view all included .1 80
84view system included .iso.org.dod.internet.mgmt.mib-2.system
85
86####
87# Finally, grant the 2 groups access to the 1 view with different
88# write permissions:
89
90# context sec.model sec.level match read write notif
91access MyROSystem "" any noauth exact system none none
92access MyROGroup "" any noauth exact all none none
93access MyRWGroup "" any noauth exact all all none
94
95# -----------------------------------------------------------------------------
96
97
98###############################################################################
99# System contact information
100#
101
102# It is also possible to set the sysContact and sysLocation system
103# variables through the snmpd.conf file. **PLEASE NOTE** that setting
104# the value of these objects here makes these objects READ-ONLY
105# (regardless of any access control settings). Any attempt to set the
106# value of an object whose value is given here will fail with an error
107# status of notWritable.
108
109syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
110syscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)
111
112# Example output of snmpwalk:
113# % snmpwalk -v 1 -c public localhost system
114# system.sysDescr.0 = "SunOS name sun4c"
115# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
116# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
117# system.sysContact.0 = "Me <me@somewhere.org>"
118# system.sysName.0 = "name"
119# system.sysLocation.0 = "Right here, right now."
120# system.sysServices.0 = 72
121
122
123# -----------------------------------------------------------------------------
124
125
126###############################################################################
127# Process checks.
128#
129# The following are examples of how to use the agent to check for
130# processes running on the host. The syntax looks something like:
131#
132# proc NAME [MAX=0] [MIN=0]
133#
134# NAME: the name of the process to check for. It must match
135# exactly (ie, http will not find httpd processes).
136# MAX: the maximum number allowed to be running. Defaults to 0.
137# MIN: the minimum number to be running. Defaults to 0.
138
139#
140# Examples:
141#
142
143# Make sure mountd is running
144#proc mountd
145
146# Make sure there are no more than 4 ntalkds running, but 0 is ok too.
147#proc ntalkd 4
148
149# Make sure at least one sendmail, but less than or equal to 10 are running.
150#proc sendmail 10 1
151
152# A snmpwalk of the prTable would look something like this:
153#
154# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.2
155# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1
156# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2
157# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3
158# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd"
159# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd"
160# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail"
161# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0
162# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0
163# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1
164# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0
165# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4
166# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10
167# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0
168# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0
169# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1
170# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1
171# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0
172# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0
173# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running."
174# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = ""
175# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = ""
176# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0
177# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0
178# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0
179#
180# Note that the errorFlag for mountd is set to 1 because one is not
181# running (in this case an rpc.mountd is, but thats not good enough),
182# and the ErrMessage tells you what's wrong. The configuration
183# imposed in the snmpd.conf file is also shown.
184#
185# Special Case: When the min and max numbers are both 0, it assumes
186# you want a max of infinity and a min of 1.
187#
188
189
190# -----------------------------------------------------------------------------
191
192
193###############################################################################
194# Executables/scripts
195#
196
197#
198# You can also have programs run by the agent that return a single
199# line of output and an exit code. Here are two examples.
200#
201# exec NAME PROGRAM [ARGS ...]
202#
203# NAME: A generic name.
204# PROGRAM: The program to run. Include the path!
205# ARGS: optional arguments to be passed to the program
206
207# a simple hello world
208#exec echotest /bin/echo hello world
209
210# Run a shell script containing:
211#
212# #!/bin/sh
213# echo hello world
214# echo hi there
215# exit 35
216#
217# Note: this has been specifically commented out to prevent
218# accidental security holes due to someone else on your system writing
219# a /tmp/shtest before you do. Uncomment to use it.
220#
221#exec shelltest /bin/sh /tmp/shtest
222
223# Then,
224# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8
225# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
226# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
227# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
228# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest"
229# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world"
230# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest"
231# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
232# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35
233# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world."
234# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world."
235# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0
236# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0
237
238# Note that the second line of the /tmp/shtest shell script is cut
239# off. Also note that the exit status of 35 was returned.
240
241# -----------------------------------------------------------------------------
242
243
244###############################################################################
245# disk checks
246#
247
248# The agent can check the amount of available disk space, and make
249# sure it is above a set limit.
250
251# disk PATH [MIN=DEFDISKMINIMUMSPACE]
252#
253# PATH: mount path to the disk in question.
254# MIN: Disks with space below this value will have the Mib's errorFlag set.
255# Default value = DEFDISKMINIMUMSPACE.
256
257# Check the / partition and make sure it contains at least 10 megs.
258
259#disk / 10000
260
261# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9
262# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
263# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F
264# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0"
265# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000
266# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130
267# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325
268# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092
269# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58
270# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0
271# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = ""
272
273# -----------------------------------------------------------------------------
274
275
276###############################################################################
277# load average checks
278#
279
280# load [1MAX=DEFMAXLOADAVE] [5MAX=DEFMAXLOADAVE] [15MAX=DEFMAXLOADAVE]
281#
282# 1MAX: If the 1 minute load average is above this limit at query
283# time, the errorFlag will be set.
284# 5MAX: Similar, but for 5 min average.
285# 15MAX: Similar, but for 15 min average.
286
287# Check for loads:
288#load 12 14 14
289
290# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.10
291# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1
292# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2
293# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3
294# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1"
295# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5"
296# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15"
297# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39
298# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31
299# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36
300# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00"
301# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00"
302# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00"
303# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0
304# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0
305# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0
306# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = ""
307# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = ""
308# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = ""
309
310# -----------------------------------------------------------------------------
311
312
313###############################################################################
314# Extensible sections.
315#
316
317# This alleviates the multiple line output problem found in the
318# previous executable mib by placing each mib in its own mib table:
319
320# Run a shell script containing:
321#
322# #!/bin/sh
323# echo hello world
324# echo hi there
325# exit 35
326#
327# Note: this has been specifically commented out to prevent
328# accidental security holes due to someone else on your system writing
329# a /tmp/shtest before you do. Uncomment to use it.
330#
331# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest
332
333# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50
334# enterprises.ucdavis.50.1.1 = 1
335# enterprises.ucdavis.50.2.1 = "shelltest"
336# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
337# enterprises.ucdavis.50.100.1 = 35
338# enterprises.ucdavis.50.101.1 = "hello world."
339# enterprises.ucdavis.50.101.2 = "hi there."
340# enterprises.ucdavis.50.102.1 = 0
341
342# Now the Output has grown to two lines, and we can see the 'hi
343# there.' output as the second line from our shell script.
344#
345# Note that you must alter the mib.txt file to be correct if you want
346# the .50.* outputs above to change to reasonable text descriptions.
347
348# Other ideas:
349#
350# exec .1.3.6.1.4.1.2021.51 ps /bin/ps
351# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top
352# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq
353
354# -----------------------------------------------------------------------------
355
356
357###############################################################################
358# Pass through control.
359#
360
361# Usage:
362# pass MIBOID EXEC-COMMAND
363#
364# This will pass total control of the mib underneath the MIBOID
365# portion of the mib to the EXEC-COMMAND.
366#
367# Note: You'll have to change the path of the passtest script to your
368# source directory or install it in the given location.
369#
370# Example: (see the script for details)
371# (commented out here since it requires that you place the
372# script in the right location. (its not installed by default))
373
374# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/passtest
375
376# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
377# enterprises.ucdavis.255.1 = "life the universe and everything"
378# enterprises.ucdavis.255.2.1 = 42
379# enterprises.ucdavis.255.2.2 = OID: 42.42.42
380# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42
381# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1
382# enterprises.ucdavis.255.5 = 42
383# enterprises.ucdavis.255.6 = Gauge: 42
384#
385# % snmpget -v 1 -c public localhost .1.3.6.1.4.1.2021.255.5
386# enterprises.ucdavis.255.5 = 42
387#
388# % snmpset -v 1 -c public localhost .1.3.6.1.4.1.2021.255.1 s "New string"
389# enterprises.ucdavis.255.1 = "New string"
390#
391
392# For specific usage information, see the man/snmpd.conf.5 manual page
393# as well as the local/passtest script used in the above example.
394
395###############################################################################
396# Subagent control
397#
398
399# The agent can support subagents using a number of extension mechanisms.
400# From the 4.2.1 release, AgentX support is being compiled in by default.
401# However, this is still experimental code, so should not be used on
402# critical production systems.
403# Please see the file README.agentx for more details.
404#
405# If having read, marked, learnt and inwardly digested this information,
406# you decide that you do wish to make use of this mechanism, simply
407# uncomment the following directive.
408#
409# master agentx
410#
411# I repeat - this is *NOT* regarded as suitable for front-line production
412# systems, though it is probably stable enough for day-to-day use.
413# Probably.
414#
415# No refunds will be given.
416
417###############################################################################
418# Further Information
419#
420# See the snmpd.conf manual page, and the output of "snmpd -H".
421# MUCH more can be done with the snmpd.conf than is shown as an
422# example here.
diff --git a/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf b/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf
new file mode 100644
index 0000000000..8d2e4375ef
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf
@@ -0,0 +1,18 @@
1###############################################################################
2#
3# EXAMPLE.conf:
4# An example configuration file for configuring the ucd-snmp snmptrapd agent.
5#
6###############################################################################
7#
8# This file is intended to only be an example. If, however, you want
9# to use it, it should be placed in /etc/snmp/snmptrapd.conf.
10# When the snmptrapd agent starts up, this is where it will look for it.
11#
12# All lines beginning with a '#' are comments and are intended for you
13# to read. All other lines are configuration commands for the agent.
14
15#
16# PLEASE: read the snmptrapd.conf(5) manual page as well!
17#
18
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service b/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service
new file mode 100644
index 0000000000..10a1eb2128
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Simple Network Management Protocol (SNMP) Daemon.
3After=syslog.target network.target
4
5[Service]
6Type=notify
7Environment=OPTIONS="-LS0-6d"
8EnvironmentFile=-/etc/default/snmpd
9ExecStart=/usr/sbin/snmpd $OPTIONS -f
10ExecReload=/bin/kill -HUP $MAINPID
11
12[Install]
13WantedBy=multi-user.target
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service b/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service
new file mode 100644
index 0000000000..951f9f2707
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Simple Network Management Protocol (SNMP) Trap Daemon.
3After=syslog.target network.target
4
5[Service]
6Type=notify
7Environment=OPTIONS="-Lsd"
8EnvironmentFile=-/etc/default/snmptrapd
9ExecStart=/usr/sbin/snmptrapd $OPTIONS -f
10ExecReload=/bin/kill -HUP $MAINPID
11
12[Install]
13WantedBy=multi-user.target
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch
new file mode 100644
index 0000000000..e19153bbc4
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch
@@ -0,0 +1,1618 @@
1Systemd support backported from the master branch as of 23/04/2012 (post 5.7.1, pre 5.8).
2
3The following commits have been cherry-picked:
4
519499c3c90bf9d7b2b9e5d08baa26cc6bba28a11
6fef6cddfdb94da1a6b1fb768af62918b80f11fd3
70641e43c694c485cbbffef0556efc4641bd3ff50
876530a89f1c8bbd0b63acce63e10d5d4812a1a16 (conflict resolved)
9bf108d7f1354f6276fc43c129963f2c49b9fc242
103692875172352f72cf3afd0d35f355e83d7e421b
1174412748067c685e1d8ab6ed3bcc3ca9c2774844
1286132e3f1e6ef7b4e0b96d8fa24e37c81b71b0e0
1363557cf8986a33dba1d4429b583a901361052c4f
14
15Upstream-Status: Backport
16
17Signed-off-by: Thomas Fitzsimmons <fitzsim@cisco.com>
18diff --git a/README.systemd b/README.systemd
19new file mode 100644
20index 0000000..f731851
21--- /dev/null
22+++ b/README.systemd
23@@ -0,0 +1,41 @@
24+README.systemd
25+--------------
26+Net-SNMP provides two daemons, which support systemd system manager.
27+See http://www.freedesktop.org/wiki/Software/systemd to learn how
28+systemd works. Both socket activation and notification is supported by these
29+daemons.
30+
31+To enable systemd support, the sources must be compiled with
32+--with-systemd configure option.
33+
34+snmpd - The SNMP agent
35+----------------------
36+Socket activation od snmpd daemon is implemented, but it's discouraged.
37+The reason is simple - snmpd not only listens and processes SNMP requests
38+from network, but also gathers system statistics counters, sends traps and
39+communicates with subagents. It even opens few netlink sockets.
40+
41+In other words, snmpd should run from system start to properly work.
42+This can be done in two ways:
43+1) either as snmpd service unit with 'Type=notification' and without a socket
44+ unit
45+2) or as snmpd service unit with 'Type=simple', appropriate socket socket unit
46+ and the snmpd service enabled. This way systemd creates the snmpd listening
47+ socket early during boot and passes the sockets to snmpd slightly later
48+ (but still during machine boot). This way systemd can paralelize start of
49+ services, which depend on snmpd. Admins must adjust the socket file manually,
50+ depending if the snmpd support AgentX, IPv6, SMUX etc.
51+
52+snmpd should be started with '-f' command line parameter to disable forking -
53+systemd does that for us automatically.
54+
55+
56+snmptrapd - The trap processing daemon
57+--------------------------------------
58+snmptrapd supports full socket activation and also notification (if needed).
59+Both 'Type=simple' (with appropriate socket unit) and 'Type=notify' services
60+will work. Again, '-f' parameter should be provided on snmptrapd command line.
61+
62+If integration with SNMP agent using AgentX protocol is enabled, snmptrapd should
63+start during boot and not after first SNMP trap arrives. Same rules as for snmpd
64+applies then.
65\ No newline at end of file
66diff --git a/agent/snmpd.c b/agent/snmpd.c
67index b177d5b..08bdfc7 100644
68--- a/agent/snmpd.c
69+++ b/agent/snmpd.c
70@@ -164,6 +164,10 @@ typedef long fd_mask;
71
72 #endif
73
74+#ifndef NETSNMP_NO_SYSTEMD
75+#include <net-snmp/library/sd-daemon.h>
76+#endif
77+
78 netsnmp_feature_want(logging_file)
79 netsnmp_feature_want(logging_stdio)
80 netsnmp_feature_want(logging_syslog)
81@@ -441,18 +445,28 @@ main(int argc, char *argv[])
82 int agent_mode = -1;
83 char *pid_file = NULL;
84 char option_compatability[] = "-Le";
85+#ifndef WIN32
86+ int prepared_sockets = 0;
87+#endif
88 #if HAVE_GETPID
89 int fd;
90 FILE *PID;
91 #endif
92
93 #ifndef WIN32
94+#ifndef NETSNMP_NO_SYSTEMD
95+ /* check if systemd has sockets for us and don't close them */
96+ prepared_sockets = netsnmp_sd_listen_fds(0);
97+#endif /* NETSNMP_NO_SYSTEMD */
98+
99 /*
100 * close all non-standard file descriptors we may have
101 * inherited from the shell.
102 */
103- for (i = getdtablesize() - 1; i > 2; --i) {
104- (void) close(i);
105+ if (!prepared_sockets) {
106+ for (i = getdtablesize() - 1; i > 2; --i) {
107+ (void) close(i);
108+ }
109 }
110 #endif /* #WIN32 */
111
112@@ -1100,6 +1114,19 @@ main(int argc, char *argv[])
113 netsnmp_addrcache_initialise();
114
115 /*
116+ * Let systemd know we're up.
117+ */
118+#ifndef NETSNMP_NO_SYSTEMD
119+ netsnmp_sd_notify(1, "READY=1\n");
120+ if (prepared_sockets)
121+ /*
122+ * Clear the environment variable, we already processed all the sockets
123+ * by now.
124+ */
125+ netsnmp_sd_listen_fds(1);
126+#endif
127+
128+ /*
129 * Forever monitor the dest_port for incoming PDUs.
130 */
131 DEBUGMSGTL(("snmpd/main", "We're up. Starting to process data.\n"));
132diff --git a/apps/snmptrapd.c b/apps/snmptrapd.c
133index 1a52080..0857ae1 100644
134--- a/apps/snmptrapd.c
135+++ b/apps/snmptrapd.c
136@@ -125,6 +125,10 @@ SOFTWARE.
137
138 #include <net-snmp/net-snmp-features.h>
139
140+#ifndef NETSNMP_NO_SYSTEMD
141+#include <net-snmp/library/sd-daemon.h>
142+#endif
143+
144 #ifndef BSD4_3
145 #define BSD4_2
146 #endif
147@@ -655,15 +659,24 @@ main(int argc, char *argv[])
148 int agentx_subagent = 1;
149 #endif
150 netsnmp_trapd_handler *traph;
151+#ifndef WIN32
152+ int prepared_sockets = 0;
153+#endif
154
155
156 #ifndef WIN32
157+#ifndef NETSNMP_NO_SYSTEMD
158+ /* check if systemd has sockets for us and don't close them */
159+ prepared_sockets = netsnmp_sd_listen_fds(0);
160+#endif
161 /*
162 * close all non-standard file descriptors we may have
163 * inherited from the shell.
164 */
165- for (i = getdtablesize() - 1; i > 2; --i) {
166- (void) close(i);
167+ if (!prepared_sockets) {
168+ for (i = getdtablesize() - 1; i > 2; --i) {
169+ (void) close(i);
170+ }
171 }
172 #endif /* #WIN32 */
173
174@@ -1311,6 +1324,19 @@ main(int argc, char *argv[])
175 #endif
176 #endif
177
178+ /*
179+ * Let systemd know we're up.
180+ */
181+#ifndef NETSNMP_NO_SYSTEMD
182+ netsnmp_sd_notify(1, "READY=1\n");
183+ if (prepared_sockets)
184+ /*
185+ * Clear the environment variable, we already processed all the sockets
186+ * by now.
187+ */
188+ netsnmp_sd_listen_fds(1);
189+#endif
190+
191 #ifdef WIN32SERVICE
192 trapd_status = SNMPTRAPD_RUNNING;
193 #endif
194diff --git a/configure.d/config_modules_lib b/configure.d/config_modules_lib
195index b6609c1..5849072 100644
196--- a/configure.d/config_modules_lib
197+++ b/configure.d/config_modules_lib
198@@ -53,6 +53,14 @@ if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"
199 other_ftobjs_list="$other_ftobjs_list winpipe.ft"
200 fi
201
202+# Linux systemd
203+if test "x$with_systemd" == "xyes"; then
204+ other_src_list="$other_src_list sd-daemon.c"
205+ other_objs_list="$other_objs_list sd-daemon.o"
206+ other_lobjs_list="$other_lobjs_list sd-daemon.lo"
207+ other_ftobjs_list="$other_ftobjs_list sd-daemon.ft"
208+fi
209+
210 AC_SUBST(other_src_list)
211 AC_SUBST(other_objs_list)
212 AC_SUBST(other_lobjs_list)
213diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable
214index 8b46ad2..59d6d5c 100644
215--- a/configure.d/config_project_with_enable
216+++ b/configure.d/config_project_with_enable
217@@ -689,6 +689,15 @@ if test "x$with_dummy_values" != "xyes"; then
218 data for])
219 fi
220
221+NETSNMP_ARG_WITH(systemd,
222+[ --with-systemd Provide systemd support. See README.systemd
223+ for details.])
224+# Define unless specifically suppressed (i.e., option defaults to false).
225+if test "x$with_systemd" != "xyes"; then
226+ AC_DEFINE(NETSNMP_NO_SYSTEMD, 1,
227+ [If you don't want to integrate with systemd.])
228+fi
229+
230 NETSNMP_ARG_ENABLE(set-support,
231 [ --disable-set-support Do not allow SNMP set requests.])
232 if test "x$enable_set_support" = "xno"; then
233diff --git a/dist/snmpd.service b/dist/snmpd.service
234new file mode 100644
235index 0000000..31391e5
236--- /dev/null
237+++ b/dist/snmpd.service
238@@ -0,0 +1,18 @@
239+#
240+# SNMP agent service file for systemd
241+#
242+#
243+# The service should be enabled, i.e. snmpd should start during machine boot.
244+# Socket activation shall not be used. See README.systemd for details.
245+
246+[Unit]
247+Description=Simple Network Management Protocol (SNMP) daemon.
248+After=syslog.target network.target
249+
250+[Service]
251+# Type=notify is also supported. It should be set when snmpd.socket is not used.
252+Type=simple
253+ExecStart=/usr/sbin/snmpd -f
254+
255+[Install]
256+WantedBy=multi-user.target
257diff --git a/dist/snmpd.socket b/dist/snmpd.socket
258new file mode 100644
259index 0000000..7f3a2d9
260--- /dev/null
261+++ b/dist/snmpd.socket
262@@ -0,0 +1,17 @@
263+[Unit]
264+Description=Socket listening for SNMP and AgentX messages
265+
266+[Socket]
267+ListenDatagram=0.0.0.0:161
268+# Uncomment other listening addresses as needed - TCP, UDP6, TCP6.
269+# It must match listening addresses/ports defined in snmpd.service
270+# or snmpd.conf.
271+# ListenStream=0.0.0.0:161
272+# ListenDatagram=[::]:161
273+# ListenStream=[::]:161
274+#
275+# Uncomment AgentX socket if snmpd.conf enables AgentX protocol.
276+# ListenStream=/var/agentx/master
277+
278+[Install]
279+WantedBy=sockets.target
280diff --git a/dist/snmptrapd.service b/dist/snmptrapd.service
281new file mode 100644
282index 0000000..e88a5b4
283--- /dev/null
284+++ b/dist/snmptrapd.service
285@@ -0,0 +1,16 @@
286+#
287+# SNMP trap-processing service file for systemd
288+#
289+
290+[Unit]
291+Description=Simple Network Management Protocol (SNMP) Trap daemon.
292+After=syslog.target network.target
293+
294+[Service]
295+# Type=notify is also supported. It should be set when snmptrapd.socket is not
296+# used.
297+Type=simple
298+ExecStart=/usr/sbin/snmptrapd -f
299+
300+[Install]
301+WantedBy=multi-user.target
302diff --git a/dist/snmptrapd.socket b/dist/snmptrapd.socket
303new file mode 100644
304index 0000000..0fc8a7c
305--- /dev/null
306+++ b/dist/snmptrapd.socket
307@@ -0,0 +1,14 @@
308+[Unit]
309+Description=Socket listening for SNMP trap messages
310+
311+[Socket]
312+ListenDatagram=0.0.0.0:162
313+# Uncomment other listening addresses as needed - TCP, UDP6, TCP6.
314+# It must match listening addresses/ports defined in snmptrapd.service
315+# or snmptrapd.conf.
316+# ListenStream=0.0.0.0:162
317+# ListenDatagram=[::]:162
318+# ListenStream=[::]:162
319+
320+[Install]
321+WantedBy=sockets.target
322diff --git a/include/net-snmp/library/sd-daemon.h b/include/net-snmp/library/sd-daemon.h
323new file mode 100644
324index 0000000..85274c9
325--- /dev/null
326+++ b/include/net-snmp/library/sd-daemon.h
327@@ -0,0 +1,290 @@
328+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
329+
330+#ifndef SNMPD_SD_DAEMON_H
331+#define SNMPD_SD_DAEMON_H
332+
333+/***
334+ Copyright 2010 Lennart Poettering
335+
336+ Permission is hereby granted, free of charge, to any person
337+ obtaining a copy of this software and associated documentation files
338+ (the "Software"), to deal in the Software without restriction,
339+ including without limitation the rights to use, copy, modify, merge,
340+ publish, distribute, sublicense, and/or sell copies of the Software,
341+ and to permit persons to whom the Software is furnished to do so,
342+ subject to the following conditions:
343+
344+ The above copyright notice and this permission notice shall be
345+ included in all copies or substantial portions of the Software.
346+
347+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
348+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
349+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
350+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
351+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
352+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
353+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
354+ SOFTWARE.
355+***/
356+
357+#ifdef HAVE_SYS_TYPES_H
358+#include <sys/types.h>
359+#endif
360+#ifdef HAVE_INTTYPES_H
361+#include <inttypes.h>
362+#endif
363+
364+#ifdef __cplusplus
365+extern "C" {
366+#endif
367+
368+/*
369+ Reference implementation of a few systemd related interfaces for
370+ writing daemons. These interfaces are trivial to implement. To
371+ simplify porting we provide this reference implementation.
372+ Applications are welcome to reimplement the algorithms described
373+ here if they do not want to include these two source files.
374+
375+ The following functionality is provided:
376+
377+ - Support for logging with log levels on stderr
378+ - File descriptor passing for socket-based activation
379+ - Daemon startup and status notification
380+ - Detection of systemd boots
381+
382+ You may compile this with -DDISABLE_SYSTEMD to disable systemd
383+ support. This makes all those calls NOPs that are directly related to
384+ systemd (i.e. only sd_is_xxx() will stay useful).
385+
386+ Since this is drop-in code we don't want any of our symbols to be
387+ exported in any case. Hence we declare hidden visibility for all of
388+ them.
389+
390+ You may find an up-to-date version of these source files online:
391+
392+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h
393+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c
394+
395+ This should compile on non-Linux systems, too, but with the
396+ exception of the sd_is_xxx() calls all functions will become NOPs.
397+
398+ See sd-daemon(7) for more information.
399+*/
400+
401+#ifndef _sd_printf_attr_
402+#if __GNUC__ >= 4
403+#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
404+#else
405+#define _sd_printf_attr_(a,b)
406+#endif
407+#endif
408+
409+/*
410+ Log levels for usage on stderr:
411+
412+ fprintf(stderr, SD_NOTICE "Hello World!\n");
413+
414+ This is similar to printk() usage in the kernel.
415+*/
416+#define SD_EMERG "<0>" /* system is unusable */
417+#define SD_ALERT "<1>" /* action must be taken immediately */
418+#define SD_CRIT "<2>" /* critical conditions */
419+#define SD_ERR "<3>" /* error conditions */
420+#define SD_WARNING "<4>" /* warning conditions */
421+#define SD_NOTICE "<5>" /* normal but significant condition */
422+#define SD_INFO "<6>" /* informational */
423+#define SD_DEBUG "<7>" /* debug-level messages */
424+
425+/* The first passed file descriptor is fd 3 */
426+#define SD_LISTEN_FDS_START 3
427+
428+/*
429+ Returns how many file descriptors have been passed, or a negative
430+ errno code on failure. Optionally, removes the $LISTEN_FDS and
431+ $LISTEN_PID file descriptors from the environment (recommended, but
432+ problematic in threaded environments). If r is the return value of
433+ this function you'll find the file descriptors passed as fds
434+ SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
435+ errno style error code on failure. This function call ensures that
436+ the FD_CLOEXEC flag is set for the passed file descriptors, to make
437+ sure they are not passed on to child processes. If FD_CLOEXEC shall
438+ not be set, the caller needs to unset it after this call for all file
439+ descriptors that are used.
440+
441+ See sd_listen_fds(3) for more information.
442+*/
443+int netsnmp_sd_listen_fds(int unset_environment);
444+
445+/*
446+ Helper call for identifying a passed file descriptor. Returns 1 if
447+ the file descriptor is a FIFO in the file system stored under the
448+ specified path, 0 otherwise. If path is NULL a path name check will
449+ not be done and the call only verifies if the file descriptor
450+ refers to a FIFO. Returns a negative errno style error code on
451+ failure.
452+
453+ See sd_is_fifo(3) for more information.
454+*/
455+int netsnmp_sd_is_fifo(int fd, const char *path);
456+
457+/*
458+ Helper call for identifying a passed file descriptor. Returns 1 if
459+ the file descriptor is a special character device on the file
460+ system stored under the specified path, 0 otherwise.
461+ If path is NULL a path name check will not be done and the call
462+ only verifies if the file descriptor refers to a special character.
463+ Returns a negative errno style error code on failure.
464+
465+ See sd_is_special(3) for more information.
466+*/
467+int netsnmp_sd_is_special(int fd, const char *path);
468+
469+/*
470+ Helper call for identifying a passed file descriptor. Returns 1 if
471+ the file descriptor is a socket of the specified family (AF_INET,
472+ ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
473+ family is 0 a socket family check will not be done. If type is 0 a
474+ socket type check will not be done and the call only verifies if
475+ the file descriptor refers to a socket. If listening is > 0 it is
476+ verified that the socket is in listening mode. (i.e. listen() has
477+ been called) If listening is == 0 it is verified that the socket is
478+ not in listening mode. If listening is < 0 no listening mode check
479+ is done. Returns a negative errno style error code on failure.
480+
481+ See sd_is_socket(3) for more information.
482+*/
483+int netsnmp_sd_is_socket(int fd, int family, int type, int listening);
484+
485+/*
486+ Helper call for identifying a passed file descriptor. Returns 1 if
487+ the file descriptor is an Internet socket, of the specified family
488+ (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
489+ SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
490+ check is not done. If type is 0 a socket type check will not be
491+ done. If port is 0 a socket port check will not be done. The
492+ listening flag is used the same way as in sd_is_socket(). Returns a
493+ negative errno style error code on failure.
494+
495+ See sd_is_socket_inet(3) for more information.
496+*/
497+int netsnmp_sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port);
498+
499+/*
500+ Helper call for identifying a passed file descriptor. Returns 1 if
501+ the file descriptor is an AF_UNIX socket of the specified type
502+ (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
503+ a socket type check will not be done. If path is NULL a socket path
504+ check will not be done. For normal AF_UNIX sockets set length to
505+ 0. For abstract namespace sockets set length to the length of the
506+ socket name (including the initial 0 byte), and pass the full
507+ socket path in path (including the initial 0 byte). The listening
508+ flag is used the same way as in sd_is_socket(). Returns a negative
509+ errno style error code on failure.
510+
511+ See sd_is_socket_unix(3) for more information.
512+*/
513+int netsnmp_sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length);
514+
515+/*
516+ Informs systemd about changed daemon state. This takes a number of
517+ newline separated environment-style variable assignments in a
518+ string. The following variables are known:
519+
520+ READY=1 Tells systemd that daemon startup is finished (only
521+ relevant for services of Type=notify). The passed
522+ argument is a boolean "1" or "0". Since there is
523+ little value in signaling non-readiness the only
524+ value daemons should send is "READY=1".
525+
526+ STATUS=... Passes a single-line status string back to systemd
527+ that describes the daemon state. This is free-from
528+ and can be used for various purposes: general state
529+ feedback, fsck-like programs could pass completion
530+ percentages and failing programs could pass a human
531+ readable error message. Example: "STATUS=Completed
532+ 66% of file system check..."
533+
534+ ERRNO=... If a daemon fails, the errno-style error code,
535+ formatted as string. Example: "ERRNO=2" for ENOENT.
536+
537+ BUSERROR=... If a daemon fails, the D-Bus error-style error
538+ code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
539+
540+ MAINPID=... The main pid of a daemon, in case systemd did not
541+ fork off the process itself. Example: "MAINPID=4711"
542+
543+ Daemons can choose to send additional variables. However, it is
544+ recommended to prefix variable names not listed above with X_.
545+
546+ Returns a negative errno-style error code on failure. Returns > 0
547+ if systemd could be notified, 0 if it couldn't possibly because
548+ systemd is not running.
549+
550+ Example: When a daemon finished starting up, it could issue this
551+ call to notify systemd about it:
552+
553+ sd_notify(0, "READY=1");
554+
555+ See sd_notifyf() for more complete examples.
556+
557+ See sd_notify(3) for more information.
558+*/
559+int netsnmp_sd_notify(int unset_environment, const char *state);
560+
561+/*
562+ Similar to sd_notify() but takes a format string.
563+
564+ Example 1: A daemon could send the following after initialization:
565+
566+ sd_notifyf(0, "READY=1\n"
567+ "STATUS=Processing requests...\n"
568+ "MAINPID=%lu",
569+ (unsigned long) getpid());
570+
571+ Example 2: A daemon could send the following shortly before
572+ exiting, on failure:
573+
574+ sd_notifyf(0, "STATUS=Failed to start up: %s\n"
575+ "ERRNO=%i",
576+ strerror(errno),
577+ errno);
578+
579+ See sd_notifyf(3) for more information.
580+*/
581+int netsnmp_sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3);
582+
583+/*
584+ Returns > 0 if the system was booted with systemd. Returns < 0 on
585+ error. Returns 0 if the system was not booted with systemd. Note
586+ that all of the functions above handle non-systemd boots just
587+ fine. You should NOT protect them with a call to this function. Also
588+ note that this function checks whether the system, not the user
589+ session is controlled by systemd. However the functions above work
590+ for both user and system services.
591+
592+ See sd_booted(3) for more information.
593+*/
594+int netsnmp_sd_booted(void);
595+
596+/**
597+ * Find an socket with given parameters. See man sd_is_socket_inet for
598+ * description of the arguments.
599+ *
600+ * Returns the file descriptor if it is found, 0 otherwise.
601+ */
602+int netsnmp_sd_find_inet_socket(int family, int type, int listening, int port);
603+
604+/**
605+ * Find an unix socket with given parameters. See man sd_is_socket_unix for
606+ * description of the arguments.
607+ *
608+ * Returns the file descriptor if it is found, 0 otherwise.
609+ */
610+int
611+netsnmp_sd_find_unix_socket(int type, int listening, const char *path);
612+
613+#ifdef __cplusplus
614+}
615+#endif
616+
617+#endif /* SNMPD_SD_DAEMON_H */
618diff --git a/snmplib/sd-daemon.c b/snmplib/sd-daemon.c
619new file mode 100644
620index 0000000..42dba29
621--- /dev/null
622+++ b/snmplib/sd-daemon.c
623@@ -0,0 +1,532 @@
624+/*
625+ * Systemd integration parts.
626+ *
627+ * Most of this file is directly copied from systemd sources.
628+ * Changes:
629+ * - all functions were renamed to have netsnmp_ prefix
630+ * - includes were changed to match Net-SNMP style.
631+ * - removed gcc export macros
632+ * - removed POSIX message queues
633+ */
634+
635+#include <net-snmp/net-snmp-config.h>
636+#include <net-snmp/net-snmp-features.h>
637+#include <net-snmp/types.h>
638+#include <net-snmp/library/snmp_debug.h>
639+
640+#ifndef NETSNMP_NO_SYSTEMD
641+
642+/***
643+ Copyright 2010 Lennart Poettering
644+
645+ Permission is hereby granted, free of charge, to any person
646+ obtaining a copy of this software and associated documentation files
647+ (the "Software"), to deal in the Software without restriction,
648+ including without limitation the rights to use, copy, modify, merge,
649+ publish, distribute, sublicense, and/or sell copies of the Software,
650+ and to permit persons to whom the Software is furnished to do so,
651+ subject to the following conditions:
652+
653+ The above copyright notice and this permission notice shall be
654+ included in all copies or substantial portions of the Software.
655+
656+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
657+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
658+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
659+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
660+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
661+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
662+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
663+ SOFTWARE.
664+***/
665+
666+#ifndef _GNU_SOURCE
667+#define _GNU_SOURCE
668+#endif
669+
670+#include <sys/types.h>
671+#include <sys/stat.h>
672+#include <sys/socket.h>
673+#include <sys/un.h>
674+#include <sys/fcntl.h>
675+#include <netinet/in.h>
676+#include <stdlib.h>
677+#include <errno.h>
678+#include <unistd.h>
679+#include <string.h>
680+#include <stdarg.h>
681+#include <stdio.h>
682+#include <stddef.h>
683+#include <limits.h>
684+
685+#include <net-snmp/library/sd-daemon.h>
686+
687+int netsnmp_sd_listen_fds(int unset_environment) {
688+
689+ int r, fd;
690+ const char *e;
691+ char *p = NULL;
692+ unsigned long l;
693+
694+ if (!(e = getenv("LISTEN_PID"))) {
695+ r = 0;
696+ goto finish;
697+ }
698+
699+ errno = 0;
700+ l = strtoul(e, &p, 10);
701+
702+ if (errno != 0) {
703+ r = -errno;
704+ goto finish;
705+ }
706+
707+ if (!p || *p || l <= 0) {
708+ r = -EINVAL;
709+ goto finish;
710+ }
711+
712+ /* Is this for us? */
713+ if (getpid() != (pid_t) l) {
714+ r = 0;
715+ goto finish;
716+ }
717+
718+ if (!(e = getenv("LISTEN_FDS"))) {
719+ r = 0;
720+ goto finish;
721+ }
722+
723+ errno = 0;
724+ l = strtoul(e, &p, 10);
725+
726+ if (errno != 0) {
727+ r = -errno;
728+ goto finish;
729+ }
730+
731+ if (!p || *p) {
732+ r = -EINVAL;
733+ goto finish;
734+ }
735+
736+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
737+ int flags;
738+
739+ if ((flags = fcntl(fd, F_GETFD)) < 0) {
740+ r = -errno;
741+ goto finish;
742+ }
743+
744+ if (flags & FD_CLOEXEC)
745+ continue;
746+
747+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
748+ r = -errno;
749+ goto finish;
750+ }
751+ }
752+
753+ r = (int) l;
754+
755+finish:
756+ if (unset_environment) {
757+ unsetenv("LISTEN_PID");
758+ unsetenv("LISTEN_FDS");
759+ }
760+
761+ return r;
762+}
763+
764+int netsnmp_sd_is_fifo(int fd, const char *path) {
765+ struct stat st_fd;
766+
767+ if (fd < 0)
768+ return -EINVAL;
769+
770+ memset(&st_fd, 0, sizeof(st_fd));
771+ if (fstat(fd, &st_fd) < 0)
772+ return -errno;
773+
774+ if (!S_ISFIFO(st_fd.st_mode))
775+ return 0;
776+
777+ if (path) {
778+ struct stat st_path;
779+
780+ memset(&st_path, 0, sizeof(st_path));
781+ if (stat(path, &st_path) < 0) {
782+
783+ if (errno == ENOENT || errno == ENOTDIR)
784+ return 0;
785+
786+ return -errno;
787+ }
788+
789+ return
790+ st_path.st_dev == st_fd.st_dev &&
791+ st_path.st_ino == st_fd.st_ino;
792+ }
793+
794+ return 1;
795+}
796+
797+int netsnmp_sd_is_special(int fd, const char *path) {
798+ struct stat st_fd;
799+
800+ if (fd < 0)
801+ return -EINVAL;
802+
803+ if (fstat(fd, &st_fd) < 0)
804+ return -errno;
805+
806+ if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode))
807+ return 0;
808+
809+ if (path) {
810+ struct stat st_path;
811+
812+ if (stat(path, &st_path) < 0) {
813+
814+ if (errno == ENOENT || errno == ENOTDIR)
815+ return 0;
816+
817+ return -errno;
818+ }
819+
820+ if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode))
821+ return
822+ st_path.st_dev == st_fd.st_dev &&
823+ st_path.st_ino == st_fd.st_ino;
824+ else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode))
825+ return st_path.st_rdev == st_fd.st_rdev;
826+ else
827+ return 0;
828+ }
829+
830+ return 1;
831+}
832+
833+static int sd_is_socket_internal(int fd, int type, int listening) {
834+ struct stat st_fd;
835+
836+ if (fd < 0 || type < 0)
837+ return -EINVAL;
838+
839+ if (fstat(fd, &st_fd) < 0)
840+ return -errno;
841+
842+ if (!S_ISSOCK(st_fd.st_mode))
843+ return 0;
844+
845+ if (type != 0) {
846+ int other_type = 0;
847+ socklen_t l = sizeof(other_type);
848+
849+ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
850+ return -errno;
851+
852+ if (l != sizeof(other_type))
853+ return -EINVAL;
854+
855+ if (other_type != type)
856+ return 0;
857+ }
858+
859+ if (listening >= 0) {
860+ int accepting = 0;
861+ socklen_t l = sizeof(accepting);
862+
863+ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
864+ return -errno;
865+
866+ if (l != sizeof(accepting))
867+ return -EINVAL;
868+
869+ if (!accepting != !listening)
870+ return 0;
871+ }
872+
873+ return 1;
874+}
875+
876+union sockaddr_union {
877+ struct sockaddr sa;
878+ struct sockaddr_in in4;
879+ struct sockaddr_in6 in6;
880+ struct sockaddr_un un;
881+ struct sockaddr_storage storage;
882+};
883+
884+int netsnmp_sd_is_socket(int fd, int family, int type, int listening) {
885+ int r;
886+
887+ if (family < 0)
888+ return -EINVAL;
889+
890+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
891+ return r;
892+
893+ if (family > 0) {
894+ union sockaddr_union sockaddr;
895+ socklen_t l;
896+
897+ memset(&sockaddr, 0, sizeof(sockaddr));
898+ l = sizeof(sockaddr);
899+
900+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
901+ return -errno;
902+
903+ if (l < sizeof(sa_family_t))
904+ return -EINVAL;
905+
906+ return sockaddr.sa.sa_family == family;
907+ }
908+
909+ return 1;
910+}
911+
912+int netsnmp_sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
913+ union sockaddr_union sockaddr;
914+ socklen_t l;
915+ int r;
916+
917+ if (family != 0 && family != AF_INET && family != AF_INET6)
918+ return -EINVAL;
919+
920+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
921+ return r;
922+
923+ memset(&sockaddr, 0, sizeof(sockaddr));
924+ l = sizeof(sockaddr);
925+
926+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
927+ return -errno;
928+
929+ if (l < sizeof(sa_family_t))
930+ return -EINVAL;
931+
932+ if (sockaddr.sa.sa_family != AF_INET &&
933+ sockaddr.sa.sa_family != AF_INET6)
934+ return 0;
935+
936+ if (family > 0)
937+ if (sockaddr.sa.sa_family != family)
938+ return 0;
939+
940+ if (port > 0) {
941+ if (sockaddr.sa.sa_family == AF_INET) {
942+ if (l < sizeof(struct sockaddr_in))
943+ return -EINVAL;
944+
945+ return htons(port) == sockaddr.in4.sin_port;
946+ } else {
947+ if (l < sizeof(struct sockaddr_in6))
948+ return -EINVAL;
949+
950+ return htons(port) == sockaddr.in6.sin6_port;
951+ }
952+ }
953+
954+ return 1;
955+}
956+
957+int netsnmp_sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
958+ union sockaddr_union sockaddr;
959+ socklen_t l;
960+ int r;
961+
962+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
963+ return r;
964+
965+ memset(&sockaddr, 0, sizeof(sockaddr));
966+ l = sizeof(sockaddr);
967+
968+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
969+ return -errno;
970+
971+ if (l < sizeof(sa_family_t))
972+ return -EINVAL;
973+
974+ if (sockaddr.sa.sa_family != AF_UNIX)
975+ return 0;
976+
977+ if (path) {
978+ if (length <= 0)
979+ length = strlen(path);
980+
981+ if (length <= 0)
982+ /* Unnamed socket */
983+ return l == offsetof(struct sockaddr_un, sun_path);
984+
985+ if (path[0])
986+ /* Normal path socket */
987+ return
988+ (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
989+ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
990+ else
991+ /* Abstract namespace socket */
992+ return
993+ (l == offsetof(struct sockaddr_un, sun_path) + length) &&
994+ memcmp(path, sockaddr.un.sun_path, length) == 0;
995+ }
996+
997+ return 1;
998+}
999+
1000+int netsnmp_sd_notify(int unset_environment, const char *state) {
1001+ int fd = -1, r;
1002+ struct msghdr msghdr;
1003+ struct iovec iovec;
1004+ union sockaddr_union sockaddr;
1005+ const char *e;
1006+
1007+ if (!state) {
1008+ r = -EINVAL;
1009+ goto finish;
1010+ }
1011+
1012+ if (!(e = getenv("NOTIFY_SOCKET")))
1013+ return 0;
1014+
1015+ /* Must be an abstract socket, or an absolute path */
1016+ if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
1017+ r = -EINVAL;
1018+ goto finish;
1019+ }
1020+
1021+ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
1022+ r = -errno;
1023+ goto finish;
1024+ }
1025+
1026+ memset(&sockaddr, 0, sizeof(sockaddr));
1027+ sockaddr.sa.sa_family = AF_UNIX;
1028+ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
1029+
1030+ if (sockaddr.un.sun_path[0] == '@')
1031+ sockaddr.un.sun_path[0] = 0;
1032+
1033+ memset(&iovec, 0, sizeof(iovec));
1034+ iovec.iov_base = (char *)state;
1035+ iovec.iov_len = strlen(state);
1036+
1037+ memset(&msghdr, 0, sizeof(msghdr));
1038+ msghdr.msg_name = &sockaddr;
1039+ msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
1040+
1041+ if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
1042+ msghdr.msg_namelen = sizeof(struct sockaddr_un);
1043+
1044+ msghdr.msg_iov = &iovec;
1045+ msghdr.msg_iovlen = 1;
1046+
1047+ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
1048+ r = -errno;
1049+ goto finish;
1050+ }
1051+
1052+ r = 1;
1053+
1054+finish:
1055+ if (unset_environment)
1056+ unsetenv("NOTIFY_SOCKET");
1057+
1058+ if (fd >= 0)
1059+ close(fd);
1060+
1061+ return r;
1062+}
1063+
1064+int netsnmp_sd_notifyf(int unset_environment, const char *format, ...) {
1065+ va_list ap;
1066+ char *p = NULL;
1067+ int r;
1068+
1069+ va_start(ap, format);
1070+ r = vasprintf(&p, format, ap);
1071+ va_end(ap);
1072+
1073+ if (r < 0 || !p)
1074+ return -ENOMEM;
1075+
1076+ r = netsnmp_sd_notify(unset_environment, p);
1077+ free(p);
1078+
1079+ return r;
1080+}
1081+
1082+int netsnmp_sd_booted(void) {
1083+ struct stat a, b;
1084+
1085+ /* We simply test whether the systemd cgroup hierarchy is
1086+ * mounted */
1087+
1088+ if (lstat("/sys/fs/cgroup", &a) < 0)
1089+ return 0;
1090+
1091+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
1092+ return 0;
1093+
1094+ return a.st_dev != b.st_dev;
1095+}
1096+
1097+/* End of original sd-daemon.c from systemd sources */
1098+
1099+int
1100+netsnmp_sd_find_inet_socket(int family, int type, int listening, int port)
1101+{
1102+ int count, fd;
1103+
1104+ count = netsnmp_sd_listen_fds(0);
1105+ if (count <= 0) {
1106+ DEBUGMSGTL(("systemd:find_inet_socket", "No LISTEN_FDS found.\n"));
1107+ return 0;
1108+ }
1109+ DEBUGMSGTL(("systemd:find_inet_socket", "LISTEN_FDS reports %d sockets.\n",
1110+ count));
1111+
1112+ for (fd = 3; fd < 3+count; fd++) {
1113+ int rc = netsnmp_sd_is_socket_inet(fd, family, type, listening, port);
1114+ if (rc < 0)
1115+ DEBUGMSGTL(("systemd:find_inet_socket",
1116+ "sd_is_socket_inet error: %d\n", rc));
1117+ if (rc > 0) {
1118+ DEBUGMSGTL(("systemd:find_inet_socket",
1119+ "Found the socket in LISTEN_FDS\n"));
1120+ return fd;
1121+ }
1122+ }
1123+ DEBUGMSGTL(("systemd:find_inet_socket", "Socket not found in LISTEN_FDS\n"));
1124+ return 0;
1125+}
1126+
1127+int
1128+netsnmp_sd_find_unix_socket(int type, int listening, const char *path)
1129+{
1130+ int count, fd;
1131+
1132+ count = netsnmp_sd_listen_fds(0);
1133+ if (count <= 0) {
1134+ DEBUGMSGTL(("systemd:find_unix_socket", "No LISTEN_FDS found.\n"));
1135+ return 0;
1136+ }
1137+ DEBUGMSGTL(("systemd:find_unix_socket", "LISTEN_FDS reports %d sockets.\n",
1138+ count));
1139+
1140+ for (fd = 3; fd < 3+count; fd++) {
1141+ int rc = netsnmp_sd_is_socket_unix(fd, type, listening, path, 0);
1142+ if (rc < 0)
1143+ DEBUGMSGTL(("systemd:find_unix_socket",
1144+ "netsnmp_sd_is_socket_unix error: %d\n", rc));
1145+ if (rc > 0) {
1146+ DEBUGMSGTL(("systemd:find_unix_socket",
1147+ "Found the socket in LISTEN_FDS\n"));
1148+ return fd;
1149+ }
1150+ }
1151+ DEBUGMSGTL(("systemd:find_unix_socket", "Socket not found in LISTEN_FDS\n"));
1152+ return 0;
1153+}
1154+
1155+#endif /* ! NETSNMP_NO_SYSTEMD */
1156diff --git a/snmplib/transports/snmpTCPDomain.c b/snmplib/transports/snmpTCPDomain.c
1157index b8bdba4..ab7f3a1 100644
1158--- a/snmplib/transports/snmpTCPDomain.c
1159+++ b/snmplib/transports/snmpTCPDomain.c
1160@@ -43,6 +43,10 @@
1161 #include <net-snmp/library/snmpTCPBaseDomain.h>
1162 #include <net-snmp/library/tools.h>
1163
1164+#ifndef NETSNMP_NO_SYSTEMD
1165+#include <net-snmp/library/sd-daemon.h>
1166+#endif
1167+
1168 /*
1169 * needs to be in sync with the definitions in snmplib/snmpUDPDomain.c
1170 * and perl/agent/agent.xs
1171@@ -149,6 +153,7 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
1172 netsnmp_transport *t = NULL;
1173 netsnmp_udp_addr_pair *addr_pair = NULL;
1174 int rc = 0;
1175+ int socket_initialized = 0;
1176
1177 #ifdef NETSNMP_NO_LISTEN_SUPPORT
1178 if (local)
1179@@ -178,7 +183,19 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
1180 t->domain_length =
1181 sizeof(netsnmp_snmpTCPDomain) / sizeof(netsnmp_snmpTCPDomain[0]);
1182
1183- t->sock = socket(PF_INET, SOCK_STREAM, 0);
1184+#ifndef NETSNMP_NO_SYSTEMD
1185+ /*
1186+ * Maybe the socket was already provided by systemd...
1187+ */
1188+ if (local) {
1189+ t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_STREAM, 1,
1190+ ntohs(addr->sin_port));
1191+ if (t->sock)
1192+ socket_initialized = 1;
1193+ }
1194+#endif
1195+ if (!socket_initialized)
1196+ t->sock = socket(PF_INET, SOCK_STREAM, 0);
1197 if (t->sock < 0) {
1198 netsnmp_transport_free(t);
1199 return NULL;
1200@@ -215,11 +232,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
1201 setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt,
1202 sizeof(opt));
1203
1204- rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr));
1205- if (rc != 0) {
1206- netsnmp_socketbase_close(t);
1207- netsnmp_transport_free(t);
1208- return NULL;
1209+ if (!socket_initialized) {
1210+ rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr));
1211+ if (rc != 0) {
1212+ netsnmp_socketbase_close(t);
1213+ netsnmp_transport_free(t);
1214+ return NULL;
1215+ }
1216 }
1217
1218 /*
1219@@ -235,12 +254,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
1220 /*
1221 * Now sit here and wait for connections to arrive.
1222 */
1223-
1224- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
1225- if (rc != 0) {
1226- netsnmp_socketbase_close(t);
1227- netsnmp_transport_free(t);
1228- return NULL;
1229+ if (!socket_initialized) {
1230+ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
1231+ if (rc != 0) {
1232+ netsnmp_socketbase_close(t);
1233+ netsnmp_transport_free(t);
1234+ return NULL;
1235+ }
1236 }
1237
1238 /*
1239diff --git a/snmplib/transports/snmpTCPIPv6Domain.c b/snmplib/transports/snmpTCPIPv6Domain.c
1240index 3c96856..305a861 100644
1241--- a/snmplib/transports/snmpTCPIPv6Domain.c
1242+++ b/snmplib/transports/snmpTCPIPv6Domain.c
1243@@ -49,6 +49,10 @@
1244 #include <net-snmp/library/snmpTCPBaseDomain.h>
1245 #include <net-snmp/library/tools.h>
1246
1247+#ifndef NETSNMP_NO_SYSTEMD
1248+#include <net-snmp/library/sd-daemon.h>
1249+#endif
1250+
1251 #include "inet_ntop.h"
1252
1253 oid netsnmp_TCPIPv6Domain[] = { TRANSPORT_DOMAIN_TCP_IPV6 };
1254@@ -140,6 +144,8 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
1255 {
1256 netsnmp_transport *t = NULL;
1257 int rc = 0;
1258+ char *str = NULL;
1259+ int socket_initialized = 0;
1260
1261 #ifdef NETSNMP_NO_LISTEN_SUPPORT
1262 if (local)
1263@@ -174,7 +180,19 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
1264 t->domain = netsnmp_TCPIPv6Domain;
1265 t->domain_length = sizeof(netsnmp_TCPIPv6Domain) / sizeof(oid);
1266
1267- t->sock = socket(PF_INET6, SOCK_STREAM, 0);
1268+#ifndef NETSNMP_NO_SYSTEMD
1269+ /*
1270+ * Maybe the socket was already provided by systemd...
1271+ */
1272+ if (local) {
1273+ t->sock = netsnmp_sd_find_inet_socket(PF_INET6, SOCK_STREAM, 1,
1274+ ntohs(addr->sin6_port));
1275+ if (t->sock)
1276+ socket_initialized = 1;
1277+ }
1278+#endif
1279+ if (!socket_initialized)
1280+ t->sock = socket(PF_INET6, SOCK_STREAM, 0);
1281 if (t->sock < 0) {
1282 netsnmp_transport_free(t);
1283 return NULL;
1284@@ -220,12 +238,14 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
1285
1286 setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt));
1287
1288- rc = bind(t->sock, (struct sockaddr *) addr,
1289- sizeof(struct sockaddr_in6));
1290- if (rc != 0) {
1291- netsnmp_socketbase_close(t);
1292- netsnmp_transport_free(t);
1293- return NULL;
1294+ if (!socket_initialized) {
1295+ rc = bind(t->sock, (struct sockaddr *) addr,
1296+ sizeof(struct sockaddr_in6));
1297+ if (rc != 0) {
1298+ netsnmp_socketbase_close(t);
1299+ netsnmp_transport_free(t);
1300+ return NULL;
1301+ }
1302 }
1303
1304 /*
1305@@ -242,11 +262,13 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
1306 * Now sit here and wait for connections to arrive.
1307 */
1308
1309- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
1310- if (rc != 0) {
1311- netsnmp_socketbase_close(t);
1312- netsnmp_transport_free(t);
1313- return NULL;
1314+ if (!socket_initialized) {
1315+ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
1316+ if (rc != 0) {
1317+ netsnmp_socketbase_close(t);
1318+ netsnmp_transport_free(t);
1319+ return NULL;
1320+ }
1321 }
1322
1323 /*
1324diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c
1325index c67427b..428e6d6 100644
1326--- a/snmplib/transports/snmpUDPIPv4BaseDomain.c
1327+++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c
1328@@ -40,6 +40,10 @@
1329
1330 #include <net-snmp/library/snmpSocketBaseDomain.h>
1331
1332+#ifndef NETSNMP_NO_SYSTEMD
1333+#include <net-snmp/library/sd-daemon.h>
1334+#endif
1335+
1336 #if (defined(linux) && defined(IP_PKTINFO)) \
1337 || defined(IP_RECVDSTADDR) && HAVE_STRUCT_MSGHDR_MSG_CONTROL \
1338 && HAVE_STRUCT_MSGHDR_MSG_FLAGS
1339@@ -67,6 +71,7 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local)
1340 char *client_socket = NULL;
1341 netsnmp_indexed_addr_pair addr_pair;
1342 socklen_t local_addr_len;
1343+ int socket_initialized = 0;
1344
1345 #ifdef NETSNMP_NO_LISTEN_SUPPORT
1346 if (local)
1347@@ -91,7 +96,19 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local)
1348 free(str);
1349 }
1350
1351- t->sock = socket(PF_INET, SOCK_DGRAM, 0);
1352+#ifndef NETSNMP_NO_SYSTEMD
1353+ /*
1354+ * Maybe the socket was already provided by systemd...
1355+ */
1356+ if (local) {
1357+ t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_DGRAM, -1,
1358+ ntohs(addr->sin_port));
1359+ if (t->sock)
1360+ socket_initialized = 1;
1361+ }
1362+#endif
1363+ if (!socket_initialized)
1364+ t->sock = socket(PF_INET, SOCK_DGRAM, 0);
1365 DEBUGMSGTL(("UDPBase", "openned socket %d as local=%d\n", t->sock, local));
1366 if (t->sock < 0) {
1367 netsnmp_transport_free(t);
1368@@ -141,12 +158,14 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local)
1369 DEBUGMSGTL(("netsnmp_udp", "set IP_RECVDSTADDR\n"));
1370 }
1371 #endif
1372- rc = bind(t->sock, (struct sockaddr *) addr,
1373- sizeof(struct sockaddr));
1374- if (rc != 0) {
1375- netsnmp_socketbase_close(t);
1376- netsnmp_transport_free(t);
1377- return NULL;
1378+ if (!socket_initialized) {
1379+ rc = bind(t->sock, (struct sockaddr *) addr,
1380+ sizeof(struct sockaddr));
1381+ if (rc != 0) {
1382+ netsnmp_socketbase_close(t);
1383+ netsnmp_transport_free(t);
1384+ return NULL;
1385+ }
1386 }
1387 t->data = NULL;
1388 t->data_length = 0;
1389diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
1390index b3eaae4..35b617f 100644
1391--- a/snmplib/transports/snmpUDPIPv6Domain.c
1392+++ b/snmplib/transports/snmpUDPIPv6Domain.c
1393@@ -67,6 +67,10 @@ static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
1394 #include <net-snmp/library/snmpSocketBaseDomain.h>
1395 #include <net-snmp/library/tools.h>
1396
1397+#ifndef NETSNMP_NO_SYSTEMD
1398+#include <net-snmp/library/sd-daemon.h>
1399+#endif
1400+
1401 #include "inet_ntop.h"
1402 #include "inet_pton.h"
1403
1404@@ -190,6 +194,8 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
1405 {
1406 netsnmp_transport *t = NULL;
1407 int rc = 0;
1408+ char *str = NULL;
1409+ int socket_initialized = 0;
1410
1411 #ifdef NETSNMP_NO_LISTEN_SUPPORT
1412 if (local)
1413@@ -217,7 +223,19 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
1414 t->domain_length =
1415 sizeof(netsnmp_UDPIPv6Domain) / sizeof(netsnmp_UDPIPv6Domain[0]);
1416
1417- t->sock = socket(PF_INET6, SOCK_DGRAM, 0);
1418+#ifndef NETSNMP_NO_SYSTEMD
1419+ /*
1420+ * Maybe the socket was already provided by systemd...
1421+ */
1422+ if (local) {
1423+ t->sock = netsnmp_sd_find_inet_socket(PF_INET6, SOCK_DGRAM, -1,
1424+ ntohs(addr->sin6_port));
1425+ if (t->sock)
1426+ socket_initialized = 1;
1427+ }
1428+#endif
1429+ if (!socket_initialized)
1430+ t->sock = socket(PF_INET6, SOCK_DGRAM, 0);
1431 if (t->sock < 0) {
1432 netsnmp_transport_free(t);
1433 return NULL;
1434@@ -242,13 +260,14 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
1435 }
1436 }
1437 #endif
1438-
1439- rc = bind(t->sock, (struct sockaddr *) addr,
1440- sizeof(struct sockaddr_in6));
1441- if (rc != 0) {
1442- netsnmp_socketbase_close(t);
1443- netsnmp_transport_free(t);
1444- return NULL;
1445+ if (!socket_initialized) {
1446+ rc = bind(t->sock, (struct sockaddr *) addr,
1447+ sizeof(struct sockaddr_in6));
1448+ if (rc != 0) {
1449+ netsnmp_socketbase_close(t);
1450+ netsnmp_transport_free(t);
1451+ return NULL;
1452+ }
1453 }
1454 t->local = (unsigned char*)malloc(18);
1455 if (t->local == NULL) {
1456diff --git a/snmplib/transports/snmpUnixDomain.c b/snmplib/transports/snmpUnixDomain.c
1457index 674dc2b..9f3d3cb 100644
1458--- a/snmplib/transports/snmpUnixDomain.c
1459+++ b/snmplib/transports/snmpUnixDomain.c
1460@@ -37,6 +37,10 @@
1461 #include <net-snmp/library/system.h> /* mkdirhier */
1462 #include <net-snmp/library/tools.h>
1463
1464+#ifndef NETSNMP_NO_SYSTEMD
1465+#include <net-snmp/library/sd-daemon.h>
1466+#endif
1467+
1468 netsnmp_feature_child_of(transport_unix_socket_all, transport_all)
1469 netsnmp_feature_child_of(unix_socket_paths, transport_unix_socket_all)
1470
1471@@ -295,6 +299,8 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
1472 netsnmp_transport *t = NULL;
1473 sockaddr_un_pair *sup = NULL;
1474 int rc = 0;
1475+ char *string = NULL;
1476+ int socket_initialized = 0;
1477
1478 #ifdef NETSNMP_NO_LISTEN_SUPPORT
1479 /* SPECIAL CIRCUMSTANCE: We still want AgentX to be able to operate,
1480@@ -333,7 +339,18 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
1481 t->data_length = sizeof(sockaddr_un_pair);
1482 sup = (sockaddr_un_pair *) t->data;
1483
1484- t->sock = socket(PF_UNIX, SOCK_STREAM, 0);
1485+#ifndef NETSNMP_NO_SYSTEMD
1486+ /*
1487+ * Maybe the socket was already provided by systemd...
1488+ */
1489+ if (local) {
1490+ t->sock = netsnmp_sd_find_unix_socket(SOCK_STREAM, 1, addr->sun_path);
1491+ if (t->sock)
1492+ socket_initialized = 1;
1493+ }
1494+#endif
1495+ if (!socket_initialized)
1496+ t->sock = socket(PF_UNIX, SOCK_STREAM, 0);
1497 if (t->sock < 0) {
1498 netsnmp_transport_free(t);
1499 return NULL;
1500@@ -357,25 +374,26 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
1501
1502 t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN;
1503
1504- unlink(addr->sun_path);
1505- rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
1506-
1507- if (rc != 0 && errno == ENOENT && create_path) {
1508- rc = mkdirhier(addr->sun_path, create_mode, 1);
1509+ if (!socket_initialized) {
1510+ unlink(addr->sun_path);
1511+ rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
1512+ if (rc != 0 && errno == ENOENT && create_path) {
1513+ rc = mkdirhier(addr->sun_path, create_mode, 1);
1514+ if (rc != 0) {
1515+ netsnmp_unix_close(t);
1516+ netsnmp_transport_free(t);
1517+ return NULL;
1518+ }
1519+ rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
1520+ }
1521 if (rc != 0) {
1522+ DEBUGMSGTL(("netsnmp_unix_transport",
1523+ "couldn't bind \"%s\", errno %d (%s)\n",
1524+ addr->sun_path, errno, strerror(errno)));
1525 netsnmp_unix_close(t);
1526 netsnmp_transport_free(t);
1527 return NULL;
1528 }
1529- rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
1530- }
1531- if (rc != 0) {
1532- DEBUGMSGTL(("netsnmp_unix_transport",
1533- "couldn't bind \"%s\", errno %d (%s)\n",
1534- addr->sun_path, errno, strerror(errno)));
1535- netsnmp_unix_close(t);
1536- netsnmp_transport_free(t);
1537- return NULL;
1538 }
1539
1540 /*
1541@@ -391,16 +409,17 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
1542 * Now sit here and listen for connections to arrive.
1543 */
1544
1545- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
1546- if (rc != 0) {
1547- DEBUGMSGTL(("netsnmp_unix_transport",
1548- "couldn't listen to \"%s\", errno %d (%s)\n",
1549- addr->sun_path, errno, strerror(errno)));
1550- netsnmp_unix_close(t);
1551- netsnmp_transport_free(t);
1552- return NULL;
1553+ if (!socket_initialized) {
1554+ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
1555+ if (rc != 0) {
1556+ DEBUGMSGTL(("netsnmp_unix_transport",
1557+ "couldn't listen to \"%s\", errno %d (%s)\n",
1558+ addr->sun_path, errno, strerror(errno)));
1559+ netsnmp_unix_close(t);
1560+ netsnmp_transport_free(t);
1561+ return NULL;
1562+ }
1563 }
1564-
1565 } else {
1566 t->remote = (u_char *)malloc(strlen(addr->sun_path));
1567 if (t->remote == NULL) {
1568diff --git a/win32/libsnmp/Makefile.in b/win32/libsnmp/Makefile.in
1569index 98d83c8..dd5689b 100644
1570--- a/win32/libsnmp/Makefile.in
1571+++ b/win32/libsnmp/Makefile.in
1572@@ -42,6 +42,7 @@ LIB32_OBJS= \
1573 "$(INTDIR)\read_config.obj" \
1574 "$(INTDIR)\readdir.obj" \
1575 "$(INTDIR)\scapi.obj" \
1576+ "$(INTDIR)\sd-daemon.obj" \
1577 "$(INTDIR)\snmp-tc.obj" \
1578 "$(INTDIR)\snmp.obj" \
1579 "$(INTDIR)\snmpCallbackDomain.obj" \
1580@@ -307,6 +308,12 @@ SOURCE=..\..\snmplib\scapi.c
1581 $(CPP) $(CPP_PROJ) $(SOURCE)
1582
1583
1584+SOURCE=..\..\snmplib\sd-daemon.c
1585+
1586+"$(INTDIR)\sd-daemon.obj" : $(SOURCE) "$(INTDIR)"
1587+ $(CPP) $(CPP_PROJ) $(SOURCE)
1588+
1589+
1590 SOURCE="..\..\snmplib\snmp-tc.c"
1591
1592 "$(INTDIR)\snmp-tc.obj" : $(SOURCE) "$(INTDIR)"
1593diff --git a/win32/net-snmp/net-snmp-config.h b/win32/net-snmp/net-snmp-config.h
1594index 7791ee0..1eccf42 100644
1595--- a/win32/net-snmp/net-snmp-config.h
1596+++ b/win32/net-snmp/net-snmp-config.h
1597@@ -1705,6 +1705,8 @@ enum {
1598 #define DMALLOC_FUNC_CHECK
1599 #endif
1600
1601+#define NETSNMP_NO_SYSTEMD
1602+
1603 /* #undef NETSNMP_ENABLE_LOCAL_SMUX */
1604
1605 /* define if agentx transport is to use domain sockets only */
1606diff --git a/win32/net-snmp/net-snmp-config.h.in b/win32/net-snmp/net-snmp-config.h.in
1607index 5215865..1607bfa 100644
1608--- a/win32/net-snmp/net-snmp-config.h.in
1609+++ b/win32/net-snmp/net-snmp-config.h.in
1610@@ -1705,6 +1705,8 @@ enum {
1611 #define DMALLOC_FUNC_CHECK
1612 #endif
1613
1614+#define NETSNMP_NO_SYSTEMD
1615+
1616 /* #undef NETSNMP_ENABLE_LOCAL_SMUX */
1617
1618 /* define if agentx transport is to use domain sockets only */
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.bb
new file mode 100644
index 0000000000..d21995a9e1
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.2.bb
@@ -0,0 +1,120 @@
1SUMMARY = "Various tools relating to the Simple Network Management Protocol"
2HOMEPAGE = "http://www.net-snmp.org/"
3LICENSE = "BSD"
4
5LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5a622ea24634e"
6
7DEPENDS = "openssl libnl pciutils"
8
9PR = "r1"
10
11SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \
12 file://init \
13 file://snmpd.conf \
14 file://snmptrapd.conf \
15 file://systemd-support.patch \
16 file://snmpd.service \
17 file://snmptrapd.service \
18 file://ifmib.patch \
19"
20
21SRC_URI[md5sum] = "5bddd02e2f82b62daa79f82717737a14"
22SRC_URI[sha256sum] = "09ed31b4cc1f3c0411ef9a16eff79ef3b30d89c32ca46d5a01a41826c4ceb816"
23
24inherit autotools update-rc.d siteinfo systemd
25
26EXTRA_OEMAKE = "INSTALL_PREFIX=${D}"
27
28PARALLEL_MAKE = ""
29CCACHE = ""
30
31TARGET_CC_ARCH += "${LDFLAGS}"
32
33EXTRA_OECONF = "--disable-embedded-perl \
34 --with-perl-modules=no \
35 --enable-shared \
36 --disable-manuals \
37 --with-defaults \
38 ${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)}"
39
40do_install_append() {
41 install -d ${D}${sysconfdir}/snmp
42 install -d ${D}${sysconfdir}/init.d
43 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/snmpd
44 install -m 644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/snmp/
45 install -m 644 ${WORKDIR}/snmptrapd.conf ${D}${sysconfdir}/snmp/
46 install -d ${STAGING_BINDIR}
47 install -m 0755 ${D}${bindir}/net-snmp-config ${STAGING_BINDIR}/
48 sed -e "s@-I/usr/include@@g" \
49 -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}@g" \
50 -e "s@^exec_prefix=.*@exec_prefix=${STAGING_DIR_HOST}@g" \
51 -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \
52 -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \
53 -i ${STAGING_BINDIR}/net-snmp-config
54 install -d ${D}${systemd_unitdir}/system
55 install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
56 install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
57}
58
59PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-dev ${PN}-staticdev ${PN}-static ${PN}-libs \
60 ${PN}-mibs ${PN}-server ${PN}-client ${PN}-server-snmpd ${PN}-server-snmptrapd"
61
62ALLOW_EMPTY_${PN}-server = "1"
63
64FILES_${PN}-libs = "${libdir}/lib*${SOLIBS}"
65FILES_${PN}-mibs = "${datadir}/snmp/mibs"
66FILES_${PN}-server-snmpd = "${sbindir}/snmpd \
67 ${sysconfdir}/snmp/snmpd.conf \
68 ${sysconfdir}/init.d \
69 ${systemd_unitdir}/system/snmpd.service \
70"
71
72FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \
73 ${sysconfdir}/snmp/snmptrapd.conf \
74 ${systemd_unitdir}/system/snmptrapd.service \
75"
76
77FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/"
78FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/"
79FILES_${PN}-dev += "${bindir}/net-snmp-config ${bindir}/mib2c ${bindir}/mib2c-update"
80
81CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf"
82CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf"
83
84INITSCRIPT_PACKAGES = "${PN}-server"
85INITSCRIPT_NAME_${PN}-server = "snmpd"
86INITSCRIPT_PARAMS_${PN}-server = "defaults"
87
88EXTRA_OECONF += "${@base_contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)}"
89
90SYSTEMD_PACKAGES = "${PN}-server-snmpd \
91 ${PN}-server-snmptrapd"
92
93SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service"
94SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service"
95
96RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs"
97RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd"
98RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd"
99RDEPENDS_${PN}-client += "net-snmp-mibs"
100RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
101RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
102
103RPROVIDES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
104RREPLACES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
105RCONFLICTS_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
106
107RPROVIDES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
108RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
109RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
110
111LEAD_SONAME = "libnetsnmp.so"
112
113pkg_postrm_${PN}-server() {
114 if test "x$D" != "x"; then
115 OPT="-r $D "
116 else
117 OPT=""
118 /etc/init.d/snmpd stop
119 fi
120}
diff --git a/meta-networking/recipes-protocols/openflow/openflow.inc b/meta-networking/recipes-protocols/openflow/openflow.inc
new file mode 100644
index 0000000000..43af54ea59
--- /dev/null
+++ b/meta-networking/recipes-protocols/openflow/openflow.inc
@@ -0,0 +1,35 @@
1SUMMARY = "OpenFlow communications protocol"
2DESCRIPTION = "\
3Open standard that enables researchers to run experimental protocols in \
4contained networks. OpenFlow is a communications interface between \
5control and forwarding planes of a software-defined networking architecture.\
6"
7HOMEPAGE = "http://www.openflow.org"
8
9SECTION = "networking"
10LICENSE = "GPLv2"
11
12LIC_FILES_CHKSUM = "file://COPYING;md5=e870c934e2c3d6ccf085fd7cf0a1e2e2"
13
14SRC_URI = "git://gitosis.stanford.edu/openflow.git;protocol=git"
15
16DEPENDS = "virtual/libc"
17
18EXTRA_OECONF += "KARCH=${TARGET_ARCH}"
19
20PACKAGECONFIG ??= "openssl"
21PACKAGECONFIG[openssl] = "--enable-ssl,--disable-ssl, openssl, libssl"
22
23S = "${WORKDIR}/git"
24
25inherit autotools
26
27do_configure() {
28 ./boot.sh
29 oe_runconf
30}
31
32do_install_append() {
33 # Remove /var/run as it is created on startup
34 rm -rf ${D}${localstatedir}/run
35}
diff --git a/meta-networking/recipes-protocols/openflow/openflow_1.0.bb b/meta-networking/recipes-protocols/openflow/openflow_1.0.bb
new file mode 100644
index 0000000000..a7e254dd85
--- /dev/null
+++ b/meta-networking/recipes-protocols/openflow/openflow_1.0.bb
@@ -0,0 +1,4 @@
1include ${BPN}.inc
2
3SRCREV = "5ccca75a69f99791659bcfbcf35353ab1921320a"
4PV = "1.0"
diff --git a/meta-networking/recipes-protocols/openflow/openflow_git.bb b/meta-networking/recipes-protocols/openflow/openflow_git.bb
new file mode 100644
index 0000000000..6403bfb220
--- /dev/null
+++ b/meta-networking/recipes-protocols/openflow/openflow_git.bb
@@ -0,0 +1,4 @@
1include ${BPN}.inc
2
3SRCREV = "c84f33f09d5dbcfc9b489f64cb30475bf36f653a"
4PV = "1.0+git${SRCPV}"
diff --git a/meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/fix-parallel-build.patch b/meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/fix-parallel-build.patch
new file mode 100644
index 0000000000..77722b064d
--- /dev/null
+++ b/meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/fix-parallel-build.patch
@@ -0,0 +1,19 @@
1pptp.c and version.c depend on config.h
2
3Upstream-Status: Backport
4
5Upstream has already similar fixes. Will be available on next release.
6
7Signed-off-by: Jesse Zhang <sen.zhang@windriver.com>
8
9--- a/Makefile 2013-02-27 17:09:24.431226665 +0800
10+++ b/Makefile 2013-02-27 17:09:03.442075550 +0800
11@@ -43,6 +43,8 @@
12 pptpsetup.8: pptpsetup
13 pod2man $? > $@
14
15+pptp.o version.o: config.h
16+
17 config.h:
18 echo "/* text added by Makefile target config.h */" > config.h
19 echo "#define PPTP_LINUX_VERSION \"$(VERSION)$(RELEASE)\"" >> config.h
diff --git a/meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/options.pptp b/meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/options.pptp
new file mode 100644
index 0000000000..f446e22a6a
--- /dev/null
+++ b/meta-networking/recipes-protocols/pptp-linux/pptp-linux-1.7.2/options.pptp
@@ -0,0 +1,30 @@
1#
2# Lock the port
3#
4lock
5
6#
7# We don't need the tunnel server to authenticate itself
8#
9noauth
10
11#
12# Turn off transmission protocols we know won't be used
13#
14nobsdcomp
15nodeflate
16
17#
18# We want MPPE
19# (option naming specific to ppp 2.4.0 with unofficial patch)
20#
21#mppe-40
22mppe-128
23#mppe-stateless
24
25#
26# We want a sane mtu/mru
27# (ppp 2.4.0 with unofficial patch)
28#
29#mtu 1000
30#mru 1000
diff --git a/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.7.2.bb b/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.7.2.bb
new file mode 100644
index 0000000000..6a90578bc6
--- /dev/null
+++ b/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.7.2.bb
@@ -0,0 +1,31 @@
1SUMMARY = "Client for Microsoft PPTP VPNs"
2DESCRIPTION = "PPTP Client is a Linux, FreeBSD, NetBSD \
3 and OpenBSD client for the proprietary Microsoft Point-to-Point \
4 Tunneling Protocol, PPTP. Allows connection to a PPTP based \
5 Virtual Private Network (VPN) as used by employers and some \
6 cable and ADSL internet service providers."
7HOMEPAGE = "http://pptpclient.sourceforge.net"
8SECTION = "network"
9LICENSE = "GPLv2+"
10LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b"
11
12PR = "r1"
13
14SRC_URI = "${SOURCEFORGE_MIRROR}/sourceforge/pptpclient/pptp-${PV}.tar.gz \
15 file://options.pptp \
16 file://fix-parallel-build.patch \
17"
18
19SRC_URI[md5sum] = "4c3d19286a37459a632c7128c92a9857"
20SRC_URI[sha256sum] = "e98ae0065d2a39fa3131654ff28cb7070e996f668ed6d0e7d9a445b8d37694bc"
21
22S = "${WORKDIR}/pptp-${PV}"
23
24do_install() {
25 install -d ${D}${sbindir} ${D}${sysconfdir}/ppp ${D}${mandir}/man8
26 install -m 555 pptp ${D}${sbindir}
27 install -m 644 pptp.8 ${D}${mandir}/man8
28 install -m 644 ${WORKDIR}/options.pptp ${D}${sysconfdir}/ppp
29}
30
31RDEPENDS_${PN} = "ppp"
diff --git a/meta-networking/recipes-protocols/quagga/files/0001-doc-fix-makeinfo-errors-and-one-warning.patch b/meta-networking/recipes-protocols/quagga/files/0001-doc-fix-makeinfo-errors-and-one-warning.patch
new file mode 100644
index 0000000000..24fdac505a
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/0001-doc-fix-makeinfo-errors-and-one-warning.patch
@@ -0,0 +1,61 @@
1From d6cbd8bbc34529a1aff74b5ee73366b89526c961 Mon Sep 17 00:00:00 2001
2From: Joe MacDonald <joe@deserted.net>
3Date: Fri, 22 Mar 2013 08:54:44 +0000
4Subject: [PATCH] doc: fix makeinfo errors and one warning
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9commit 4afa50b added few lines that are syntactically incorrect
10with leading plus sign.
11
12Upstream-Status: Backport [http://git.savannah.gnu.org/gitweb/?p=quagga.git;a=commit;h=b58c90807c9d0bfa9601704c7490a16070906004]
13
14Cc: Denis Ovsienko <infrastation@yandex.ru>
15Signed-off-by: Timo Teräs <timo.teras@iki.fi>
16Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17Signed-off-by: Joe MacDonald <joe@deserted.net>
18---
19 doc/ipv6.texi | 4 ++--
20 doc/quagga.texi | 6 +++---
21 2 files changed, 5 insertions(+), 5 deletions(-)
22
23diff --git a/doc/ipv6.texi b/doc/ipv6.texi
24index b6cc437..2482c1c 100644
25--- a/doc/ipv6.texi
26+++ b/doc/ipv6.texi
27@@ -136,8 +136,8 @@ for the lowest preference possible.
28 Default: 0
29 @end deffn
30
31-+@deffn {Interface Command} {ipv6 nd home-agent-lifetime <0-65520>} {}
32-+@deffnx {Interface Command} {no ipv6 nd home-agent-lifetime [<0-65520>]} {}
33+@deffn {Interface Command} {ipv6 nd home-agent-lifetime <0-65520>} {}
34+@deffnx {Interface Command} {no ipv6 nd home-agent-lifetime [<0-65520>]} {}
35 The value to be placed in Home Agent Option, when Home Agent config flag is set,
36 which indicates to hosts Home Agent Lifetime. The default value of 0 means to
37 place the current Router Lifetime value.
38diff --git a/doc/quagga.texi b/doc/quagga.texi
39index ff913aa..b4105ac 100644
40--- a/doc/quagga.texi
41+++ b/doc/quagga.texi
42@@ -1,13 +1,13 @@
43 \input texinfo @c -*- texinfo -*-
44+@c Set variables - sourced from defines.texi
45+@include defines.texi
46+
47 @c %**start of header
48 @setchapternewpage odd
49 @settitle @uref{http://www.quagga.net,,@value{PACKAGE_NAME}}
50 @setfilename quagga.info
51 @c %**end of header
52
53-@c Set variables - sourced from defines.texi
54-@include defines.texi
55-
56 @c automake will automatically generate version.texi
57 @c and set EDITION, VERSION, UPDATED and UPDATED-MONTH
58 @include version.texi
59--
601.7.10.4
61
diff --git a/meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch b/meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch
new file mode 100644
index 0000000000..35f4637d8e
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch
@@ -0,0 +1,48 @@
1sync zebra routing table with the kernel one when interface is down
2
3Add router to kernel main router table with "ip", then you can see
4a router item in kernel main router table. Also can see this router
5item in zebra router table. If down the interface, this router item
6will be deleted from kernel main router table, but it will not be
7deleted from zebra router table, just set as inactive.
8
9This patch is adopted from [1].
10[1] http://www.gossamer-threads.com/lists/quagga/dev/22609
11
12Upstream-Status: Pending
13
14Signed-of-by: Aws Ismail <aws.ismail@windriver.com>
15Signed-of-by: Roy.Li <rongqing.li@windriver.com>
16
17---
18 zebra/zebra_rib.c | 7 +++++++
19 1 files changed, 7 insertions(+), 0 deletions(-)
20
21diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
22index 154e8d5..63434d0 100644
23--- a/zebra/zebra_rib.c
24+++ b/zebra/zebra_rib.c
25@@ -765,6 +765,9 @@ rib_match_ipv6 (struct in6_addr *addr)
26 #define RIB_SYSTEM_ROUTE(R) \
27 ((R)->type == ZEBRA_ROUTE_KERNEL || (R)->type == ZEBRA_ROUTE_CONNECT)
28
29+#define RIB_KERNEL_ROUTE(R) \
30+ ((R)->type == ZEBRA_ROUTE_KERNEL)
31+
32 /* This function verifies reachability of one given nexthop, which can be
33 * numbered or unnumbered, IPv4 or IPv6. The result is unconditionally stored
34 * in nexthop->flags field. If the 4th parameter, 'set', is non-zero,
35@@ -1135,6 +1138,10 @@ rib_process (struct route_node *rn)
36 redistribute_delete (&rn->p, fib);
37 if (! RIB_SYSTEM_ROUTE (fib))
38 rib_uninstall_kernel (rn, fib);
39+#ifdef GNU_LINUX
40+ else if(RIB_KERNEL_ROUTE (fib) && !if_is_up(if_lookup_by_index(fib->nexthop->ifindex)))
41+ del=fib;
42+#endif
43 UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED);
44
45 /* Set real nexthop. */
46--
471.7.4.1
48
diff --git a/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch b/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch
new file mode 100644
index 0000000000..c2757a2fb7
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch
@@ -0,0 +1,50 @@
1From ba71f768e6dbb1f2ac72ed3bd880bff75a48d345 Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Wed, 19 Feb 2014 14:13:40 +0800
4Subject: [PATCH] babeld: close stdout once the background daemon is created
5
6Upstream-Status: pending
7
8Once babald becomes a background daemon, it should not output information to
9stdout, so need to close stdout.
10
11In fact, other daemons close their stdout when they run into background, like
12ospfd, isisd and bgpd, by calling daemon() which is in lib/daemon.c
13
14Closing the stdout can fix a tee hang issue { #/usr/sbin/babeld -d |tee tmp }
15
16Signed-off-by: Roy Li <rongqing.li@windriver.com>
17---
18 babeld/util.c | 10 +++++++++-
19 1 file changed, 9 insertions(+), 1 deletion(-)
20
21diff --git a/babeld/util.c b/babeld/util.c
22index 011f382..76203bc 100644
23--- a/babeld/util.c
24+++ b/babeld/util.c
25@@ -425,7 +425,7 @@ uchar_to_in6addr(struct in6_addr *dest, const unsigned char *src)
26 int
27 daemonise()
28 {
29- int rc;
30+ int rc, fd;
31
32 fflush(stdout);
33 fflush(stderr);
34@@ -441,5 +441,13 @@ daemonise()
35 if(rc < 0)
36 return -1;
37
38+ fd = open("/dev/null", O_RDWR, 0);
39+ if (fd != -1)
40+ {
41+ dup2(fd, STDOUT_FILENO);
42+ if (fd > 2)
43+ close(fd);
44+ }
45+
46 return 1;
47 }
48--
491.7.10.4
50
diff --git a/meta-networking/recipes-protocols/quagga/files/build-fix-extract.pl-for-cross-compilation.patch b/meta-networking/recipes-protocols/quagga/files/build-fix-extract.pl-for-cross-compilation.patch
new file mode 100644
index 0000000000..7e5beef30d
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/build-fix-extract.pl-for-cross-compilation.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Backport
2
3From ed6e297972318a0070ad4d973401fbc6e0def558 Mon Sep 17 00:00:00 2001
4From: Serj Kalichev <serj.kalichev@gmail.com>
5Date: Fri, 7 Sep 2012 13:29:42 +0400
6Subject: [PATCH] build: fix extract.pl for cross compilation
7
8extract.pl should invoke the C preprocessor for the target system, not the
9host.
10
11* vtysh/extract.pl.in: use @CPP@ to get target cpp
12---
13 vtysh/extract.pl.in | 2 +-
14 1 files changed, 1 insertions(+), 1 deletions(-)
15
16diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in
17index 7612aff..4c3a47f 100755
18--- a/vtysh/extract.pl.in
19+++ b/vtysh/extract.pl.in
20@@ -63,7 +63,7 @@ $ignore{'"show history"'} = "ignore";
21 foreach (@ARGV) {
22 $file = $_;
23
24- open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |");
25+ open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |");
26 local $/; undef $/;
27 $line = <FH>;
28 close (FH);
29--
301.7.1
31
diff --git a/meta-networking/recipes-protocols/quagga/files/fix-for-lib-inpath.patch b/meta-networking/recipes-protocols/quagga/files/fix-for-lib-inpath.patch
new file mode 100644
index 0000000000..50f0ad502f
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/fix-for-lib-inpath.patch
@@ -0,0 +1,19 @@
1At first this worked, then I tried a clean build in a directory that
2contained lib in it (oe/build/titan-glibc) and vtysh no longer
3worked. It's test for the lib directory was excepting anything
4containing lib.
5
6With this patch you still cannot have lib in the path anywhere, but
7at least things containing lib will now work.
8
9--- quagga-0.99.2/vtysh/extract.pl.in 2005/11/16 04:12:04 1.1
10+++ quagga-0.99.2/vtysh/extract.pl.in 2005/11/16 04:12:16
11@@ -89,7 +89,7 @@
12 $cmd =~ s/\s+$//g;
13
14 # $protocol is VTYSH_PROTO format for redirection of user input
15- if ($file =~ /lib/) {
16+ if ($file =~ /\/lib\//) {
17 if ($file =~ /keychain.c/) {
18 $protocol = "VTYSH_RIPD";
19 }
diff --git a/meta-networking/recipes-protocols/quagga/files/lingering-IP-address-after-deletion-BZ-486.patch b/meta-networking/recipes-protocols/quagga/files/lingering-IP-address-after-deletion-BZ-486.patch
new file mode 100644
index 0000000000..42bdc20fcb
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/lingering-IP-address-after-deletion-BZ-486.patch
@@ -0,0 +1,64 @@
1From 7f062c217b262e362a3362c677dea6c5e820adf1 Mon Sep 17 00:00:00 2001
2From: David Lamparter <equinox@diac24.net>
3Date: Mon, 1 Feb 2010 16:41:26 +0100
4Subject: [PATCH] zebra: lingering IP address after deletion (BZ#486)
5
6Upstream-status: Backport
7
8zebra address bookkeeping is a mess. this is just a workaround to have
9IPv4 address deletion somewhat working on Linux.
10
11the if_unset_prefix call is synchronous, when it returns success the
12address deletion completed successfully. this is either signaled by a
13netlink ACK or by an OK return value from ioctl().
14
15This version is wrapped by #ifdef HAVE_NETLINK so we don't touch the
16BSDs for now.
17
18* zebra/interface.c: On Linux, update zebra internal state after
19 deleting an address.
20
21Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
22---
23 zebra/interface.c | 21 ++++++++++++++++++---
24 1 file changed, 18 insertions(+), 3 deletions(-)
25
26diff --git a/zebra/interface.c b/zebra/interface.c
27index 2242259..3578b79 100644
28--- a/zebra/interface.c
29+++ b/zebra/interface.c
30@@ -1297,13 +1297,28 @@ ip_address_uninstall (struct vty *vty, struct interface *ifp,
31 safe_strerror(errno), VTY_NEWLINE);
32 return CMD_WARNING;
33 }
34+ /* success! call returned that the address deletion went through.
35+ * this is a synchronous operation, so we know it succeeded and can
36+ * now update all internal state. */
37+
38+ /* the HAVE_NETLINK check is only here because, on BSD, although the
39+ * call above is still synchronous, we get a second confirmation later
40+ * through the route socket, and we don't want to touch that behaviour
41+ * for now. It should work without the #ifdef, but why take the risk...
42+ * -- equinox 2012-07-13 */
43+#ifdef HAVE_NETLINK
44+
45+ /* Remove connected route. */
46+ connected_down_ipv4 (ifp, ifc);
47
48-#if 0
49 /* Redistribute this information. */
50 zebra_interface_address_delete_update (ifp, ifc);
51
52- /* Remove connected route. */
53- connected_down_ipv4 (ifp, ifc);
54+ /* IP address propery set. */
55+ UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL);
56+
57+ /* remove from interface, remark secondaries */
58+ if_subnet_delete (ifp, ifc);
59
60 /* Free address information. */
61 listnode_delete (ifp->connected, ifc);
62--
631.7.10.4
64
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga-0.99.17-libcap.patch b/meta-networking/recipes-protocols/quagga/files/quagga-0.99.17-libcap.patch
new file mode 100644
index 0000000000..9563ea2f36
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/quagga-0.99.17-libcap.patch
@@ -0,0 +1,64 @@
1From 63e97633d01908da6d3776ac61e4033e6fa91e5c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@gmail.com>
3Date: Sun, 5 Sep 2010 18:19:09 +0200
4Subject: [PATCH] build: fix linking position for libcap
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9 * lib/Makefile.am: link libzebra to libcap, since it uses symbols
10 from there.
11 * zebra/Makefile.am: no need to link libcap here now, since it's not
12 used directly (libtool with apply transitive dependencies for
13 static linking).
14
15Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com>
16
17Imported from Gentoo by Paul Eggleton <paul.eggleton@linux.intel.com>
18Upstream-Status: Pending
19
20---
21 lib/Makefile.am | 2 +-
22 zebra/Makefile.am | 5 ++---
23 2 files changed, 3 insertions(+), 4 deletions(-)
24
25diff --git a/lib/Makefile.am b/lib/Makefile.am
26index 315e919..6e69993 100644
27--- a/lib/Makefile.am
28+++ b/lib/Makefile.am
29@@ -18,7 +18,7 @@ BUILT_SOURCES = memtypes.h route_types.h
30
31 libzebra_la_DEPENDENCIES = @LIB_REGEX@
32
33-libzebra_la_LIBADD = @LIB_REGEX@
34+libzebra_la_LIBADD = @LIB_REGEX@ $(LIBCAP)
35
36 pkginclude_HEADERS = \
37 buffer.h checksum.h command.h filter.h getopt.h hash.h \
38diff --git a/zebra/Makefile.am b/zebra/Makefile.am
39index 542f36f..d09a209 100644
40--- a/zebra/Makefile.am
41+++ b/zebra/Makefile.am
42@@ -5,7 +5,6 @@ DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DMULTIPATH_NUM=@MULTIPATH_NUM@
43 INSTALL_SDATA=@INSTALL@ -m 600
44
45 LIB_IPV6 = @LIB_IPV6@
46-LIBCAP = @LIBCAP@
47
48 ipforward = @IPFORWARD@
49 if_method = @IF_METHOD@
50@@ -39,9 +38,9 @@ noinst_HEADERS = \
51 connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \
52 interface.h ipforward.h irdp.h router-id.h kernel_socket.h
53
54-zebra_LDADD = $(otherobj) $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la
55+zebra_LDADD = $(otherobj) ../lib/libzebra.la $(LIB_IPV6)
56
57-testzebra_LDADD = $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la
58+testzebra_LDADD = ../lib/libzebra.la $(LIB_IPV6)
59
60 zebra_DEPENDENCIES = $(otherobj)
61
62--
631.7.2.2
64
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch b/meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch
new file mode 100644
index 0000000000..a07e33f9fd
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch
@@ -0,0 +1,54 @@
1quagga: Avoid duplicate connected address adding to the list
2
3commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
4introduces an regression: ifp->connected list is cleaned up when ripd is
5restarting, however, for interface addresses which are not specified in
6ripd configuration file, they are never to be added into ifp->connected
7again, this will lead to some abnormal behavior for route advertising.
8
9Instead of cleaning up the ifp->connected list to avoid duplicated
10connected address being added into this list, we can check this
11condition during interface address adding process and return early
12when an identical address has already been added.
13
14Upstream-Status: Pending
15
16Signed-off-by: Hu Yadi <Yadi.hu@windriver.com>
17Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
18Signed-off-by: Joe MacDonald <joe@deserted.net>
19---
20--- a/lib/if.c
21+++ b/lib/if.c
22@@ -738,6 +738,16 @@ connected_add_by_prefix (struct interfac
23 struct prefix *destination)
24 {
25 struct connected *ifc;
26+ struct listnode *cnode;
27+ struct connected *c;
28+ int ret = 0;
29+
30+ for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
31+ {
32+ ret = connected_same_prefix (p, (c->address));
33+ if(ret == 1)
34+ return NULL;
35+ }
36
37 /* Allocate new connected address. */
38 ifc = connected_new ();
39--- a/ripd/rip_interface.c
40+++ b/ripd/rip_interface.c
41@@ -516,13 +516,6 @@ rip_interface_clean (void)
42 thread_cancel (ri->t_wakeup);
43 ri->t_wakeup = NULL;
44 }
45-
46- for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
47- {
48- ifc = listgetdata (conn_node);
49- next = conn_node->next;
50- listnode_delete (ifp->connected, ifc);
51- }
52 }
53 }
54
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga-fix-CVE-2013-6051.patch b/meta-networking/recipes-protocols/quagga/files/quagga-fix-CVE-2013-6051.patch
new file mode 100644
index 0000000000..fde9e0ca81
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/quagga-fix-CVE-2013-6051.patch
@@ -0,0 +1,29 @@
1
2From 8794e8d229dc9fe29ea31424883433d4880ef408
3From: Paul Jakma <paul@quagga.net>
4Date: Mon, 13 Feb 2012 13:53:07 +0000
5Subject: bgpd: Fix regression in args consolidation, total should be inited from args
6
7bgpd: Fix regression in args consolidation, total should be inited from args
8
9* bgp_attr.c: (bgp_attr_unknown) total should be initialised from the args.
10
11Upstream-Status: Backport
12
13Signed-off-by: Kai Kang <kai.kang@windriver.com>
14---
15
16diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
17index 65af824..839f64d 100644
18--- a/bgpd/bgp_attr.c
19+++ b/bgpd/bgp_attr.c
20
21@@ -1646,7 +1646,7 @@
22 static bgp_attr_parse_ret_t
23 bgp_attr_unknown (struct bgp_attr_parser_args *args)
24 {
25- bgp_size_t total;
26+ bgp_size_t total = args->total;
27 struct transit *transit;
28 struct attr_extra *attre;
29 struct peer *const peer = args->peer;
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga.default b/meta-networking/recipes-protocols/quagga/files/quagga.default
new file mode 100644
index 0000000000..0c1ce6c042
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/quagga.default
@@ -0,0 +1,13 @@
1# If this option is set the /etc/init.d/quagga script automatically loads
2# the config via "vtysh -b" when the servers are started.
3vtysh_enable=yes
4
5# Bind all daemons to loopback only by default
6zebra_options=" --daemon -A 127.0.0.1"
7babeld_options="--daemon -A 127.0.0.1"
8bgpd_options=" --daemon -A 127.0.0.1"
9ospfd_options=" --daemon -A 127.0.0.1"
10ospf6d_options="--daemon -A ::1"
11ripd_options=" --daemon -A 127.0.0.1"
12ripngd_options="--daemon -A ::1"
13isisd_options=" --daemon -A 127.0.0.1"
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga.init b/meta-networking/recipes-protocols/quagga/files/quagga.init
new file mode 100644
index 0000000000..60b5ab01a1
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/quagga.init
@@ -0,0 +1,200 @@
1#!/bin/sh
2#
3# /etc/init.d/quagga -- start/stop the Quagga routing daemons
4#
5# Based on debian version by Endre Hirling <endre@mail.elte.hu> and
6# Christian Hammers <ch@debian.org>.
7#
8
9### BEGIN INIT INFO
10# Provides: quagga
11# Required-Start: $local_fs $network $remote_fs $syslog
12# Required-Stop: $local_fs $network $remote_fs $syslog
13# Default-Start: 2 3 4 5
14# Default-Stop: 0 1 6
15# Short-Description: start and stop the Quagga routing suite
16# Description: Quagga is a routing suite for IP routing protocols like
17# BGP, OSPF, RIP and others. This script contols the main
18# daemon "quagga" as well as the individual protocol daemons.
19### END INIT INFO
20
21# NOTE: sbin must be before bin so we get the iproute2 ip and not the
22# busybox ip command. The busybox one flushes all routes instead of just
23# the dynamic routes
24PATH=/sbin:/usr/sbin:/bin:/usr/bin:/sbin
25D_PATH=/usr/sbin
26C_PATH=/etc/quagga
27
28# Keep zebra first and do not list watchquagga!
29DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld"
30
31# Print the name of the pidfile.
32pidfile()
33{
34 echo "/var/run/quagga/$1.pid"
35}
36
37# Check if daemon is started by using the pidfile.
38started()
39{
40 [ -e `pidfile $1` ] && kill -0 `cat \`pidfile $1\`` 2> /dev/null && return 0
41 return 1
42}
43
44# Loads the config via vtysh -b if configured to do so.
45vtysh_b ()
46{
47 # Rember, that all variables have been incremented by 1 in convert_daemon_prios()
48 if [ "$vtysh_enable" = 2 -a -f $C_PATH/Quagga.conf ]; then
49 /usr/bin/vtysh -b
50 fi
51}
52
53# Check if the daemon is activated and if its executable and config files
54# are in place.
55# params: daemon name
56# returns: 0=ok, 1=error
57check_daemon()
58{
59 # If the integrated config file is used the others are not checked.
60 if [ -r "$C_PATH/Quagga.conf" ]; then
61 return 0
62 fi
63
64 # check for config file
65 if [ ! -r "$C_PATH/$1.conf" ]; then
66 return 1
67 fi
68 return 0
69}
70
71# Starts the server if it's not alrady running according to the pid file.
72# The Quagga daemons creates the pidfile when starting.
73start()
74{
75 if ! check_daemon $1; then echo -n " (!$1)"; return; fi
76 echo -n " $1"
77 start-stop-daemon \
78 --start \
79 --pidfile=`pidfile $1` \
80 --exec "$D_PATH/$1" \
81 -- \
82 `eval echo "$""$1""_options"`
83
84}
85
86# Stop the daemon given in the parameter, printing its name to the terminal.
87stop()
88{
89 if ! started "$1" ; then
90 echo -n " (!$1)"
91 return 0
92 else
93 PIDFILE=`pidfile $1`
94 PID=`cat $PIDFILE 2>/dev/null`
95 start-stop-daemon --stop --quiet --exec "$D_PATH/$1"
96 #
97 # Now we have to wait until $DAEMON has _really_ stopped.
98 #
99 if test -n "$PID" && kill -0 $PID 2>/dev/null; then
100 echo -n " (waiting) ."
101 cnt=0
102 while kill -0 $PID 2>/dev/null; do
103 cnt=`expr $cnt + 1`
104 if [ $cnt -gt 60 ]; then
105 # Waited 120 secs now, fail.
106 echo -n "Failed.. "
107 break
108 fi
109 sleep 2
110 echo -n "."
111 done
112 fi
113 echo -n " $1"
114 rm -f `pidfile $1`
115 fi
116}
117
118stop_all()
119{
120 local daemon_list
121 daemon_list=${1:-$DAEMONS}
122
123 echo -n "Stopping Quagga daemons:"
124 for daemon_name in $daemon_list; do
125 stop "$daemon_name"
126 done
127 echo "."
128}
129
130start_all()
131{
132 local daemon_list
133 daemon_list=${1:-$DAEMONS}
134
135 echo -n "Starting Quagga daemons:"
136 for daemon_name in $daemon_list; do
137 start "$daemon_name"
138 done
139 echo "."
140}
141
142status_all()
143{
144 local daemon_list
145 daemon_list=${1:-$DAEMONS}
146 res=1
147
148 echo -n "quagga: "
149 for daemon_name in $daemon_list; do
150 if started "$daemon_name" ; then
151 id=`cat \`pidfile $daemon_name\``
152 echo -n "$daemon_name (pid $id) "
153 res=0
154 fi
155 done
156 if [ $res -eq 0 ]; then
157 echo "is running..."
158 else
159 echo "is stopped..."
160 fi
161 exit $res
162}
163
164#########################################################
165# Main program #
166#########################################################
167
168# Load configuration
169test -f /etc/default/quagga && . /etc/default/quagga
170
171case "$1" in
172 start)
173 cd $C_PATH/
174 start_all $2
175 vtysh_b
176 ;;
177
178 stop)
179 stop_all $2
180 echo "Removing all routes made by zebra."
181 ip route flush proto zebra
182 ;;
183
184 status)
185 status_all $2
186 ;;
187
188 restart|force-reload)
189 $0 stop $2
190 sleep 1
191 $0 start $2
192 ;;
193
194 *)
195 echo "Usage: /etc/init.d/quagga {start|stop|restart|status|force-reload} [daemon]"
196 exit 1
197 ;;
198esac
199
200exit 0
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga.pam b/meta-networking/recipes-protocols/quagga/files/quagga.pam
new file mode 100644
index 0000000000..3541a975ae
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/quagga.pam
@@ -0,0 +1,13 @@
1#
2# The PAM configuration file for the quagga `vtysh' service
3#
4
5# This allows root to change user infomation without being
6# prompted for a password
7auth sufficient pam_rootok.so
8
9# The standard Unix authentication modules, used with
10# NIS (man nsswitch) as well as normal /etc/passwd and
11# /etc/shadow entries.
12auth include common-auth
13
diff --git a/meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch b/meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch
new file mode 100644
index 0000000000..4b8c9a929b
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch
@@ -0,0 +1,50 @@
1ripd: Fix two bugs after received SIGHUP signal
2
3There are two problems for ripd implementation after received
4SIGHUP signal:
51). ripd didn't clean up ifp->connected list before reload
6 configuration file.
72). ripd reset ri->split_horizon flag to RIP_NO_SPLIT_HORIZON
8 which lead to the unnecessary route to be advertised.
9
10Upstream-Status: Submitted [http://patchwork.diac24.net/patch/604/]
11
12Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
13Signed-off-by: Joe MacDonald <joe@deserted.net>
14---
15--- a/ripd/rip_interface.c
16+++ b/ripd/rip_interface.c
17@@ -500,6 +500,8 @@
18 struct listnode *node;
19 struct interface *ifp;
20 struct rip_interface *ri;
21+ struct connected *ifc;
22+ struct listnode *conn_node, *next;
23
24 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
25 {
26@@ -514,6 +516,13 @@
27 thread_cancel (ri->t_wakeup);
28 ri->t_wakeup = NULL;
29 }
30+
31+ for (conn_node = listhead (ifp->connected); conn_node; conn_node = next)
32+ {
33+ ifc = listgetdata (conn_node);
34+ next = conn_node->next;
35+ listnode_delete (ifp->connected, ifc);
36+ }
37 }
38 }
39
40@@ -548,8 +557,8 @@
41 ri->key_chain = NULL;
42 }
43
44- ri->split_horizon = RIP_NO_SPLIT_HORIZON;
45- ri->split_horizon_default = RIP_NO_SPLIT_HORIZON;
46+ ri->split_horizon = RIP_SPLIT_HORIZON;
47+ ri->split_horizon_default = RIP_SPLIT_HORIZON;
48
49 ri->list[RIP_FILTER_IN] = NULL;
50 ri->list[RIP_FILTER_OUT] = NULL;
diff --git a/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga b/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga
new file mode 100644
index 0000000000..cfb896a17b
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga
@@ -0,0 +1,3 @@
1# <type> <owner> <group> <mode> <path> <linksource>
2d quagga quagga 0755 /var/run/quagga none
3d quagga quagga 0755 /var/log/quagga none \ No newline at end of file
diff --git a/meta-networking/recipes-protocols/quagga/files/watchquagga.default b/meta-networking/recipes-protocols/quagga/files/watchquagga.default
new file mode 100644
index 0000000000..2d601ec97d
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/watchquagga.default
@@ -0,0 +1,12 @@
1# Watchquagga configuration
2#watch_daemons="zebra bgpd ospfd ospf6d ripd ripngd"
3watch_daemons="zebra"
4
5# To enable restarts when multiple daemons are being used, uncomment this line (but first be sure to edit
6# the WATCH_DAEMONS line to reflect the daemons you are actually using):
7#watch_options="-Az -b_ -r/etc/init.d/quagga_restart_%s -s/etc/init.d/quagga_start_%s -k/etc/init.d/quagga_stop_%s"
8
9# Since we are using one quagga daemon for now, use the following line. If using
10# multiple daemons, comment the line below and uncoment the line mentioned
11# above.
12watch_options="-z -b_ -r/etc/init.d/quagga_restart_%s"
diff --git a/meta-networking/recipes-protocols/quagga/files/watchquagga.init b/meta-networking/recipes-protocols/quagga/files/watchquagga.init
new file mode 100644
index 0000000000..5ddd94a3d6
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/watchquagga.init
@@ -0,0 +1,64 @@
1#!/bin/sh
2#
3### BEGIN INIT INFO
4# Provides: watchquagga
5# Required-Start: $local_fs $network $remote_fs $syslog
6# Required-Stop: $local_fs $network $remote_fs $syslog
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: start and stop the Quagga watchdog
10### END INIT INFO
11
12PATH=/bin:/usr/bin:/sbin:/usr/sbin
13
14# Load configuration
15test -f /etc/default/watchquagga && . /etc/default/watchquagga
16
17# Check that there are daemons to be monitored.
18[ -z "$watch_daemons" ] && exit 0
19
20pidfile="/var/run/quagga/watchquagga.pid"
21
22case "$1" in
23 start)
24 echo -n "Starting quagga watchdog daemon: watchquagga"
25 start-stop-daemon --start \
26 --pidfile $pidfile \
27 --exec /usr/sbin/watchquagga \
28 -- -d $watch_options $watch_daemons
29 echo "."
30 ;;
31
32 stop)
33 echo -n "Stopping quagga watchdog daemon: watchquagga"
34 start-stop-daemon --stop --quiet \
35 --pidfile $pidfile
36 echo "."
37 ;;
38
39 status)
40 echo -n "watchquagga "
41 res=1
42 [ -e $pidfile ] && kill -0 `cat $pidfile` 2> /dev/null
43 if [ $? -eq 0 ]; then
44 echo "(pid `cat $pidfile`) is running..."
45 res=0
46 else
47 echo "is stopped..."
48 fi
49 exit $res
50 ;;
51
52 restart|force-reload)
53 $0 stop $2
54 sleep 1
55 $0 start $2
56 ;;
57
58 *)
59 echo "Usage: /etc/init.d/watchquagga {start|stop|restart|force-reload}"
60 exit 1
61 ;;
62esac
63
64exit 0
diff --git a/meta-networking/recipes-protocols/quagga/files/work-with-new-readline.patch b/meta-networking/recipes-protocols/quagga/files/work-with-new-readline.patch
new file mode 100644
index 0000000000..2bd333a70a
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/work-with-new-readline.patch
@@ -0,0 +1,34 @@
1From 66df315d2a270a254c613a4d2e72c0ea47f15a71 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 27 Mar 2014 09:35:29 +0000
4Subject: [PATCH] vtysh/vtysh.c: works with new readline
5
6The Function and CPPFunction had been removed by in readline 6.3, use
7the new functions to replace them.
8
9Upstream-Status: Pending
10
11Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
12---
13 vtysh/vtysh.c | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
17index 431c08e..fdd82fb 100644
18--- a/vtysh/vtysh.c
19+++ b/vtysh/vtysh.c
20@@ -2212,9 +2212,9 @@ void
21 vtysh_readline_init (void)
22 {
23 /* readline related settings. */
24- rl_bind_key ('?', (Function *) vtysh_rl_describe);
25+ rl_bind_key ('?', (rl_command_func_t *) vtysh_rl_describe);
26 rl_completion_entry_function = vtysh_completion_entry_function;
27- rl_attempted_completion_function = (CPPFunction *)new_completion;
28+ rl_attempted_completion_function = (rl_completion_func_t *)new_completion;
29 /* do not append space after completion. It will be appended
30 * in new_completion() function explicitly. */
31 rl_completion_append_character = '\0';
32--
331.8.3.4
34
diff --git a/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-networking/recipes-protocols/quagga/quagga.inc
new file mode 100644
index 0000000000..60baab8011
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/quagga.inc
@@ -0,0 +1,207 @@
1SUMMARY = "BGP/OSPF/RIP routing daemon"
2DESCRIPTION = "Quagga is a routing software suite, providing \
3implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \
4Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
5Quagga is a fork of GNU Zebra which was developed by Kunihiro \
6Ishiguro. The Quagga tree aims to build a more involved community \
7around Quagga than the current centralised model of GNU Zebra."
8HOMEPAGE = "http://www.nongnu.org/quagga/"
9SECTION = "network"
10LICENSE = "GPL-2.0 & LGPL-2.0"
11DEPENDS = "readline ncurses perl-native"
12DEPENDS += "${@base_contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}"
13SNMP_CONF="${@base_contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}"
14
15LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
16 file://COPYING.LIB;md5=f30a9716ef3762e3467a2f62bf790f0a"
17
18INC_PR = "r2"
19
20# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
21RDEPENDS_${PN} += "iproute2"
22
23QUAGGASUBDIR = ""
24# ${QUAGGASUBDIR} is deal with old versions. Set to "/attic" for old
25# versions and leave it empty for recent versions.
26SRC_URI = "http://download.savannah.gnu.org/releases/quagga${QUAGGASUBDIR}/quagga-${PV}.tar.gz;name=quagga-${PV} \
27 file://fix-for-lib-inpath.patch \
28 file://quagga-0.99.17-libcap.patch \
29 file://quagga-fix-CVE-2013-6051.patch \
30 file://Zebra-sync-zebra-routing-table-with-the-kernel-one.patch \
31 file://quagga.init \
32 file://quagga.default \
33 file://watchquagga.init \
34 file://watchquagga.default \
35 file://volatiles.03_quagga \
36 file://quagga.pam \
37 file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
38 file://quagga-Avoid-duplicate-connected-address.patch \
39"
40
41MIRRORS += "http://download.savannah.gnu.org/releases/ http://download-mirror.savannah.gnu.org/releases/ \n"
42
43PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
44PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
45PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
46
47inherit autotools update-rc.d useradd
48
49EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
50 --localstatedir=${localstatedir}/run/quagga \
51 --enable-exampledir=${docdir}/quagga/examples/ \
52 --enable-vtysh \
53 --enable-isisd \
54 --enable-watchquagga \
55 --enable-ospf-te \
56 --enable-opaque-lsa \
57 --enable-ipv6 \
58 --enable-ospfclient=yes \
59 --enable-multipath=64 \
60 --enable-user=quagga \
61 --enable-group=quagga \
62 --enable-vty-group=quaggavty \
63 --enable-configfile-mask=0640 \
64 --enable-logfile-mask=0640 \
65 --enable-rtadv \
66 --enable-linux24-tcp-md5 \
67 ap_cv_cc_pie=no \
68 ${SNMP_CONF}"
69
70do_install () {
71 # Install init script and default settings
72 install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
73 ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
74 install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
75 install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
76 install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
77 install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
78 install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
79
80 # Install sample configurations for the daemons
81 for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
82 install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
83 done
84
85 for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
86 touch ${D}${sysconfdir}/quagga/$f.conf
87 done
88 chown quagga:quaggavty ${D}${sysconfdir}/quagga
89 chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
90 chmod 750 ${D}${sysconfdir}/quagga
91 chmod 640 ${D}${sysconfdir}/quagga/*.conf
92
93 # Install quagga
94 oe_runmake install DESTDIR=${D} prefix=${prefix} \
95 sbindir=${sbindir} \
96 sysconfdir=${sysconfdir}/quagga \
97 localstatedir=${localstatedir}/run/quagga
98
99 # Fix hardcoded paths
100 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
101 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
102 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
103 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
104 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
105
106 # Remove generated info dir file, it doesn't belong in the generated
107 # package.
108 rm -f ${D}${infodir}/dir
109
110 # For PAM
111 for feature in ${DISTRO_FEATURES}; do
112 if [ "$feature" = "pam" ]; then
113 install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
114 break
115 fi
116 done
117
118}
119
120# Split into a main package and separate per-protocol packages
121PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-babeld ${PN}-bgpd \
122 ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
123 ${PN}-ospfclient ${PN}-watchquagga"
124
125FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*"
126FILES_${PN}-ospf6d = "${sbindir}/ospf6d"
127FILES_${PN}-babeld = "${sbindir}/babeld"
128FILES_${PN}-bgpd = "${sbindir}/bgpd"
129FILES_${PN}-ripd = "${sbindir}/ripd"
130FILES_${PN}-ripngd = "${sbindir}/ripngd"
131FILES_${PN}-isisd = "${sbindir}/isisd"
132FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
133FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
134 ${sysconfdir}/init.d/watchquagga"
135
136# Indicate that the default files are configuration files
137CONFFILES_${PN} = "${sysconfdir}/default/quagga \
138 ${sysconfdir}/quagga/bgpd.conf \
139 ${sysconfdir}/quagga/vtysh.conf \
140 ${sysconfdir}/quagga/babeld.conf \
141 ${sysconfdir}/quagga/isisd.conf \
142 ${sysconfdir}/quagga/ospfd.conf \
143 ${sysconfdir}/quagga/ripngd.conf \
144 ${sysconfdir}/quagga/zebra.conf \
145 ${sysconfdir}/quagga/ripd.conf \
146 ${sysconfdir}/quagga/ospf6d.conf \
147 "
148CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
149
150# Stop the names being rewritten due to the internal shared libraries
151DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
152DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
153
154# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
155RDEPENDS_${PN} += "iproute2"
156
157# Main init script starts all deamons
158# Seperate init script for watchquagga
159INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga"
160INITSCRIPT_NAME_${PN} = "quagga"
161INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
162INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga"
163INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10"
164
165# Add quagga's user and group
166USERADD_PACKAGES = "${PN}"
167GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
168USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga --shell /bin/false quagga"
169
170pkg_postinst_${PN} () {
171 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
172 ${sysconfdir}/init.d/populate-volatile.sh update
173 fi
174}
175
176# Stop apps before uninstall
177pkg_prerm_${PN} () {
178 ${sysconfdir}/init.d/quagga stop
179}
180
181pkg_prerm_${PN}-ospfd () {
182 ${sysconfdir}/init.d/quagga stop ospfd
183}
184
185pkg_prerm_${PN}-ospf6d () {
186 ${sysconfdir}/init.d/quagga stop ospf6d
187}
188
189pkg_prerm_${PN}-babeld () {
190 ${sysconfdir}/init.d/quagga stop babeld
191}
192
193pkg_prerm_${PN}-bgpd () {
194 ${sysconfdir}/init.d/quagga stop bgpd
195}
196
197pkg_prerm_${PN}-ripd () {
198 ${sysconfdir}/init.d/quagga stop ripd
199}
200
201pkg_prerm_${PN}-ripngd () {
202 ${sysconfdir}/init.d/quagga stop ripngd
203}
204
205pkg_prerm_${PN}-isisd () {
206 ${sysconfdir}/init.d/quagga stop isisd
207}
diff --git a/meta-networking/recipes-protocols/quagga/quagga_0.99.21.bb b/meta-networking/recipes-protocols/quagga/quagga_0.99.21.bb
new file mode 100644
index 0000000000..0988b70eb0
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/quagga_0.99.21.bb
@@ -0,0 +1,15 @@
1require quagga.inc
2
3PR = "${INC_PR}.0"
4
5SRC_URI += "file://0001-doc-fix-makeinfo-errors-and-one-warning.patch \
6 file://lingering-IP-address-after-deletion-BZ-486.patch \
7 file://build-fix-extract.pl-for-cross-compilation.patch \
8 file://babel-close-the-stdout-stderr-as-in-other-daemons.patch \
9 file://work-with-new-readline.patch \
10"
11
12SRC_URI[quagga-0.99.21.md5sum] = "99840adbe57047c90dfba6b6ed9aec7f"
13SRC_URI[quagga-0.99.21.sha256sum] = "9b8aea9026b4771a28e254a66cbd854723bcd0d71eebd0201d11838d4eb392ee"
14
15QUAGGASUBDIR = ""
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/configure_in_cross.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/configure_in_cross.patch
new file mode 100644
index 0000000000..1896759427
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/configure_in_cross.patch
@@ -0,0 +1,142 @@
1Update the configure script to cross-compiling with OE. This hard-codes
2a few target paths, reworks a few tests to be more friendly for cross
3and drops other tests.
4
5Upstream-Status: Inappropriate [build system specific changes]
6
7Index: src/configure.in
8===================================================================
9--- rp-pppoe-3.8.orig/src/configure.in 2006-04-03 00:29:42.000000000 +1000
10+++ rp-pppoe-3.8/src/configure.in 2007-06-07 22:19:36.000000000 +1000
11@@ -5,6 +5,13 @@
12 dnl pppd directory for kernel-mode PPPoE
13 PPPD_DIR=ppp-2.4.1.pppoe2
14
15+dnl hard code some paths
16+PPPD=/usr/sbin/pppd
17+ID=/usr/bin/id
18+ECHO=/bin/echo
19+AC_ARG_VAR(PPPD)
20+AC_ARG_VAR(ID)
21+
22 AC_CONFIG_HEADER(config.h)
23
24 AC_PREFIX_DEFAULT(/usr)
25@@ -44,7 +51,7 @@
26 AC_MSG_RESULT($ac_cv_struct_sockaddr_ll)
27
28 if test "$ac_cv_struct_sockaddr_ll" = yes ; then
29-AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL)
30+AC_DEFINE([HAVE_STRUCT_SOCKADDR_LL], [], [Have struct SOCKADDR_LL])
31 fi
32
33 dnl Check for N_HDLC line discipline
34@@ -55,7 +62,7 @@
35 ac_cv_n_hdlc=no)
36 AC_MSG_RESULT($ac_cv_n_hdlc)
37 if test "$ac_cv_n_hdlc" = yes ; then
38-AC_DEFINE(HAVE_N_HDLC)
39+AC_DEFINE([HAVE_N_HDLC], [], [Have N_HDLC])
40 fi
41
42 AC_ARG_ENABLE(plugin, [ --enable-plugin=pppd_src_path build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no)
43@@ -100,13 +107,13 @@
44 if test "$ac_cv_header_linux_if_pppox_h" = yes ; then
45 if test "$ac_cv_pluginpath" != no ; then
46 LINUX_KERNELMODE_PLUGIN=rp-pppoe.so
47- AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE)
48+ AC_DEFINE([HAVE_LINUX_KERNEL_PPPOE], [], [Have kernel PPPoE])
49 PPPD_INCDIR=$ac_cv_pluginpath
50 fi
51 fi
52
53 if test "$ac_cv_debugging" = "yes" ; then
54- AC_DEFINE(DEBUGGING_ENABLED)
55+ AC_DEFINE([DEBUGGING_ENABLED], [], [Debugging enabled])
56 fi
57
58 AC_SUBST(LINUX_KERNELMODE_PLUGIN)
59@@ -131,15 +138,8 @@
60 AC_CHECK_SIZEOF(unsigned int)
61 AC_CHECK_SIZEOF(unsigned long)
62
63-dnl Check for location of pppd
64-AC_PATH_PROG(PPPD, pppd, NOTFOUND, $PATH:/sbin:/usr/sbin:/usr/local/sbin)
65-AC_PATH_PROG(ECHO, echo, echo)
66-
67-dnl Check for setsid (probably Linux-specific)
68-AC_PATH_PROG(SETSID, setsid, "", $PATH:/sbin:/usr/sbin:/usr/local/sbin)
69-
70 dnl Check for an "id" which accepts "-u" option -- hack for Solaris.
71-AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH)
72+dnl AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH)
73
74 dnl Check for Linux-specific kernel support for PPPoE
75 AC_MSG_CHECKING(for Linux 2.4.X kernel-mode PPPoE support)
76@@ -183,44 +183,8 @@
77 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -ansi"
78 fi
79
80-dnl If we couldn't find pppd, die
81-if test "$PPPD" = "NOTFOUND"; then
82- AC_MSG_WARN([*** Oops! I couldn't find pppd, the PPP daemon anywhere.])
83- AC_MSG_WARN([*** You must install pppd, version 2.3.10 or later.])
84- AC_MSG_WARN([*** I will keep going, but it may not work.])
85- PPPD=pppd
86-fi
87-
88-dnl Figure out pppd version. 2.3.7 to 2.3.9 -- issue warning. Less than
89-dnl 2.3.7 -- stop
90-
91-PPPD_VERSION=`$PPPD --version 2>&1 | awk ' /version/ {print $NF}'`
92-
93-case "$PPPD_VERSION" in
94-1.*|2.0.*|2.1.*|2.2.*|2.3.0|2.3.1|2.3.2|2.3.3|2.3.4|2.3.5|2.3.6)
95- AC_MSG_WARN([*** Oops! Your version of pppd is $PPPD_VERSION, which is too old.])
96- AC_MSG_WARN([*** You need at least 2.3.7 (2.3.10 or newer recommended.])
97- AC_MSG_WARN([*** I will keep going, but it may not work.])
98- ;;
99-
100-2.3.7|2.3.8|2.3.9)
101- AC_MSG_WARN([*** Warning. Your version of pppd is $PPPD_VERSION. You will])
102- AC_MSG_WARN([*** not be able to use connect-on-demand. Upgrade to pppd])
103- AC_MSG_WARN([*** 2.3.10 or newer if you need connect-on-demand.])
104- ;;
105-
106-2*|3*|4*|5*|6*|7*|8*|9*)
107- ;;
108-
109-*)
110- AC_MSG_WARN([*** Oops. I cannot figure out what version of pppd you have.])
111- AC_MSG_WARN([*** All I got back was '$PPPD_VERSION'])
112- AC_MSG_WARN([*** I will keep going, but it may not work.])
113- ;;
114-esac
115-
116 dnl Figure out packing order of structures
117-AC_MSG_CHECKING([packing order of bit fields])
118+AC_CACHE_CHECK([packing order of bit fields],rpppoe_cv_pack_bitfields,[
119 AC_TRY_RUN([
120 union foo {
121 struct bar {
122@@ -245,10 +209,11 @@
123 }
124 }], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev,
125 $ECHO "no defaults for cross-compiling"; exit 0)
126+])
127
128 if test "$rpppoe_cv_pack_bitfields" = "rev" ; then
129 AC_MSG_RESULT(reversed)
130- AC_DEFINE(PACK_BITFIELDS_REVERSED)
131+ AC_DEFINE([PACK_BITFIELDS_REVERSED], [], [Reversed bitfields])
132 else
133 AC_MSG_RESULT(normal)
134 fi
135@@ -312,6 +277,7 @@
136 AC_SUBST(RDYNAMIC)
137 AC_SUBST(LIBEVENT)
138 AC_SUBST(ECHO)
139+AC_SUBST(HAVE_STRUCT_SOCKADDR_LL)
140
141 datadir_evaluated=`eval echo $datadir`
142 AC_SUBST(datadir_evaluated)
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/discard-use-of-dnl-in-Makefile.am.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/discard-use-of-dnl-in-Makefile.am.patch
new file mode 100644
index 0000000000..8b7886485a
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/discard-use-of-dnl-in-Makefile.am.patch
@@ -0,0 +1,27 @@
1From 611c9fe719c5aa264a2ad2eb920cf4522ae2ddec Mon Sep 17 00:00:00 2001
2From: Ting Liu <b28495@freescale.com>
3Date: Tue, 12 Jun 2012 14:26:16 -0400
4Subject: [PATCH] discard use of dnl in Makefile.am
5
6Since Makefile.am is not processed by m4, but by automake, 'dnl' does
7not introduce a comment.
8
9Signed-off-by: Ting Liu <b28495@freescale.com>
10---
11 Makefile.am | 2 +-
12 1 files changed, 1 insertions(+), 1 deletions(-)
13
14diff --git a/Makefile.am b/Makefile.am
15index eff6977..3091c33 100644
16--- a/Makefile.am
17+++ b/Makefile.am
18@@ -1,5 +1,5 @@
19 PACKAGE = rp-pppoe
20 VERSION = 3.8
21
22-dnl AM_CFLAGS = -Wall -DDEBUG
23+##dnl AM_CFLAGS = -Wall -DDEBUG
24 SUBDIRS = src
25--
261.7.6.5
27
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/dont-swallow-errors.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/dont-swallow-errors.patch
new file mode 100644
index 0000000000..c7fc9cfacc
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/dont-swallow-errors.patch
@@ -0,0 +1,15 @@
1Further fixup to the configure scripts to not swallow errors
2
3Upstream-Status: Pending
4
5--- a/src/configure.in.org 2008-01-14 21:08:38.000000000 +0200
6+++ a/src/configure.in 2008-01-14 21:20:09.000000000 +0200
7@@ -208,7 +208,7 @@
8 return 2;
9 }
10 }], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev,
11-$ECHO "no defaults for cross-compiling"; exit 0)
12+$ECHO "no defaults for cross-compiling"; exit 1)
13 ])
14
15 if test "$rpppoe_cv_pack_bitfields" = "rev" ; then
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.default b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.default
new file mode 100644
index 0000000000..996d57f3cf
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.default
@@ -0,0 +1,22 @@
1# PPPoE Server options
2
3# Maximum segment size, not used for in kernel PPPoE
4#MSS=1412
5
6# Device(s) - Space seperated list of devices to listen on
7#DEVICES="eth1"
8
9# Local IP
10#LOCAL_IP=10.0.0.1
11
12# Starting remote IP
13#REMOTE_IP=10.67.15.1
14
15# Service name
16#SERVICE_NAME="acme"
17
18# Maximum number of sessions, default is 16
19#MAX_SESSIONS=64
20
21# Access concentrator name, default is the hostname
22#ACCESS_CONCENTRATOR_NAME="pppoe-rtr-1"
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.init b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.init
new file mode 100755
index 0000000000..21afe0be39
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-server.init
@@ -0,0 +1,59 @@
1#! /bin/sh
2
3test -f /usr/sbin/pppoe-server || exit 0
4test -f /etc/default/pppoe-server && . /etc/default/pppoe-server
5
6case $1 in
7 start)
8 OPTIONS=""
9 if [ -n "$MSS" ]; then
10 OPTIONS="$OPTIONS -m $MSS"
11 fi
12 if [ -n "$DEVICES" ]; then
13 for i in $DEVICES; do
14 OPTIONS="$OPTIONS -I $i"
15 done
16 fi
17 if [ -n "$LOCAL_IP" ]; then
18 OPTIONS="$OPTIONS -L $LOCAL_IP"
19 fi
20 if [ -n "$REMOTE_IP" ]; then
21 OPTIONS="$OPTIONS -R $REMOTE_IP"
22 fi
23 if [ -n "$SERVICE_NAME" ]; then
24 OPTIONS="$OPTIONS -S $SERVICE_NAME"
25 fi
26 if [ -n "$MAX_SESSIONS" ]; then
27 OPTIONS="$OPTIONS -N $MAX_SESSIONS"
28 fi
29 if [ -n "$ACCESS_CONCENTRATOR_NAME" ]; then
30 OPTIONS="$OPTIONS -C $ACCESS_CONCENTRATOR_NAME"
31 fi
32 echo -n "Starting PPPoE server: pppoe-server"
33 start-stop-daemon --start --quiet --exec /usr/sbin/pppoe-server -- $OPTIONS
34 echo "."
35 ;;
36 stop)
37 echo -n "Stopping PPPoE server: pppoe-server"
38 start-stop-daemon --stop --quiet --exec /usr/sbin/pppoe-server -- $OPTIONS
39 echo "."
40 ;;
41 status)
42 pid=$(pidof pppoe-server)
43 if [ -n "$pid" ] ; then
44 echo "Running with pid $pid"
45 else
46 echo "Not running"
47 fi
48 ;;
49 restart|force-reload)
50 $0 stop
51 $0 start
52 ;;
53 *)
54 echo "Usage: /etc/init.d/pppoe-server {start|stop|restart|force-reload}"
55 exit 1
56 ;;
57esac
58
59exit 0
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-src-restrictions.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-src-restrictions.patch
new file mode 100644
index 0000000000..bcf4d1164d
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/pppoe-src-restrictions.patch
@@ -0,0 +1,20 @@
1Relax restrictions on the PPPoE src address, as per debian bug
2293811:
3
4 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=293811
5
6Upstream-Status: Inappropriate [Backport from Debian]
7
8--- rp-pppoe-3.8.orig/src/discovery.c
9+++ rp-pppoe-3.8/src/discovery.c
10@@ -376,8 +376,8 @@
11 if (!packetIsForMe(conn, &packet)) continue;
12
13 if (packet.code == CODE_PADO) {
14- if (NOT_UNICAST(packet.ethHdr.h_source)) {
15- printErr("Ignoring PADO packet from non-unicast MAC address");
16+ if (BROADCAST(packet.ethHdr.h_source)) {
17+ printErr("Ignoring broadcast PADO packet");
18 continue;
19 }
20 parsePacket(&packet, parsePADOTags, &pc);
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/top-autoconf.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/top-autoconf.patch
new file mode 100644
index 0000000000..4fe73d0171
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/top-autoconf.patch
@@ -0,0 +1,27 @@
1The autoconf stuff is all in a subdirectory, which is rather annoying
2as OE expects patches to be applied and autoconf stuff to be done in
3S. This adds enough autoconf at the top level to allow it to be
4called there - all it does is run a sub autoconf stuff in the src
5directory.
6
7Upstream-Status: Inappropriate [build system specific change]
8
9Index: rp-pppoe-3.8/Makefile.am
10===================================================================
11--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12+++ rp-pppoe-3.8/Makefile.am 2007-06-08 15:58:16.000000000 +1000
13@@ -0,0 +1,5 @@
14+PACKAGE = rp-pppoe
15+VERSION = 3.8
16+
17+dnl AM_CFLAGS = -Wall -DDEBUG
18+SUBDIRS = src
19Index: rp-pppoe-3.8/configure.in
20===================================================================
21--- /dev/null 1970-01-01 00:00:00.000000000 +0000
22+++ rp-pppoe-3.8/configure.in 2007-06-08 15:58:16.000000000 +1000
23@@ -0,0 +1,4 @@
24+AC_INIT(src/pppoe.c)
25+AM_INIT_AUTOMAKE([rp-pppoe], [3.8])
26+AC_CONFIG_SUBDIRS(src)
27+AC_OUTPUT(Makefile)
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/update-config.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/update-config.patch
new file mode 100644
index 0000000000..42a3bc62c8
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/update-config.patch
@@ -0,0 +1,32 @@
1Set the timeout to 0 since we don't want pppoe to try reconnecting,
2we want whatever is calling it to reconnect. Lots of odd things
3happen when you have pppoe retrying itself.
4
5The path for the plugin is wrong, it's now part of ppp and is in a
6ppp's plugin lib directory. If no path is specified then that's where
7ppp looks, so that's what we do here.
8
9Upstream-Status: Inappropriate [configuration]
10
11Index: rp-pppoe-3.8/configs/pppoe.conf
12===================================================================
13--- rp-pppoe-3.8.orig/configs/pppoe.conf 2006-04-03 00:29:41.000000000 +1000
14+++ rp-pppoe-3.8/configs/pppoe.conf 2007-06-08 16:02:47.000000000 +1000
15@@ -66,7 +66,7 @@
16 # to connect forever after pppoe-start is called. Otherwise, it will
17 # give out after CONNECT_TIMEOUT seconds and will not attempt to
18 # connect again, making it impossible to reach.
19-CONNECT_TIMEOUT=30
20+CONNECT_TIMEOUT=0
21
22 # How often in seconds pppoe-start polls to check if link is up
23 CONNECT_POLL=2
24@@ -115,7 +115,7 @@
25 FIREWALL=NONE
26
27 # Linux kernel-mode plugin for pppd. If you want to try the kernel-mode
28-# plugin, use LINUX_PLUGIN=/etc/ppp/plugins/rp-pppoe.so
29+# plugin, use LINUX_PLUGIN=rp-pppoe.so
30 LINUX_PLUGIN=
31
32 # Any extra arguments to pass to pppoe. Normally, use a blank string
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/use-ldflags.patch b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/use-ldflags.patch
new file mode 100644
index 0000000000..95f629298b
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.8/use-ldflags.patch
@@ -0,0 +1,27 @@
1Make the Makefile obey LDFLAGS.
2
3Upstream-Status: Pending
4
5--- a/src/Makefile.in 2006-04-02 18:29:42.000000000 +0400
6+++ b/src/Makefile.in 2010-04-16 17:51:31.000000000 +0400
7@@ -67,16 +67,16 @@ all: $(TARGETS)
8 @echo "Type 'make install' as root to install the software."
9
10 pppoe-sniff: pppoe-sniff.o if.o common.o debug.o
11- @CC@ -o pppoe-sniff pppoe-sniff.o if.o common.o debug.o
12+ @CC@ -o pppoe-sniff pppoe-sniff.o if.o common.o debug.o $(LDFLAGS)
13
14 pppoe-server: pppoe-server.o if.o debug.o common.o md5.o libevent/libevent.a @PPPOE_SERVER_DEPS@
15- @CC@ -o pppoe-server @RDYNAMIC@ pppoe-server.o if.o debug.o common.o md5.o $(PPPOE_SERVER_LIBS) -Llibevent -levent
16+ @CC@ -o pppoe-server @RDYNAMIC@ pppoe-server.o if.o debug.o common.o md5.o $(PPPOE_SERVER_LIBS) -Llibevent -levent $(LDFLAGS)
17
18 pppoe: pppoe.o if.o debug.o common.o ppp.o discovery.o
19- @CC@ -o pppoe pppoe.o if.o debug.o common.o ppp.o discovery.o
20+ @CC@ -o pppoe pppoe.o if.o debug.o common.o ppp.o discovery.o $(LDFLAGS)
21
22 pppoe-relay: relay.o if.o debug.o common.o
23- @CC@ -o pppoe-relay relay.o if.o debug.o common.o
24+ @CC@ -o pppoe-relay relay.o if.o debug.o common.o $(LDFLAGS)
25
26 pppoe.o: pppoe.c pppoe.h
27 @CC@ $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o pppoe.o pppoe.c
diff --git a/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.8.bb b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.8.bb
new file mode 100644
index 0000000000..90a8f4dd91
--- /dev/null
+++ b/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.8.bb
@@ -0,0 +1,58 @@
1SUMMARY = "A user-mode PPPoE client and server suite for Linux"
2HOMEPAGE = "http://www.roaringpenguin.com/products/pppoe"
3SECTION = "console/network"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=a194eaefae2be54ee3221339b10d0581"
6
7PR = "r10"
8
9SRC_URI = "http://www.roaringpenguin.com/files/download/${BP}.tar.gz \
10 file://top-autoconf.patch \
11 file://configure_in_cross.patch \
12 file://pppoe-src-restrictions.patch \
13 file://update-config.patch \
14 file://dont-swallow-errors.patch \
15 file://discard-use-of-dnl-in-Makefile.am.patch \
16 file://use-ldflags.patch \
17 file://pppoe-server.default \
18 file://pppoe-server.init"
19
20SRC_URI[md5sum] = "0e32760f498f9cde44081ee6aafc823b"
21SRC_URI[sha256sum] = "d916e9cfe1e62395f63a5361936fa855f6d0f0a37dc7227b394cdb725f553479"
22
23inherit autotools update-rc.d
24
25do_install() {
26 # Install init script and default settings
27 install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d
28 install -m 0644 ${WORKDIR}/pppoe-server.default ${D}${sysconfdir}/default/pppoe-server
29 install -m 0755 ${WORKDIR}/pppoe-server.init ${D}${sysconfdir}/init.d/pppoe-server
30 # Install
31 oe_runmake -C ${S} RPM_INSTALL_ROOT=${D} docdir=${docdir} install
32 chmod 4755 ${D}${sbindir}/pppoe
33}
34
35# Insert server package before main package
36PACKAGES = "${PN}-dbg ${PN}-server ${PN}-relay ${PN}-sniff ${PN} ${PN}-doc"
37
38FILES_${PN}-server = "${sysconfdir}/default/pppoe-server \
39 ${sysconfdir}/init.d/pppoe-server \
40 ${sbindir}/pppoe-server \
41 ${sysconfdir}/ppp/pppoe-server-options"
42FILES_${PN}-relay = "${sbindir}/pppoe-relay"
43FILES_${PN}-sniff = "${sbindir}/pppoe-sniff"
44
45CONFFILES_${PN} = "${sysconfdir}/ppp/pppoe.conf \
46 ${sysconfdir}/ppp/firewall-standalone \
47 ${sysconfdir}/ppp/firewall-masq"
48CONFFILES_${PN}-server = "${sysconfdir}/ppp/pppoe-server-options \
49 ${sysconfdir}/default/pppoe-server"
50
51INITSCRIPT_PACKAGES = "${PN}-server"
52INITSCRIPT_NAME_${PN}-server = "pppoe-server"
53INITSCRIPT_PARAMS_${PN}-server = "defaults 92 8"
54
55RDEPENDS_${PN} = "ppp"
56RDEPENDS_${PN}-server = "${PN}"
57RRECOMMENDS_${PN} = "ppp-oe"
58
diff --git a/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc b/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc
new file mode 100644
index 0000000000..f4ea2b8266
--- /dev/null
+++ b/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc
@@ -0,0 +1,40 @@
1SUMMARY = "Xelerance version of the Layer 2 Tunneling Protocol (L2TP) daemon"
2HOMEPAGE = "http://www.xelerance.com/software/xl2tpd/"
3SECTION = "network"
4DEPENDS = "ppp virtual/kernel"
5
6LICENSE = "GPLv2"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=0636e73ff0215e8d672dc4c32c317bb3"
8
9INC_PR = "r0"
10
11SRC_URI = "git://github.com/xelerance/xl2tpd.git"
12
13S = "${WORKDIR}/git"
14
15inherit update-rc.d
16
17do_compile () {
18 oe_runmake CFLAGS="${CFLAGS} -DLINUX" LDFLAGS="${LDFLAGS}" PREFIX="${prefix}" KERNELSRC=${STAGING_KERNEL_DIR} all
19}
20
21do_install () {
22 oe_runmake PREFIX="${D}${prefix}" install
23
24 install -d ${D}${sysconfdir}/init.d
25 touch ${D}${sysconfdir}/xl2tpd.conf
26 install -m 0755 debian/xl2tpd.init ${D}${sysconfdir}/init.d/xl2tpd
27 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/xl2tpd
28 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/xl2tpd
29 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/xl2tpd
30 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/xl2tpd
31
32 install -d ${D}${sysconfdir}/default
33 install -m 0644 debian/xl2tpd.default ${D}${sysconfdir}/default/xl2tpd
34}
35
36CONFFILES_${PN} += "${sysconfdir}/xl2tpd.conf ${sysconfdir}/default/xl2tpd"
37
38INITSCRIPT_PACKAGES = "${PN}"
39INITSCRIPT_NAME_${PN} = "xl2tpd"
40
diff --git a/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb b/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb
new file mode 100644
index 0000000000..bd084aa009
--- /dev/null
+++ b/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb
@@ -0,0 +1,5 @@
1require xl2tpd.inc
2PR = "${INC_PR}.0"
3
4SRCREV = "df7e30eb199fc5710faa83866381aea18b66e60c"
5
diff --git a/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch b/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch
new file mode 100644
index 0000000000..328e574a9e
--- /dev/null
+++ b/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch
@@ -0,0 +1,19 @@
1| zeroconf.c: In function 'main':
2| zeroconf.c:145: error: 'PATH_MAX' undeclared (first use in this function)
3
4RP - 4/9/09
5
6Upstream-Status: Pending
7
8Index: zeroconf-0.9/zeroconf.c
9===================================================================
10--- zeroconf-0.9.orig/zeroconf.c 2009-09-04 10:05:25.000000000 +0100
11+++ zeroconf-0.9/zeroconf.c 2009-09-04 10:05:42.000000000 +0100
12@@ -33,6 +33,7 @@
13 #include <net/if_arp.h>
14 #include <sys/time.h>
15 #include <signal.h>
16+#include <limits.h>
17
18 #include "delay.h"
19
diff --git a/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf b/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf
new file mode 100644
index 0000000000..0c9d15ba12
--- /dev/null
+++ b/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf
@@ -0,0 +1,51 @@
1#!/bin/sh
2
3if [ ! -x /usr/sbin/zeroconf ]; then
4 exit 0
5fi
6
7# IPv4 link-local addresses (zeroconf) are
8# only applicable on the 'inet' address family
9[ "X$ADDRFAM" != "Xinet" ] && exit 0
10
11# However there are some methods where it doesn't
12# make any sense to configure an IPv4LL address
13
14# not on loopback
15[ "X$METHOD" = "Xloopback" ] && exit 0
16
17# not on ppp or wvdial either
18[ "X$METHOD" = "Xppp" ] && exit 0
19[ "X$METHOD" = "Xwvdial" ] && exit 0
20
21# The administrator may have blacklisted interfaces
22# or only want zeroconf in a fallback situation
23[ -f /etc/default/zeroconf ] &&
24 . /etc/default/zeroconf
25
26[ -n "$DISABLE" ] && exit 0
27
28for BLACK in $IFBLACKLIST; do
29 case $IFACE in
30 $BLACK)
31 exit 0
32 ;;
33 esac
34done
35
36# should we only allocate an address if we do not already have one?
37if [ -n "$FALLBACK" ]; then
38 /sbin/ip addr show $IFACE scope global | grep -q "inet"
39 IP=$?
40 if [ $IP -eq 0 ]; then
41 /sbin/ip route add 169.254.0.0/16 dev $IFACE
42 exit 0
43 fi
44fi
45
46# otherwise, run if we aren't already going
47if [ ! -r /var/run/zeroconf.$IFACE.pid ]; then
48 /usr/sbin/zeroconf -i $IFACE
49fi
50
51exit 0
diff --git a/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default b/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default
new file mode 100644
index 0000000000..cc07b275f1
--- /dev/null
+++ b/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default
@@ -0,0 +1,17 @@
1# Default for zeroconf
2
3# disable zeroconf
4# If you want to disable zeroconf completely, uncomment the following line
5# this may be useful if you are debugging zeroconf or starting it manually
6#DISABLE=yes
7
8# black-listed interfaces
9# Interfaces which you never wish to have zeroconf run on should
10# be listed here. e.g. "eth2 wlan1" in a space seperated string
11IFBLACKLIST=""
12
13# fallback only
14# If you would only like a link-local address if you were unable to
15# obtain an address via DHCP then uncomment the following line
16#FALLBACK=yes
17
diff --git a/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb b/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb
new file mode 100644
index 0000000000..9307263c7b
--- /dev/null
+++ b/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb
@@ -0,0 +1,34 @@
1SUMMARY = "IPv4 link-local address allocator"
2DESCRIPTION = "Zeroconf is a program that is used to claim IPv4 \
3link-local addresses. IPv4 link-local addresses are useful when setting \
4up ad-hoc networking between devices without the involvement of a either \
5a DHCP server or network administrator. \
6These addresses are allocated from the 169.254.0.0/16 address range and \
7are normally attached to each Ethernet device in your computer. \
8Addresses are assigned randomly by each host and, in case of collision, \
9both hosts (are supposed to) renumber."
10AUTHOR = "Anand Kumria <wildfire@progsoc.uts.edu.au>"
11HOMEPAGE = "http://www.progsoc.org/~wildfire/zeroconf/"
12LICENSE = "GPLv2+"
13LIC_FILES_CHKSUM = "file://COPYING;md5=4325afd396febcb659c36b49533135d4 \
14 file://zeroconf.c;beginline=1;endline=13;md5=a5bada96e1e34b08eb7446b28e2630b2"
15SECTION = "net"
16
17PR = "r1"
18
19SRC_URI = "http://www.progsoc.org/~wildfire/zeroconf/download/${BPN}-${PV}.tar.gz \
20 file://compilefix.patch \
21 file://zeroconf-default \
22 file://debian-zeroconf"
23
24SRC_URI[md5sum] = "bdafb16b008ebb5633e4e581f77821d2"
25SRC_URI[sha256sum] = "a8c74df127753e2310fa1e072f3c9ca44a404bb0bbce9cfec7a84c6dff8bec7b"
26
27do_install () {
28 install -d ${D}${sbindir}
29 install -d ${D}${sysconfdir}/network/if-up.d
30 install -d ${D}${sysconfdir}/default
31 install -c -m 755 ${S}/zeroconf ${D}${sbindir}/zeroconf
32 install -c -m 755 ${WORKDIR}/debian-zeroconf ${D}${sysconfdir}/network/if-up.d/zeroconf
33 install -c ${WORKDIR}/zeroconf-default ${D}${sysconfdir}/default/zeroconf
34}