summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-networking/recipes-protocols
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-protocols')
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/dante/dante_1.4.1.bb49
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch223
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freeDiameter.conf250
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.init72
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.service11
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/files/install_test.patch22
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch72
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/files/run-ptest11
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb138
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch42
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/mdns/files/build.patch167
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service15
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_765.50.9.bb90
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init66
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf422
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf18
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch45
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Remove-U64-typedef.patch2524
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch34
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_libs2-Error-Fix.patch31
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-configure-fix-check-for-enable-perl-cc-checks.patch31
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-get_pid_from_inode-Include-limit.h.patch29
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch26
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch33
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0002-configure-fix-a-cc-check-issue.patch30
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch186
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0004-configure-fix-incorrect-variable.patch30
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch131
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch25
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch42
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch35
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch75
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch32
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch34
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest4
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service13
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service13
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch1652
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb244
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/nopoll/nopoll_0.4.2.b297.bb23
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openflow/openflow.inc37
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch64
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch59
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_1.0.bb4
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_git.bb9
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch29
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch34
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api.c-include-rpc-clnt.h-for-resultproc_t.patch31
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-test-pppd_dummy.c-Fix-return-value.patch38
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch25
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch33
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch35
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch36
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-modify-CFLAGS-to-aviod-build-error.patch106
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-obey-LDFLAGS.patch15
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/fix_linux_4.15_compile.patch44
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tp-simplify-gcc-warning-hack.patch41
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch24
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch35
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch32
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch49
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service17
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest97
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb99
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/0001-include-missing-sys-types.h.patch28
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/options.pptp30
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.9.0.bb31
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service16
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service14
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service16
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service16
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default12
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init200
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam13
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service16
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service16
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga3
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default12
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init64
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service17
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc232
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb4
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/Modify-configure.in-and-etc-Makefile.am.patch84
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/config-site.radiusclient-ng-0.5.61
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng_0.5.6.bb36
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0001-ppoe-Dont-include-linux-if_ether.h.patch28
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0002-Enable-support-for-the-kernel-module.patch23
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.in-Error-fix.patch57
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.patch19
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure_in_cross.patch153
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/discard-use-of-dnl-in-Makefile.am.patch25
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/dont-swallow-errors.patch26
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.default22
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.init59
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.service11
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-src-restrictions.patch31
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/top-autoconf.patch41
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/update-config.patch41
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.12.bb77
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks/makefile-add-ldflags.patch19
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks_1.8beta5.bb28
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp/0001-Use-foreign-switch-for-automake.patch28
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp_git.bb24
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc41
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_1.3.6.bb7
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb8
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/0001-zeroconf-Rename-arp_op-to-avoid-namespace-conflicts-.patch69
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch19
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf51
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/makefile-add-ldflags.patch19
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default17
-rw-r--r--meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb37
112 files changed, 9824 insertions, 0 deletions
diff --git a/meta-openembedded/meta-networking/recipes-protocols/dante/dante_1.4.1.bb b/meta-openembedded/meta-networking/recipes-protocols/dante/dante_1.4.1.bb
new file mode 100644
index 000000000..ffdab22cf
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/dante/dante_1.4.1.bb
@@ -0,0 +1,49 @@
+SECTION = "console/utils"
+SUMMARY = "A free SOCKS server"
+DESCRIPTION = "Dante consists of a SOCKS server and a SOCKS client,\
+implementing RFC 1928 and related standards. It is a flexible product\
+that can be used to provide convenient and secure network\
+connectivity. Once installed, Dante can in most cases be made\
+transparent to clients, providing functionality somewhat similar to\
+what could be described as a non-transparent Layer 4 router."
+HOMEPAGE = "http://www.inet.no/dante/"
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=221118dda731fe93a85d0ed973467249"
+
+SRC_URI = "https://www.inet.no/dante/files/dante-${PV}.tar.gz \
+ "
+SRC_URI[md5sum] = "68c2ce12119e12cea11a90c7a80efa8f"
+SRC_URI[sha256sum] = "b6d232bd6fefc87d14bf97e447e4fcdeef4b28b16b048d804b50b48f261c4f53"
+
+# without --without-gssapi, config.log will contain reference to /usr/lib
+# as a consequence of GSSAPI path being set to /usr by default.
+# --with-gssapi-path=PATH specify gssapi path
+# --without-gssapi disable gssapi support
+# --enable-release build prerelease as full release
+EXTRA_OECONF += "--without-gssapi --sbindir=${bindir}"
+
+DEPENDS += "flex-native bison-native libpam"
+
+inherit autotools-brokensep distro_features_check
+
+REQUIRED_DISTRO_FEATURES = "pam"
+
+EXTRA_AUTORECONF = "-I ${S}"
+
+PACKAGECONFIG[libwrap] = ",--disable-libwrap,tcp-wrappers,libwrap"
+PACKAGECONFIG[krb5] = ",--without-krb5,krb5"
+
+PACKAGECONFIG ??= ""
+
+do_install_append() {
+ install -d ${D}${sysconfdir}
+ cp ${S}/example/sock[sd].conf ${D}${sysconfdir}
+}
+
+PACKAGES =+ "${PN}-sockd ${PN}-libdsocks "
+
+FILES_${PN}-libdsocks = "${libdir}/libdsocks.so"
+FILES_${PN}-sockd = "${bindir}/sockd ${sysconfdir}/sockd.conf"
+
+INSANE_SKIP_${PN}-libdsocks = "dev-elf"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch
new file mode 100644
index 000000000..71a5a1ae4
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch
@@ -0,0 +1,223 @@
+Replace murmurhash algorithm with Robert Jenkin's hash algorithm
+
+Upstream-Status: Pending
+
+From test result, murmurhash algorithm does not work in big endian
+processor, so replace it with Robert Jenkin's hash which has worked
+in linux kernel for many years and has more adaptability.
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+ libfdproto/ostr.c | 192 +++++++++++++++++++++--------------------------------
+ 1 file changed, 74 insertions(+), 118 deletions(-)
+
+diff --git a/libfdproto/ostr.c b/libfdproto/ostr.c
+index 8f29b48..ce1f4dd 100644
+--- a/libfdproto/ostr.c
++++ b/libfdproto/ostr.c
+@@ -430,128 +430,84 @@ after_proto:
+
+
+ /********************************************************************************************************/
+-/* Hash function -- credits to Austin Appleby, thank you ^^ */
+-/* See http://murmurhash.googlepages.com for more information on this function */
+-
+-/* the strings are NOT always aligned properly (ex: received in RADIUS message), so we use the aligned MurmurHash2 function as needed */
+-#define _HASH_MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
+-uint32_t fd_os_hash ( uint8_t * string, size_t len )
++/*
++ * Robert Jenkin's hash function.
++ * http://burtleburtle.net/bob/hash/evahash.html
++ * This is in the public domain.
++ */
++#define mix(a, b, c) \
++ do { \
++ a = a - b; a = a - c; a = a ^ (c >> 13); \
++ b = b - c; b = b - a; b = b ^ (a << 8); \
++ c = c - a; c = c - b; c = c ^ (b >> 13); \
++ a = a - b; a = a - c; a = a ^ (c >> 12); \
++ b = b - c; b = b - a; b = b ^ (a << 16); \
++ c = c - a; c = c - b; c = c ^ (b >> 5); \
++ a = a - b; a = a - c; a = a ^ (c >> 3); \
++ b = b - c; b = b - a; b = b ^ (a << 10); \
++ c = c - a; c = c - b; c = c ^ (b >> 15); \
++ } while (0)
++
++unsigned hash_rjenkins(const char *str, unsigned length)
+ {
+- uint32_t hash = len;
+- uint8_t * data = string;
+-
+- const unsigned int m = 0x5bd1e995;
+- const int r = 24;
+- int align = (long)string & 3;
+-
+- if (!align || (len < 4)) {
+- /* In case data is aligned, MurmurHash2 function */
+- while(len >= 4)
+- {
+- /* Mix 4 bytes at a time into the hash */
+- uint32_t k = *(uint32_t *)data; /* We don't care about the byte order */
+-
+- _HASH_MIX(hash, k, m);
+-
+- data += 4;
+- len -= 4;
+- }
+-
+- /* Handle the last few bytes of the input */
+- switch(len) {
+- case 3: hash ^= data[2] << 16;
+- case 2: hash ^= data[1] << 8;
+- case 1: hash ^= data[0];
+- hash *= m;
+- }
+-
+- } else {
+- /* Unaligned data, use alignment-safe slower version */
+-
+- /* Pre-load the temp registers */
+- uint32_t t = 0, d = 0;
+- switch(align)
+- {
+- case 1: t |= data[2] << 16;
+- case 2: t |= data[1] << 8;
+- case 3: t |= data[0];
+- }
+- t <<= (8 * align);
+-
+- data += 4-align;
+- len -= 4-align;
+-
+- /* From this point, "data" can be read by chunks of 4 bytes */
+-
+- int sl = 8 * (4-align);
+- int sr = 8 * align;
+-
+- /* Mix */
+- while(len >= 4)
+- {
+- uint32_t k;
+-
+- d = *(unsigned int *)data;
+- k = (t >> sr) | (d << sl);
+-
+- _HASH_MIX(hash, k, m);
+-
+- t = d;
+-
+- data += 4;
+- len -= 4;
+- }
+-
+- /* Handle leftover data in temp registers */
+- d = 0;
+- if(len >= align)
+- {
+- uint32_t k;
+-
+- switch(align)
+- {
+- case 3: d |= data[2] << 16;
+- case 2: d |= data[1] << 8;
+- case 1: d |= data[0];
+- }
+-
+- k = (t >> sr) | (d << sl);
+- _HASH_MIX(hash, k, m);
+-
+- data += align;
+- len -= align;
+-
+- /* Handle tail bytes */
+-
+- switch(len)
+- {
+- case 3: hash ^= data[2] << 16;
+- case 2: hash ^= data[1] << 8;
+- case 1: hash ^= data[0];
+- hash *= m;
+- };
+- }
+- else
+- {
+- switch(len)
+- {
+- case 3: d |= data[2] << 16;
+- case 2: d |= data[1] << 8;
+- case 1: d |= data[0];
+- case 0: hash ^= (t >> sr) | (d << sl);
+- hash *= m;
+- }
+- }
+-
++ const unsigned char *k = (const unsigned char *)str;
++ uint32_t a, b, c; /* the internal state */
++ uint32_t len; /* how many key bytes still need mixing */
++
++ /* Set up the internal state */
++ len = length;
++ a = 0x9e3779b9; /* the golden ratio; an arbitrary value */
++ b = a;
++ c = 0; /* variable initialization of internal state */
++
++ /* handle most of the key */
++ while (len >= 12) {
++ a = a + (k[0] + ((uint32_t)k[1] << 8) + ((uint32_t)k[2] << 16) +
++ ((uint32_t)k[3] << 24));
++ b = b + (k[4] + ((uint32_t)k[5] << 8) + ((uint32_t)k[6] << 16) +
++ ((uint32_t)k[7] << 24));
++ c = c + (k[8] + ((uint32_t)k[9] << 8) + ((uint32_t)k[10] << 16) +
++ ((uint32_t)k[11] << 24));
++ mix(a, b, c);
++ k = k + 12;
++ len = len - 12;
++ }
+
++ /* handle the last 11 bytes */
++ c = c + length;
++ switch (len) { /* all the case statements fall through */
++ case 11:
++ c = c + ((uint32_t)k[10] << 24);
++ case 10:
++ c = c + ((uint32_t)k[9] << 16);
++ case 9:
++ c = c + ((uint32_t)k[8] << 8);
++ /* the first byte of c is reserved for the length */
++ case 8:
++ b = b + ((uint32_t)k[7] << 24);
++ case 7:
++ b = b + ((uint32_t)k[6] << 16);
++ case 6:
++ b = b + ((uint32_t)k[5] << 8);
++ case 5:
++ b = b + k[4];
++ case 4:
++ a = a + ((uint32_t)k[3] << 24);
++ case 3:
++ a = a + ((uint32_t)k[2] << 16);
++ case 2:
++ a = a + ((uint32_t)k[1] << 8);
++ case 1:
++ a = a + k[0];
++ /* case 0: nothing left to add */
+ }
++ mix(a, b, c);
+
+- /* Do a few final mixes of the hash to ensure the last few
+- bytes are well-incorporated. */
+- hash ^= hash >> 13;
+- hash *= m;
+- hash ^= hash >> 15;
++ return c;
++}
+
+- return hash;
++uint32_t fd_os_hash ( uint8_t * string, size_t len )
++{
++ return hash_rjenkins(string, len);
+ }
+
+--
+1.7.10.4
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freeDiameter.conf b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freeDiameter.conf
new file mode 100644
index 000000000..7b56d748a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freeDiameter.conf
@@ -0,0 +1,250 @@
+# This is a sample configuration file for freeDiameter daemon.
+
+# Most of the options can be omitted, as they default to reasonable values.
+# Only TLS-related options must be configured properly in usual setups.
+
+# It is possible to use "include" keyword to import additional files
+# e.g.: include "/etc/freeDiameter.d/*.conf"
+# This is exactly equivalent as copy & paste the content of the included file(s)
+# where the "include" keyword is found.
+
+
+##############################################################
+## Peer identity and realm
+
+# The Diameter Identity of this daemon.
+# This must be a valid FQDN that resolves to the local host.
+# Default: hostname's FQDN
+#Identity = "aaa.koganei.freediameter.net";
+
+# The Diameter Realm of this daemon.
+# Default: the domain part of Identity (after the first dot).
+#Realm = "koganei.freediameter.net";
+
+##############################################################
+## Transport protocol configuration
+
+# The port this peer is listening on for incoming connections (TCP and SCTP).
+# Default: 3868. Use 0 to disable.
+#Port = 3868;
+
+# The port this peer is listening on for incoming TLS-protected connections (TCP and SCTP).
+# See TLS_old_method for more information about TLS flavours.
+# Note: we use TLS/SCTP instead of DTLS/SCTP at the moment. This will change in future version of freeDiameter.
+# Default: 5868. Use 0 to disable.
+#SecPort = 5868;
+
+# Use RFC3588 method for TLS protection, where TLS is negociated after CER/CEA exchange is completed
+# on the unsecure connection. The alternative is RFC6733 mechanism, where TLS protects also the
+# CER/CEA exchange on a dedicated secure port.
+# This parameter only affects outgoing connections.
+# The setting can be also defined per-peer (see Peers configuration section).
+# Default: use RFC6733 method with separate port for TLS.
+#TLS_old_method;
+
+# Disable use of TCP protocol (only listen and connect over SCTP)
+# Default : TCP enabled
+#No_TCP;
+
+# Disable use of SCTP protocol (only listen and connect over TCP)
+# Default : SCTP enabled
+#No_SCTP;
+# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option.
+
+# Prefer TCP instead of SCTP for establishing new connections.
+# This setting may be overwritten per peer in peer configuration blocs.
+# Default : SCTP is attempted first.
+#Prefer_TCP;
+
+# Default number of streams per SCTP associations.
+# This setting may be overwritten per peer basis.
+# Default : 30 streams
+#SCTP_streams = 30;
+
+##############################################################
+## Endpoint configuration
+
+# Disable use of IP addresses (only IPv6)
+# Default : IP enabled
+#No_IP;
+
+# Disable use of IPv6 addresses (only IP)
+# Default : IPv6 enabled
+#No_IPv6;
+
+# Specify local addresses the server must bind to
+# Default : listen on all addresses available.
+#ListenOn = "202.249.37.5";
+#ListenOn = "2001:200:903:2::202:1";
+#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
+
+
+##############################################################
+## Server configuration
+
+# How many Diameter peers are allowed to be connecting at the same time ?
+# This parameter limits the number of incoming connections from the time
+# the connection is accepted until the first CER is received.
+# Default: 5 unidentified clients in paralel.
+#ThreadsPerServer = 5;
+
+##############################################################
+## TLS Configuration
+
+# TLS is managed by the GNUTLS library in the freeDiameter daemon.
+# You may find more information about parameters and special behaviors
+# in the relevant documentation.
+# http://www.gnu.org/software/gnutls/manual/
+
+# Credentials of the local peer
+# The X509 certificate and private key file to use for the local peer.
+# The files must contain PKCS-1 encoded RSA key, in PEM format.
+# (These parameters are passed to gnutls_certificate_set_x509_key_file function)
+# Default : NO DEFAULT
+#TLS_Cred = "<x509 certif file.PEM>" , "<x509 private key file.PEM>";
+#TLS_Cred = "/etc/ssl/certs/freeDiameter.pem", "/etc/ssl/private/freeDiameter.key";
+
+# Certificate authority / trust anchors
+# The file containing the list of trusted Certificate Authorities (PEM list)
+# (This parameter is passed to gnutls_certificate_set_x509_trust_file function)
+# The directive can appear several times to specify several files.
+# Default : GNUTLS default behavior
+#TLS_CA = "<file.PEM>";
+
+# Certificate Revocation List file
+# The information about revoked certificates.
+# The file contains a list of trusted CRLs in PEM format. They should have been verified before.
+# (This parameter is passed to gnutls_certificate_set_x509_crl_file function)
+# Note: openssl CRL format might have interoperability issue with GNUTLS format.
+# Default : GNUTLS default behavior
+#TLS_CRL = "<file.PEM>";
+
+# GNU TLS Priority string
+# This string allows to configure the behavior of GNUTLS key exchanges
+# algorithms. See gnutls_priority_init function documentation for information.
+# You should also refer to the Diameter required TLS support here:
+# http://tools.ietf.org/html/rfc6733#section-13.1
+# Default : "NORMAL"
+# Example: TLS_Prio = "NONE:+VERS-TLS1.1:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL";
+#TLS_Prio = "NORMAL";
+
+# Diffie-Hellman parameters size
+# Set the number of bits for generated DH parameters
+# Valid value should be 768, 1024, 2048, 3072 or 4096.
+# (This parameter is passed to gnutls_dh_params_generate2 function,
+# it usually should match RSA key size)
+# Default : 1024
+#TLS_DH_Bits = 1024;
+
+# Alternatively, you can specify a file to load the PKCS#3 encoded
+# DH parameters directly from. This accelerates the daemon start
+# but is slightly less secure. If this file is provided, the
+# TLS_DH_Bits parameters has no effect.
+# Default : no default.
+#TLS_DH_File = "<file.PEM>";
+
+
+##############################################################
+## Timers configuration
+
+# The Tc timer of this peer.
+# It is the delay before a new attempt is made to reconnect a disconnected peer.
+# The value is expressed in seconds. The recommended value is 30 seconds.
+# Default: 30
+#TcTimer = 30;
+
+# The Tw timer of this peer.
+# It is the delay before a watchdog message is sent, as described in RFC 3539.
+# The value is expressed in seconds. The default value is 30 seconds. Value must
+# be greater or equal to 6 seconds. See details in the RFC.
+# Default: 30
+#TwTimer = 30;
+
+##############################################################
+## Applications configuration
+
+# Disable the relaying of Diameter messages?
+# For messages not handled locally, the default behavior is to forward the
+# message to another peer if any is available, according to the routing
+# algorithms. In addition the "0xffffff" application is advertised in CER/CEA
+# exchanges.
+# Default: Relaying is enabled.
+#NoRelay;
+
+# Number of server threads that can handle incoming messages at the same time.
+# Default: 4
+#AppServThreads = 4;
+
+# Other applications are configured by loaded extensions.
+
+##############################################################
+## Extensions configuration
+
+# The freeDiameter framework merely provides support for
+# Diameter Base Protocol. The specific application behaviors,
+# as well as advanced functions, are provided
+# by loadable extensions (plug-ins).
+# These extensions may in addition receive the name of a
+# configuration file, the format of which is extension-specific.
+#
+# Format:
+#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
+#
+# Examples:
+#LoadExtension = "extensions/sample.fdx";
+#LoadExtension = "extensions/sample.fdx":"conf/sample.conf";
+
+# Extensions are named as follow:
+# dict_* for extensions that add content to the dictionary definitions.
+# dbg_* for extensions useful only to retrieve more information on the framework execution.
+# acl_* : Access control list, to control which peers are allowed to connect.
+# rt_* : routing extensions that impact how messages are forwarded to other peers.
+# app_* : applications, these extensions usually register callbacks to handle specific messages.
+# test_* : dummy extensions that are useful only in testing environments.
+
+
+# The dbg_msg_dump.fdx extension allows you to tweak the way freeDiameter displays some
+# information about some events. This extension does not actually use a configuration file
+# but receives directly a parameter in the string passed to the extension. Here are some examples:
+## LoadExtension = "dbg_msg_dumps.fdx" : "0x1111"; # Removes all default hooks, very quiet even in case of errors.
+## LoadExtension = "dbg_msg_dumps.fdx" : "0x2222"; # Display all events with few details.
+## LoadExtension = "dbg_msg_dumps.fdx" : "0x0080"; # Dump complete information about sent and received messages.
+# The four digits respectively control: connections, routing decisions, sent/received messages, errors.
+# The values for each digit are:
+# 0 - default - keep the default behavior
+# 1 - quiet - remove any specific log
+# 2 - compact - display only a summary of the information
+# 4 - full - display the complete information on a single long line
+# 8 - tree - display the complete information in an easier to read format spanning several lines.
+
+
+##############################################################
+## Peers configuration
+
+# The local server listens for incoming connections. By default,
+# all unknown connecting peers are rejected. Extensions can override this behavior (e.g., acl_wl).
+#
+# In addition to incoming connections, the local peer can
+# be configured to establish and maintain connections to some
+# Diameter nodes and allow connections from these nodes.
+# This is achieved with the ConnectPeer directive described below.
+#
+# Note that the configured Diameter Identity MUST match
+# the information received inside CEA, or the connection will be aborted.
+#
+# Format:
+#ConnectPeer = "diameterid" [ { parameter1; parameter2; ...} ] ;
+# Parameters that can be specified in the peer's parameter list:
+# No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method;
+# No_TLS; # assume transparent security instead of TLS. DTLS is not supported yet (will change in future versions).
+# Port = 5868; # The port to connect to
+# TcTimer = 30;
+# TwTimer = 30;
+# ConnectTo = "202.249.37.5";
+# ConnectTo = "2001:200:903:2::202:1";
+# TLS_Prio = "NORMAL";
+# Realm = "realm.net"; # Reject the peer if it does not advertise this realm.
+# Examples:
+#ConnectPeer = "aaa.wide.ad.jp";
+#ConnectPeer = "old.diameter.serv" { TcTimer = 60; TLS_old_method; No_SCTP; Port=3868; } ;
+##############################################################
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.init b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.init
new file mode 100755
index 000000000..e63a42a7c
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.init
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: freediameter
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Short-Description: Start freeDiameter daemon at boot time
+# Description: Start the freeDiameter daemon at boot time.
+# freeDiameter is an extensible implementation of the Diameter protocol,
+# designed for Authentication, Authorization and Accounting. Diameter is
+# an evolution of the RADIUS protocol.
+### END INIT INFO#
+DAEMON=/usr/bin/freeDiameterd
+CONF=/etc/freeDiameter/freeDiameter.conf
+NAME=freediameter
+DESC="freeDiameter daemon"
+
+. /etc/init.d/functions
+start() {
+ [ -x $DAEMON ] || exit 5
+ echo -n $"Starting $DAEMON: "
+ start-stop-daemon -S -b -x ${DAEMON} && success || failure
+ retval=$?
+ echo ""
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ start-stop-daemon -K -x $DAEMON
+ retval=$?
+ echo ""
+ return $retval
+}
+
+restart() {
+ stop
+ sleep 3
+ start
+}
+
+rh_status() {
+ status $DAEMON
+}
+
+rh_status_q() {
+ rh_status > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ start
+ ;;
+ stop)
+ rh_status_q || exit 0
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ status)
+ rh_status
+ ;;
+ *)
+ echo $"Usage: $prog {start|stop|status|restart}"
+ exit 2
+esac
+
+exit $?
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.service b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.service
new file mode 100644
index 000000000..514481b43
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/freediameter.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=freediameter daemon
+After=network.target
+
+[Service]
+Type=simple
+PIDFile=/var/run/freediameter.pid
+ExecStart=@BINDIR@/freeDiameterd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/install_test.patch b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/install_test.patch
new file mode 100644
index 000000000..151037d69
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/install_test.patch
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <yao.zhao@windriver.com>
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index da8da1b..de04059 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -113,4 +113,9 @@ ENDFOREACH( TEST )
+ ####
+ ## INSTALL section ##
+
+-# we do not install the tests
++# install the tests
++SET(INSTALL_TEST_SUFFIX /opt/${FD_PROJECT_NAME}-tests CACHE PATH "Directory where the test binary is installed.")
++
++INSTALL(TARGETS ${TEST_LIST}
++ RUNTIME DESTINATION ${INSTALL_TEST_SUFFIX}
++ COMPONENT freeDiameter-common)
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch
new file mode 100644
index 000000000..ea857af7d
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch
@@ -0,0 +1,72 @@
+freediameter ptest cases testmesg_stress.c and testloadext.c need load
+extensions both build time and runtime. Then they search extensions with
+build directory that causes runtime failures.
+
+Pass an environment variable to define runtime extension path.
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-1.2.0/tests/testloadext.c
+--- freeDiameter-1.2.0.orig/tests/testloadext.c 2014-02-19 17:33:24.785405032 +0800
++++ freeDiameter-1.2.0/tests/testloadext.c 2014-02-19 20:08:03.871403924 +0800
+@@ -49,7 +49,7 @@
+ {
+ DIR *dir;
+ struct dirent *dp;
+- char fullname[512];
++ char fullname[1024];
+ int pathlen;
+
+ /* First, initialize the daemon modules */
+@@ -57,11 +57,16 @@
+ CHECK( 0, fd_queues_init() );
+ CHECK( 0, fd_msg_init() );
+ CHECK( 0, fd_rtdisp_init() );
+-
++
++ char *ext_dir = getenv("EXTENSIONS_DIR");
++ if (ext_dir)
++ pathlen = snprintf(fullname, sizeof(fullname), "%s", ext_dir);
++ else
++ pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
++
+ /* Find all extensions which have been compiled along the test */
+- TRACE_DEBUG(INFO, "Loading from: '%s'", BUILD_DIR "/extensions");
+- CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
+- pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
++ TRACE_DEBUG(INFO, "Loading from: '%s'", fullname);
++ CHECK( 0, (dir = opendir (fullname)) == NULL ? 1 : 0 );
+
+ while ((dp = readdir (dir)) != NULL) {
+ char * dot = strrchr(dp->d_name, '.');
+diff -Nur freeDiameter-1.2.0.orig/tests/testmesg_stress.c freeDiameter-1.2.0/tests/testmesg_stress.c
+--- freeDiameter-1.2.0.orig/tests/testmesg_stress.c 2014-02-19 17:33:24.785405032 +0800
++++ freeDiameter-1.2.0/tests/testmesg_stress.c 2014-02-19 20:08:03.928403924 +0800
+@@ -67,15 +67,20 @@
+ {
+ DIR *dir;
+ struct dirent *dp;
+- char fullname[512];
++ char fullname[1024];
+ int pathlen;
+ struct fd_list all_extensions = FD_LIST_INITIALIZER(all_extensions);
+ struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends);
+
++ char *ext_dir = getenv("EXTENSIONS_DIR");
++ if (ext_dir)
++ pathlen = snprintf(fullname, sizeof(fullname), "%s", ext_dir);
++ else
++ pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
++
+ /* Find all extensions which have been compiled along the test */
+- LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?: "");
+- CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
+- pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
++ TRACE_DEBUG(INFO, "Loading from: '%s'", fullname);
++ CHECK( 0, (dir = opendir (fullname)) == NULL ? 1 : 0 );
+
+ while ((dp = readdir (dir)) != NULL) {
+ char * dot = strrchr(dp->d_name, '.');
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/run-ptest b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/run-ptest
new file mode 100644
index 000000000..d0ca8d962
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/files/run-ptest
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if ! lsmod | grep -q sctp && ! modprobe sctp 2>/dev/null; then
+ echo "Couldn't load kernel module sctp."
+ echo "Test cases testsctp and testcnx will fail."
+ echo
+fi
+
+export EXTENSIONS_DIR=$EXTENSIONS_DIR
+cmake -E cmake_echo_color --cyan "Running tests..."
+ctest --force-new-ctest-process
diff --git a/meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb b/meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb
new file mode 100644
index 000000000..c556eb48e
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb
@@ -0,0 +1,138 @@
+SUMMARY = "An open source implementation of the diameter protocol"
+DESCRIPTION = "\
+freeDiameter is an open source Diameter protocol implementation \
+(RFC3588). It provides an extensible platform for deploying a \
+Diameter network for your Authentication, Authorization and \
+Accounting needs."
+
+HOMEPAGE = "http://www.freediameter.net"
+
+DEPENDS = "flex bison cmake-native libgcrypt gnutls libidn lksctp-tools virtual/kernel"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+fd_pkgname = "freeDiameter"
+
+SRC_URI = "\
+ http://www.freediameter.net/hg/${fd_pkgname}/archive/${PV}.tar.gz;downloadfilename=${fd_pkgname}-${PV}.tar.gz \
+ file://Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch \
+ file://freediameter.service \
+ file://freediameter.init \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://install_test.patch file://run-ptest file://pass-ptest-env.patch', '', d)} \
+ file://freeDiameter.conf \
+ "
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] = "bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"
+
+S = "${WORKDIR}/${fd_pkgname}-${PV}"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35"
+
+PTEST_PATH = "${libdir}/${fd_pkgname}/ptest"
+
+inherit cmake pkgconfig update-rc.d ptest systemd
+
+EXTRA_OECMAKE = " \
+ -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${fd_pkgname} \
+ -DBUILD_DBG_MONITOR:BOOL=ON \
+ -DBUILD_TEST_APP:BOOL=ON \
+ -DBUILD_TESTING:BOOL=ON \
+ -DBUILD_APP_RADGW:BOOL=ON \
+ -DBUILD_APP_REDIRECT:BOOL=ON \
+ -DBUILD_TEST_ACCT:BOOL=ON \
+ -DBUILD_TEST_NETEMUL:BOOL=ON \
+ -DBUILD_TEST_RT_ANY:BOOL=ON \
+ -DINSTALL_LIBRARY_SUFFIX:PATH=${baselib} \
+ -DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${fd_pkgname} \
+ -DINSTALL_TEST_SUFFIX:PATH=${PTEST_PATH}-tests \
+ -DCMAKE_SKIP_RPATH:BOOL=ON \
+"
+# INSTALL_LIBRARY_SUFFIX is relative to CMAKE_INSTALL_PREFIX
+# specify it on cmd line will fix the SET bug in CMakeList.txt
+
+# -DBUILD_APP_ACCT:BOOL=ON This needs POSTGRESQL support
+
+# -DBUILD_APP_DIAMEAP:BOOL=ON -DBUILD_APP_SIP:BOOL=ON -DBUILD_TEST_SIP:BOOL=ON
+# These need MySQL support
+
+# -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support
+
+# -DALL_EXTENSIONS=ON will enable all
+
+FD_KEY ?="${BPN}.key"
+FD_PEM ?= "${BPN}.pem"
+FD_CA ?= "${BPN}.pem"
+FD_DH_PEM ?= "${BPN}-dh.pem"
+FD_HOSTNAME ?= "${MACHINE}"
+FD_REALM ?= "openembedded.org"
+
+do_install_append() {
+ # install the sample configuration files
+ install -d -m 0755 ${D}${sysconfdir}/${fd_pkgname}
+ for i in ${S}/doc/*.conf.sample; do
+ install -m 0644 $i ${D}${sysconfdir}/${fd_pkgname}/
+ done
+ mv ${D}${sysconfdir}/${fd_pkgname}/freediameter.conf.sample \
+ ${D}${sysconfdir}/${fd_pkgname}/freeDiameter.conf.sample
+ install -d ${D}${sysconfdir}/freeDiameter
+ install ${WORKDIR}/freeDiameter.conf ${D}${sysconfdir}/${fd_pkgname}/freeDiameter.conf
+
+ # install daemon init related files
+ install -d -m 0755 ${D}${sysconfdir}/default
+ install -d -m 0755 ${D}${sysconfdir}/init.d
+ install -m 0644 ${S}/contrib/debian/freediameter-daemon.default \
+ ${D}${sysconfdir}/default/${BPN}
+ install -m 0755 ${WORKDIR}/freediameter.init ${D}${sysconfdir}/init.d/${BPN}
+
+ # install for systemd
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/freediameter.service ${D}${systemd_system_unitdir}
+ sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/*.service
+
+ cat >> ${D}${sysconfdir}/freeDiameter/freeDiameter.conf <<EOF
+## OE specific ##
+#Identity="${FD_HOSTNAME}";
+Identity = "${FD_HOSTNAME}.${FD_REALM}";
+Realm = "${FD_REALM}";
+Port = 30868;
+SecPort = 30869;
+TLS_Cred = "/etc/freeDiameter/${FD_PEM}" , "/etc/freeDiameter/${FD_KEY}";
+TLS_CA = "/etc/freeDiameter/${FD_CA}";
+TLS_DH_File = "/etc/freeDiameter/${FD_DH_PEM}";
+EOF
+
+ # create self cert
+ openssl req -x509 -config ${STAGING_DIR_NATIVE}/etc/ssl/openssl.cnf -newkey rsa:4096 -sha256 -nodes -out ${D}${sysconfdir}/freeDiameter/${FD_PEM} -keyout ${D}${sysconfdir}/freeDiameter/${FD_KEY} -days 3650 -subj '/CN=${FD_HOSTNAME}.${FD_REALM}'
+ openssl dhparam -out ${D}${sysconfdir}/freeDiameter/${FD_DH_PEM} 1024
+
+}
+
+do_install_ptest() {
+ sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${fd_pkgname}/#" ${D}${PTEST_PATH}/run-ptest
+ mv ${D}${PTEST_PATH}-tests/* ${D}${PTEST_PATH}/
+ rmdir ${D}${PTEST_PATH}-tests
+ install -m 0644 ${B}/tests/CTestTestfile.cmake ${D}${PTEST_PATH}/
+}
+
+FILES_${PN}-dbg += "${libdir}/${fd_pkgname}/.debug/*"
+
+# include the extensions in main package
+FILES_${PN} += "${libdir}/${fd_pkgname}/*"
+
+RDEPENDS_${PN} = "glib-2.0 gnutls libidn"
+RDEPENDS_${PN} += "openssl openssl-conf openssl-engines"
+RRECOMMENDS_${PN} += "kernel-module-tipc kernel-module-sctp"
+RRECOMMENDS_${PN} += "kernel-module-udp-tunnel kernel-module-ipip"
+RDEPENDS_${PN}-ptest = "cmake"
+
+INITSCRIPT_PACKAGES = "${PN}"
+INITSCRIPT_NAME_${PN} = "${BPN}"
+INITSCRIPT_PARAMS$_${PN} = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "freediameter.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
+CONFFILES_${PN} = "${sysconfdir}/freediameter.conf"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch
new file mode 100644
index 000000000..863866d18
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch
@@ -0,0 +1,42 @@
+From d3082d2c606c810aa0a39378bf1e02575af3a301 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 2 Feb 2018 21:54:11 -0800
+Subject: [PATCH] nss_mdns: Do not include nss.h when libc != glibc
+
+Provide nss_status macro instead for non-glibc case
+where nss.h is absent
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ mDNSPosix/nss_mdns.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/mDNSPosix/nss_mdns.c b/mDNSPosix/nss_mdns.c
+index afadb3c..c469584 100755
+--- a/mDNSPosix/nss_mdns.c
++++ b/mDNSPosix/nss_mdns.c
+@@ -378,8 +378,19 @@ init_config ();
+
+ #define ENTNAME hostent
+ #define DATABASE "hosts"
+-
++#ifdef __GLIBC__
+ #include <nss.h>
++#else
++enum nss_status
++{
++ NSS_STATUS_TRYAGAIN = -2,
++ NSS_STATUS_UNAVAIL,
++ NSS_STATUS_NOTFOUND,
++ NSS_STATUS_SUCCESS,
++ NSS_STATUS_RETURN
++};
++#define NETDB_INTERNAL NULL
++#endif
+ // For nss_status
+ #include <netdb.h>
+ // For hostent
+--
+2.16.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/build.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/build.patch
new file mode 100644
index 000000000..4ab9d23bf
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/build.patch
@@ -0,0 +1,167 @@
+From 43b6e98c9c37afd0d914949dcff4eab81f5a995f Mon Sep 17 00:00:00 2001
+From: Brendan Le Foll <brendan.le.foll@intel.com>
+Date: Tue, 3 Mar 2015 11:42:57 +0000
+
+Upstream-Status: Inappropriate [OE-specific]
+
+Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
+
+---
+ mDNSPosix/Makefile | 54 +++++++++++++++++++++++++-----------------------------
+ 1 file changed, 25 insertions(+), 29 deletions(-)
+
+diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile
+index 4f98e90..8ac97ad 100755
+--- a/mDNSPosix/Makefile
++++ b/mDNSPosix/Makefile
+@@ -50,6 +50,7 @@
+
+ LIBVERS = 1
+
++POSIXDIR = ../mDNSPosix
+ COREDIR = ../mDNSCore
+ SHAREDDIR ?= ../mDNSShared
+ JDK = /usr/jdk
+@@ -58,11 +59,11 @@ CC = @cc
+ BISON = @bison
+ FLEX = @flex
+ ST = @strip
+-LD = ld -shared
++LD =@LD
+ CP = cp
+ RM = rm
+ LN = ln -s -f
+-CFLAGS_COMMON = -I$(COREDIR) -I$(SHAREDDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\"
++CFLAGS_COMMON = -I$(POSIXDIR) -I$(COREDIR) -I$(SHAREDDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\"
+ CFLAGS_PTHREAD =
+ LINKOPTS =
+ LINKOPTS_PTHREAD = -lpthread
+@@ -70,7 +71,7 @@ LDSUFFIX = so
+ JAVACFLAGS_OS = -fPIC -shared -ldns_sd
+
+ # Set up diverging paths for debug vs. prod builds
+-DEBUG=0
++DEBUG?=1
+ ifeq ($(DEBUG),1)
+ CFLAGS_DEBUG = -g -DMDNS_DEBUGMSGS=2
+ OBJDIR = objects/debug
+@@ -213,7 +214,7 @@ endif
+ endif
+ endif
+
+-CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG)
++CFLAGS_BUILD = $(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG)
+
+ #############################################################################
+
+@@ -249,8 +250,7 @@ Daemon: setup $(BUILDDIR)/mdnsd
+ @echo "Responder daemon done"
+
+ $(BUILDDIR)/mdnsd: $(DAEMONOBJS)
+- $(CC) -o $@ $+ $(LINKOPTS)
+- @$(STRIP) $@
++ $(CC) -o $@ $+
+
+ # libdns_sd target builds the client library
+ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX)
+@@ -259,22 +259,18 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX)
+ CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o
+
+ $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS)
+- @$(LD) $(LINKOPTS) -o $@ $+
+- @$(STRIP) $@
++ $(LD) -shared $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+
+
+-Clients: setup libdns_sd ../Clients/build/dns-sd
++Clients: setup libdns_sd
++ @$(MAKE) -C ../Clients DEBUG=${DEBUG}
+ @echo "Clients done"
+
+-../Clients/build/dns-sd:
+- @$(MAKE) -C ../Clients
+-
+ # nss_mdns target builds the Name Service Switch module
+ nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE)
+ @echo "Name Service Switch module done"
+
+ $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o
+- @$(LD) $(LINKOPTS) -o $@ $+
+- @$(STRIP) $@
++ $(LD) -shared $(LINKOPTS) -o $@ $+
+
+ #############################################################################
+
+@@ -470,55 +466,55 @@ dnsextd: setup $(BUILDDIR)/dnsextd
+ @echo "dnsextd done"
+
+ $(BUILDDIR)/mDNSClientPosix: $(APPOBJ) $(OBJDIR)/Client.c.o
+- $(CC) $+ -o $@ $(LINKOPTS)
++ $(CC) $+ -o $@
+
+ $(BUILDDIR)/mDNSResponderPosix: $(COMMONOBJ) $(OBJDIR)/Responder.c.o
+- $(CC) $+ -o $@ $(LINKOPTS)
++ $(CC) $+ -o $@
+
+ $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ) $(OBJDIR)/ProxyResponder.c.o
+- $(CC) $+ -o $@ $(LINKOPTS)
++ $(CC) $+ -o $@
+
+ $(BUILDDIR)/mDNSIdentify: $(SPECIALOBJ) $(OBJDIR)/Identify.c.o
+- $(CC) $+ -o $@ $(LINKOPTS)
++ $(CC) $+ -o $@
+
+ $(OBJDIR)/Identify.c.o: $(COREDIR)/mDNS.c # Note: Identify.c textually imports mDNS.c
+
+ $(BUILDDIR)/mDNSNetMonitor: $(SPECIALOBJ) $(OBJDIR)/NetMonitor.c.o
+- $(CC) $+ -o $@ $(LINKOPTS)
++ $(CC) $+ -o $@
+
+ $(OBJDIR)/NetMonitor.c.o: $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c
+
+ $(BUILDDIR)/dnsextd: $(DNSEXTDOBJ) $(OBJDIR)/dnsextd.c.threadsafe.o
+- $(CC) $+ -o $@ $(LINKOPTS) $(LINKOPTS_PTHREAD)
++ $(CC) $+ -o $@ $(LINKOPTS_PTHREAD)
+
+ #############################################################################
+
+ # Implicit rules
+ $(OBJDIR)/%.c.o: %.c
+- $(CC) $(CFLAGS) -c -o $@ $<
++ $(CC) $(CFLAGS_BUILD) -c -o $@ $<
+
+ $(OBJDIR)/%.c.o: $(COREDIR)/%.c
+- $(CC) $(CFLAGS) -c -o $@ $<
++ $(CC) $(CFLAGS_BUILD) -c -o $@ $<
+
+ $(OBJDIR)/%.c.o: $(SHAREDDIR)/%.c
+- $(CC) $(CFLAGS) -c -o $@ $<
++ $(CC) $(CFLAGS_BUILD) -c -o $@ $<
+
+ $(OBJDIR)/%.c.threadsafe.o: %.c
+- $(CC) $(CFLAGS) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $<
++ $(CC) $(CFLAGS_BUILD) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $<
+
+ $(OBJDIR)/%.c.threadsafe.o: $(SHAREDDIR)/%.c
+- $(CC) $(CFLAGS) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $<
++ $(CC) $(CFLAGS_BUILD) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $<
+
+ $(OBJDIR)/%.c.so.o: %.c
+- $(CC) $(CFLAGS) -c -fPIC -o $@ $<
++ $(CC) $(CFLAGS_BUILD) -c -fPIC -o $@ $<
+
+ $(OBJDIR)/%.c.so.o: $(SHAREDDIR)/%.c
+- $(CC) $(CFLAGS) -c -fPIC -o $@ $<
++ $(CC) $(CFLAGS_BUILD) -c -fPIC -o $@ $<
+
+ $(OBJDIR)/%.y.o: $(SHAREDDIR)/%.y
+ $(BISON) -o $(OBJDIR)/$*.c -d $<
+- $(CC) $(CFLAGS) -c -o $@ $(OBJDIR)/$*.c
++ $(CC) $(CFLAGS_BUILD) -c -o $@ $(OBJDIR)/$*.c
+
+ $(OBJDIR)/%.l.o: $(SHAREDDIR)/%.l
+ $(FLEX) $(FLEXFLAGS_OS) -i -o$(OBJDIR)/$*.l.c $<
+- $(CC) $(CFLAGS) -Wno-error -c -o $@ $(OBJDIR)/$*.l.c
++ $(CC) $(CFLAGS_BUILD) -Wno-error -c -o $@ $(OBJDIR)/$*.l.c
+--
+2.9.5
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service
new file mode 100644
index 000000000..531d142dc
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Zero-configuration networking
+After=network.target
+
+[Service]
+Type=forking
+ExecStartPre=/bin/rm -f /var/run/mdnsd.pid
+ExecStart=/usr/sbin/mdnsd
+ExecReload=/bin/kill -HUP $MAINPID
+PIDFile=/var/run/mdnsd.pid
+Restart=always
+RestartSec=10s
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_765.50.9.bb b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_765.50.9.bb
new file mode 100644
index 000000000..9a7152fcf
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_765.50.9.bb
@@ -0,0 +1,90 @@
+SUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol"
+DESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks."
+HOMEPAGE = "http://developer.apple.com/networking/bonjour/"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://../LICENSE;md5=31c50371921e0fb731003bbc665f29bf"
+
+RPROVIDES_${PN} += "libdns_sd.so"
+
+SRC_URI = "http://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-${PV}.tar.gz \
+ file://build.patch;patchdir=.. \
+ file://mdns.service \
+ file://0001-nss_mdns-Do-not-include-nss.h-when-libc-glibc.patch;patchdir=.. \
+ "
+
+SRC_URI[md5sum] = "4a6bc1628851002634ea3833a4dca317"
+SRC_URI[sha256sum] = "de61dd0034357aa50c60806726fb1f70fa8e953ff9cb62eccfb73efad10dba0a"
+
+PARALLEL_MAKE = ""
+
+S = "${WORKDIR}/mDNSResponder-${PV}/mDNSPosix"
+
+EXTRA_OEMAKE += "os=linux DEBUG=0 'CC=${CC}' 'LD=${CCLD} ${LDFLAGS}'"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+do_install () {
+ install -d ${D}${sbindir}
+ install -m 0755 build/prod/mdnsd ${D}${sbindir}
+
+ install -d ${D}${libdir}
+ cp build/prod/libdns_sd.so ${D}${libdir}/libdns_sd.so.1
+ chmod 0644 ${D}${libdir}/libdns_sd.so.1
+ ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so
+
+ install -d ${D}${includedir}
+ install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir}
+
+ install -d ${D}${mandir}/man8
+ install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8
+
+ install -d ${D}${bindir}
+ install -m 0755 ../Clients/build/dns-sd ${D}${bindir}
+
+ install -d ${D}${libdir}
+ oe_libinstall -C build/prod -so libnss_mdns-0.2 ${D}${libdir}
+ ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2
+
+ install -d ${D}${sysconfdir}
+ install -m 0644 nss_mdns.conf ${D}${sysconfdir}
+
+ install -d ${D}${mandir}/man5
+ install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5
+
+ install -d ${D}${mandir}/man8
+ install -m 0644 libnss_mdns.8 ${D}${mandir}/man8
+
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_unitdir}/system/
+}
+
+pkg_postinst_${PN} () {
+ sed -e '/^hosts:/s/\s*\<mdns\>//' \
+ -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns\3\4\5/' \
+ -i $D/etc/nsswitch.conf
+}
+
+pkg_prerm_${PN} () {
+ sed -e '/^hosts:/s/\s*\<mdns\>//' \
+ -e '/^hosts:/s/\s*mdns//' \
+ -i $D/etc/nsswitch.conf
+}
+
+inherit systemd
+
+SYSTEMD_SERVICE_${PN} = "mdns.service"
+
+FILES_${PN} += "${systemd_unitdir}/system/mdns.service"
+FILES_${PN} += "${libdir}/libdns_sd.so.1 \
+ ${bindir}/dns-sd \
+ ${libdir}/libnss_mdns-0.2.so \
+ ${sysconfdir}/nss_mdns.conf"
+
+FILES_${PN}-dev += "${libdir}/libdns_sd.so \
+ ${includedir}/dns_sd.h "
+
+FILES_${PN}-man += "${mandir}/man8/mdnsd.8 \
+ ${mandir}/man5/nss_mdns.conf.5 \
+ ${mandir}/man8/libnss_mdns.8"
+
+PACKAGES = "${PN} ${PN}-dev ${PN}-man ${PN}-dbg"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init
new file mode 100755
index 000000000..47995466f
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init
@@ -0,0 +1,66 @@
+#! /bin/sh
+# /etc/init.d/snmpd: start snmp daemon.
+
+. /etc/init.d/functions
+
+# Defaults
+export MIBDIRS=/usr/share/snmp/mibs
+SNMPDRUN=yes
+SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
+TRAPDRUN=no
+TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
+PIDFILE=/var/run/snmpd.pid
+SPIDFILE=/var/run/snmptrapd.pid
+
+# Reads config file if exists (will override defaults above)
+[ -r /etc/default/snmpd ] && . /etc/default/snmpd
+
+[ "$SNMPDRUN" = "yes" ] && { test -x /usr/sbin/snmpd || exit 0; }
+[ "$TRAPDRUN" = "yes" ] && { test -x /usr/sbin/snmptrapd || exit 0; }
+
+case "$1" in
+ start)
+ echo -n "Starting network management services:"
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf -a ! -f "$PIDFILE" ]; then
+ start-stop-daemon -o --start --quiet --name snmpd --pidfile "$PIDFILE" \
+ --exec /usr/sbin/snmpd -- $SNMPDOPTS
+ echo -n " snmpd"
+ fi
+ if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf -a ! -f "$SPIDFILE" ]; then
+ start-stop-daemon -o --start --quiet --name snmptrapd --pidfile "$SPIDFILE" \
+ --exec /usr/sbin/snmptrapd -- $TRAPDOPTS
+ echo -n " snmptrapd"
+ fi
+ echo "."
+
+ test ! -x /sbin/restorecon || /sbin/restorecon -FR /var/lib/net-snmp
+ ;;
+ stop)
+ echo -n "Stopping network management services:"
+ if [ -f "$PIDFILE" ] ; then
+ start-stop-daemon -o --stop --quiet --pidfile $PIDFILE --name snmpd
+ fi
+ echo -n " snmpd"
+ if [ -f "$SPIDFILE" ] ; then
+ start-stop-daemon -o --stop --quiet --pidfile $SPIDFILE --name snmptrapd
+ rm -rf $SPIDFILE
+ fi
+ echo -n " snmptrapd"
+ echo "."
+ ;;
+ status)
+ status /usr/sbin/snmpd;
+ exit $?
+ ;;
+ restart|reload|force-reload)
+ $0 stop
+ # Allow the daemons time to exit completely.
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/snmpd {start|stop|status|restart|reload|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf
new file mode 100644
index 000000000..728171c42
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmpd.conf
@@ -0,0 +1,422 @@
+###############################################################################
+#
+# EXAMPLE.conf:
+# An example configuration file for configuring the ucd-snmp snmpd agent.
+#
+###############################################################################
+#
+# This file is intended to only be an example. If, however, you want
+# to use it, it should be placed in /etc/snmp/snmpd.conf.
+# When the snmpd agent starts up, this is where it will look for it.
+#
+# You might be interested in generating your own snmpd.conf file using
+# the "snmpconf" program (perl script) instead. It's a nice menu
+# based interface to writing well commented configuration files. Try it!
+#
+# Note: This file is automatically generated from EXAMPLE.conf.def.
+# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run
+# configure & make, and then make sure you read the EXAMPLE.conf file
+# instead, as it will tailor itself to your configuration.
+
+# All lines beginning with a '#' are comments and are intended for you
+# to read. All other lines are configuration commands for the agent.
+
+#
+# PLEASE: read the snmpd.conf(5) manual page as well!
+#
+
+
+###############################################################################
+# Access Control
+###############################################################################
+
+# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
+# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
+# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
+
+# By far, the most common question I get about the agent is "why won't
+# it work?", when really it should be "how do I configure the agent to
+# allow me to access it?"
+#
+# By default, the agent responds to the "public" community for read
+# only access, if run out of the box without any configuration file in
+# place. The following examples show you other ways of configuring
+# the agent so that you can change the community names, and give
+# yourself write access as well.
+#
+# The following lines change the access permissions of the agent so
+# that the COMMUNITY string provides read-only access to your entire
+# NETWORK (EG: 10.10.10.0/24), and read/write access to only the
+# localhost (127.0.0.1, not its real ipaddress).
+#
+# For more information, read the FAQ as well as the snmpd.conf(5)
+# manual page.
+
+####
+# First, map the community name (COMMUNITY) into a security name
+# (local and mynetwork, depending on where the request is coming
+# from):
+
+# sec.name source community
+com2sec paranoid default public
+#com2sec readonly default public
+#com2sec readwrite default private
+
+####
+# Second, map the security names into group names:
+
+# sec.model sec.name
+group MyROSystem v1 paranoid
+group MyROSystem v2c paranoid
+group MyROSystem usm paranoid
+group MyROGroup v1 readonly
+group MyROGroup v2c readonly
+group MyROGroup usm readonly
+group MyRWGroup v1 readwrite
+group MyRWGroup v2c readwrite
+group MyRWGroup usm readwrite
+
+####
+# Third, create a view for us to let the groups have rights to:
+
+# incl/excl subtree mask
+view all included .1 80
+view system included .iso.org.dod.internet.mgmt.mib-2.system
+
+####
+# Finally, grant the 2 groups access to the 1 view with different
+# write permissions:
+
+# context sec.model sec.level match read write notif
+access MyROSystem "" any noauth exact system none none
+access MyROGroup "" any noauth exact all none none
+access MyRWGroup "" any noauth exact all all none
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# System contact information
+#
+
+# It is also possible to set the sysContact and sysLocation system
+# variables through the snmpd.conf file. **PLEASE NOTE** that setting
+# the value of these objects here makes these objects READ-ONLY
+# (regardless of any access control settings). Any attempt to set the
+# value of an object whose value is given here will fail with an error
+# status of notWritable.
+
+syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
+syscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)
+
+# Example output of snmpwalk:
+# % snmpwalk -v 1 -c public localhost system
+# system.sysDescr.0 = "SunOS name sun4c"
+# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
+# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
+# system.sysContact.0 = "Me <me@somewhere.org>"
+# system.sysName.0 = "name"
+# system.sysLocation.0 = "Right here, right now."
+# system.sysServices.0 = 72
+
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Process checks.
+#
+# The following are examples of how to use the agent to check for
+# processes running on the host. The syntax looks something like:
+#
+# proc NAME [MAX=0] [MIN=0]
+#
+# NAME: the name of the process to check for. It must match
+# exactly (ie, http will not find httpd processes).
+# MAX: the maximum number allowed to be running. Defaults to 0.
+# MIN: the minimum number to be running. Defaults to 0.
+
+#
+# Examples:
+#
+
+# Make sure mountd is running
+#proc mountd
+
+# Make sure there are no more than 4 ntalkds running, but 0 is ok too.
+#proc ntalkd 4
+
+# Make sure at least one sendmail, but less than or equal to 10 are running.
+#proc sendmail 10 1
+
+# A snmpwalk of the prTable would look something like this:
+#
+# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.2
+# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1
+# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2
+# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3
+# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd"
+# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd"
+# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail"
+# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1
+# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4
+# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10
+# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1
+# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1
+# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running."
+# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = ""
+# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = ""
+# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0
+#
+# Note that the errorFlag for mountd is set to 1 because one is not
+# running (in this case an rpc.mountd is, but thats not good enough),
+# and the ErrMessage tells you what's wrong. The configuration
+# imposed in the snmpd.conf file is also shown.
+#
+# Special Case: When the min and max numbers are both 0, it assumes
+# you want a max of infinity and a min of 1.
+#
+
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Executables/scripts
+#
+
+#
+# You can also have programs run by the agent that return a single
+# line of output and an exit code. Here are two examples.
+#
+# exec NAME PROGRAM [ARGS ...]
+#
+# NAME: A generic name.
+# PROGRAM: The program to run. Include the path!
+# ARGS: optional arguments to be passed to the program
+
+# a simple hello world
+#exec echotest /bin/echo hello world
+
+# Run a shell script containing:
+#
+# #!/bin/sh
+# echo hello world
+# echo hi there
+# exit 35
+#
+# Note: this has been specifically commented out to prevent
+# accidental security holes due to someone else on your system writing
+# a /tmp/shtest before you do. Uncomment to use it.
+#
+#exec shelltest /bin/sh /tmp/shtest
+
+# Then,
+# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8
+# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
+# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
+# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
+# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest"
+# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world"
+# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest"
+# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
+# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35
+# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world."
+# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world."
+# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0
+# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0
+
+# Note that the second line of the /tmp/shtest shell script is cut
+# off. Also note that the exit status of 35 was returned.
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# disk checks
+#
+
+# The agent can check the amount of available disk space, and make
+# sure it is above a set limit.
+
+# disk PATH [MIN=DEFDISKMINIMUMSPACE]
+#
+# PATH: mount path to the disk in question.
+# MIN: Disks with space below this value will have the Mib's errorFlag set.
+# Default value = DEFDISKMINIMUMSPACE.
+
+# Check the / partition and make sure it contains at least 10 megs.
+
+#disk / 10000
+
+# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9
+# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
+# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F
+# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0"
+# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000
+# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130
+# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325
+# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092
+# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58
+# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0
+# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = ""
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# load average checks
+#
+
+# load [1MAX=DEFMAXLOADAVE] [5MAX=DEFMAXLOADAVE] [15MAX=DEFMAXLOADAVE]
+#
+# 1MAX: If the 1 minute load average is above this limit at query
+# time, the errorFlag will be set.
+# 5MAX: Similar, but for 5 min average.
+# 15MAX: Similar, but for 15 min average.
+
+# Check for loads:
+#load 12 14 14
+
+# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.10
+# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1
+# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2
+# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3
+# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1"
+# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5"
+# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15"
+# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39
+# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31
+# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36
+# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00"
+# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00"
+# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00"
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = ""
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = ""
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = ""
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Extensible sections.
+#
+
+# This alleviates the multiple line output problem found in the
+# previous executable mib by placing each mib in its own mib table:
+
+# Run a shell script containing:
+#
+# #!/bin/sh
+# echo hello world
+# echo hi there
+# exit 35
+#
+# Note: this has been specifically commented out to prevent
+# accidental security holes due to someone else on your system writing
+# a /tmp/shtest before you do. Uncomment to use it.
+#
+# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest
+
+# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50
+# enterprises.ucdavis.50.1.1 = 1
+# enterprises.ucdavis.50.2.1 = "shelltest"
+# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
+# enterprises.ucdavis.50.100.1 = 35
+# enterprises.ucdavis.50.101.1 = "hello world."
+# enterprises.ucdavis.50.101.2 = "hi there."
+# enterprises.ucdavis.50.102.1 = 0
+
+# Now the Output has grown to two lines, and we can see the 'hi
+# there.' output as the second line from our shell script.
+#
+# Note that you must alter the mib.txt file to be correct if you want
+# the .50.* outputs above to change to reasonable text descriptions.
+
+# Other ideas:
+#
+# exec .1.3.6.1.4.1.2021.51 ps /bin/ps
+# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top
+# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Pass through control.
+#
+
+# Usage:
+# pass MIBOID EXEC-COMMAND
+#
+# This will pass total control of the mib underneath the MIBOID
+# portion of the mib to the EXEC-COMMAND.
+#
+# Note: You'll have to change the path of the passtest script to your
+# source directory or install it in the given location.
+#
+# Example: (see the script for details)
+# (commented out here since it requires that you place the
+# script in the right location. (its not installed by default))
+
+# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/passtest
+
+# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
+# enterprises.ucdavis.255.1 = "life the universe and everything"
+# enterprises.ucdavis.255.2.1 = 42
+# enterprises.ucdavis.255.2.2 = OID: 42.42.42
+# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42
+# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1
+# enterprises.ucdavis.255.5 = 42
+# enterprises.ucdavis.255.6 = Gauge: 42
+#
+# % snmpget -v 1 -c public localhost .1.3.6.1.4.1.2021.255.5
+# enterprises.ucdavis.255.5 = 42
+#
+# % snmpset -v 1 -c public localhost .1.3.6.1.4.1.2021.255.1 s "New string"
+# enterprises.ucdavis.255.1 = "New string"
+#
+
+# For specific usage information, see the man/snmpd.conf.5 manual page
+# as well as the local/passtest script used in the above example.
+
+###############################################################################
+# Subagent control
+#
+
+# The agent can support subagents using a number of extension mechanisms.
+# From the 4.2.1 release, AgentX support is being compiled in by default.
+# However, this is still experimental code, so should not be used on
+# critical production systems.
+# Please see the file README.agentx for more details.
+#
+# If having read, marked, learnt and inwardly digested this information,
+# you decide that you do wish to make use of this mechanism, simply
+# uncomment the following directive.
+#
+# master agentx
+#
+# I repeat - this is *NOT* regarded as suitable for front-line production
+# systems, though it is probably stable enough for day-to-day use.
+# Probably.
+#
+# No refunds will be given.
+
+###############################################################################
+# Further Information
+#
+# See the snmpd.conf manual page, and the output of "snmpd -H".
+# MUCH more can be done with the snmpd.conf than is shown as an
+# example here.
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf
new file mode 100644
index 000000000..8d2e4375e
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/snmptrapd.conf
@@ -0,0 +1,18 @@
+###############################################################################
+#
+# EXAMPLE.conf:
+# An example configuration file for configuring the ucd-snmp snmptrapd agent.
+#
+###############################################################################
+#
+# This file is intended to only be an example. If, however, you want
+# to use it, it should be placed in /etc/snmp/snmptrapd.conf.
+# When the snmptrapd agent starts up, this is where it will look for it.
+#
+# All lines beginning with a '#' are comments and are intended for you
+# to read. All other lines are configuration commands for the agent.
+
+#
+# PLEASE: read the snmptrapd.conf(5) manual page as well!
+#
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch
new file mode 100644
index 000000000..b14b76128
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch
@@ -0,0 +1,45 @@
+From a92628a163ebf1ea62220684736300461c003875 Mon Sep 17 00:00:00 2001
+From: Niels Baggesen <nba@users.sourceforge.net>
+Date: Mon, 26 Jan 2015 20:26:06 +0100
+Subject: [PATCH] BUG#a2584: Fix snmptrap to use clientaddr from snmp.conf.
+ Thanks to rizwan
+
+Upstream-Status: backport
+
+Signed-off-by: Li Zhou <li.zhou@windriver.com>
+---
+ snmplib/transports/snmpUDPIPv6Domain.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+Index: net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/transports/snmpUDPIPv6Domain.c
++++ net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
+@@ -286,6 +286,27 @@ netsnmp_udp6_transport(struct sockaddr_i
+ return NULL;
+ #endif /* NETSNMP_NO_LISTEN_SUPPORT */
+ } else {
++ char *client_socket = NULL;
++ /*
++ * This is a client session. If we've been given a
++ * client address to send from, then bind to that.
++ * Otherwise the send will use "something sensible".
++ */
++
++ client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
++ NETSNMP_DS_LIB_CLIENT_ADDR);
++ if (client_socket) {
++ struct sockaddr_in6 client_addr;
++ netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL);
++ rc = bind(t->sock, (struct sockaddr *)&client_addr,
++ sizeof(struct sockaddr_in6));
++ if ( rc != 0 ) {
++ DEBUGMSGTL(("netsnmp_udp6", "failed to bind for clientaddr: %d %s\n",
++ errno, strerror(errno)));
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ }
++ }
+ /*
+ * This is a client session. Save the address in the
+ * transport-specific data pointer for later use by netsnmp_udp6_send.
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Remove-U64-typedef.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Remove-U64-typedef.patch
new file mode 100644
index 000000000..7314ab16a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Remove-U64-typedef.patch
@@ -0,0 +1,2524 @@
+net-snmp: remove U64 typedef
+
+From git://git.code.sf.net/p/net-snmp/code
+
+Upstream-Status: Backport (unmodified)
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+From 477b4307ef12ddce3b6a9205e0bdddbfb2e0e9b6 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Sat, 20 Feb 2016 18:58:18 -0800
+Subject: [PATCH 1/1] Remove U64 typedef
+
+The U64 typedef conflicts with a typedef in a Perl header file. Hence
+remove the U64 typedef from the Net-SNMP header files. This patch does
+not modify the Net-SNMP ABI.
+---
+ agent/mibgroup/if-mib/ifXTable/ifXTable.c | 16 +-
+ agent/mibgroup/if-mib/ifXTable/ifXTable.h | 48 +-
+ .../mibgroup/if-mib/ifXTable/ifXTable_interface.c | 32 +-
+ .../ip-mib/data_access/systemstats_common.c | 2 +-
+ .../ipIfStatsTable/ipIfStatsTable_data_get.c | 28 +-
+ .../ipIfStatsTable/ipIfStatsTable_data_get.h | 28 +-
+ .../ipIfStatsTable/ipIfStatsTable_interface.c | 56 +-
+ .../ip-mib/ipSystemStatsTable/ipSystemStatsTable.c | 28 +-
+ .../ip-mib/ipSystemStatsTable/ipSystemStatsTable.h | 921 ++-------------------
+ .../ipSystemStatsTable_interface.c | 56 +-
+ include/net-snmp/data_access/ipstats.h | 42 +-
+ include/net-snmp/library/int64.h | 34 +-
+ snmplib/int64.c | 38 +-
+ snmplib/read_config.c | 6 +-
+ testing/fulltests/unit-tests/T015int64_clib.c | 10 +-
+ 15 files changed, 274 insertions(+), 1071 deletions(-)
+
+Index: net-snmp-5.7.3/agent/mibgroup/if-mib/ifXTable/ifXTable.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/if-mib/ifXTable/ifXTable.c
++++ net-snmp-5.7.3/agent/mibgroup/if-mib/ifXTable/ifXTable.c
+@@ -722,7 +722,7 @@ The total number of octets received on t
+ */
+ int
+ ifHCInOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCInOctets_val_ptr)
++ struct counter64 *ifHCInOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInOctets_val_ptr);
+@@ -779,7 +779,7 @@ The number of packets, delivered by this
+ */
+ int
+ ifHCInUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCInUcastPkts_val_ptr)
++ struct counter64 *ifHCInUcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInUcastPkts_val_ptr);
+@@ -838,7 +838,7 @@ The number of packets, delivered by this
+ */
+ int
+ ifHCInMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCInMulticastPkts_val_ptr)
++ struct counter64 *ifHCInMulticastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInMulticastPkts_val_ptr);
+@@ -897,7 +897,7 @@ The number of packets, delivered by this
+ */
+ int
+ ifHCInBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCInBroadcastPkts_val_ptr)
++ struct counter64 *ifHCInBroadcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInBroadcastPkts_val_ptr);
+@@ -955,7 +955,7 @@ The total number of octets transmitted o
+ */
+ int
+ ifHCOutOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCOutOctets_val_ptr)
++ struct counter64 *ifHCOutOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutOctets_val_ptr);
+@@ -1013,7 +1013,7 @@ The total number of packets that higher-
+ */
+ int
+ ifHCOutUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCOutUcastPkts_val_ptr)
++ struct counter64 *ifHCOutUcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutUcastPkts_val_ptr);
+@@ -1074,7 +1074,7 @@ The total number of packets that higher-
+ */
+ int
+ ifHCOutMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCOutMulticastPkts_val_ptr)
++ struct counter64 *ifHCOutMulticastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutMulticastPkts_val_ptr);
+@@ -1134,7 +1134,7 @@ The total number of packets that higher-
+ */
+ int
+ ifHCOutBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCOutBroadcastPkts_val_ptr)
++ struct counter64 *ifHCOutBroadcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutBroadcastPkts_val_ptr);
+Index: net-snmp-5.7.3/agent/mibgroup/if-mib/ifXTable/ifXTable.h
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/if-mib/ifXTable/ifXTable.h
++++ net-snmp-5.7.3/agent/mibgroup/if-mib/ifXTable/ifXTable.h
+@@ -143,28 +143,28 @@ config_require(if-mib/ifXTable/ifXTable_
+ u_long *
+ ifOutBroadcastPkts_val_ptr);
+ int ifHCInOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCInOctets_val_ptr);
++ struct counter64 *ifHCInOctets_val_ptr);
+ int ifHCInUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCInUcastPkts_val_ptr);
++ struct counter64 *ifHCInUcastPkts_val_ptr);
+ int ifHCInMulticastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ifHCInMulticastPkts_val_ptr);
+ int ifHCInBroadcastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ifHCInBroadcastPkts_val_ptr);
+ int ifHCOutOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCOutOctets_val_ptr);
++ struct counter64 *ifHCOutOctets_val_ptr);
+ int ifHCOutUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 * ifHCOutUcastPkts_val_ptr);
++ struct counter64 *ifHCOutUcastPkts_val_ptr);
+ int ifHCOutMulticastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ifHCOutMulticastPkts_val_ptr);
+ int ifHCOutBroadcastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ifHCOutBroadcastPkts_val_ptr);
+ int ifLinkUpDownTrapEnable_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -284,86 +284,86 @@ config_require(if-mib/ifXTable/ifXTable_
+
+ int ifHCInOctets_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCInOctets_val);
++ struct counter64 ifHCInOctets_val);
+ int ifHCInOctets_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInOctets_set(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 ifHCInOctets_val);
++ struct counter64 ifHCInOctets_val);
+ int ifHCInOctets_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifHCInUcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCInUcastPkts_val);
++ struct counter64 ifHCInUcastPkts_val);
+ int ifHCInUcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInUcastPkts_set(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 ifHCInUcastPkts_val);
++ struct counter64 ifHCInUcastPkts_val);
+ int ifHCInUcastPkts_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifHCInMulticastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64
++ struct counter64
+ ifHCInMulticastPkts_val);
+ int ifHCInMulticastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInMulticastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCInMulticastPkts_val);
++ struct counter64 ifHCInMulticastPkts_val);
+ int ifHCInMulticastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCInBroadcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64
++ struct counter64
+ ifHCInBroadcastPkts_val);
+ int ifHCInBroadcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInBroadcastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCInBroadcastPkts_val);
++ struct counter64 ifHCInBroadcastPkts_val);
+ int ifHCInBroadcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCOutOctets_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCOutOctets_val);
++ struct counter64 ifHCOutOctets_val);
+ int ifHCOutOctets_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutOctets_set(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 ifHCOutOctets_val);
++ struct counter64 ifHCOutOctets_val);
+ int ifHCOutOctets_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifHCOutUcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCOutUcastPkts_val);
++ struct counter64 ifHCOutUcastPkts_val);
+ int ifHCOutUcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutUcastPkts_set(ifXTable_rowreq_ctx * rowreq_ctx,
+- U64 ifHCOutUcastPkts_val);
++ struct counter64 ifHCOutUcastPkts_val);
+ int ifHCOutUcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCOutMulticastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64
++ struct counter64
+ ifHCOutMulticastPkts_val);
+ int ifHCOutMulticastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutMulticastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCOutMulticastPkts_val);
++ struct counter64 ifHCOutMulticastPkts_val);
+ int ifHCOutMulticastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCOutBroadcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64
++ struct counter64
+ ifHCOutBroadcastPkts_val);
+ int ifHCOutBroadcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutBroadcastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 ifHCOutBroadcastPkts_val);
++ struct counter64 ifHCOutBroadcastPkts_val);
+ int ifHCOutBroadcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+Index: net-snmp-5.7.3/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
++++ net-snmp-5.7.3/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
+@@ -729,72 +729,72 @@ _ifXTable_get_column(ifXTable_rowreq_ctx
+ * ifHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCInOctets_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCInOctets_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCInUcastPkts(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINUCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCInUcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCInUcastPkts_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCInMulticastPkts(8)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINMULTICASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCInMulticastPkts_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCInMulticastPkts_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCInBroadcastPkts(9)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINBROADCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCInBroadcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCInBroadcastPkts_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutOctets(10)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCOutOctets_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCOutOctets_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutUcastPkts(11)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTUCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCOutUcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCOutUcastPkts_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutMulticastPkts(12)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTMULTICASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCOutMulticastPkts_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCOutMulticastPkts_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutBroadcastPkts(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTBROADCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ifHCOutBroadcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ifHCOutBroadcastPkts_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/data_access/systemstats_common.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/data_access/systemstats_common.c
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/data_access/systemstats_common.c
+@@ -264,7 +264,7 @@ _calculate_entries(netsnmp_systemstats_e
+ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES]
+ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTDISCARDS]) {
+
+- U64 tmp, tmp2, tmp3;
++ struct counter64 tmp, tmp2, tmp3;
+ tmp = entry->stats.HCOutRequests;
+ u64Incr(&tmp, &entry->stats.HCOutForwDatagrams);
+ u64Incr(&tmp, &entry->stats.HCOutFragCreates);
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c
+@@ -270,7 +270,7 @@ The total number of input IP datagrams r
+ */
+ int
+ ipIfStatsHCInReceives_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInReceives_val_ptr)
++ struct counter64 *ipIfStatsHCInReceives_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInReceives_val_ptr);
+@@ -395,7 +395,7 @@ The total number of octets received in i
+ */
+ int
+ ipIfStatsHCInOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInOctets_val_ptr)
++ struct counter64 *ipIfStatsHCInOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInOctets_val_ptr);
+@@ -862,7 +862,7 @@ The number of input datagrams for which
+ */
+ int
+ ipIfStatsHCInForwDatagrams_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInForwDatagrams_val_ptr)
++ struct counter64 *ipIfStatsHCInForwDatagrams_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInForwDatagrams_val_ptr);
+@@ -1267,7 +1267,7 @@ The total number of datagrams successful
+ */
+ int
+ ipIfStatsHCInDelivers_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInDelivers_val_ptr)
++ struct counter64 *ipIfStatsHCInDelivers_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInDelivers_val_ptr);
+@@ -1396,7 +1396,7 @@ The total number of IP datagrams that lo
+ */
+ int
+ ipIfStatsHCOutRequests_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutRequests_val_ptr)
++ struct counter64 *ipIfStatsHCOutRequests_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutRequests_val_ptr);
+@@ -1532,7 +1532,7 @@ The number of datagrams for which this e
+ */
+ int
+ ipIfStatsHCOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutForwDatagrams_val_ptr)
++ struct counter64 *ipIfStatsHCOutForwDatagrams_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutForwDatagrams_val_ptr);
+@@ -1999,7 +1999,7 @@ The total number of IP datagrams that th
+ */
+ int
+ ipIfStatsHCOutTransmits_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutTransmits_val_ptr)
++ struct counter64 *ipIfStatsHCOutTransmits_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutTransmits_val_ptr);
+@@ -2123,7 +2123,7 @@ The total number of octets in IP datagra
+ */
+ int
+ ipIfStatsHCOutOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutOctets_val_ptr)
++ struct counter64 *ipIfStatsHCOutOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutOctets_val_ptr);
+@@ -2245,7 +2245,7 @@ The number of IP multicast datagrams rec
+ */
+ int
+ ipIfStatsHCInMcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInMcastPkts_val_ptr)
++ struct counter64 *ipIfStatsHCInMcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInMcastPkts_val_ptr);
+@@ -2372,7 +2372,7 @@ The total number of octets received in I
+ */
+ int
+ ipIfStatsHCInMcastOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInMcastOctets_val_ptr)
++ struct counter64 *ipIfStatsHCInMcastOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInMcastOctets_val_ptr);
+@@ -2497,7 +2497,7 @@ The number of IP multicast datagrams tra
+ */
+ int
+ ipIfStatsHCOutMcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutMcastPkts_val_ptr)
++ struct counter64 *ipIfStatsHCOutMcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutMcastPkts_val_ptr);
+@@ -2621,7 +2621,7 @@ The total number of octets transmitted i
+ */
+ int
+ ipIfStatsHCOutMcastOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutMcastOctets_val_ptr)
++ struct counter64 *ipIfStatsHCOutMcastOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutMcastOctets_val_ptr);
+@@ -2743,7 +2743,7 @@ The number of IP broadcast datagrams rec
+ */
+ int
+ ipIfStatsHCInBcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCInBcastPkts_val_ptr)
++ struct counter64 *ipIfStatsHCInBcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCInBcastPkts_val_ptr);
+@@ -2865,7 +2865,7 @@ The number of IP broadcast datagrams tra
+ */
+ int
+ ipIfStatsHCOutBcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipIfStatsHCOutBcastPkts_val_ptr)
++ struct counter64 *ipIfStatsHCOutBcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipIfStatsHCOutBcastPkts_val_ptr);
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h
+@@ -50,7 +50,7 @@ extern "C" {
+ ipIfStatsInReceives_val_ptr);
+ int ipIfStatsHCInReceives_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInReceives_val_ptr);
+ int ipIfStatsInOctets_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -58,7 +58,7 @@ extern "C" {
+ ipIfStatsInOctets_val_ptr);
+ int ipIfStatsHCInOctets_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInOctets_val_ptr);
+ int ipIfStatsInHdrErrors_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -87,7 +87,7 @@ extern "C" {
+ int
+ ipIfStatsHCInForwDatagrams_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInForwDatagrams_val_ptr);
+ int ipIfStatsReasmReqds_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -111,7 +111,7 @@ extern "C" {
+ ipIfStatsInDelivers_val_ptr);
+ int ipIfStatsHCInDelivers_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInDelivers_val_ptr);
+ int ipIfStatsOutRequests_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -119,7 +119,7 @@ extern "C" {
+ ipIfStatsOutRequests_val_ptr);
+ int ipIfStatsHCOutRequests_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutRequests_val_ptr);
+ int ipIfStatsOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx
+ * rowreq_ctx,
+@@ -128,7 +128,7 @@ extern "C" {
+ int
+ ipIfStatsHCOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutForwDatagrams_val_ptr);
+ int ipIfStatsOutDiscards_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -156,7 +156,7 @@ extern "C" {
+ ipIfStatsOutTransmits_val_ptr);
+ int ipIfStatsHCOutTransmits_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutTransmits_val_ptr);
+ int ipIfStatsOutOctets_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -164,7 +164,7 @@ extern "C" {
+ ipIfStatsOutOctets_val_ptr);
+ int ipIfStatsHCOutOctets_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutOctets_val_ptr);
+ int ipIfStatsInMcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -172,7 +172,7 @@ extern "C" {
+ ipIfStatsInMcastPkts_val_ptr);
+ int ipIfStatsHCInMcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInMcastPkts_val_ptr);
+ int ipIfStatsInMcastOctets_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -180,7 +180,7 @@ extern "C" {
+ ipIfStatsInMcastOctets_val_ptr);
+ int ipIfStatsHCInMcastOctets_get(ipIfStatsTable_rowreq_ctx
+ * rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInMcastOctets_val_ptr);
+ int ipIfStatsOutMcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -188,7 +188,7 @@ extern "C" {
+ ipIfStatsOutMcastPkts_val_ptr);
+ int ipIfStatsHCOutMcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutMcastPkts_val_ptr);
+ int ipIfStatsOutMcastOctets_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -196,7 +196,7 @@ extern "C" {
+ ipIfStatsOutMcastOctets_val_ptr);
+ int ipIfStatsHCOutMcastOctets_get(ipIfStatsTable_rowreq_ctx
+ * rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutMcastOctets_val_ptr);
+ int ipIfStatsInBcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -204,7 +204,7 @@ extern "C" {
+ ipIfStatsInBcastPkts_val_ptr);
+ int ipIfStatsHCInBcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCInBcastPkts_val_ptr);
+ int ipIfStatsOutBcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+@@ -212,7 +212,7 @@ extern "C" {
+ ipIfStatsOutBcastPkts_val_ptr);
+ int ipIfStatsHCOutBcastPkts_get(ipIfStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipIfStatsHCOutBcastPkts_val_ptr);
+ int
+ ipIfStatsDiscontinuityTime_get(ipIfStatsTable_rowreq_ctx *
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c
+@@ -722,10 +722,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInReceives(4)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINRECEIVES:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCInReceives_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -741,9 +741,9 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ipIfStatsHCInOctets_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ipIfStatsHCInOctets_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -810,10 +810,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInForwDatagrams(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINFORWDATAGRAMS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCInForwDatagrams_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -869,10 +869,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInDelivers(19)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINDELIVERS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCInDelivers_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -889,10 +889,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutRequests(21)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTREQUESTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCOutRequests_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -909,10 +909,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutForwDatagrams(24)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTFORWDATAGRAMS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCOutForwDatagrams_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -979,10 +979,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutTransmits(31)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTTRANSMITS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCOutTransmits_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -999,9 +999,9 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutOctets(33)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+- rc = ipIfStatsHCOutOctets_get(rowreq_ctx, (U64 *) var->val.string);
++ rc = ipIfStatsHCOutOctets_get(rowreq_ctx, (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1018,10 +1018,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInMcastPkts(35)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINMCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCInMcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1038,10 +1038,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInMcastOctets(37)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINMCASTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCInMcastOctets_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1058,10 +1058,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutMcastPkts(39)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTMCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCOutMcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1078,10 +1078,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutMcastOctets(41)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTMCASTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCOutMcastOctets_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1098,10 +1098,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCInBcastPkts(43)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCINBCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCInBcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1118,10 +1118,10 @@ _ipIfStatsTable_get_column(ipIfStatsTabl
+ * ipIfStatsHCOutBcastPkts(45)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPIFSTATSHCOUTBCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipIfStatsHCOutBcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c
+@@ -452,7 +452,7 @@ The total number of input IP datagrams r
+ */
+ int
+ ipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCInReceives_val_ptr)
++ struct counter64 *ipSystemStatsHCInReceives_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInReceives_val_ptr);
+@@ -579,7 +579,7 @@ The total number of octets received in i
+ */
+ int
+ ipSystemStatsHCInOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCInOctets_val_ptr)
++ struct counter64 *ipSystemStatsHCInOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInOctets_val_ptr);
+@@ -1058,7 +1058,7 @@ The number of input datagrams for which
+ int
+ ipSystemStatsHCInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInForwDatagrams_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+@@ -1474,7 +1474,7 @@ The total number of datagrams successful
+ */
+ int
+ ipSystemStatsHCInDelivers_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCInDelivers_val_ptr)
++ struct counter64 *ipSystemStatsHCInDelivers_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInDelivers_val_ptr);
+@@ -1602,7 +1602,7 @@ The total number of IP datagrams which l
+ */
+ int
+ ipSystemStatsHCOutRequests_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCOutRequests_val_ptr)
++ struct counter64 *ipSystemStatsHCOutRequests_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutRequests_val_ptr);
+@@ -1809,7 +1809,7 @@ The number of datagrams for which this e
+ int
+ ipSystemStatsHCOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutForwDatagrams_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+@@ -2288,7 +2288,7 @@ The total number of IP datagrams that th
+ */
+ int
+ ipSystemStatsHCOutTransmits_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCOutTransmits_val_ptr)
++ struct counter64 *ipSystemStatsHCOutTransmits_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutTransmits_val_ptr);
+@@ -2415,7 +2415,7 @@ The total number of octets in IP datagra
+ */
+ int
+ ipSystemStatsHCOutOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCOutOctets_val_ptr)
++ struct counter64 *ipSystemStatsHCOutOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutOctets_val_ptr);
+@@ -2539,7 +2539,7 @@ The number of IP multicast datagrams rec
+ */
+ int
+ ipSystemStatsHCInMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCInMcastPkts_val_ptr)
++ struct counter64 *ipSystemStatsHCInMcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInMcastPkts_val_ptr);
+@@ -2665,7 +2665,7 @@ The total number of octets received in I
+ int
+ ipSystemStatsHCInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInMcastOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+@@ -2790,7 +2790,7 @@ The number of IP multicast datagrams tra
+ */
+ int
+ ipSystemStatsHCOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCOutMcastPkts_val_ptr)
++ struct counter64 *ipSystemStatsHCOutMcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutMcastPkts_val_ptr);
+@@ -2921,7 +2921,7 @@ The total number of octets transmitted i
+ int
+ ipSystemStatsHCOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutMcastOctets_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+@@ -3046,7 +3046,7 @@ The number of IP broadcast datagrams rec
+ */
+ int
+ ipSystemStatsHCInBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCInBcastPkts_val_ptr)
++ struct counter64 *ipSystemStatsHCInBcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInBcastPkts_val_ptr);
+@@ -3170,7 +3170,7 @@ The number of IP broadcast datagrams tra
+ */
+ int
+ ipSystemStatsHCOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+- U64 * ipSystemStatsHCOutBcastPkts_val_ptr)
++ struct counter64 *ipSystemStatsHCOutBcastPkts_val_ptr)
+ {
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutBcastPkts_val_ptr);
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h
+@@ -144,93 +144,22 @@ config_require(ip-mib/ipSystemStatsTable
+ *********************************************************************
+ * function prototypes
+ */
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsTable_pre_request(ipSystemStatsTable_registration *
++ int ipSystemStatsTable_pre_request(ipSystemStatsTable_registration *
+ user_context);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsTable_post_request(ipSystemStatsTable_registration *
++ int ipSystemStatsTable_post_request(ipSystemStatsTable_registration *
+ user_context, int rc);
+
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsTable_rowreq_ctx_init(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsTable_rowreq_ctx_init(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+ ipSystemStatsTable_rowreq_ctx_cleanup(ipSystemStatsTable_rowreq_ctx
+ * rowreq_ctx);
+
+ ipSystemStatsTable_data *ipSystemStatsTable_allocate_data(void);
+ void ipSystemStatsTable_release_data(ipSystemStatsTable_data
+ * data);
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsTable_rowreq_ctx
++ ipSystemStatsTable_rowreq_ctx
+ * ipSystemStatsTable_row_find_by_mib_index
+ (ipSystemStatsTable_mib_index * mib_idx);
+
+@@ -265,226 +194,50 @@ config_require(ip-mib/ipSystemStatsTable
+ * indexes
+ */
+
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInReceives_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInReceives_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInReceives_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInReceives_val_ptr);
+ int ipSystemStatsInOctets_get(ipSystemStatsTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ ipSystemStatsInOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 * ipSystemStatsHCInOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInHdrErrors_get(ipSystemStatsTable_rowreq_ctx *
++ struct counter64 *ipSystemStatsHCInOctets_val_ptr);
++ int ipSystemStatsInHdrErrors_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInHdrErrors_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInNoRoutes_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInNoRoutes_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInNoRoutes_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInAddrErrors_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInAddrErrors_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInAddrErrors_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInUnknownProtos_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInUnknownProtos_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInUnknownProtos_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInTruncatedPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInTruncatedPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInTruncatedPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInForwDatagrams_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInForwDatagrams_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsReasmReqds_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsReasmReqds_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsReasmReqds_val_ptr);
+@@ -492,690 +245,142 @@ config_require(ip-mib/ipSystemStatsTable
+ * rowreq_ctx,
+ u_long *
+ ipSystemStatsReasmOKs_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsReasmFails_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsReasmFails_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsReasmFails_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInDiscards_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInDiscards_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInDiscards_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInDelivers_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInDelivers_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInDelivers_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInDelivers_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInDelivers_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInDelivers_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutRequests_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutRequests_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutRequests_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutRequests_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutRequests_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutRequests_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutNoRoutes_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutNoRoutes_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutNoRoutes_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutForwDatagrams_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutForwDatagrams_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutDiscards_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutDiscards_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutDiscards_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutFragReqds_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutFragReqds_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragReqds_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutFragOKs_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutFragOKs_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragOKs_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutFragFails_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutFragFails_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragFails_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutFragCreates_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutFragCreates_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragCreates_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutTransmits_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutTransmits_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutTransmits_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutTransmits_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutTransmits_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutTransmits_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInMcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInMcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInMcastOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInMcastOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutMcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutMcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutMcastOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutMcastOctets_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsInBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsInBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInBcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCInBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCInBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCInBcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutBcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsHCOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsHCOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+- U64 *
++ struct counter64 *
+ ipSystemStatsHCOutBcastPkts_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsDiscontinuityTime_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsDiscontinuityTime_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsDiscontinuityTime_val_ptr);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsRefreshRate_get(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsRefreshRate_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsRefreshRate_val_ptr);
+-
+-
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsTable_indexes_set_tbl_idx(ipSystemStatsTable_mib_index
++ int ipSystemStatsTable_indexes_set_tbl_idx(ipSystemStatsTable_mib_index
+ * tbl_idx,
+ u_long
+ ipSystemStatsIPVersion_val);
+- int
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+- ipSystemStatsTable_indexes_set(ipSystemStatsTable_rowreq_ctx *
++ int ipSystemStatsTable_indexes_set(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipSystemStatsIPVersion_val);
+
+-
+-
+ /*
+ *********************************************************************
+ * SET function declarations
+Index: net-snmp-5.7.3/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c
++++ net-snmp-5.7.3/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c
+@@ -674,10 +674,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInReceives(4)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINRECEIVES:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInReceives_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -694,10 +694,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInOctets_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -764,10 +764,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInForwDatagrams(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINFORWDATAGRAMS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInForwDatagrams_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -824,10 +824,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInDelivers(19)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINDELIVERS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInDelivers_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -844,10 +844,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutRequests(21)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTREQUESTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutRequests_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -874,10 +874,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutForwDatagrams(24)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTFORWDATAGRAMS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutForwDatagrams_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -944,10 +944,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutTransmits(31)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTTRANSMITS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutTransmits_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -964,10 +964,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutOctets(33)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutOctets_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -984,10 +984,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInMcastPkts(35)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINMCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInMcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1004,10 +1004,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInMcastOctets(37)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINMCASTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInMcastOctets_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1024,10 +1024,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutMcastPkts(39)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTMCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutMcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1044,10 +1044,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutMcastOctets(41)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTMCASTOCTETS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutMcastOctets_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1064,10 +1064,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCInBcastPkts(43)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINBCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInBcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+@@ -1084,10 +1084,10 @@ _ipSystemStatsTable_get_column(ipSystemS
+ * ipSystemStatsHCOutBcastPkts(45)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTBCASTPKTS:
+- var->val_len = sizeof(U64);
++ var->val_len = sizeof(struct counter64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutBcastPkts_get(rowreq_ctx,
+- (U64 *) var->val.string);
++ (struct counter64 *) var->val.string);
+ break;
+
+ /*
+Index: net-snmp-5.7.3/include/net-snmp/data_access/ipstats.h
+===================================================================
+--- net-snmp-5.7.3.orig/include/net-snmp/data_access/ipstats.h
++++ net-snmp-5.7.3/include/net-snmp/data_access/ipstats.h
+@@ -58,45 +58,45 @@ typedef struct netsnmp_ipstats_s {
+ * other columns, when underlying OS does not provide them.
+ * Always fill at least 32 bits, the table is periodically polled -> 32 bit
+ * overflow shall be detected and 64 bit value should be computed automatically. */
+- U64 HCInReceives;
+- U64 HCInOctets;
++ struct counter64 HCInReceives;
++ struct counter64 HCInOctets;
+ u_long InHdrErrors;
+- U64 HCInNoRoutes;
++ struct counter64 HCInNoRoutes;
+ u_long InAddrErrors;
+ u_long InUnknownProtos;
+ u_long InTruncatedPkts;
+
+ /* optional, can be computed from HCInNoRoutes and HCOutForwDatagrams */
+- U64 HCInForwDatagrams;
++ struct counter64 HCInForwDatagrams;
+
+ u_long ReasmReqds;
+ u_long ReasmOKs;
+ u_long ReasmFails;
+ u_long InDiscards;
+- U64 HCInDelivers;
+- U64 HCOutRequests;
+- U64 HCOutNoRoutes;
+- U64 HCOutForwDatagrams;
+- U64 HCOutDiscards;
++ struct counter64 HCInDelivers;
++ struct counter64 HCOutRequests;
++ struct counter64 HCOutNoRoutes;
++ struct counter64 HCOutForwDatagrams;
++ struct counter64 HCOutDiscards;
+
+ /* optional, can be computed from HCOutFragOKs + HCOutFragFails*/
+- U64 HCOutFragReqds;
+- U64 HCOutFragOKs;
+- U64 HCOutFragFails;
+- U64 HCOutFragCreates;
++ struct counter64 HCOutFragReqds;
++ struct counter64 HCOutFragOKs;
++ struct counter64 HCOutFragFails;
++ struct counter64 HCOutFragCreates;
+
+ /* optional, can be computed from
+ * HCOutRequests +HCOutForwDatagrams + HCOutFragCreates
+ * - HCOutFragReqds - HCOutNoRoutes - HCOutDiscards */
+- U64 HCOutTransmits;
++ struct counter64 HCOutTransmits;
+
+- U64 HCOutOctets;
+- U64 HCInMcastPkts;
+- U64 HCInMcastOctets;
+- U64 HCOutMcastPkts;
+- U64 HCOutMcastOctets;
+- U64 HCInBcastPkts;
+- U64 HCOutBcastPkts;
++ struct counter64 HCOutOctets;
++ struct counter64 HCInMcastPkts;
++ struct counter64 HCInMcastOctets;
++ struct counter64 HCOutMcastPkts;
++ struct counter64 HCOutMcastOctets;
++ struct counter64 HCInBcastPkts;
++ struct counter64 HCOutBcastPkts;
+
+ /* Array of available columns.*/
+ int columnAvail[IPSYSTEMSTATSTABLE_LAST+1];
+Index: net-snmp-5.7.3/include/net-snmp/library/int64.h
+===================================================================
+--- net-snmp-5.7.3.orig/include/net-snmp/library/int64.h
++++ net-snmp-5.7.3/include/net-snmp/library/int64.h
+@@ -5,31 +5,29 @@
+ extern "C" {
+ #endif
+
+- typedef struct counter64 U64;
+-
+ #define I64CHARSZ 21
+
+- void divBy10(U64, U64 *, unsigned int *);
+- void multBy10(U64, U64 *);
+- void incrByU16(U64 *, unsigned int);
+- void incrByU32(U64 *, unsigned int);
++ void divBy10(struct counter64, struct counter64 *, unsigned int *);
++ void multBy10(struct counter64, struct counter64 *);
++ void incrByU16(struct counter64 *, unsigned int);
++ void incrByU32(struct counter64 *, unsigned int);
+ NETSNMP_IMPORT
+- void zeroU64(U64 *);
+- int isZeroU64(const U64 *);
++ void zeroU64(struct counter64 *);
++ int isZeroU64(const struct counter64 *);
+ NETSNMP_IMPORT
+- void printU64(char *, const U64 *);
++ void printU64(char *, const struct counter64 *);
+ NETSNMP_IMPORT
+- void printI64(char *, const U64 *);
+- int read64(U64 *, const char *);
++ void printI64(char *, const struct counter64 *);
++ int read64(struct counter64 *, const char *);
+ NETSNMP_IMPORT
+- void u64Subtract(const U64 * pu64one, const U64 * pu64two,
+- U64 * pu64out);
+- void u64Incr(U64 * pu64out, const U64 * pu64one);
+- void u64UpdateCounter(U64 * pu64out, const U64 * pu64one,
+- const U64 * pu64two);
+- void u64Copy(U64 * pu64one, const U64 * pu64two);
++ void u64Subtract(const struct counter64 *pu64one, const struct counter64 *pu64two,
++ struct counter64 *pu64out);
++ void u64Incr(struct counter64 *pu64out, const struct counter64 *pu64one);
++ void u64UpdateCounter(struct counter64 *pu64out, const struct counter64 *pu64one,
++ const struct counter64 *pu64two);
++ void u64Copy(struct counter64 *pu64one, const struct counter64 *pu64two);
+
+- int netsnmp_c64_check_for_32bit_wrap(U64 *old_val, U64 *new_val,
++ int netsnmp_c64_check_for_32bit_wrap(struct counter64 *old_val, struct counter64 *new_val,
+ int adjust);
+ NETSNMP_IMPORT
+ int netsnmp_c64_check32_and_update(struct counter64 *prev_val,
+Index: net-snmp-5.7.3/snmplib/int64.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/int64.c
++++ net-snmp-5.7.3/snmplib/int64.c
+@@ -33,7 +33,7 @@
+ * @param[out] puR Remainder.
+ */
+ void
+-divBy10(U64 u64, U64 * pu64Q, unsigned int *puR)
++divBy10(struct counter64 u64, struct counter64 *pu64Q, unsigned int *puR)
+ {
+ unsigned long ulT;
+ unsigned long ulQ;
+@@ -83,7 +83,7 @@ divBy10(U64 u64, U64 * pu64Q, unsigned i
+ * @param[out] pu64P Product.
+ */
+ void
+-multBy10(U64 u64, U64 * pu64P)
++multBy10(struct counter64 u64, struct counter64 *pu64P)
+ {
+ unsigned long ulT;
+ unsigned long ulP;
+@@ -130,7 +130,7 @@ multBy10(U64 u64, U64 * pu64P)
+ *
+ */
+ void
+-incrByU16(U64 * pu64, unsigned int u16)
++incrByU16(struct counter64 *pu64, unsigned int u16)
+ {
+ incrByU32(pu64, u16);
+ }
+@@ -143,7 +143,7 @@ incrByU16(U64 * pu64, unsigned int u16)
+ *
+ */
+ void
+-incrByU32(U64 * pu64, unsigned int u32)
++incrByU32(struct counter64 *pu64, unsigned int u32)
+ {
+ uint32_t tmp;
+
+@@ -161,7 +161,7 @@ incrByU32(U64 * pu64, unsigned int u32)
+ * @param[out] pu64out pu64one - pu64two.
+ */
+ void
+-u64Subtract(const U64 * pu64one, const U64 * pu64two, U64 * pu64out)
++u64Subtract(const struct counter64 *pu64one, const struct counter64 *pu64two, struct counter64 *pu64out)
+ {
+ int carry;
+
+@@ -177,7 +177,7 @@ u64Subtract(const U64 * pu64one, const U
+ * @param[in,out] pu64out pu64out += pu64one.
+ */
+ void
+-u64Incr(U64 * pu64out, const U64 * pu64one)
++u64Incr(struct counter64 *pu64out, const struct counter64 *pu64one)
+ {
+ pu64out->high = (uint32_t)(pu64out->high + pu64one->high);
+ incrByU32(pu64out, pu64one->low);
+@@ -191,9 +191,9 @@ u64Incr(U64 * pu64out, const U64 * pu64o
+ * @param[out] pu64out pu64out += (pu64one - pu64two)
+ */
+ void
+-u64UpdateCounter(U64 * pu64out, const U64 * pu64one, const U64 * pu64two)
++u64UpdateCounter(struct counter64 *pu64out, const struct counter64 *pu64one, const struct counter64 *pu64two)
+ {
+- U64 tmp;
++ struct counter64 tmp;
+
+ u64Subtract(pu64one, pu64two, &tmp);
+ u64Incr(pu64out, &tmp);
+@@ -208,7 +208,7 @@ netsnmp_feature_child_of(u64copy, netsnm
+ * @param[out] pu64one Where to store the copy - *pu64one = *pu64two.
+ */
+ void
+-u64Copy(U64 * pu64one, const U64 * pu64two)
++u64Copy(struct counter64 *pu64one, const struct counter64 *pu64two)
+ {
+ *pu64one = *pu64two;
+ }
+@@ -220,7 +220,7 @@ u64Copy(U64 * pu64one, const U64 * pu64t
+ * @param[in] pu64 Number to be zeroed.
+ */
+ void
+-zeroU64(U64 * pu64)
++zeroU64(struct counter64 *pu64)
+ {
+ pu64->low = 0;
+ pu64->high = 0;
+@@ -232,7 +232,7 @@ zeroU64(U64 * pu64)
+ * @param[in] pu64 Number to be checked.
+ */
+ int
+-isZeroU64(const U64 * pu64)
++isZeroU64(const struct counter64 *pu64)
+ {
+ return pu64->low == 0 && pu64->high == 0;
+ }
+@@ -390,10 +390,10 @@ netsnmp_c64_check32_and_update(struct co
+ /** Convert an unsigned 64-bit number to ASCII. */
+ void
+ printU64(char *buf, /* char [I64CHARSZ+1]; */
+- const U64 * pu64)
++ const struct counter64 *pu64)
+ {
+- U64 u64a;
+- U64 u64b;
++ struct counter64 u64a;
++ struct counter64 u64b;
+
+ char aRes[I64CHARSZ + 1];
+ unsigned int u;
+@@ -414,9 +414,9 @@ printU64(char *buf, /* char [I64CHARSZ+1
+ /** Convert a signed 64-bit number to ASCII. */
+ void
+ printI64(char *buf, /* char [I64CHARSZ+1]; */
+- const U64 * pu64)
++ const struct counter64 *pu64)
+ {
+- U64 u64a;
++ struct counter64 u64a;
+
+ if (pu64->high & 0x80000000) {
+ u64a.high = (uint32_t) ~pu64->high;
+@@ -429,11 +429,11 @@ printI64(char *buf, /* char [I64CHARSZ+1
+ }
+ }
+
+-/** Convert a signed 64-bit integer from ASCII to U64. */
++/** Convert a signed 64-bit integer from ASCII to struct counter64. */
+ int
+-read64(U64 * i64, const char *str)
++read64(struct counter64 *i64, const char *str)
+ {
+- U64 i64p;
++ struct counter64 i64p;
+ unsigned int u;
+ int sign = 0;
+ int ok = 0;
+Index: net-snmp-5.7.3/snmplib/read_config.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/read_config.c
++++ net-snmp-5.7.3/snmplib/read_config.c
+@@ -2270,10 +2270,10 @@ read_config_read_memory(int type, char *
+ return readfrom;
+
+ case ASN_COUNTER64:
+- if (*len < sizeof(U64))
++ if (*len < sizeof(struct counter64))
+ return NULL;
+- *len = sizeof(U64);
+- read64((U64 *) dataptr, readfrom);
++ *len = sizeof(struct counter64);
++ read64((struct counter64 *) dataptr, readfrom);
+ readfrom = skip_token(readfrom);
+ return readfrom;
+ }
+Index: net-snmp-5.7.3/testing/fulltests/unit-tests/T015int64_clib.c
+===================================================================
+--- net-snmp-5.7.3.orig/testing/fulltests/unit-tests/T015int64_clib.c
++++ net-snmp-5.7.3/testing/fulltests/unit-tests/T015int64_clib.c
+@@ -1,4 +1,4 @@
+-/* HEADER Testing 64-bit integer operations (U64). */
++/* HEADER Testing 64-bit integer operations (struct counter64). */
+
+ int i, j;
+ char buf[22];
+@@ -15,7 +15,7 @@ static const int64_t intval[] = {
+ };
+
+ for (i = 0; i < sizeof(intval)/sizeof(intval[0]); ++i) {
+- U64 a, b;
++ struct counter64 a, b;
+ a.low = (uint32_t)intval[i];
+ a.high = (uint32_t)(intval[i] >> 32);
+ printI64(buf, &a);
+@@ -27,7 +27,7 @@ for (i = 0; i < sizeof(intval)/sizeof(in
+
+ for (i = 0; i < sizeof(intval)/sizeof(intval[0]); ++i) {
+ for (j = i; j < sizeof(intval)/sizeof(intval[0]); ++j) {
+- U64 a, b;
++ struct counter64 a, b;
+ uint64_t d;
+ a.low = (uint32_t)intval[i];
+ a.high = (uint32_t)(intval[i] >> 32);
+@@ -43,7 +43,7 @@ for (i = 0; i < sizeof(intval)/sizeof(in
+
+ for (i = 0; i < sizeof(intval)/sizeof(intval[0]); ++i) {
+ for (j = i; j < sizeof(intval)/sizeof(intval[0]); ++j) {
+- U64 a, b, c;
++ struct counter64 a, b, c;
+ uint64_t d;
+ a.low = (uint32_t)intval[i];
+ a.high = (uint32_t)(intval[i] >> 32);
+@@ -58,7 +58,7 @@ for (i = 0; i < sizeof(intval)/sizeof(in
+ }
+
+ {
+- U64 old_val, new_val;
++ struct counter64 old_val, new_val;
+ old_val.low = 7;
+ old_val.high = 0;
+ new_val = old_val;
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch
new file mode 100644
index 000000000..44359bebe
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_headers-Error-Fix.patch
@@ -0,0 +1,34 @@
+From 261a22096c79f8e6ef7b387514a74d208e4e5945 Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Fri, 21 Aug 2015 18:23:13 +0900
+Subject: [PATCH] config_os_headers: Error Fix
+
+ERROR: This autoconf log indicates errors, it looked at host include
+and/or library paths while determining system capabilities.
+cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories]
+conftest.c:168:17: fatal error: pkg.h: No such file or directory
+ #include <pkg.h>
+ ^
+
+Upstream-Status: pending
+
+Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
+---
+ configure.d/config_os_headers | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: net-snmp-5.7.3/configure.d/config_os_headers
+===================================================================
+--- net-snmp-5.7.3.orig/configure.d/config_os_headers
++++ net-snmp-5.7.3/configure.d/config_os_headers
+@@ -484,8 +484,8 @@ then
+ unset ac_cv_header_pkg_h
+ netsnmp_save_CPPFLAGS="$CPPFLAGS"
+ netsnmp_save_LDFLAGS="$LDFLAGS"
+- CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+- LDFLAGS="$LDFLAGS -L/usr/local/lib"
++ CPPFLAGS="$CPPFLAGS"
++ LDFLAGS="$LDFLAGS"
+ AC_CHECK_HEADERS(pkg.h,
+ NETSNMP_SEARCH_LIBS(pkg_init, pkg,
+ AC_DEFINE(HAVE_LIBPKG, 1, [define if you have BSD pkg-ng])))
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_libs2-Error-Fix.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_libs2-Error-Fix.patch
new file mode 100644
index 000000000..5866a95ed
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-config_os_libs2-Error-Fix.patch
@@ -0,0 +1,31 @@
+From e24fcd140f3f6dd18fd836b197c6d4bb773e50e7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <funman@videolan.org>
+Date: Wed, 4 Nov 2015 16:49:30 +0100
+Subject: [PATCH] config_os_libs2: Error Fix
+
+ERROR: This autoconf log indicates errors, it looked at host include
+and/or library paths while determining system capabilities.
+---
+ configure.d/config_os_libs2 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2
+index 47491e2..e3647f9 100644
+--- a/configure.d/config_os_libs2
++++ b/configure.d/config_os_libs2
+@@ -226,10 +226,10 @@ if test "x$with_nl" != "xno"; then
+ case $target_os in
+ linux*) # Check for libnl (linux)
+ netsnmp_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="-I/usr/include/libnl3 $CPPFLAGS"
++ CPPFLAGS="$CPPFLAGS"
+ NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
+ [AC_CHECK_HEADERS(netlink/netlink.h)
+- EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES -I/usr/include/libnl3"],
++ EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES"],
+ [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS])
+ if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
+ NETSNMP_SEARCH_LIBS(nl_connect, nl, [
+--
+2.5.0
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-configure-fix-check-for-enable-perl-cc-checks.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-configure-fix-check-for-enable-perl-cc-checks.patch
new file mode 100644
index 000000000..b87e9eec2
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-configure-fix-check-for-enable-perl-cc-checks.patch
@@ -0,0 +1,31 @@
+From c6304a3e4b8441ff0a6464c0f1f6c5229092fa32 Mon Sep 17 00:00:00 2001
+From: Niels Baggesen <nba@users.sourceforge.net>
+Date: Wed, 24 May 2017 16:40:03 +0800
+Subject: [PATCH 1/4] configure: fix check for --enable-perl-cc-checks
+
+This patch comes from git://git.code.sf.net/p/net-snmp/code,
+the commit is 8f431d410b803603dc809d82e0893509615d9a11.
+
+Upstream-Status: Backport
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ configure.d/config_project_perl_python | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.d/config_project_perl_python b/configure.d/config_project_perl_python
+index 23f8c7e..475c843 100644
+--- a/configure.d/config_project_perl_python
++++ b/configure.d/config_project_perl_python
+@@ -84,7 +84,7 @@ if test "x$install_perl" != "xno" ; then
+
+ # What compiler was used to build the perl binary?
+ #
+- if test "xenable_perl_cc_checks" != "xno" ; then
++ if test "x$enable_perl_cc_checks" != "xno" ; then
+ AC_MSG_CHECKING([for Perl cc])
+ changequote(, )
+ PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'`
+--
+1.9.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-get_pid_from_inode-Include-limit.h.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-get_pid_from_inode-Include-limit.h.patch
new file mode 100644
index 000000000..60ce80996
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-get_pid_from_inode-Include-limit.h.patch
@@ -0,0 +1,29 @@
+From 7136d593ba96b64537069637c328bc65e1b66b2d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 22 Jul 2016 18:34:39 +0000
+Subject: [PATCH] get_pid_from_inode: Include limit.h
+
+PATH_MAX and NAME_MAX are required by this file
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ agent/mibgroup/util_funcs/get_pid_from_inode.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/agent/mibgroup/util_funcs/get_pid_from_inode.c b/agent/mibgroup/util_funcs/get_pid_from_inode.c
+index 8e157ae..a494ec7 100644
+--- a/agent/mibgroup/util_funcs/get_pid_from_inode.c
++++ b/agent/mibgroup/util_funcs/get_pid_from_inode.c
+@@ -5,6 +5,7 @@
+ #include <net-snmp/output_api.h>
+
+ #include <ctype.h>
++#include <limits.h>
+ #include <stdio.h>
+ #if HAVE_STDLIB_H
+ #include <stdlib.h>
+--
+1.8.3.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch
new file mode 100644
index 000000000..527aa39f2
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch
@@ -0,0 +1,26 @@
+From 1ee72102fbe722d232d74abc4660a8b134cec8d6 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Sat, 23 May 2015 07:32:53 +0200
+Subject: [PATCH] snmplib, UDPIPv6 transport: Add a missing return statement
+
+Detected by Coverity.
+
+Upstream-Status: backport
+
+Signed-off-by: Li Zhou <li.zhou@windriver.com>
+---
+ snmplib/transports/snmpUDPIPv6Domain.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/transports/snmpUDPIPv6Domain.c
++++ net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
+@@ -305,6 +305,7 @@ netsnmp_udp6_transport(struct sockaddr_i
+ errno, strerror(errno)));
+ netsnmp_socketbase_close(t);
+ netsnmp_transport_free(t);
++ return NULL;
+ }
+ }
+ /*
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch
new file mode 100644
index 000000000..af242fafb
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch
@@ -0,0 +1,33 @@
+From d3027a227bc0f603a5b650d01f97ee1dec515be5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 18 Sep 2015 00:28:45 -0400
+Subject: [PATCH] snmplib/keytools.c: Don't check for return from
+ EVP_MD_CTX_init()
+
+EVP_MD_CTX_init() API returns void, it fixes errors with new compilers
+
+snmplib/keytools.c: In function 'generate_Ku': error: invalid use of void expression
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted [https://sourceforge.net/p/net-snmp/patches/1317/]
+ snmplib/keytools.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/snmplib/keytools.c b/snmplib/keytools.c
+index 0ccb3a6..880fc14 100644
+--- a/snmplib/keytools.c
++++ b/snmplib/keytools.c
+@@ -153,8 +153,7 @@ generate_Ku(const oid * hashtype, u_int hashtype_len,
+ ctx = EVP_MD_CTX_create();
+ #else
+ ctx = malloc(sizeof(*ctx));
+- if (!EVP_MD_CTX_init(ctx))
+- return SNMPERR_GENERR;
++ EVP_MD_CTX_init(ctx);
+ #endif
+ #ifndef NETSNMP_DISABLE_MD5
+ if (ISTRANSFORM(hashtype, HMACMD5Auth)) {
+--
+2.5.2
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0002-configure-fix-a-cc-check-issue.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0002-configure-fix-a-cc-check-issue.patch
new file mode 100644
index 000000000..999976d27
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0002-configure-fix-a-cc-check-issue.patch
@@ -0,0 +1,30 @@
+From 94e7e4969bc84c945dfea12d67a1e10f61973948 Mon Sep 17 00:00:00 2001
+From: Wenlin Kang <wenlin.kang@windriver.com>
+Date: Wed, 24 May 2017 16:45:34 +0800
+Subject: [PATCH 2/4] configure: fix a cc check issue.
+
+When has "." in cc value, the expression
+$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'
+can't get corretly the cc's value.
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ configure.d/config_project_perl_python | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.d/config_project_perl_python b/configure.d/config_project_perl_python
+index 475c843..22d2ad3 100644
+--- a/configure.d/config_project_perl_python
++++ b/configure.d/config_project_perl_python
+@@ -87,7 +87,7 @@ if test "x$install_perl" != "xno" ; then
+ if test "x$enable_perl_cc_checks" != "xno" ; then
+ AC_MSG_CHECKING([for Perl cc])
+ changequote(, )
+- PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'`
++ PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\.\w\s\/]+).;\s*/$1/);'`
+ changequote([, ])
+ if test "x$PERLCC" != "x" ; then
+ AC_MSG_RESULT([$PERLCC])
+--
+1.9.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch
new file mode 100644
index 000000000..7951234a4
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch
@@ -0,0 +1,186 @@
+From e57fc809ad6ae522670f3dc157aadde20d968ca7 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Wed, 24 May 2017 17:05:03 +0800
+Subject: [PATCH 3/4] CHANGES: BUG: 2712: Fix Perl module compilation
+
+Avoid that building the Net-SNMP Perl modules fails as follows:
+
+ERROR from evaluation of /sources/net-snmp-5.7.3/perl/ASN/Makefile.PL: Bizarre \ copy of HASH in list assignment at /usr/lib/perl5/site_perl/5.24.0/Carp.pm line\ 229.
+
+See also https://sourceforge.net/p/net-snmp/bugs/2712/.
+
+This patch comes from git://git.code.sf.net/p/net-snmp/code,
+the commit is 4e793461e96a2b4fd81142ab312d074d5c8841fa.
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ perl/ASN/Makefile.PL | 4 +---
+ perl/Makefile.PL | 4 +---
+ perl/OID/Makefile.PL | 5 +----
+ perl/SNMP/Makefile.PL | 5 +----
+ perl/TrapReceiver/Makefile.PL | 5 +----
+ perl/agent/Makefile.PL | 5 +----
+ perl/agent/Support/Makefile.PL | 5 +----
+ perl/agent/default_store/Makefile.PL | 5 +----
+ perl/default_store/Makefile.PL | 5 +----
+ 9 files changed, 9 insertions(+), 34 deletions(-)
+
+diff --git a/perl/ASN/Makefile.PL b/perl/ASN/Makefile.PL
+index 4576781..c33d8ba 100644
+--- a/perl/ASN/Makefile.PL
++++ b/perl/ASN/Makefile.PL
+@@ -7,9 +7,7 @@ my $lib_version;
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
+ # the contents of the Makefile that is written.
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/Makefile.PL b/perl/Makefile.PL
+index 31fdc40..48aba2a 100644
+--- a/perl/Makefile.PL
++++ b/perl/Makefile.PL
+@@ -3,9 +3,7 @@ use Config;
+ use Getopt::Long;
+ require 5;
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ sub InitMakeParams {
+ $nsconfig="net-snmp-config"; # in path by default
+diff --git a/perl/OID/Makefile.PL b/perl/OID/Makefile.PL
+index 6bb1616..2589985 100644
+--- a/perl/OID/Makefile.PL
++++ b/perl/OID/Makefile.PL
+@@ -6,11 +6,8 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/SNMP/Makefile.PL b/perl/SNMP/Makefile.PL
+index e617cb7..8aab9a9 100644
+--- a/perl/SNMP/Makefile.PL
++++ b/perl/SNMP/Makefile.PL
+@@ -3,15 +3,12 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+ my $opts;
+
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
+ # the contents of the Makefile that is written.
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/TrapReceiver/Makefile.PL b/perl/TrapReceiver/Makefile.PL
+index 874ee21..7e9e58e 100644
+--- a/perl/TrapReceiver/Makefile.PL
++++ b/perl/TrapReceiver/Makefile.PL
+@@ -3,11 +3,8 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/agent/Makefile.PL b/perl/agent/Makefile.PL
+index 4f7bee3..003c0d1 100644
+--- a/perl/agent/Makefile.PL
++++ b/perl/agent/Makefile.PL
+@@ -3,11 +3,8 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/agent/Support/Makefile.PL b/perl/agent/Support/Makefile.PL
+index 48815b6..2325e10 100644
+--- a/perl/agent/Support/Makefile.PL
++++ b/perl/agent/Support/Makefile.PL
+@@ -3,14 +3,11 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
+ # the contents of the Makefile that is written.
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/agent/default_store/Makefile.PL b/perl/agent/default_store/Makefile.PL
+index ed6483a..31cfbee 100644
+--- a/perl/agent/default_store/Makefile.PL
++++ b/perl/agent/default_store/Makefile.PL
+@@ -3,11 +3,8 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+ Check_Version();
+
+diff --git a/perl/default_store/Makefile.PL b/perl/default_store/Makefile.PL
+index 7c671b8..01c8dd0 100644
+--- a/perl/default_store/Makefile.PL
++++ b/perl/default_store/Makefile.PL
+@@ -3,11 +3,8 @@ require 5;
+ use Config;
+ use Getopt::Long;
+ my $lib_version;
+-my %MakeParams = ();
+
+-%MakeParams = InitMakeParams();
+-
+-WriteMakefile(%MakeParams);
++WriteMakefile(InitMakeParams());
+
+
+ sub InitMakeParams {
+--
+1.9.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0004-configure-fix-incorrect-variable.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0004-configure-fix-incorrect-variable.patch
new file mode 100644
index 000000000..2b03f9e9a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/0004-configure-fix-incorrect-variable.patch
@@ -0,0 +1,30 @@
+From 4ad98ef125eb4e7d7a1a93146042002f78254d36 Mon Sep 17 00:00:00 2001
+From: Wenlin Kang <wenlin.kang@windriver.com>
+Date: Wed, 24 May 2017 17:10:20 +0800
+Subject: [PATCH 4/4] configure: fix incorrect variable
+
+For cross compile platform, this variable will not be correct, so fix it.
+
+Upstream-Status: Inappropriate [cross compile specific]
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index cfcdf73..164df05 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -171,7 +171,7 @@ OTHERCLEANTODOS=perlclean @PYTHONCLEANTARGS@ cleanfeatures perlcleanfeatures pyt
+ #
+ # override LD_RUN_PATH to avoid dependencies on the build directory
+ perlmodules: perlmakefiles subdirs
+- @(cd perl ; $(MAKE) LD_RUN_PATH="$(libdir):`$(PERL) -e 'use Config; print qq($$Config{archlibexp}/CORE);'`") ; \
++ @(cd perl ; $(MAKE) LD_RUN_PATH="$(libdir):`$(PERL) -e 'use Config; print qq($$Config{installprivlib}/CORE);'`") ; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi
+--
+1.9.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch
new file mode 100644
index 000000000..6bd0f93c4
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/dont-return-incompletely-parsed-varbinds.patch
@@ -0,0 +1,131 @@
+From 6b93e686bdb6a908d00595608646a05527a5326b Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Fri, 21 Aug 2015 12:39:12 +0900
+Subject: [PATCH] the snmp_pdu_parse() function could leave incompletely parsed
+ varBind variables in the list of variables in case the parsing of the SNMP
+ PDU failed. If later processing tries to operate on the stale and
+ incompletely processed varBind (e.g. when printing the variables), this can
+ lead to e.g. crashes or, possibly, execution of arbitrary code
+
+Upstream-Status: Backport [net-snmp]
+
+Written-by: Robert Story
+---
+ snmplib/snmp_api.c | 53 ++++++++++++++++++++++++++++-------------------------
+ 1 file changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c
+index 191debf..15a2d39 100644
+--- a/snmplib/snmp_api.c
++++ b/snmplib/snmp_api.c
+@@ -4350,10 +4350,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+ u_char type;
+ u_char msg_type;
+ u_char *var_val;
+- int badtype = 0;
+ size_t len;
+ size_t four;
+- netsnmp_variable_list *vp = NULL;
++ netsnmp_variable_list *vp = NULL, *vplast = NULL;
+ oid objid[MAX_OID_LEN];
+ u_char *p;
+
+@@ -4493,31 +4492,17 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+ (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+ "varbinds");
+ if (data == NULL)
+- return -1;
++ goto fail;
+
+ /*
+ * get each varBind sequence
+ */
+ while ((int) *length > 0) {
+- netsnmp_variable_list *vptemp;
+- vptemp = (netsnmp_variable_list *) malloc(sizeof(*vptemp));
+- if (NULL == vptemp) {
+- return -1;
+- }
+- if (NULL == vp) {
+- pdu->variables = vptemp;
+- } else {
+- vp->next_variable = vptemp;
+- }
+- vp = vptemp;
++ vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
++ if (NULL == vp)
++ goto fail;
+
+- vp->next_variable = NULL;
+- vp->val.string = NULL;
+ vp->name_length = MAX_OID_LEN;
+- vp->name = NULL;
+- vp->index = 0;
+- vp->data = NULL;
+- vp->dataFreeHook = NULL;
+ DEBUGDUMPSECTION("recv", "VarBind");
+ data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
+ &vp->val_len, &var_val, length);
+@@ -4604,7 +4589,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+ vp->val.string = (u_char *) malloc(vp->val_len);
+ }
+ if (vp->val.string == NULL) {
+- return -1;
++ goto fail;
+ }
+ p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
+ &vp->val_len);
+@@ -4619,7 +4604,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+ vp->val_len *= sizeof(oid);
+ vp->val.objid = (oid *) malloc(vp->val_len);
+ if (vp->val.objid == NULL) {
+- return -1;
++ goto fail;
+ }
+ memmove(vp->val.objid, objid, vp->val_len);
+ break;
+@@ -4631,7 +4616,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+ case ASN_BIT_STR:
+ vp->val.bitstring = (u_char *) malloc(vp->val_len);
+ if (vp->val.bitstring == NULL) {
+- return -1;
++ goto fail;
+ }
+ p = asn_parse_bitstring(var_val, &len, &vp->type,
+ vp->val.bitstring, &vp->val_len);
+@@ -4640,12 +4625,30 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+ break;
+ default:
+ snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
+- badtype = -1;
++ goto fail;
+ break;
+ }
+ DEBUGINDENTADD(-4);
++
++ if (NULL == vplast) {
++ pdu->variables = vp;
++ } else {
++ vplast->next_variable = vp;
++ }
++ vplast = vp;
++ vp = NULL;
++
+ }
+- return badtype;
++ return 0;
++
++ fail:
++ DEBUGMSGTL(("recv", "error while parsing VarBindList\n"));
++ /** if we were parsing a var, remove it from the pdu and free it */
++ if (vp)
++ snmp_free_var(vp);
++
++ return -1;
++
+ }
+
+ /*
+--
+1.8.4.2
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch
new file mode 100644
index 000000000..d29be3395
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/fix-libtool-finish.patch
@@ -0,0 +1,25 @@
+LIB_LDCONFIG_CMD failed since it is using a host dir $(libdir)
+which is /usr/lib64 does not exist on host when compile 64bit
+image.
+
+In fact, configuring dynamic linker run-time bindings is meaningless
+at this step, If it is needed, Poky would write ldconfig scripts to
+rpm-postinst for each recipe while do_package, in package.bbclass.
+
+Upstream-Status: Inappropriate [cross compile specific]
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+Index: net-snmp-5.7.3/Makefile.top
+===================================================================
+--- net-snmp-5.7.3.orig/Makefile.top
++++ net-snmp-5.7.3/Makefile.top
+@@ -87,7 +87,7 @@ LIBREVISION = 3
+ LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
+ LIB_EXTENSION = la
+ LIB_VERSION =
+-LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(INSTALL_PREFIX)$(libdir)
++LIB_LDCONFIG_CMD = echo "do not ldconfig\n"
+ LINK = $(LIBTOOL) --mode=link $(LINKCC)
+ # RANLIB = @RANLIB@
+ RANLIB = :
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch
new file mode 100644
index 000000000..fbd274bba
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch
@@ -0,0 +1,42 @@
+From e47c60dc7f649959f63e56bc62355de4bdfd73f4 Mon Sep 17 00:00:00 2001
+From: Marian Florea <marian.florea@windriver.com>
+Date: Thu, 20 Jul 2017 16:55:24 +0800
+Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP
+
+Upstream-Status: Pending
+
+Signed-off-by: Marian Florea <marian.florea@windriver.com>
+Signed-off-by: Li Zhou <li.zhou@windriver.com>
+---
+ agent/snmpd.c | 1 +
+ snmplib/snmpv3.c | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+Index: net-snmp-5.7.3/agent/snmpd.c
+===================================================================
+--- net-snmp-5.7.3.orig/agent/snmpd.c
++++ net-snmp-5.7.3/agent/snmpd.c
+@@ -1253,6 +1253,7 @@ receive(void)
+ snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
+ netsnmp_get_version());
+ update_config();
++ snmp_store(app_name);
+ send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
+ #if HAVE_SIGHOLD
+ sigrelse(SIGHUP);
+Index: net-snmp-5.7.3/snmplib/snmpv3.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/snmpv3.c
++++ net-snmp-5.7.3/snmplib/snmpv3.c
+@@ -984,9 +984,9 @@ init_snmpv3_post_config(int majorid, int
+ /*
+ * if our engineID has changed at all, the boots record must be set to 1
+ */
+- if (engineIDLen != oldEngineIDLength ||
++ if (oldEngineIDLength != (size_t)0 && (engineIDLen != oldEngineIDLength ||
+ oldEngineID == NULL || c_engineID == NULL ||
+- memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
++ memcmp(oldEngineID, c_engineID, engineIDLen) != 0)) {
+ engineBoots = 1;
+ }
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch
new file mode 100644
index 000000000..74b0c12e0
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-add-knob-whether-nlist.h-are-checked.patch
@@ -0,0 +1,35 @@
+net-snmp: add knob whether nlist.h are checked
+
+Previously, it still was checked when there was no nlish.h in sysroots directory.
+Add knob to decide whether nlist.h are checked or not.
+
+Upstream-status: Pending
+
+Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
+---
+ configure.d/config_os_headers | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers
+index d903f58..a05d30e 100644
+--- a/configure.d/config_os_headers
++++ b/configure.d/config_os_headers
+@@ -31,6 +31,7 @@ AC_CHECK_HEADERS([getopt.h pthread.h regex.h ] dnl
+ [sys/un.h ])
+
+ # Library and Agent:
++if test "x$with_elf" != "xno"; then
+ AC_CHECK_HEADERS([nlist.h],,,[
+ AC_INCLUDES_DEFAULT
+ [
+@@ -38,6 +39,7 @@ AC_INCLUDES_DEFAULT
+ #define LIBBSD_DISABLE_DEPRECATED 1
+ #endif
+ ]])
++fi
+
+ # Library:
+ AC_CHECK_HEADERS([fcntl.h io.h kstat.h ] dnl
+--
+1.7.9.5
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch
new file mode 100644
index 000000000..5eed893e1
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch
@@ -0,0 +1,75 @@
+Description: fix snmpd crash via AgentX connection
+
+ taken from Fedora, net-snmp-5.7-agentx-crash.patch
+
+bz729738 - net-snmp dumps core in netsnmp_oid_find_prefix
+bz1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out
+
+commit f9304c83f76202db0e684269ca1af32e43cd9db4
+Author: Jan Safranek <jsafranek@users.sourceforge.net>
+Date: Tue Feb 7 14:53:44 2012 +0100
+
+ CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent
+ disconnect in the middle of processing of a request.
+
+ I fixed also the memory leak reported in the tracker comments.
+
+Upstream-Status: Backport
+
+Signed-off-by: Zhu Yanjun <yanjun.zhu@windriver.com>
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+---
+ agent/mibgroup/agentx/master.c | 5 +++++
+ agent/mibgroup/agentx/master_admin.c | 9 +++++++--
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
+index c42a42a..baeebaf 100644
+--- a/agent/mibgroup/agentx/master.c
++++ b/agent/mibgroup/agentx/master.c
+@@ -219,6 +219,9 @@ agentx_got_response(int operation,
+ if (!cache) {
+ DEBUGMSGTL(("agentx/master", "response too late on session %8p\n",
+ session));
++ /* response is too late, free the cache */
++ if (magic)
++ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
+ return 0;
+ }
+ requests = cache->requests;
+@@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handler *handler,
+ result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
+ if (result == 0) {
+ snmp_free_pdu(pdu);
++ if (cb_data)
++ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data);
+ }
+
+ return SNMP_ERR_NOERROR;
+diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
+index f16f392..b84b85e 100644
+--- a/agent/mibgroup/agentx/master_admin.c
++++ b/agent/mibgroup/agentx/master_admin.c
+@@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * session, int sessid)
+ * requests, so that the delegated request will be completed and
+ * further requests can be processed
+ */
+- netsnmp_remove_delegated_requests_for_session(session);
++ while (netsnmp_remove_delegated_requests_for_session(session)) {
++ DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n"));
++ }
++
+ if (session->subsession != NULL) {
+ netsnmp_session *subsession = session->subsession;
+ for(; subsession; subsession = subsession->next) {
+- netsnmp_remove_delegated_requests_for_session(subsession);
++ while (netsnmp_remove_delegated_requests_for_session(subsession)) {
++ DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n"));
++ }
+ }
+ }
+
+--
+2.7.4
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch
new file mode 100644
index 000000000..25eb9c96f
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch
@@ -0,0 +1,32 @@
+From 270e952f58a7e5ddeabe5a15e3ddaaadf40017d0 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Thu, 22 Jun 2017 10:25:08 +0800
+Subject: [PATCH] net-snmp: fix for --disable-des
+
+Include des.h only if it's found in openssl so that
+the --disable-des works correctly.
+
+Upstream-Status: Submitted [net-snmp-coders@lists.sourceforge.net]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ snmplib/scapi.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/snmplib/scapi.c b/snmplib/scapi.c
+index 16ac829..271684b 100644
+--- a/snmplib/scapi.c
++++ b/snmplib/scapi.c
+@@ -79,7 +79,9 @@ netsnmp_feature_child_of(usm_scapi, usm_support)
+ #include <openssl/hmac.h>
+ #include <openssl/evp.h>
+ #include <openssl/rand.h>
++#ifdef HAVE_OPENSSL_DES_H
+ #include <openssl/des.h>
++#endif
+ #ifdef HAVE_AES
+ #include <openssl/aes.h>
+ #endif
+--
+2.11.0
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch
new file mode 100644
index 000000000..8f8336a49
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-testing-add-the-output-format-for-ptest.patch
@@ -0,0 +1,34 @@
+From 4bb4024b395f19d36ab3569e2773ea80d8cc5261 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Wed, 14 Jan 2015 15:10:06 +0800
+Subject: [PATCH] testing: add the output format for ptest
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ testing/RUNTESTS | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+Index: net-snmp-5.7.3/testing/RUNTESTS
+===================================================================
+--- net-snmp-5.7.3.orig/testing/RUNTESTS
++++ net-snmp-5.7.3/testing/RUNTESTS
+@@ -29,13 +29,17 @@ failed_count=0
+ rm -f failed_tests
+ for i in "${srcdir}"/testing/fulltests/default/T*$1*; do
+ echo "RUNNING $i"
++ test_name=`basename $i`
+ ${srcdir}/testing/fulltests/support/simple_run $i
+ if [ $? = 0 ]; then
++ echo "PASS: $test_name"
+ success_count=`expr $success_count + 1`
+ else
++ echo "FAIL: $test_name"
+ failed_count=`expr $failed_count + 1`
+ echo "$i" >> failed_tests
+ fi
++ echo
+ done
+
+ if [ -f failed_tests ]; then
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest
new file mode 100755
index 000000000..2334217bc
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd testing
+./RUNTESTS
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service
new file mode 100644
index 000000000..447683f85
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmpd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Simple Network Management Protocol (SNMP) Daemon.
+After=syslog.target network.target
+
+[Service]
+Type=notify
+Environment=OPTIONS="-Ls0-6d"
+EnvironmentFile=-/etc/default/snmpd
+ExecStart=/usr/sbin/snmpd $OPTIONS -a -f
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service
new file mode 100644
index 000000000..951f9f270
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/snmptrapd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Simple Network Management Protocol (SNMP) Trap Daemon.
+After=syslog.target network.target
+
+[Service]
+Type=notify
+Environment=OPTIONS="-Lsd"
+EnvironmentFile=-/etc/default/snmptrapd
+ExecStart=/usr/sbin/snmptrapd $OPTIONS -f
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch
new file mode 100644
index 000000000..c6af8c0f3
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/systemd-support.patch
@@ -0,0 +1,1652 @@
+From 0cad0c6c36af2a2d589563804c9ed2b37b7085fb Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Fri, 21 Aug 2015 14:37:02 +0900
+Subject: [PATCH] ystemd support backported from the master branch as of
+ 23/04/2012 (post 5.7.1, pre 5.8).
+
+The following commits have been cherry-picked:
+
+19499c3c90bf9d7b2b9e5d08baa26cc6bba28a11
+fef6cddfdb94da1a6b1fb768af62918b80f11fd3
+0641e43c694c485cbbffef0556efc4641bd3ff50
+76530a89f1c8bbd0b63acce63e10d5d4812a1a16 (conflict resolved)
+bf108d7f1354f6276fc43c129963f2c49b9fc242
+3692875172352f72cf3afd0d35f355e83d7e421b
+74412748067c685e1d8ab6ed3bcc3ca9c2774844
+86132e3f1e6ef7b4e0b96d8fa24e37c81b71b0e0
+63557cf8986a33dba1d4429b583a901361052c4f
+
+Upstream-Status: Backport
+
+Signed-off-by: Thomas Fitzsimmons <fitzsim@cisco.com>
+---
+ README.systemd | 41 +++
+ agent/snmpd.c | 33 +-
+ apps/snmptrapd.c | 32 +-
+ configure.d/config_modules_lib | 8 +
+ configure.d/config_project_with_enable | 9 +
+ dist/snmpd.servic | 18 +
+ dist/snmpd.socket | 17 +
+ dist/snmptrapd.service | 16 +
+ dist/snmptrapd.socket | 14 +
+ include/net-snmp/library/sd-daemon.h | 290 ++++++++++++++++
+ snmplib/sd-daemon.c | 532 +++++++++++++++++++++++++++++
+ snmplib/transports/snmpTCPDomain.c | 43 ++-
+ snmplib/transports/snmpTCPIPv6Domain.c | 46 ++-
+ snmplib/transports/snmpUDPIPv4BaseDomain.c | 33 +-
+ snmplib/transports/snmpUDPIPv6Domain.c | 34 +-
+ snmplib/transports/snmpUnixDomain.c | 66 ++--
+ win32/libsnmp/Makefile.in | 6 +
+ win32/net-snmp/net-snmp-config.h | 2 +
+ win32/net-snmp/net-snmp-config.h.in | 2 +
+ 19 files changed, 1176 insertions(+), 66 deletions(-)
+ create mode 100644 README.systemd
+ create mode 100644 dist/snmpd.servic
+ create mode 100644 dist/snmpd.socket
+ create mode 100644 dist/snmptrapd.service
+ create mode 100644 dist/snmptrapd.socket
+ create mode 100644 include/net-snmp/library/sd-daemon.h
+ create mode 100644 snmplib/sd-daemon.c
+
+diff --git a/README.systemd b/README.systemd
+new file mode 100644
+index 0000000..dba15d1
+--- /dev/null
++++ b/README.systemd
+@@ -0,0 +1,41 @@
++README.systemd
++--------------
++Net-SNMP provides two daemons, which support systemd system manager.
++See http://www.freedesktop.org/wiki/Software/systemd to learn how
++systemd works. Both socket activation and notification is supported by these
++daemons.
++
++To enable systemd support, the sources must be compiled with
++--with-systemd configure option.
++
++snmpd - The SNMP agent
++----------------------
++Socket activation od snmpd daemon is implemented, but it's discouraged.
++The reason is simple - snmpd not only listens and processes SNMP requests
++from network, but also gathers system statistics counters, sends traps and
++communicates with subagents. It even opens few netlink sockets.
++
++In other words, snmpd should run from system start to properly work.
++This can be done in two ways:
++1) either as snmpd service unit with 'Type=notification' and without a socket
++ unit
++2) or as snmpd service unit with 'Type=simple', appropriate socket socket unit
++ and the snmpd service enabled. This way systemd creates the snmpd listening
++ socket early during boot and passes the sockets to snmpd slightly later
++ (but still during machine boot). This way systemd can paralelize start of
++ services, which depend on snmpd. Admins must adjust the socket file manually,
++ depending if the snmpd support AgentX, IPv6, SMUX etc.
++
++snmpd should be started with '-f' command line parameter to disable forking -
++systemd does that for us automatically.
++
++
++snmptrapd - The trap processing daemon
++--------------------------------------
++snmptrapd supports full socket activation and also notification (if needed).
++Both 'Type=simple' (with appropriate socket unit) and 'Type=notify' services
++will work. Again, '-f' parameter should be provided on snmptrapd command line.
++
++If integration with SNMP agent using AgentX protocol is enabled, snmptrapd should
++start during boot and not after first SNMP trap arrives. Same rules as for snmpd
++applies then.
+diff --git a/agent/snmpd.c b/agent/snmpd.c
+index cfc7bce..116ee5c 100644
+--- a/agent/snmpd.c
++++ b/agent/snmpd.c
+@@ -164,6 +164,10 @@ typedef long fd_mask;
+
+ #endif
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ netsnmp_feature_want(logging_file)
+ netsnmp_feature_want(logging_stdio)
+ netsnmp_feature_want(logging_syslog)
+@@ -443,19 +447,29 @@ main(int argc, char *argv[])
+ int agent_mode = -1;
+ char *pid_file = NULL;
+ char option_compatability[] = "-Le";
++#ifndef WIN32
++ int prepared_sockets = 0;
++#endif
+ #if HAVE_GETPID
+ int fd;
+ FILE *PID;
+ #endif
+
+ #ifndef WIN32
++#ifndef NETSNMP_NO_SYSTEMD
++ /* check if systemd has sockets for us and don't close them */
++ prepared_sockets = netsnmp_sd_listen_fds(0);
++#endif /* NETSNMP_NO_SYSTEMD */
++
+ /*
+ * close all non-standard file descriptors we may have
+ * inherited from the shell.
+ */
+- for (i = getdtablesize() - 1; i > 2; --i) {
+- (void) close(i);
+- }
++ if (!prepared_sockets) {
++ for (i = getdtablesize() - 1; i > 2; --i) {
++ (void) close(i);
++ }
++}
+ #endif /* #WIN32 */
+
+ /*
+@@ -1107,6 +1121,19 @@ main(int argc, char *argv[])
+ netsnmp_addrcache_initialise();
+
+ /*
++ * Let systemd know we're up.
++ */
++#ifndef NETSNMP_NO_SYSTEMD
++ netsnmp_sd_notify(1, "READY=1\n");
++ if (prepared_sockets)
++ /*
++ * Clear the environment variable, we already processed all the sockets
++ * by now.
++ */
++ netsnmp_sd_listen_fds(1);
++#endif
++
++ /*
+ * Forever monitor the dest_port for incoming PDUs.
+ */
+ DEBUGMSGTL(("snmpd/main", "We're up. Starting to process data.\n"));
+diff --git a/apps/snmptrapd.c b/apps/snmptrapd.c
+index bce0d47..c6a74ec 100644
+--- a/apps/snmptrapd.c
++++ b/apps/snmptrapd.c
+@@ -125,6 +125,10 @@ SOFTWARE.
+
+ #include <net-snmp/net-snmp-features.h>
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ #ifndef BSD4_3
+ #define BSD4_2
+ #endif
+@@ -657,16 +661,25 @@ main(int argc, char *argv[])
+ int agentx_subagent = 1;
+ #endif
+ netsnmp_trapd_handler *traph;
++#ifndef WIN32
++ int prepared_sockets = 0;
++#endif
+
+
+ #ifndef WIN32
++#ifndef NETSNMP_NO_SYSTEMD
++ /* check if systemd has sockets for us and don't close them */
++ prepared_sockets = netsnmp_sd_listen_fds(0);
++#endif
+ /*
+ * close all non-standard file descriptors we may have
+ * inherited from the shell.
+ */
+- for (i = getdtablesize() - 1; i > 2; --i) {
+- (void) close(i);
+- }
++ if (!prepared_sockets) {
++ for (i = getdtablesize() - 1; i > 2; --i) {
++ (void) close(i);
++ }
++}
+ #endif /* #WIN32 */
+
+ #ifdef SIGTERM
+@@ -1318,6 +1331,19 @@ main(int argc, char *argv[])
+ #endif
+ #endif
+
++ /*
++ * Let systemd know we're up.
++ */
++#ifndef NETSNMP_NO_SYSTEMD
++ netsnmp_sd_notify(1, "READY=1\n");
++ if (prepared_sockets)
++ /*
++ * Clear the environment variable, we already processed all the sockets
++ * by now.
++ */
++ netsnmp_sd_listen_fds(1);
++#endif
++
+ #ifdef WIN32SERVICE
+ trapd_status = SNMPTRAPD_RUNNING;
+ #endif
+diff --git a/configure.d/config_modules_lib b/configure.d/config_modules_lib
+index 362ba0a..bb69daa 100644
+--- a/configure.d/config_modules_lib
++++ b/configure.d/config_modules_lib
+@@ -53,6 +53,14 @@ if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"
+ other_ftobjs_list="$other_ftobjs_list winpipe.ft"
+ fi
+
++# Linux systemd
++if test "x$with_systemd" == "xyes"; then
++ other_src_list="$other_src_list sd-daemon.c"
++ other_objs_list="$other_objs_list sd-daemon.o"
++ other_lobjs_list="$other_lobjs_list sd-daemon.lo"
++ other_ftobjs_list="$other_ftobjs_list sd-daemon.ft"
++fi
++
+ AC_SUBST(other_src_list)
+ AC_SUBST(other_objs_list)
+ AC_SUBST(other_lobjs_list)
+diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable
+index 61ba026..d782d12 100644
+--- a/configure.d/config_project_with_enable
++++ b/configure.d/config_project_with_enable
+@@ -690,6 +690,15 @@ if test "x$with_dummy_values" != "xyes"; then
+ data for])
+ fi
+
++NETSNMP_ARG_WITH(systemd,
++[ --with-systemd Provide systemd support. See README.systemd
++ for details.])
++# Define unless specifically suppressed (i.e., option defaults to false).
++if test "x$with_systemd" != "xyes"; then
++ AC_DEFINE(NETSNMP_NO_SYSTEMD, 1,
++ [If you don't want to integrate with systemd.])
++fi
++
+ NETSNMP_ARG_ENABLE(set-support,
+ [ --disable-set-support Do not allow SNMP set requests.])
+ if test "x$enable_set_support" = "xno"; then
+diff --git a/dist/snmpd.servic b/dist/snmpd.servic
+new file mode 100644
+index 0000000..31391e5
+--- /dev/null
++++ b/dist/snmpd.servic
+@@ -0,0 +1,18 @@
++#
++# SNMP agent service file for systemd
++#
++#
++# The service should be enabled, i.e. snmpd should start during machine boot.
++# Socket activation shall not be used. See README.systemd for details.
++
++[Unit]
++Description=Simple Network Management Protocol (SNMP) daemon.
++After=syslog.target network.target
++
++[Service]
++# Type=notify is also supported. It should be set when snmpd.socket is not used.
++Type=simple
++ExecStart=/usr/sbin/snmpd -f
++
++[Install]
++WantedBy=multi-user.target
+diff --git a/dist/snmpd.socket b/dist/snmpd.socket
+new file mode 100644
+index 0000000..7f3a2d9
+--- /dev/null
++++ b/dist/snmpd.socket
+@@ -0,0 +1,17 @@
++[Unit]
++Description=Socket listening for SNMP and AgentX messages
++
++[Socket]
++ListenDatagram=0.0.0.0:161
++# Uncomment other listening addresses as needed - TCP, UDP6, TCP6.
++# It must match listening addresses/ports defined in snmpd.service
++# or snmpd.conf.
++# ListenStream=0.0.0.0:161
++# ListenDatagram=[::]:161
++# ListenStream=[::]:161
++#
++# Uncomment AgentX socket if snmpd.conf enables AgentX protocol.
++# ListenStream=/var/agentx/master
++
++[Install]
++WantedBy=sockets.target
+diff --git a/dist/snmptrapd.service b/dist/snmptrapd.service
+new file mode 100644
+index 0000000..e88a5b4
+--- /dev/null
++++ b/dist/snmptrapd.service
+@@ -0,0 +1,16 @@
++#
++# SNMP trap-processing service file for systemd
++#
++
++[Unit]
++Description=Simple Network Management Protocol (SNMP) Trap daemon.
++After=syslog.target network.target
++
++[Service]
++# Type=notify is also supported. It should be set when snmptrapd.socket is not
++# used.
++Type=simple
++ExecStart=/usr/sbin/snmptrapd -f
++
++[Install]
++WantedBy=multi-user.target
+diff --git a/dist/snmptrapd.socket b/dist/snmptrapd.socket
+new file mode 100644
+index 0000000..2d24fb8
+--- /dev/null
++++ b/dist/snmptrapd.socket
+@@ -0,0 +1,14 @@
+++[Unit]
+++Description=Socket listening for SNMP trap messages
+++
+++[Socket]
+++ListenDatagram=0.0.0.0:162
+++# Uncomment other listening addresses as needed - TCP, UDP6, TCP6.
+++# It must match listening addresses/ports defined in snmptrapd.service
+++# or snmptrapd.conf.
+++# ListenStream=0.0.0.0:162
+++# ListenDatagram=[::]:162
+++# ListenStream=[::]:162
+++
+++[Install]
+++WantedBy=sockets.target
+diff --git a/include/net-snmp/library/sd-daemon.h b/include/net-snmp/library/sd-daemon.h
+new file mode 100644
+index 0000000..85274c9
+--- /dev/null
++++ b/include/net-snmp/library/sd-daemon.h
+@@ -0,0 +1,290 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++#ifndef SNMPD_SD_DAEMON_H
++#define SNMPD_SD_DAEMON_H
++
++/***
++ Copyright 2010 Lennart Poettering
++
++ Permission is hereby granted, free of charge, to any person
++ obtaining a copy of this software and associated documentation files
++ (the "Software"), to deal in the Software without restriction,
++ including without limitation the rights to use, copy, modify, merge,
++ publish, distribute, sublicense, and/or sell copies of the Software,
++ and to permit persons to whom the Software is furnished to do so,
++ subject to the following conditions:
++
++ The above copyright notice and this permission notice shall be
++ included in all copies or substantial portions of the Software.
++
++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ SOFTWARE.
++***/
++
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#ifdef HAVE_INTTYPES_H
++#include <inttypes.h>
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++ Reference implementation of a few systemd related interfaces for
++ writing daemons. These interfaces are trivial to implement. To
++ simplify porting we provide this reference implementation.
++ Applications are welcome to reimplement the algorithms described
++ here if they do not want to include these two source files.
++
++ The following functionality is provided:
++
++ - Support for logging with log levels on stderr
++ - File descriptor passing for socket-based activation
++ - Daemon startup and status notification
++ - Detection of systemd boots
++
++ You may compile this with -DDISABLE_SYSTEMD to disable systemd
++ support. This makes all those calls NOPs that are directly related to
++ systemd (i.e. only sd_is_xxx() will stay useful).
++
++ Since this is drop-in code we don't want any of our symbols to be
++ exported in any case. Hence we declare hidden visibility for all of
++ them.
++
++ You may find an up-to-date version of these source files online:
++
++ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h
++ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c
++
++ This should compile on non-Linux systems, too, but with the
++ exception of the sd_is_xxx() calls all functions will become NOPs.
++
++ See sd-daemon(7) for more information.
++*/
++
++#ifndef _sd_printf_attr_
++#if __GNUC__ >= 4
++#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
++#else
++#define _sd_printf_attr_(a,b)
++#endif
++#endif
++
++/*
++ Log levels for usage on stderr:
++
++ fprintf(stderr, SD_NOTICE "Hello World!\n");
++
++ This is similar to printk() usage in the kernel.
++*/
++#define SD_EMERG "<0>" /* system is unusable */
++#define SD_ALERT "<1>" /* action must be taken immediately */
++#define SD_CRIT "<2>" /* critical conditions */
++#define SD_ERR "<3>" /* error conditions */
++#define SD_WARNING "<4>" /* warning conditions */
++#define SD_NOTICE "<5>" /* normal but significant condition */
++#define SD_INFO "<6>" /* informational */
++#define SD_DEBUG "<7>" /* debug-level messages */
++
++/* The first passed file descriptor is fd 3 */
++#define SD_LISTEN_FDS_START 3
++
++/*
++ Returns how many file descriptors have been passed, or a negative
++ errno code on failure. Optionally, removes the $LISTEN_FDS and
++ $LISTEN_PID file descriptors from the environment (recommended, but
++ problematic in threaded environments). If r is the return value of
++ this function you'll find the file descriptors passed as fds
++ SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
++ errno style error code on failure. This function call ensures that
++ the FD_CLOEXEC flag is set for the passed file descriptors, to make
++ sure they are not passed on to child processes. If FD_CLOEXEC shall
++ not be set, the caller needs to unset it after this call for all file
++ descriptors that are used.
++
++ See sd_listen_fds(3) for more information.
++*/
++int netsnmp_sd_listen_fds(int unset_environment);
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is a FIFO in the file system stored under the
++ specified path, 0 otherwise. If path is NULL a path name check will
++ not be done and the call only verifies if the file descriptor
++ refers to a FIFO. Returns a negative errno style error code on
++ failure.
++
++ See sd_is_fifo(3) for more information.
++*/
++int netsnmp_sd_is_fifo(int fd, const char *path);
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is a special character device on the file
++ system stored under the specified path, 0 otherwise.
++ If path is NULL a path name check will not be done and the call
++ only verifies if the file descriptor refers to a special character.
++ Returns a negative errno style error code on failure.
++
++ See sd_is_special(3) for more information.
++*/
++int netsnmp_sd_is_special(int fd, const char *path);
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is a socket of the specified family (AF_INET,
++ ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
++ family is 0 a socket family check will not be done. If type is 0 a
++ socket type check will not be done and the call only verifies if
++ the file descriptor refers to a socket. If listening is > 0 it is
++ verified that the socket is in listening mode. (i.e. listen() has
++ been called) If listening is == 0 it is verified that the socket is
++ not in listening mode. If listening is < 0 no listening mode check
++ is done. Returns a negative errno style error code on failure.
++
++ See sd_is_socket(3) for more information.
++*/
++int netsnmp_sd_is_socket(int fd, int family, int type, int listening);
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is an Internet socket, of the specified family
++ (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
++ SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
++ check is not done. If type is 0 a socket type check will not be
++ done. If port is 0 a socket port check will not be done. The
++ listening flag is used the same way as in sd_is_socket(). Returns a
++ negative errno style error code on failure.
++
++ See sd_is_socket_inet(3) for more information.
++*/
++int netsnmp_sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port);
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is an AF_UNIX socket of the specified type
++ (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
++ a socket type check will not be done. If path is NULL a socket path
++ check will not be done. For normal AF_UNIX sockets set length to
++ 0. For abstract namespace sockets set length to the length of the
++ socket name (including the initial 0 byte), and pass the full
++ socket path in path (including the initial 0 byte). The listening
++ flag is used the same way as in sd_is_socket(). Returns a negative
++ errno style error code on failure.
++
++ See sd_is_socket_unix(3) for more information.
++*/
++int netsnmp_sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length);
++
++/*
++ Informs systemd about changed daemon state. This takes a number of
++ newline separated environment-style variable assignments in a
++ string. The following variables are known:
++
++ READY=1 Tells systemd that daemon startup is finished (only
++ relevant for services of Type=notify). The passed
++ argument is a boolean "1" or "0". Since there is
++ little value in signaling non-readiness the only
++ value daemons should send is "READY=1".
++
++ STATUS=... Passes a single-line status string back to systemd
++ that describes the daemon state. This is free-from
++ and can be used for various purposes: general state
++ feedback, fsck-like programs could pass completion
++ percentages and failing programs could pass a human
++ readable error message. Example: "STATUS=Completed
++ 66% of file system check..."
++
++ ERRNO=... If a daemon fails, the errno-style error code,
++ formatted as string. Example: "ERRNO=2" for ENOENT.
++
++ BUSERROR=... If a daemon fails, the D-Bus error-style error
++ code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
++
++ MAINPID=... The main pid of a daemon, in case systemd did not
++ fork off the process itself. Example: "MAINPID=4711"
++
++ Daemons can choose to send additional variables. However, it is
++ recommended to prefix variable names not listed above with X_.
++
++ Returns a negative errno-style error code on failure. Returns > 0
++ if systemd could be notified, 0 if it couldn't possibly because
++ systemd is not running.
++
++ Example: When a daemon finished starting up, it could issue this
++ call to notify systemd about it:
++
++ sd_notify(0, "READY=1");
++
++ See sd_notifyf() for more complete examples.
++
++ See sd_notify(3) for more information.
++*/
++int netsnmp_sd_notify(int unset_environment, const char *state);
++
++/*
++ Similar to sd_notify() but takes a format string.
++
++ Example 1: A daemon could send the following after initialization:
++
++ sd_notifyf(0, "READY=1\n"
++ "STATUS=Processing requests...\n"
++ "MAINPID=%lu",
++ (unsigned long) getpid());
++
++ Example 2: A daemon could send the following shortly before
++ exiting, on failure:
++
++ sd_notifyf(0, "STATUS=Failed to start up: %s\n"
++ "ERRNO=%i",
++ strerror(errno),
++ errno);
++
++ See sd_notifyf(3) for more information.
++*/
++int netsnmp_sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3);
++
++/*
++ Returns > 0 if the system was booted with systemd. Returns < 0 on
++ error. Returns 0 if the system was not booted with systemd. Note
++ that all of the functions above handle non-systemd boots just
++ fine. You should NOT protect them with a call to this function. Also
++ note that this function checks whether the system, not the user
++ session is controlled by systemd. However the functions above work
++ for both user and system services.
++
++ See sd_booted(3) for more information.
++*/
++int netsnmp_sd_booted(void);
++
++/**
++ * Find an socket with given parameters. See man sd_is_socket_inet for
++ * description of the arguments.
++ *
++ * Returns the file descriptor if it is found, 0 otherwise.
++ */
++int netsnmp_sd_find_inet_socket(int family, int type, int listening, int port);
++
++/**
++ * Find an unix socket with given parameters. See man sd_is_socket_unix for
++ * description of the arguments.
++ *
++ * Returns the file descriptor if it is found, 0 otherwise.
++ */
++int
++netsnmp_sd_find_unix_socket(int type, int listening, const char *path);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* SNMPD_SD_DAEMON_H */
+diff --git a/snmplib/sd-daemon.c b/snmplib/sd-daemon.c
+new file mode 100644
+index 0000000..42dba29
+--- /dev/null
++++ b/snmplib/sd-daemon.c
+@@ -0,0 +1,532 @@
++/*
++ * Systemd integration parts.
++ *
++ * Most of this file is directly copied from systemd sources.
++ * Changes:
++ * - all functions were renamed to have netsnmp_ prefix
++ * - includes were changed to match Net-SNMP style.
++ * - removed gcc export macros
++ * - removed POSIX message queues
++ */
++
++#include <net-snmp/net-snmp-config.h>
++#include <net-snmp/net-snmp-features.h>
++#include <net-snmp/types.h>
++#include <net-snmp/library/snmp_debug.h>
++
++#ifndef NETSNMP_NO_SYSTEMD
++
++/***
++ Copyright 2010 Lennart Poettering
++
++ Permission is hereby granted, free of charge, to any person
++ obtaining a copy of this software and associated documentation files
++ (the "Software"), to deal in the Software without restriction,
++ including without limitation the rights to use, copy, modify, merge,
++ publish, distribute, sublicense, and/or sell copies of the Software,
++ and to permit persons to whom the Software is furnished to do so,
++ subject to the following conditions:
++
++ The above copyright notice and this permission notice shall be
++ included in all copies or substantial portions of the Software.
++
++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ SOFTWARE.
++***/
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE
++#endif
++
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/socket.h>
++#include <sys/un.h>
++#include <sys/fcntl.h>
++#include <netinet/in.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <unistd.h>
++#include <string.h>
++#include <stdarg.h>
++#include <stdio.h>
++#include <stddef.h>
++#include <limits.h>
++
++#include <net-snmp/library/sd-daemon.h>
++
++int netsnmp_sd_listen_fds(int unset_environment) {
++
++ int r, fd;
++ const char *e;
++ char *p = NULL;
++ unsigned long l;
++
++ if (!(e = getenv("LISTEN_PID"))) {
++ r = 0;
++ goto finish;
++ }
++
++ errno = 0;
++ l = strtoul(e, &p, 10);
++
++ if (errno != 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ if (!p || *p || l <= 0) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ /* Is this for us? */
++ if (getpid() != (pid_t) l) {
++ r = 0;
++ goto finish;
++ }
++
++ if (!(e = getenv("LISTEN_FDS"))) {
++ r = 0;
++ goto finish;
++ }
++
++ errno = 0;
++ l = strtoul(e, &p, 10);
++
++ if (errno != 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ if (!p || *p) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
++ int flags;
++
++ if ((flags = fcntl(fd, F_GETFD)) < 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ if (flags & FD_CLOEXEC)
++ continue;
++
++ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
++ r = -errno;
++ goto finish;
++ }
++ }
++
++ r = (int) l;
++
++finish:
++ if (unset_environment) {
++ unsetenv("LISTEN_PID");
++ unsetenv("LISTEN_FDS");
++ }
++
++ return r;
++}
++
++int netsnmp_sd_is_fifo(int fd, const char *path) {
++ struct stat st_fd;
++
++ if (fd < 0)
++ return -EINVAL;
++
++ memset(&st_fd, 0, sizeof(st_fd));
++ if (fstat(fd, &st_fd) < 0)
++ return -errno;
++
++ if (!S_ISFIFO(st_fd.st_mode))
++ return 0;
++
++ if (path) {
++ struct stat st_path;
++
++ memset(&st_path, 0, sizeof(st_path));
++ if (stat(path, &st_path) < 0) {
++
++ if (errno == ENOENT || errno == ENOTDIR)
++ return 0;
++
++ return -errno;
++ }
++
++ return
++ st_path.st_dev == st_fd.st_dev &&
++ st_path.st_ino == st_fd.st_ino;
++ }
++
++ return 1;
++}
++
++int netsnmp_sd_is_special(int fd, const char *path) {
++ struct stat st_fd;
++
++ if (fd < 0)
++ return -EINVAL;
++
++ if (fstat(fd, &st_fd) < 0)
++ return -errno;
++
++ if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode))
++ return 0;
++
++ if (path) {
++ struct stat st_path;
++
++ if (stat(path, &st_path) < 0) {
++
++ if (errno == ENOENT || errno == ENOTDIR)
++ return 0;
++
++ return -errno;
++ }
++
++ if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode))
++ return
++ st_path.st_dev == st_fd.st_dev &&
++ st_path.st_ino == st_fd.st_ino;
++ else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode))
++ return st_path.st_rdev == st_fd.st_rdev;
++ else
++ return 0;
++ }
++
++ return 1;
++}
++
++static int sd_is_socket_internal(int fd, int type, int listening) {
++ struct stat st_fd;
++
++ if (fd < 0 || type < 0)
++ return -EINVAL;
++
++ if (fstat(fd, &st_fd) < 0)
++ return -errno;
++
++ if (!S_ISSOCK(st_fd.st_mode))
++ return 0;
++
++ if (type != 0) {
++ int other_type = 0;
++ socklen_t l = sizeof(other_type);
++
++ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
++ return -errno;
++
++ if (l != sizeof(other_type))
++ return -EINVAL;
++
++ if (other_type != type)
++ return 0;
++ }
++
++ if (listening >= 0) {
++ int accepting = 0;
++ socklen_t l = sizeof(accepting);
++
++ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
++ return -errno;
++
++ if (l != sizeof(accepting))
++ return -EINVAL;
++
++ if (!accepting != !listening)
++ return 0;
++ }
++
++ return 1;
++}
++
++union sockaddr_union {
++ struct sockaddr sa;
++ struct sockaddr_in in4;
++ struct sockaddr_in6 in6;
++ struct sockaddr_un un;
++ struct sockaddr_storage storage;
++};
++
++int netsnmp_sd_is_socket(int fd, int family, int type, int listening) {
++ int r;
++
++ if (family < 0)
++ return -EINVAL;
++
++ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
++ return r;
++
++ if (family > 0) {
++ union sockaddr_union sockaddr;
++ socklen_t l;
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ l = sizeof(sockaddr);
++
++ if (getsockname(fd, &sockaddr.sa, &l) < 0)
++ return -errno;
++
++ if (l < sizeof(sa_family_t))
++ return -EINVAL;
++
++ return sockaddr.sa.sa_family == family;
++ }
++
++ return 1;
++}
++
++int netsnmp_sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
++ union sockaddr_union sockaddr;
++ socklen_t l;
++ int r;
++
++ if (family != 0 && family != AF_INET && family != AF_INET6)
++ return -EINVAL;
++
++ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
++ return r;
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ l = sizeof(sockaddr);
++
++ if (getsockname(fd, &sockaddr.sa, &l) < 0)
++ return -errno;
++
++ if (l < sizeof(sa_family_t))
++ return -EINVAL;
++
++ if (sockaddr.sa.sa_family != AF_INET &&
++ sockaddr.sa.sa_family != AF_INET6)
++ return 0;
++
++ if (family > 0)
++ if (sockaddr.sa.sa_family != family)
++ return 0;
++
++ if (port > 0) {
++ if (sockaddr.sa.sa_family == AF_INET) {
++ if (l < sizeof(struct sockaddr_in))
++ return -EINVAL;
++
++ return htons(port) == sockaddr.in4.sin_port;
++ } else {
++ if (l < sizeof(struct sockaddr_in6))
++ return -EINVAL;
++
++ return htons(port) == sockaddr.in6.sin6_port;
++ }
++ }
++
++ return 1;
++}
++
++int netsnmp_sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
++ union sockaddr_union sockaddr;
++ socklen_t l;
++ int r;
++
++ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
++ return r;
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ l = sizeof(sockaddr);
++
++ if (getsockname(fd, &sockaddr.sa, &l) < 0)
++ return -errno;
++
++ if (l < sizeof(sa_family_t))
++ return -EINVAL;
++
++ if (sockaddr.sa.sa_family != AF_UNIX)
++ return 0;
++
++ if (path) {
++ if (length <= 0)
++ length = strlen(path);
++
++ if (length <= 0)
++ /* Unnamed socket */
++ return l == offsetof(struct sockaddr_un, sun_path);
++
++ if (path[0])
++ /* Normal path socket */
++ return
++ (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
++ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
++ else
++ /* Abstract namespace socket */
++ return
++ (l == offsetof(struct sockaddr_un, sun_path) + length) &&
++ memcmp(path, sockaddr.un.sun_path, length) == 0;
++ }
++
++ return 1;
++}
++
++int netsnmp_sd_notify(int unset_environment, const char *state) {
++ int fd = -1, r;
++ struct msghdr msghdr;
++ struct iovec iovec;
++ union sockaddr_union sockaddr;
++ const char *e;
++
++ if (!state) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ if (!(e = getenv("NOTIFY_SOCKET")))
++ return 0;
++
++ /* Must be an abstract socket, or an absolute path */
++ if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ sockaddr.sa.sa_family = AF_UNIX;
++ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
++
++ if (sockaddr.un.sun_path[0] == '@')
++ sockaddr.un.sun_path[0] = 0;
++
++ memset(&iovec, 0, sizeof(iovec));
++ iovec.iov_base = (char *)state;
++ iovec.iov_len = strlen(state);
++
++ memset(&msghdr, 0, sizeof(msghdr));
++ msghdr.msg_name = &sockaddr;
++ msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
++
++ if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
++ msghdr.msg_namelen = sizeof(struct sockaddr_un);
++
++ msghdr.msg_iov = &iovec;
++ msghdr.msg_iovlen = 1;
++
++ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ r = 1;
++
++finish:
++ if (unset_environment)
++ unsetenv("NOTIFY_SOCKET");
++
++ if (fd >= 0)
++ close(fd);
++
++ return r;
++}
++
++int netsnmp_sd_notifyf(int unset_environment, const char *format, ...) {
++ va_list ap;
++ char *p = NULL;
++ int r;
++
++ va_start(ap, format);
++ r = vasprintf(&p, format, ap);
++ va_end(ap);
++
++ if (r < 0 || !p)
++ return -ENOMEM;
++
++ r = netsnmp_sd_notify(unset_environment, p);
++ free(p);
++
++ return r;
++}
++
++int netsnmp_sd_booted(void) {
++ struct stat a, b;
++
++ /* We simply test whether the systemd cgroup hierarchy is
++ * mounted */
++
++ if (lstat("/sys/fs/cgroup", &a) < 0)
++ return 0;
++
++ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
++ return 0;
++
++ return a.st_dev != b.st_dev;
++}
++
++/* End of original sd-daemon.c from systemd sources */
++
++int
++netsnmp_sd_find_inet_socket(int family, int type, int listening, int port)
++{
++ int count, fd;
++
++ count = netsnmp_sd_listen_fds(0);
++ if (count <= 0) {
++ DEBUGMSGTL(("systemd:find_inet_socket", "No LISTEN_FDS found.\n"));
++ return 0;
++ }
++ DEBUGMSGTL(("systemd:find_inet_socket", "LISTEN_FDS reports %d sockets.\n",
++ count));
++
++ for (fd = 3; fd < 3+count; fd++) {
++ int rc = netsnmp_sd_is_socket_inet(fd, family, type, listening, port);
++ if (rc < 0)
++ DEBUGMSGTL(("systemd:find_inet_socket",
++ "sd_is_socket_inet error: %d\n", rc));
++ if (rc > 0) {
++ DEBUGMSGTL(("systemd:find_inet_socket",
++ "Found the socket in LISTEN_FDS\n"));
++ return fd;
++ }
++ }
++ DEBUGMSGTL(("systemd:find_inet_socket", "Socket not found in LISTEN_FDS\n"));
++ return 0;
++}
++
++int
++netsnmp_sd_find_unix_socket(int type, int listening, const char *path)
++{
++ int count, fd;
++
++ count = netsnmp_sd_listen_fds(0);
++ if (count <= 0) {
++ DEBUGMSGTL(("systemd:find_unix_socket", "No LISTEN_FDS found.\n"));
++ return 0;
++ }
++ DEBUGMSGTL(("systemd:find_unix_socket", "LISTEN_FDS reports %d sockets.\n",
++ count));
++
++ for (fd = 3; fd < 3+count; fd++) {
++ int rc = netsnmp_sd_is_socket_unix(fd, type, listening, path, 0);
++ if (rc < 0)
++ DEBUGMSGTL(("systemd:find_unix_socket",
++ "netsnmp_sd_is_socket_unix error: %d\n", rc));
++ if (rc > 0) {
++ DEBUGMSGTL(("systemd:find_unix_socket",
++ "Found the socket in LISTEN_FDS\n"));
++ return fd;
++ }
++ }
++ DEBUGMSGTL(("systemd:find_unix_socket", "Socket not found in LISTEN_FDS\n"));
++ return 0;
++}
++
++#endif /* ! NETSNMP_NO_SYSTEMD */
+diff --git a/snmplib/transports/snmpTCPDomain.c b/snmplib/transports/snmpTCPDomain.c
+index 7feb028..a41b926 100644
+--- a/snmplib/transports/snmpTCPDomain.c
++++ b/snmplib/transports/snmpTCPDomain.c
+@@ -43,6 +43,10 @@
+ #include <net-snmp/library/snmpTCPBaseDomain.h>
+ #include <net-snmp/library/tools.h>
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ /*
+ * needs to be in sync with the definitions in snmplib/snmpUDPDomain.c
+ * and perl/agent/agent.xs
+@@ -149,6 +153,7 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
+ netsnmp_transport *t = NULL;
+ netsnmp_udp_addr_pair *addr_pair = NULL;
+ int rc = 0;
++ int socket_initialized = 0;
+
+ #ifdef NETSNMP_NO_LISTEN_SUPPORT
+ if (local)
+@@ -178,7 +183,19 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
+ t->domain_length =
+ sizeof(netsnmp_snmpTCPDomain) / sizeof(netsnmp_snmpTCPDomain[0]);
+
+- t->sock = socket(PF_INET, SOCK_STREAM, 0);
++#ifndef NETSNMP_NO_SYSTEMD
++ /*
++ * Maybe the socket was already provided by systemd...
++ */
++ if (local) {
++ t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_STREAM, 1,
++ ntohs(addr->sin_port));
++ if (t->sock)
++ socket_initialized = 1;
++ }
++#endif
++ if (!socket_initialized)
++ t->sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (t->sock < 0) {
+ netsnmp_transport_free(t);
+ return NULL;
+@@ -215,11 +232,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
+ setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt,
+ sizeof(opt));
+
+- rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr));
+- if (rc != 0) {
+- netsnmp_socketbase_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr));
++ if (rc != 0) {
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+
+ /*
+@@ -236,11 +255,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
+ * Now sit here and wait for connections to arrive.
+ */
+
+- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
+- if (rc != 0) {
+- netsnmp_socketbase_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
++ if (rc != 0) {
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+
+ /*
+diff --git a/snmplib/transports/snmpTCPIPv6Domain.c b/snmplib/transports/snmpTCPIPv6Domain.c
+index d2e0a2d..22de6d4 100644
+--- a/snmplib/transports/snmpTCPIPv6Domain.c
++++ b/snmplib/transports/snmpTCPIPv6Domain.c
+@@ -49,6 +49,10 @@
+ #include <net-snmp/library/snmpTCPBaseDomain.h>
+ #include <net-snmp/library/tools.h>
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ #include "inet_ntop.h"
+
+ oid netsnmp_TCPIPv6Domain[] = { TRANSPORT_DOMAIN_TCP_IPV6 };
+@@ -140,6 +144,8 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
+ {
+ netsnmp_transport *t = NULL;
+ int rc = 0;
++ char *str = NULL;
++ int socket_initialized = 0;
+
+ #ifdef NETSNMP_NO_LISTEN_SUPPORT
+ if (local)
+@@ -174,7 +180,19 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
+ t->domain = netsnmp_TCPIPv6Domain;
+ t->domain_length = sizeof(netsnmp_TCPIPv6Domain) / sizeof(oid);
+
+- t->sock = socket(PF_INET6, SOCK_STREAM, 0);
++#ifndef NETSNMP_NO_SYSTEMD
++ /*
++ * Maybe the socket was already provided by systemd...
++ */
++ if (local) {
++ t->sock = netsnmp_sd_find_inet_socket(PF_INET6, SOCK_STREAM, 1,
++ ntohs(addr->sin6_port));
++ if (t->sock)
++ socket_initialized = 1;
++ }
++#endif
++ if (!socket_initialized)
++ t->sock = socket(PF_INET6, SOCK_STREAM, 0);
+ if (t->sock < 0) {
+ netsnmp_transport_free(t);
+ return NULL;
+@@ -220,12 +238,14 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
+
+ setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt));
+
+- rc = bind(t->sock, (struct sockaddr *) addr,
+- sizeof(struct sockaddr_in6));
+- if (rc != 0) {
+- netsnmp_socketbase_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = bind(t->sock, (struct sockaddr *) addr,
++ sizeof(struct sockaddr_in6));
++ if (rc != 0) {
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+
+ /*
+@@ -242,11 +262,13 @@ netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
+ * Now sit here and wait for connections to arrive.
+ */
+
+- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
+- if (rc != 0) {
+- netsnmp_socketbase_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
++ if (rc != 0) {
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+
+ /*
+diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c
+index 8c0fb05..00e5bbc 100644
+--- a/snmplib/transports/snmpUDPIPv4BaseDomain.c
++++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c
+@@ -40,6 +40,10 @@
+
+ #include <net-snmp/library/snmpSocketBaseDomain.h>
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ #if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR)
+ int netsnmp_udpipv4_recvfrom(int s, void *buf, int len, struct sockaddr *from,
+ socklen_t *fromlen, struct sockaddr *dstip,
+@@ -64,6 +68,7 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local)
+ char *client_socket = NULL;
+ netsnmp_indexed_addr_pair addr_pair;
+ socklen_t local_addr_len;
++ int socket_initialized = 0;
+
+ #ifdef NETSNMP_NO_LISTEN_SUPPORT
+ if (local)
+@@ -88,7 +93,19 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local)
+ free(str);
+ }
+
+- t->sock = socket(PF_INET, SOCK_DGRAM, 0);
++#ifndef NETSNMP_NO_SYSTEMD
++ /*
++ * Maybe the socket was already provided by systemd...
++ */
++ if (local) {
++ t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_DGRAM, -1,
++ ntohs(addr->sin_port));
++ if (t->sock)
++ socket_initialized = 1;
++ }
++#endif
++ if (!socket_initialized)
++ t->sock = socket(PF_INET, SOCK_DGRAM, 0);
+ DEBUGMSGTL(("UDPBase", "openned socket %d as local=%d\n", t->sock, local));
+ if (t->sock < 0) {
+ netsnmp_transport_free(t);
+@@ -151,12 +168,14 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local)
+ }
+ }
+ #endif /* !defined(WIN32) */
+- rc = bind(t->sock, (struct sockaddr *) addr,
+- sizeof(struct sockaddr));
+- if (rc != 0) {
+- netsnmp_socketbase_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = bind(t->sock, (struct sockaddr *) addr,
++ sizeof(struct sockaddr));
++ if (rc != 0) {
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+ t->data = NULL;
+ t->data_length = 0;
+diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
+index 18de876..fd2ced4 100644
+--- a/snmplib/transports/snmpUDPIPv6Domain.c
++++ b/snmplib/transports/snmpUDPIPv6Domain.c
+@@ -67,6 +67,10 @@ static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+ #include <net-snmp/library/snmpSocketBaseDomain.h>
+ #include <net-snmp/library/tools.h>
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ #include "inet_ntop.h"
+ #include "inet_pton.h"
+
+@@ -190,6 +194,8 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
+ {
+ netsnmp_transport *t = NULL;
+ int rc = 0;
++ char *str = NULL;
++ int socket_initialized = 0;
+
+ #ifdef NETSNMP_NO_LISTEN_SUPPORT
+ if (local)
+@@ -217,7 +223,19 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
+ t->domain_length =
+ sizeof(netsnmp_UDPIPv6Domain) / sizeof(netsnmp_UDPIPv6Domain[0]);
+
+- t->sock = socket(PF_INET6, SOCK_DGRAM, 0);
++#ifndef NETSNMP_NO_SYSTEMD
++ /*
++ * Maybe the socket was already provided by systemd...
++ */
++ if (local) {
++ t->sock = netsnmp_sd_find_inet_socket(PF_INET6, SOCK_DGRAM, -1,
++ ntohs(addr->sin6_port));
++ if (t->sock)
++ socket_initialized = 1;
++ }
++#endif
++ if (!socket_initialized)
++ t->sock = socket(PF_INET6, SOCK_DGRAM, 0);
+ if (t->sock < 0) {
+ netsnmp_transport_free(t);
+ return NULL;
+@@ -243,12 +261,14 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
+ }
+ #endif
+
+- rc = bind(t->sock, (struct sockaddr *) addr,
+- sizeof(struct sockaddr_in6));
+- if (rc != 0) {
+- netsnmp_socketbase_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = bind(t->sock, (struct sockaddr *) addr,
++ sizeof(struct sockaddr_in6));
++ if (rc != 0) {
++ netsnmp_socketbase_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+ t->local = (unsigned char*)malloc(18);
+ if (t->local == NULL) {
+diff --git a/snmplib/transports/snmpUnixDomain.c b/snmplib/transports/snmpUnixDomain.c
+index 47dffc1..8f34c37 100644
+--- a/snmplib/transports/snmpUnixDomain.c
++++ b/snmplib/transports/snmpUnixDomain.c
+@@ -37,6 +37,10 @@
+ #include <net-snmp/library/system.h> /* mkdirhier */
+ #include <net-snmp/library/tools.h>
+
++#ifndef NETSNMP_NO_SYSTEMD
++#include <net-snmp/library/sd-daemon.h>
++#endif
++
+ netsnmp_feature_child_of(transport_unix_socket_all, transport_all)
+ netsnmp_feature_child_of(unix_socket_paths, transport_unix_socket_all)
+
+@@ -295,6 +299,8 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
+ netsnmp_transport *t = NULL;
+ sockaddr_un_pair *sup = NULL;
+ int rc = 0;
++ char *string = NULL;
++ int socket_initialized = 0;
+
+ #ifdef NETSNMP_NO_LISTEN_SUPPORT
+ /* SPECIAL CIRCUMSTANCE: We still want AgentX to be able to operate,
+@@ -333,7 +339,18 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
+ t->data_length = sizeof(sockaddr_un_pair);
+ sup = (sockaddr_un_pair *) t->data;
+
+- t->sock = socket(PF_UNIX, SOCK_STREAM, 0);
++#ifndef NETSNMP_NO_SYSTEMD
++ /*
++ * Maybe the socket was already provided by systemd...
++ */
++ if (local) {
++ t->sock = netsnmp_sd_find_unix_socket(SOCK_STREAM, 1, addr->sun_path);
++ if (t->sock)
++ socket_initialized = 1;
++ }
++#endif
++ if (!socket_initialized)
++ t->sock = socket(PF_UNIX, SOCK_STREAM, 0);
+ if (t->sock < 0) {
+ netsnmp_transport_free(t);
+ return NULL;
+@@ -357,25 +374,26 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
+
+ t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN;
+
+- unlink(addr->sun_path);
+- rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
+-
+- if (rc != 0 && errno == ENOENT && create_path) {
+- rc = mkdirhier(addr->sun_path, create_mode, 1);
++ if (!socket_initialized) {
++ unlink(addr->sun_path);
++ rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
++ if (rc != 0 && errno == ENOENT && create_path) {
++ rc = mkdirhier(addr->sun_path, create_mode, 1);
++ if (rc != 0) {
++ netsnmp_unix_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
++ rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
++ }
+ if (rc != 0) {
++ DEBUGMSGTL(("netsnmp_unix_transport",
++ "couldn't bind \"%s\", errno %d (%s)\n",
++ addr->sun_path, errno, strerror(errno)));
+ netsnmp_unix_close(t);
+ netsnmp_transport_free(t);
+ return NULL;
+ }
+- rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
+- }
+- if (rc != 0) {
+- DEBUGMSGTL(("netsnmp_unix_transport",
+- "couldn't bind \"%s\", errno %d (%s)\n",
+- addr->sun_path, errno, strerror(errno)));
+- netsnmp_unix_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
+ }
+
+ /*
+@@ -391,14 +409,16 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local)
+ * Now sit here and listen for connections to arrive.
+ */
+
+- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
+- if (rc != 0) {
+- DEBUGMSGTL(("netsnmp_unix_transport",
+- "couldn't listen to \"%s\", errno %d (%s)\n",
+- addr->sun_path, errno, strerror(errno)));
+- netsnmp_unix_close(t);
+- netsnmp_transport_free(t);
+- return NULL;
++ if (!socket_initialized) {
++ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
++ if (rc != 0) {
++ DEBUGMSGTL(("netsnmp_unix_transport",
++ "couldn't listen to \"%s\", errno %d (%s)\n",
++ addr->sun_path, errno, strerror(errno)));
++ netsnmp_unix_close(t);
++ netsnmp_transport_free(t);
++ return NULL;
++ }
+ }
+
+ } else {
+diff --git a/win32/libsnmp/Makefile.in b/win32/libsnmp/Makefile.in
+index 98d83c8..b228d20 100644
+--- a/win32/libsnmp/Makefile.in
++++ b/win32/libsnmp/Makefile.in
+@@ -42,6 +42,7 @@ LIB32_OBJS= \
+ "$(INTDIR)\read_config.obj" \
+ "$(INTDIR)\readdir.obj" \
+ "$(INTDIR)\scapi.obj" \
++ "$(INTDIR)\sd-daemon.obj" \
+ "$(INTDIR)\snmp-tc.obj" \
+ "$(INTDIR)\snmp.obj" \
+ "$(INTDIR)\snmpCallbackDomain.obj" \
+@@ -138,6 +139,11 @@ SOURCE=..\..\snmplib\asn1.c
+ "$(INTDIR)\asn1.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
++SOURCE=..\..\snmplib\sd-daemon.c
++
++"$(INTDIR)\sd-daemon.obj" : $(SOURCE) "$(INTDIR)"
++ $(CPP) $(CPP_PROJ) $(SOURCE)
++
+
+ SOURCE=..\..\snmplib\callback.c
+
+diff --git a/win32/net-snmp/net-snmp-config.h b/win32/net-snmp/net-snmp-config.h
+index 1608563..7aec547 100644
+--- a/win32/net-snmp/net-snmp-config.h
++++ b/win32/net-snmp/net-snmp-config.h
+@@ -1717,6 +1717,8 @@ enum {
+ #define DMALLOC_FUNC_CHECK
+ #endif
+
+++#define NETSNMP_NO_SYSTEMD
+++
+ /* #undef NETSNMP_ENABLE_LOCAL_SMUX */
+
+ /* define if agentx transport is to use domain sockets only */
+diff --git a/win32/net-snmp/net-snmp-config.h.in b/win32/net-snmp/net-snmp-config.h.in
+index 9693730..96ec3d9 100644
+--- a/win32/net-snmp/net-snmp-config.h.in
++++ b/win32/net-snmp/net-snmp-config.h.in
+@@ -1717,6 +1717,8 @@ enum {
+ #define DMALLOC_FUNC_CHECK
+ #endif
+
++#define NETSNMP_NO_SYSTEMD
++
+ /* #undef NETSNMP_ENABLE_LOCAL_SMUX */
+
+ /* define if agentx transport is to use domain sockets only */
+--
+1.8.4.2
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
new file mode 100644
index 000000000..faf73a563
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
@@ -0,0 +1,244 @@
+SUMMARY = "Various tools relating to the Simple Network Management Protocol"
+HOMEPAGE = "http://www.net-snmp.org/"
+SECTION = "net"
+LICENSE = "BSD"
+
+LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5a622ea24634e"
+
+DEPENDS = "openssl libnl pciutils"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
+ file://init \
+ file://snmpd.conf \
+ file://snmptrapd.conf \
+ file://systemd-support.patch \
+ file://snmpd.service \
+ file://snmptrapd.service \
+ file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \
+ file://fix-libtool-finish.patch \
+ file://net-snmp-testing-add-the-output-format-for-ptest.patch \
+ file://run-ptest \
+ file://dont-return-incompletely-parsed-varbinds.patch \
+ file://0001-config_os_headers-Error-Fix.patch \
+ file://0001-config_os_libs2-Error-Fix.patch \
+ file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \
+ file://net-snmp-agentx-crash.patch \
+ file://0001-get_pid_from_inode-Include-limit.h.patch \
+ file://0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch \
+ file://0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch \
+ file://0001-configure-fix-check-for-enable-perl-cc-checks.patch \
+ file://0002-configure-fix-a-cc-check-issue.patch \
+ file://0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch \
+ file://0004-configure-fix-incorrect-variable.patch \
+ file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
+ file://net-snmp-fix-for-disable-des.patch \
+ file://0001-Remove-U64-typedef.patch \
+ "
+SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee"
+SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e"
+
+inherit autotools-brokensep update-rc.d siteinfo systemd pkgconfig perlnative
+
+EXTRA_OEMAKE = "INSTALL_PREFIX=${D} OTHERLDFLAGS='${LDFLAGS}' HOST_CPPFLAGS='${BUILD_CPPFLAGS}'"
+
+PARALLEL_MAKE = ""
+CCACHE = ""
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils"
+PACKAGECONFIG[libnl] = "--with-nl, --without-nl, libnl"
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
+PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,,"
+
+PACKAGECONFIG[perl] = "--enable-embedded-perl --with-perl-modules=yes, --disable-embedded-perl --with-perl-modules=no,\
+ perl, perl perl-lib"
+
+EXTRA_OECONF = "--enable-shared \
+ --disable-manuals \
+ --with-defaults \
+ --with-install-prefix=${D} \
+ --with-persistent-directory=${localstatedir}/lib/net-snmp \
+ ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \
+"
+
+# net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp
+EXTRA_OECONF += "--with-mib-modules=smux"
+
+CACHED_CONFIGUREVARS = " \
+ ac_cv_header_valgrind_valgrind_h=no \
+ ac_cv_header_valgrind_memcheck_h=no \
+ ac_cv_ETC_MNTTAB=/etc/mtab \
+ lt_cv_shlibpath_overrides_runpath=yes \
+"
+export PERLPROG="${bindir}/env perl"
+PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
+
+HAS_PERL = "${@bb.utils.contains('PACKAGECONFIG', 'perl', '1', '0', d)}"
+
+do_configure_prepend() {
+ sed -i -e "s|I/usr/include|I${STAGING_INCDIR}|g" \
+ "${S}"/configure \
+ "${S}"/configure.d/config_os_libs2
+
+ if [ "${HAS_PERL}" = "1" ]; then
+ # this may need to be changed when package perl has any change.
+ cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl/*/Config.pm ${WORKDIR}/
+ cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl/*/Config_heavy.pl ${WORKDIR}/
+ sed -e "s@libpth => '/usr/lib.*@libpth => '${STAGING_DIR_TARGET}/${libdir} ${STAGING_DIR_TARGET}/${base_libdir}',@g" \
+ -e "s@privlibexp => '/usr@privlibexp => '${STAGING_DIR_TARGET}/usr@g" \
+ -e "s@scriptdir => '/usr@scriptdir => '${STAGING_DIR_TARGET}/usr@g" \
+ -e "s@sitearchexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
+ -e "s@sitelibexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
+ -e "s@vendorarchexp => '/usr@vendorarchexp => '${STAGING_DIR_TARGET}/usr@g" \
+ -e "s@vendorlibexp => '/usr@vendorlibexp => '${STAGING_DIR_TARGET}/usr@g" \
+ -i ${WORKDIR}/Config.pm
+ fi
+
+}
+
+do_configure_append() {
+ if [ "${HAS_PERL}" = "1" ]; then
+ sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=${STAGING_DIR_TARGET}\$\{includedir\}@g" \
+ -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L${STAGING_DIR_TARGET}\$\{libdir\}@g" \
+ -i ${B}/net-snmp-config
+ fi
+}
+
+do_install_append() {
+ install -d ${D}${sysconfdir}/snmp
+ install -d ${D}${sysconfdir}/init.d
+ install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/snmpd
+ install -m 644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/snmp/
+ install -m 644 ${WORKDIR}/snmptrapd.conf ${D}${sysconfdir}/snmp/
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
+ sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
+ -i ${D}${bindir}/net-snmp-create-v3-user
+ sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
+ -e "s@\([^ ]*-fdebug-prefix-map=[^ ]*\)\1*@@g" \
+ -e "s@\([^ ]*--sysroot=[^ ]*\)\1*@@g" \
+ -e "s@\([^ ]*--with-libtool-sysroot=[^ ]*\)\1*@@g" \
+ -e "s@\([^ ]*--with-install-prefix=[^ ]*\)\1*@@g" \
+ -i ${D}${bindir}/net-snmp-config
+
+ if [ "${HAS_PERL}" = "1" ]; then
+ sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=\$\{includedir\}@g" \
+ -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L\$\{libdir\}@g" \
+ -i ${D}${bindir}/net-snmp-config
+ fi
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}
+ for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \
+ ${B}/net-snmp-config ${S}/testing; do
+ if [ -e "$i" ]; then
+ cp -R --no-dereference --preserve=mode,links -v "$i" ${D}${PTEST_PATH}
+ fi
+ done
+ echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version
+
+ rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build"
+ for i in $rmdlist; do
+ if [ -d "$i" ]; then
+ rm -rf "$i"
+ fi
+ done
+}
+
+SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess"
+SNMP_DBGDIR = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+
+net_snmp_sysroot_preprocess () {
+ if [ -e ${D}${bindir}/net-snmp-config ]; then
+ install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
+ install -m 755 ${D}${bindir}/net-snmp-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
+ sed -e "s@-I/usr/include@-I${STAGING_INCDIR}@g" \
+ -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}${prefix}@g" \
+ -e "s@^exec_prefix=.*@exec_prefix=${STAGING_EXECPREFIXDIR}@g" \
+ -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \
+ -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \
+ -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=${S}@g" \
+ -e "s@-fdebug-prefix-map=${SNMP_DBGDIR}@-fdebug-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \
+ -e "s@-fdebug-prefix-map= -fdebug-prefix-map=@-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+ -fdebug-prefix-map=${STAGING_DIR_HOST}=@g" \
+ -e "s@--sysroot=@--sysroot=${STAGING_DIR_HOST}@g" \
+ -e "s@--with-libtool-sysroot=@--with-libtool-sysroot=${STAGING_DIR_HOST}@g" \
+ -e "s@--with-install-prefix=@--with-install-prefix=${D}@g" \
+ -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/net-snmp-config
+ fi
+}
+
+PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client ${PN}-server-snmpd ${PN}-server-snmptrapd"
+
+# perl module
+PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl-modules', '', d)}"
+
+ALLOW_EMPTY_${PN} = "1"
+ALLOW_EMPTY_${PN}-server = "1"
+
+FILES_${PN}-perl-modules = "${libdir}/perl/*"
+
+FILES_${PN}-libs = "${libdir}/lib*${SOLIBS}"
+FILES_${PN}-mibs = "${datadir}/snmp/mibs"
+FILES_${PN}-server-snmpd = "${sbindir}/snmpd \
+ ${sysconfdir}/snmp/snmpd.conf \
+ ${sysconfdir}/init.d \
+ ${systemd_unitdir}/system/snmpd.service \
+"
+
+FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \
+ ${sysconfdir}/snmp/snmptrapd.conf \
+ ${systemd_unitdir}/system/snmptrapd.service \
+"
+
+FILES_${PN} = ""
+FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/"
+FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/"
+FILES_${PN}-dev += "${bindir}/mib2c ${bindir}/mib2c-update"
+
+CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf"
+CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf"
+
+INITSCRIPT_PACKAGES = "${PN}-server-snmpd"
+INITSCRIPT_NAME_${PN}-server-snmpd = "snmpd"
+INITSCRIPT_PARAMS_${PN}-server-snmpd = "start 90 2 3 4 5 . stop 60 0 1 6 ."
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)}"
+
+SYSTEMD_PACKAGES = "${PN}-server-snmpd \
+ ${PN}-server-snmptrapd"
+
+SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service"
+SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service"
+
+RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'net-snmp-perl-modules', '', d)}"
+RDEPENDS_${PN} += "net-snmp-client"
+RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs"
+RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd"
+RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd"
+RDEPENDS_${PN}-client += "net-snmp-mibs net-snmp-libs"
+RDEPENDS_${PN}-libs += "libpci"
+RDEPENDS_${PN}-ptest += "perl \
+ perl-module-test \
+ perl-module-file-basename \
+ perl-module-getopt-long \
+ perl-module-file-temp \
+ perl-module-data-dumper \
+"
+RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
+RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
+
+RPROVIDES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
+RREPLACES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
+RCONFLICTS_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
+
+RPROVIDES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
+RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
+RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
+
+LEAD_SONAME = "libnetsnmp.so"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/nopoll/nopoll_0.4.2.b297.bb b/meta-openembedded/meta-networking/recipes-protocols/nopoll/nopoll_0.4.2.b297.bb
new file mode 100644
index 000000000..1d77891d4
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/nopoll/nopoll_0.4.2.b297.bb
@@ -0,0 +1,23 @@
+SUMMARY = "OpenSource WebSocket Toolkit"
+DESCRIPTION = "noPoll is a OpenSource WebSocket implementation (RFC 6455), \
+written in ansi C, that allows building pure WebSocket solutions or to \
+provide WebSocket support to existing TCP oriented applications.\
+\
+noPoll provides support for WebSocket (ws://) and TLS (secure) WebSocket (wss://),\
+allowing message based (handler notified) programming or stream oriented access."
+
+HOMEPAGE = "http://www.aspl.es/nopoll/"
+LICENSE = "LGPL-2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=f0504124678c1b3158146e0630229298 \
+ "
+DEPENDS = "openssl"
+SRC_URI = "http://www.aspl.es/nopoll/downloads/nopoll-${PV}.tar.gz \
+ "
+SRC_URI[md5sum] = "8c411cd0f3c0479aed28c4cf7b114fbb"
+SRC_URI[sha256sum] = "f5fbf8aaa16a77b0f265d8c847eb06cb3e68f2b1a50737466dae81181618654c"
+
+inherit autotools pkgconfig
+
+EXTRA_OECONF += "--disable-nopoll-doc"
+
+LDFLAGS += "-lpthread"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow.inc b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow.inc
new file mode 100644
index 000000000..cccbfa19a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow.inc
@@ -0,0 +1,37 @@
+SUMMARY = "OpenFlow communications protocol"
+DESCRIPTION = "\
+Open standard that enables researchers to run experimental protocols in \
+contained networks. OpenFlow is a communications interface between \
+control and forwarding planes of a software-defined networking architecture.\
+"
+HOMEPAGE = "http://www.openflow.org"
+
+SECTION = "net"
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=e870c934e2c3d6ccf085fd7cf0a1e2e2"
+
+SRC_URI = "git://gitosis.stanford.edu/openflow.git;protocol=git"
+
+DEPENDS = "virtual/libc"
+
+PACKAGECONFIG ??= "openssl"
+PACKAGECONFIG[openssl] = "--enable-ssl,--disable-ssl, openssl openssl-native, libssl"
+
+EXTRA_OECONF += " \
+ KARCH=${TARGET_ARCH} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'openssl', 'SSL_LIBS="-lssl -lcrypto"', '', d)} \
+ "
+
+S = "${WORKDIR}/git"
+
+inherit autotools-brokensep pkgconfig
+
+do_configure_prepend() {
+ ./boot.sh
+}
+
+do_install_append() {
+ # Remove /var/run as it is created on startup
+ rm -rf ${D}${localstatedir}/run
+}
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch
new file mode 100644
index 000000000..952274bb9
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch
@@ -0,0 +1,64 @@
+From 7b62e5884353b247f542844d1e4687d0e9211999 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 20 Jul 2017 04:27:32 -0700
+Subject: [PATCH 1/2] Check and use strlcpy from libc before defining own
+
+This is required especially on musl where
+function prototype conflicts and causes build
+failures.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac | 2 +-
+ lib/util.c | 2 ++
+ lib/util.h | 1 +
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 13064f6..596c43f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -57,7 +57,7 @@ OFP_CHECK_HWTABLES
+ OFP_CHECK_HWLIBS
+ AC_SYS_LARGEFILE
+
+-AC_CHECK_FUNCS([strsignal])
++AC_CHECK_FUNCS([strlcpy strsignal])
+
+ AC_ARG_VAR(KARCH, [Kernel Architecture String])
+ AC_SUBST(KARCH)
+diff --git a/lib/util.c b/lib/util.c
+index 21cc28d..1f341b1 100644
+--- a/lib/util.c
++++ b/lib/util.c
+@@ -138,6 +138,7 @@ xasprintf(const char *format, ...)
+ return s;
+ }
+
++#ifndef HAVE_STRLCPY
+ void
+ strlcpy(char *dst, const char *src, size_t size)
+ {
+@@ -148,6 +149,7 @@ strlcpy(char *dst, const char *src, size_t size)
+ dst[n_copy] = '\0';
+ }
+ }
++#endif
+
+ void
+ ofp_fatal(int err_no, const char *format, ...)
+diff --git a/lib/util.h b/lib/util.h
+index fde681f..9e45ea9 100644
+--- a/lib/util.h
++++ b/lib/util.h
+@@ -41,6 +41,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include "compiler.h"
++#include "config.h"
+
+ #ifndef va_copy
+ #ifdef __va_copy
+--
+2.13.3
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch
new file mode 100644
index 000000000..75180fe32
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch
@@ -0,0 +1,59 @@
+From 5bba224edea38607e8732081f86679ffd8b218ab Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 20 Jul 2017 04:29:04 -0700
+Subject: [PATCH 2/2] lib/netdev: Adjust header include sequence
+
+Specify libc headers before kernel UAPIs
+this helps compiling with musl where otherwise
+it uses the definition from kernel and complains
+about double definition in libc headers
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/netdev.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/lib/netdev.c b/lib/netdev.c
+index 3b6fbc5..c7de25e 100644
+--- a/lib/netdev.c
++++ b/lib/netdev.c
+@@ -39,7 +39,6 @@
+ #include <fcntl.h>
+ #include <arpa/inet.h>
+ #include <inttypes.h>
+-#include <linux/if_tun.h>
+
+ /* Fix for some compile issues we were experiencing when setting up openwrt
+ * with the 2.4 kernel. linux/ethtool.h seems to use kernel-style inttypes,
+@@ -57,10 +56,6 @@
+ #define s64 __s64
+ #endif
+
+-#include <linux/ethtool.h>
+-#include <linux/rtnetlink.h>
+-#include <linux/sockios.h>
+-#include <linux/version.h>
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+@@ -68,12 +63,16 @@
+ #include <net/ethernet.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
+-#include <net/if_packet.h>
+ #include <net/route.h>
+ #include <netinet/in.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <linux/ethtool.h>
++#include <linux/rtnetlink.h>
++#include <linux/sockios.h>
++#include <linux/version.h>
++#include <linux/if_tun.h>
+
+ #include "fatal-signal.h"
+ #include "list.h"
+--
+2.13.3
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_1.0.bb b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_1.0.bb
new file mode 100644
index 000000000..a7e254dd8
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_1.0.bb
@@ -0,0 +1,4 @@
+include ${BPN}.inc
+
+SRCREV = "5ccca75a69f99791659bcfbcf35353ab1921320a"
+PV = "1.0"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_git.bb b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_git.bb
new file mode 100644
index 000000000..eceb45e94
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openflow/openflow_git.bb
@@ -0,0 +1,9 @@
+include ${BPN}.inc
+
+SRCREV = "c84f33f09d5dbcfc9b489f64cb30475bf36f653a"
+PV = "1.0+git${SRCPV}"
+
+SRC_URI += "\
+ file://0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch \
+ file://0002-lib-netdev-Adjust-header-include-sequence.patch \
+ "
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch
new file mode 100644
index 000000000..d1ee3c591
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch
@@ -0,0 +1,29 @@
+From 1f8d336a5cd88b87e15596d05980f6fe77a0f226 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 11:28:41 -0700
+Subject: [PATCH 1/4] Use -1 instead of WAIT_ANY
+
+WAIT_ANY is not supported by POSIX and some C libraries
+e.g. musl do not define this.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ usl/usl_pid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usl/usl_pid.c b/usl/usl_pid.c
+index 103458b..9819473 100644
+--- a/usl/usl_pid.c
++++ b/usl/usl_pid.c
+@@ -78,7 +78,7 @@ int usl_pid_reap_children(int waitfor)
+
+ /* Wait for processes in our process group. */
+
+- while (((pid = waitpid(WAIT_ANY, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) {
++ while (((pid = waitpid(-1, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) {
+ have_callback = 0;
+ usl_list_for_each(walk, tmp, &usl_child_list) {
+ child = usl_list_entry(walk, struct usl_pid_child, list);
+--
+2.12.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch
new file mode 100644
index 000000000..c50f68e65
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch
@@ -0,0 +1,34 @@
+From 25dce20a75bc84ae9e4ec640590cef0c12750789 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 17:48:13 -0700
+Subject: [PATCH 1/2] l2tp_api: Included needed headers
+
+These are flagged by musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ l2tp_api.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/l2tp_api.c b/l2tp_api.c
+index d16f80e..9d6f60a 100644
+--- a/l2tp_api.c
++++ b/l2tp_api.c
+@@ -22,9 +22,12 @@
+ * Each module implements the required RPC xxx_1_svc() callbacks which
+ * are called directly by the RPC library.
+ */
+-
++#define _GNU_SOURCE
++#include <sys/types.h>
++#include <rpc/types.h>
++#include <rpc/xdr.h>
+ #include <rpc/pmap_clnt.h>
+-#include <net/ethernet.h>
++//#include <netinet/in.h>
+
+ #include "usl.h"
+
+--
+2.12.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api.c-include-rpc-clnt.h-for-resultproc_t.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api.c-include-rpc-clnt.h-for-resultproc_t.patch
new file mode 100644
index 000000000..a11a97ebd
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api.c-include-rpc-clnt.h-for-resultproc_t.patch
@@ -0,0 +1,31 @@
+From 8f299df4dd1ca857e34859c377a29b183c630961 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 21 Sep 2017 13:05:03 -0700
+Subject: [PATCH] l2tp_api.c: include rpc/clnt.h for 'resultproc_t'
+
+Fixes
+
+| /mnt/a/oe/build/tmp/work/mips32r2-bec-linux-musl/openl2tp/1.8-r0/recipe-sysroot/usr/include/tirpc/rpc/pmap_clnt.h:81:12: error: unknown type name 'resultproc_t'; did you mean 'rpcproc_t'? | resultproc_t); | ^~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ l2tp_api.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/l2tp_api.c b/l2tp_api.c
+index f0946fd..f77881c 100644
+--- a/l2tp_api.c
++++ b/l2tp_api.c
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
++#include <rpc/clnt.h>
+ #include <rpc/pmap_clnt.h>
+ //#include <netinet/in.h>
+
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-test-pppd_dummy.c-Fix-return-value.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-test-pppd_dummy.c-Fix-return-value.patch
new file mode 100644
index 000000000..1f576fa71
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-test-pppd_dummy.c-Fix-return-value.patch
@@ -0,0 +1,38 @@
+From ce5f5563ab54db9d28dba44a0e25e8a8c7bb9876 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 19 Oct 2016 00:34:35 +0000
+Subject: [PATCH] test/pppd_dummy.c: Fix return value
+
+pause() is defined in unistd.h, clang does not
+like the fact that we are using a function without
+declaration
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ test/pppd_dummy.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/test/pppd_dummy.c b/test/pppd_dummy.c
+index 148e7d2..b564c36 100644
+--- a/test/pppd_dummy.c
++++ b/test/pppd_dummy.c
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <syslog.h>
++#include <unistd.h>
+
+ #define PPPD_DUMMY_TMP_FILE "/tmp/pppd_dummy"
+
+@@ -40,7 +41,7 @@ int main(int argc, char **argv)
+
+ if (file == NULL) {
+ syslog(LOG_ERR, "Failed to open %s\n", filename);
+- return;
++ return -1;
+ }
+
+ for (arg = 1; arg < argc; arg++) {
+--
+1.9.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch
new file mode 100644
index 000000000..9df32658a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch
@@ -0,0 +1,25 @@
+From 2d633f4c18ff3cb52234449fd86a0a63b55d669b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 11:31:55 -0700
+Subject: [PATCH 2/4] cli: include fcntl.h for O_CREAT define
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ cli/cli_readline.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cli/cli_readline.c b/cli/cli_readline.c
+index 097ed6a..127136c 100644
+--- a/cli/cli_readline.c
++++ b/cli/cli_readline.c
+@@ -24,6 +24,7 @@
+ #include <sys/file.h>
+ #include <sys/stat.h>
+ #include <sys/errno.h>
++#include <fcntl.h>
+ #include <signal.h>
+
+ #include <readline/readline.h>
+--
+2.12.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch
new file mode 100644
index 000000000..3f8bcaa48
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch
@@ -0,0 +1,33 @@
+From a41cbeee3cf660663a9baac80545050a8d960898 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 18:09:58 -0700
+Subject: [PATCH 2/2] user ipv6 structures
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ l2tp_api.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/l2tp_api.c b/l2tp_api.c
+index 9d6f60a..f0946fd 100644
+--- a/l2tp_api.c
++++ b/l2tp_api.c
+@@ -450,10 +450,12 @@ int l2tp_api_rpc_check_request(SVCXPRT *xprt)
+ * non-loopback interface, reject the request.
+ */
+ if ((!l2tp_opt_remote_rpc) &&
+- ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) &&
+- (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) {
++ ((xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_LOOPBACK)) &&
++ (xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_ANY)))) {
++ char straddr[INET6_ADDRSTRLEN];
++ inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr));
+ if (l2tp_opt_trace_flags & L2TP_DEBUG_API) {
+- l2tp_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr));
++ l2tp_log(LOG_ERR, "Rejecting RPC request from %s", straddr);
+ }
+ svcerr_auth(xprt, AUTH_TOOWEAK);
+ return -EPERM;
+--
+2.12.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch
new file mode 100644
index 000000000..e05be1bbb
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch
@@ -0,0 +1,35 @@
+From 74fe72583472bcc3c89a52839cac2ebbad6c8a74 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 11:34:52 -0700
+Subject: [PATCH 3/4] cli: Define _GNU_SOURCE for getting sighandler_t
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ cli/cli_readline.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cli/cli_readline.c b/cli/cli_readline.c
+index 127136c..931779b 100644
+--- a/cli/cli_readline.c
++++ b/cli/cli_readline.c
+@@ -17,7 +17,7 @@
+ * Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+-
++#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+@@ -634,7 +634,7 @@ static void cli_rl_uninstall_signal_handlers(void)
+
+ static int cli_rl_install_signal_handlers(void)
+ {
+- __sighandler_t handler;
++ sighandler_t handler;
+
+ rl_catch_signals = 0;
+ rl_clear_signals();
+--
+2.12.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch
new file mode 100644
index 000000000..0fcba6546
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch
@@ -0,0 +1,36 @@
+From ede4ae8e25f9fb746a6f4e076d0ef029938d2880 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 11:46:56 -0700
+Subject: [PATCH 4/4] Adjust for linux-kernel headers assumptions on glibc
+
+Fixes build issues e.g.
+
+In file included from /mnt/a/build/tmp-musl/work/cortexa7hf-neon-vfpv4-oe-linux-musleabi/openl2tp/1.8-r0/recipe-sysroot/usr/include/linux/if_pppox.h:24:
+/mnt/a/build/tmp-musl/work/cortexa7hf-neon-vfpv4-oe-linux-musleabi/openl2tp/1.8-r0/recipe-sysroot/usr/include/linux/if.h:97:2: error: expected identifier
+ IFF_LOWER_UP = 1<<16, /* __volatile__ */
+ ^
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ plugins/ppp_unix.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/plugins/ppp_unix.c b/plugins/ppp_unix.c
+index 869066f..5c1e44f 100644
+--- a/plugins/ppp_unix.c
++++ b/plugins/ppp_unix.c
+@@ -21,6 +21,11 @@
+ * Plugin to use the standard UNIX pppd
+ */
+
++/* hack to make sure kernel headers understand that libc (musl)
++ * does define IFF_LOWER_UP et al.
++ */
++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
++
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sys/types.h>
+--
+2.12.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-modify-CFLAGS-to-aviod-build-error.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-modify-CFLAGS-to-aviod-build-error.patch
new file mode 100644
index 000000000..96dbc7551
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-modify-CFLAGS-to-aviod-build-error.patch
@@ -0,0 +1,106 @@
+From 152486fa3c36c3b99d17d5b553cf87ef412fae8e Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Mon, 1 Dec 2014 01:53:41 +0900
+Subject: [PATCH] Makefile:modify CFLAGS to aviod build error.
+
+Upstream-Status: pending
+
+Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
+---
+ Makefile | 22 +++++++++++-----------
+ plugins/Makefile | 6 +++---
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 4aaa448..baa7882 100644
+--- a/Makefile
++++ b/Makefile
+@@ -152,10 +152,10 @@ LIBS.dmalloc= -ldmalloc
+ export USE_DMALLOC
+ endif
+
+-CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
+-CFLAGS= -I. -Iusl -Icli -isystem include \
+- -MMD -Wall -Werror -Wno-strict-aliasing \
+- $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
++ADD_CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
++ADD_CFLAGS= -I. -Iusl -Icli -isystem include \
++ -MMD -Wall -Wno-strict-aliasing \
++ $(ADD_CPPFLAGS) $(CPPFLAGS.dmalloc) \
+ -DSYS_LIBDIR=$(SYS_LIBDIR)
+ LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
+ LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
+@@ -170,10 +170,10 @@ CFLAGS.optimize= $(OPT_CFLAGS)
+ endif
+ export CFLAGS.optimize
+
+-CFLAGS+= $(CFLAGS.optimize)
++ADD_CFLAGS+= $(CFLAGS.optimize)
+
+ ifeq ($(L2TP_USE_ASYNC_RPC),y)
+-CPPFLAGS+= -DL2TP_ASYNC_RPC
++ADD_CPPFLAGS+= -DL2TP_ASYNC_RPC
+ endif
+
+ ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
+@@ -220,13 +220,13 @@ endif
+
+ # Compile without -Wall because rpcgen-generated code is full of warnings.
+ %_xdr.o: %_xdr.c
+- $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
++ $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
+
+ %_client.o: %_client.c
+- $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
++ $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
+
+ %_server.o: %_server.c
+- $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
++ $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
+
+ %_xdr.c: %.x
+ -$(RM) $@
+@@ -272,7 +272,7 @@ l2tpconfig: $(L2TPCONFIG_SRCS.o)
+ $(CC) -o $@ $^ $(LDFLAGS.l2tpconfig)
+
+ %.o: %.c
+- $(CC) -c $(CFLAGS) $< -o $@
++ $(CC) -c $(CFLAGS) $(ADD_CFLAGS) $< -o $@
+
+ l2tp_options.h: FORCE
+ @rm -f $@.tmp
+@@ -325,7 +325,7 @@ install: install-all
+ install-all: all install-daemon install-app
+
+ install-daemon:
+- @for d in $(filter-out usl,$(SUBDIRS)); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" install; if [ $$? -ne 0 ]; then exit 1; fi; done
++ @for d in $(filter-out usl,$(SUBDIRS)); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS) $(ADD_CPPFLAGS)" install; if [ $$? -ne 0 ]; then exit 1; fi; done
+ $(INSTALL) -d $(DESTDIR)/usr/sbin
+ $(INSTALL) openl2tpd $(DESTDIR)/usr/sbin
+
+diff --git a/plugins/Makefile b/plugins/Makefile
+index 5be996d..6810236 100644
+--- a/plugins/Makefile
++++ b/plugins/Makefile
+@@ -1,7 +1,7 @@
+-CFLAGS := $(CFLAGS.optimize) -MMD -Wall \
++ADD_CFLAGS := $(CFLAGS.optimize) -MMD -Wall \
+ -isystem ../include \
+ -I. -I.. -I../usl -fPIC $(EXTRA_CFLAGS)
+-LDFLAGS := -shared
++ADD_LDFLAGS := -shared
+
+ PLUGINS.c:= ppp_unix.c ppp_null.c ipsec.c event_sock.c
+
+@@ -21,7 +21,7 @@ clean:
+ $(RM) $(PLUGINS.so) $(wildcard *.o) $(wildcard *.d) $(SRC.generated)
+
+ %.so: %.c
+- $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $<
++ $(CC) -o $@ $(LDFLAGS) $(ADD_LDFLAGS) $(CFLAGS) $(ADD_CFLAGS) $<
+
+ install: all
+ $(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
+--
+1.8.4.2
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-obey-LDFLAGS.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-obey-LDFLAGS.patch
new file mode 100644
index 000000000..811faddd0
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/Makefile-obey-LDFLAGS.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Pending
+
+--- openl2tp-1.8/Makefile.orig 2016-09-16 14:54:18.554291976 +0200
++++ openl2tp-1.8/Makefile 2016-09-16 14:57:23.559090400 +0200
+@@ -157,8 +157,8 @@ ADD_CFLAGS= -I. -Iusl -Icli -isystem i
+ -MMD -Wall -Wno-strict-aliasing \
+ $(ADD_CPPFLAGS) $(CPPFLAGS.dmalloc) \
+ -DSYS_LIBDIR=$(SYS_LIBDIR)
+-LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
+-LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
++LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc $(LDFLAGS)
++LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc $(LDFLAGS)
+
+ OPT_CFLAGS?= -O
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/fix_linux_4.15_compile.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/fix_linux_4.15_compile.patch
new file mode 100644
index 000000000..4597df80a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/fix_linux_4.15_compile.patch
@@ -0,0 +1,44 @@
+This fixes a compile issue introduced with linux kernel 4.15
+
+include/linux/in.h:222:8: error: redefinition of 'struct in_pktinfo'
+| struct in_pktinfo {
+
+
+Upstream-Status: Pending
+Signed-off-by: Armin Kuster <akuster808@gmail.com>
+
+Index: openl2tp-1.8/plugins/ppp_unix.c
+===================================================================
+--- openl2tp-1.8.orig/plugins/ppp_unix.c
++++ openl2tp-1.8/plugins/ppp_unix.c
+@@ -25,9 +25,14 @@
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <signal.h>
++#include <linux/version.h>
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+ #include <net/ethernet.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
++#endif
++
+ #include <arpa/inet.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -41,12 +46,12 @@
+ #define __user
+ #endif
+ #include <sys/ioctl.h>
+-#include <linux/if_ether.h>
+-#include <linux/if_pppox.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_ppp.h>
++#include <linux/if_pppox.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+ #include <linux/if_pppol2tp.h>
+-
++#endif
+ #include "usl.h"
+ #include "l2tp_private.h"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tp-simplify-gcc-warning-hack.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tp-simplify-gcc-warning-hack.patch
new file mode 100644
index 000000000..c11a127b8
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tp-simplify-gcc-warning-hack.patch
@@ -0,0 +1,41 @@
+From 460549a3de27f8dd8371b6d6fc1f69d8bffa102b Mon Sep 17 00:00:00 2001
+From: Joe MacDonald <joe_macdonald@mentor.com>
+Date: Tue, 6 Jan 2015 11:23:21 -0500
+Subject: [PATCH] openl2tp: simplify gcc warning hack
+
+The hack to work around the gcc warning causes problems with some modern
+gcc configurations. Since the redef behaviour is essentially correct
+everywhere and since the hack is still required on 32-bit builders, leave
+it in place but remove the #if guard since it is only there to ensure that
+the l2tp_private.h file is updated if the rpc source file is changed and
+the two get out of sync.
+
+Upstream-status: pending
+
+Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
+---
+ l2tp_private.h | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/l2tp_private.h b/l2tp_private.h
+index f3c1af7..cca6806 100644
+--- a/l2tp_private.h
++++ b/l2tp_private.h
+@@ -89,14 +89,8 @@
+ * So we redefine the constant with UL suffix to avoid the gcc warning.
+ * Is there some C preprocessor magic that could avoid having to do this?
+ */
+-#if L2TP_API_TUNNEL_FLAG_MTU != 2147483648
+-#error Constant L2TP_API_TUNNEL_FLAG_MTU changed. Update local definition here.
+-#endif
+ #undef L2TP_API_TUNNEL_FLAG_MTU
+ #define L2TP_API_TUNNEL_FLAG_MTU 2147483648UL
+-#if L2TP_API_SESSION_FLAG_NO_PPP != 2147483648
+-#error Constant L2TP_API_SESSION_FLAG_NO_PPP changed. Update local definition here.
+-#endif
+ #undef L2TP_API_SESSION_FLAG_NO_PPP
+ #define L2TP_API_SESSION_FLAG_NO_PPP 2147483648UL
+
+--
+1.9.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch
new file mode 100644
index 000000000..0bece2f4d
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch
@@ -0,0 +1,24 @@
+commit 3e96a6c41bdd26417265a45ed685138d8eed564e
+Author: Aws Ismail <aws.ismail@windriver.com>
+Date: Fri Sep 14 02:32:53 2012 -0400
+
+ openl2tp: Enable tests
+
+ Build the test direcctory as part
+ of the overall build
+
+ Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
+
+diff --git a/Makefile b/Makefile
+index 412cf4d..adf4f44 100644
+--- a/Makefile
++++ b/Makefile
+@@ -16,7 +16,7 @@ L2TP_FEATURE_LOCAL_CONF_FILE= y
+
+ # Define to include test code. This must be defined to run the
+ # regression tests
+-# L2TP_TEST= y
++L2TP_TEST=y
+
+ # Define to compile in debug code. Also makes default trace flags
+ # enable all messages
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch
new file mode 100644
index 000000000..3119425e6
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch
@@ -0,0 +1,35 @@
+commit 6ea3125e2bec15004f312814022335d94cdf7e94
+Author: Aws Ismail <aws.ismail@windriver.com>
+Date: Wed Sep 19 11:34:48 2012 -0400
+
+ Fix openl2tp config script location
+
+ Correct the location of the sysconfig
+ script. Use /etc/default/ instead of
+ /etc/sysconfig/
+
+ Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
+
+ Upstream-Status: Inappropriate [configuration]
+
+ Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+diff --git a/etc/rc.d/init.d/openl2tpd b/etc/rc.d/init.d/openl2tpd
+index 7f27bb7..4194f63 100755
+--- a/etc/rc.d/init.d/openl2tpd
++++ b/etc/rc.d/init.d/openl2tpd
+@@ -8,12 +8,12 @@
+ # can be used to implement L2TP VPNs. As a server, it can handle
+ # hundreds of tunnels and sessions.
+ # processname: openl2tpd
+-# config: /etc/sysconfig/openl2tpd
++# config: /etc/default/openl2tpd
+ # pidfile: /var/run/openl2tpd.pid
+
+ # Source function library.
+ . /etc/init.d/functions
+-. /etc/sysconfig/openl2tpd
++. /etc/default/openl2tpd
+
+ # See how we were called.
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch
new file mode 100644
index 000000000..15a8c5b08
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch
@@ -0,0 +1,32 @@
+openl2tp: eliminate warning from modprobe
+
+modprobe will emit alarming warnings if it cannot
+find a module, but we only care that it find one
+of two possible modules when we start openl2tpd.
+
+Suppress messages from modprobe.
+
+Upstream-Status: Pending
+
+Signed-off-by: Joe Slater <jslater@windriver.com>
+
+--- a/etc/rc.d/init.d/openl2tpd
++++ b/etc/rc.d/init.d/openl2tpd
+@@ -29,7 +29,7 @@ start() {
+ return 1
+ fi
+ fi
+- modprobe -s pppol2tp || modprobe -s l2tp_ppp
++ modprobe -sq pppol2tp || modprobe -sq l2tp_ppp
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ start-stop-daemon --start --exec openl2tpd $OPENL2TPDARGS
+@@ -57,7 +57,7 @@ stop() {
+ return 1;
+ fi
+ killproc openl2tpd
+- modprobe -s -r pppol2tp || modprobe -s -r l2tp_ppp
++ modprobe -srq pppol2tp || modprobe -srq l2tp_ppp
+ echo
+ rm -f /var/run/openl2tpd.pid
+ rm -f /var/lock/subsys/openl2tpd
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch
new file mode 100644
index 000000000..9ecd4b072
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch
@@ -0,0 +1,49 @@
+commit 7c58a1e244ea83a9e7bbd51a6d354cee25cdbd33
+Author: Aws Ismail <aws.ismail@windriver.com>
+Date: Wed Sep 12 23:35:40 2012 -0400
+
+ Fix openl2tpd initscript
+
+ - Correct the location of the retval statement.
+ - use start-stop-daemon instead of daemon.
+
+ Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
+
+ Upstream-Status: Inappropriate [OE specific]
+
+ Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+diff --git a/etc/rc.d/init.d/openl2tpd b/etc/rc.d/init.d/openl2tpd
+index ce21b50..7f27bb7 100755
+--- a/etc/rc.d/init.d/openl2tpd
++++ b/etc/rc.d/init.d/openl2tpd
+@@ -24,7 +24,7 @@ start() {
+ if [ -e /var/lock/subsys/openl2tpd ]; then
+ if [ -e /var/run/openl2tpd.pid ] && [ -e /proc/`cat /var/run/openl2tpd.pid` ]; then
+ echo -n $"cannot start openl2tpd: openl2tpd is already running.";
+- failure $"cannot start openl2tpd: openl2tpd already running.";
++ #failure $"cannot start openl2tpd: openl2tpd already running.";
+ echo
+ return 1
+ fi
+@@ -32,9 +32,9 @@ start() {
+ modprobe -s pppol2tp || modprobe -s l2tp_ppp
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+- daemon openl2tpd $OPENL2TPDARGS
++ start-stop-daemon --start --exec openl2tpd $OPENL2TPDARGS
++ RETVAL=$?
+ fi
+- RETVAL=$?
+ echo
+ if [ $RETVAL -eq 0 ]; then
+ touch /var/lock/subsys/openl2tpd
+@@ -52,7 +52,7 @@ stop() {
+ echo -n $"Stopping $prog: "
+ if [ ! -e /var/lock/subsys/openl2tpd ]; then
+ echo -n $"cannot stop openl2tpd: openl2tpd is not running."
+- failure $"cannot stop openl2tpd: openl2tpd is not running."
++ #failure $"cannot stop openl2tpd: openl2tpd is not running."
+ echo
+ return 1;
+ fi
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service
new file mode 100644
index 000000000..7b3faf672
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=The open L2TP implementation
+After=network.target remote-fs.target nss-lookup.target rpcbind.target
+Requires=rpcbind.service
+
+[Service]
+Type=forking
+PIDFile=@STATEDIR@/run/openl2tpd.pid
+EnvironmentFile=@SYSCONFDIR@/default/openl2tpd
+ExecStartPre=@BASE_BINDIR@/sh -c "@BASE_SBINDIR@/modprobe -sq l2tp_ppp || @BASE_SBINDIR@/modprobe -sq pppol2tp"
+ExecStart=@SBINDIR@/openl2tpd $OPENL2TPDARGS
+ExecStartPost=@BASE_BINDIR@/sh -c 'if [ -n "$OPENL2TPD_CONFIG_FILE" ]; then sleep 1; @BINDIR@/l2tpconfig config restore file=$OPENL2TPD_CONFIG_FILE; fi'
+ExecStopPost=@BASE_BINDIR@/sh -c "@BASE_SBINDIR@/modprobe -rsq l2tp_ppp || @BASE_SBINDIR@/modprobe -rsq pppol2tp"
+SuccessExitStatus=1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest
new file mode 100644
index 000000000..01c9c7b44
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+TMP_DIR=`mktemp -d /tmp/std.26.tmp.XXXXXX`
+
+# restore the file if exist
+restore_file()
+{
+ filelist="test_procs.tcl tunnel.test session.test"
+ for file in ${filelist}
+ do
+ if [ -f ${TMP_DIR}/${file} ]; then
+ mv ${TMP_DIR}/${file} ${OPENL2TP_DIR}
+ fi
+ done
+}
+
+exit_cus()
+{
+ restore_file
+ echo $1
+ exit $2
+}
+
+if [ -d /usr/lib64/openl2tp/ptest ]; then
+ OPENL2TP_DIR="/usr/lib64/openl2tp"
+elif [ -d /usr/lib/openl2tp/ptest ]; then
+ OPENL2TP_DIR="/usr/lib/openl2tp"
+else
+ exit_cus "The openl2tp ptest directory not installed, skip the test" 1
+fi
+
+#read -p "Please input the network interface you use to test(such as eth0, em1 etc):" ETH_TEST
+echo "Please input the network interface you use to test(such as eth0, em1 etc):"
+read ETH_TEST > /dev/null
+
+if [ x"$ETH_TEST" = x ]; then
+ exit_cus "The network interface cannot be null" 1
+fi
+ifconfig | grep $ETH_TEST > /dev/null || exit_cus "The network interface you provide is invalid" 1
+
+# check openl2tp related kernel config
+zcat /proc/config.gz | grep CONFIG_L2TP=y > /dev/null || exit_cus "Failed to check CONFIG_L2TP=y, skip the tests." 1
+zcat /proc/config.gz | grep CONFIG_PPPOL2TP=m > /dev/null || exit_cus "Failed to check CONFIG_PPPOL2TP=m, skip the tests." 1
+
+SYSV_INIT="/etc/init.d/rpcbind"
+if [ -e ${SYSV_INIT} ]; then
+ ${SYSV_INIT} status > /dev/null || ${SYSV_INIT} start > /dev/null
+else
+ systemctl status rpcbind > /dev/null || systemctl start rpcbind > /dev/null
+fi
+
+which systemctl > /dev/null && systemctl status rpcbind > /dev/null || service rpcbind status > /dev/null
+[ $? -ne 0 ] && exit_cus "Failed to start rpcbind service, skip the tests." 1
+
+# backup the below files
+cp ${OPENL2TP_DIR}/ptest/test_procs.tcl $TMP_DIR
+cp ${OPENL2TP_DIR}/ptest/tunnel.test $TMP_DIR
+cp ${OPENL2TP_DIR}/ptest/session.test $TMP_DIR
+
+# customise the config
+if [ x"$ETH_TEST" = x ]; then
+ exit_cus "Please set ETH_TEST which used to test first, skip the tests." 1
+fi
+
+sed -i 's/eth2/'\"$ETH_TEST\"'/g' ${OPENL2TP_DIR}/ptest/test_procs.tcl
+test_ip="`ifconfig $ETH_TEST | grep 'inet ' | sed 's/^.*inet addr://g' | \
+ sed 's/ *Mask.*$//g'|sed 's/ *Bcast.*$//g'`"
+sed -i 's/192.168.0.1/'"$test_ip"'/g' ${OPENL2TP_DIR}/ptest/tunnel.test
+
+# load module l2tp_ppp
+modprobe l2tp_ppp > /dev/null
+lsmod | grep l2tp_ppp > /dev/null || exit_cus "FAIL: Load module l2tp_ppp" 2
+
+# start openl2tpd
+ps aux | grep openl2tpd | grep -v grep > /dev/null && killall openl2tpd > /dev/null
+ppp_path=`rpm -ql openl2tp | grep ppp_null.so`
+echo "test it here"
+/usr/sbin/openl2tpd -d all -D -f -p ${ppp_path} & > /dev/null
+
+# prepare the test env
+rm -rf $OPENL2TP_DIR/results
+mkdir -p $OPENL2TP_DIR/results || exit_cus "FAIL: mkdir $OPENL2TP_DIR/results" 2
+cp /usr/bin/l2tpconfig ${OPENL2TP_DIR} || exit_cus "FAIL: copy /usr/bin/l2tpconfig to ${OPENL2TP_DIR}" 2
+
+# start the test
+cd ${OPENL2TP_DIR}/ptest && tclsh all.tcl -preservecore 3 -verbose bps -tmpdir $OPENL2TP_DIR/results -outfile test-l2tpd.result -constraints "l2tpdRunning peerProfile tunnelProfile sessionProfile pppProfile system" -match "peer_profile-1.1 tunnel_profile-1.1 session_profile-1.1 ppp_profile-1.1 system-1.1"
+
+# check the result
+PASSNUM=`grep PASS $OPENL2TP_DIR/results/test-l2tpd.result | wc -l`
+FAILNUM=`grep FAIL $OPENL2TP_DIR/results/test-l2tpd.result | wc -l`
+if [ $PASSNUM -ne 0 ] && [ $FAILNUM -eq 0 ]; then
+ echo "PASS: openl2tp"
+else
+ echo "FAIL: openl2tp"
+fi
+
+restore_file
diff --git a/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb
new file mode 100644
index 000000000..1f6b4ded3
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb
@@ -0,0 +1,99 @@
+SUMMARY = "An L2TP client/server, designed for VPN use."
+DESCRIPTION = "OpenL2TP is an open source L2TP client / server, written \
+specifically for Linux. It has been designed for use as an enterprise \
+L2TP VPN server or in commercial, Linux-based, embedded networking \
+products and is able to support hundreds of sessions, each with \
+different configuration. It is used by several ISPs to provide \
+L2TP services and by corporations to implement L2TP VPNs."
+HOMEPAGE = "http://www.openl2tp.org/"
+SECTION = "net"
+
+# cli and usl use license LGPL-2.1
+LICENSE = "GPL-2.0 & LGPL-2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=e9d9259cbbf00945adc25a470c1d3585 \
+ file://LICENSE;md5=f8970abd5ea9be701a0deedf5afd77a5 \
+ file://cli/LICENSE;md5=9c1387a3c5213aa40671438af3e00793 \
+ file://usl/LICENSE;md5=9c1387a3c5213aa40671438af3e00793 \
+ "
+
+DEPENDS = "popt flex readline"
+
+SRC_URI = "ftp://ftp.openl2tp.org/releases/${BP}/${BP}.tar.gz \
+ file://Makefile-modify-CFLAGS-to-aviod-build-error.patch \
+ file://openl2tp-simplify-gcc-warning-hack.patch \
+ file://Makefile-obey-LDFLAGS.patch \
+ file://0001-test-pppd_dummy.c-Fix-return-value.patch \
+ file://0001-Use-1-instead-of-WAIT_ANY.patch \
+ file://0002-cli-include-fcntl.h-for-O_CREAT-define.patch \
+ file://0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch \
+ file://0001-l2tp_api-Included-needed-headers.patch \
+ file://openl2tpd-initscript-fix.patch \
+ file://openl2tpd-initscript-fix-sysconfig.patch \
+ file://openl2tpd-initscript-fix-warning.patch \
+ file://openl2tpd.service \
+ file://openl2tpd-enable-tests.patch \
+ file://run-ptest \
+ file://fix_linux_4.15_compile.patch \
+ "
+
+SRC_URI_append_libc-musl = "\
+ file://0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch \
+ file://0002-user-ipv6-structures.patch \
+ file://0001-l2tp_api.c-include-rpc-clnt.h-for-resultproc_t.patch \
+ "
+SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0"
+SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f"
+
+inherit autotools-brokensep pkgconfig systemd ptest
+
+SYSTEMD_SERVICE_${PN} = "openl2tpd.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
+DEPENDS_append_libc-musl = " libtirpc"
+CPPFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
+LDFLAGS_append_libc-musl = " -ltirpc"
+
+PARALLEL_MAKE = ""
+EXTRA_OEMAKE = 'CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" CPPFLAGS="${CPPFLAGS}" OPT_CFLAGS="${CFLAGS}"'
+
+do_compile_prepend() {
+ sed -i -e "s:SYS_LIBDIR=.*:SYS_LIBDIR=${libdir}:g" \
+ -e 's:$(CROSS_COMPILE)as:${AS}:g' \
+ -e 's:$(CROSS_COMPILE)ld:${LD}:g' \
+ -e 's:$(CROSS_COMPILE)gcc:${CC}:g' \
+ -e 's:$(CROSS_COMPILE)ar:${AR}:g' \
+ -e 's:$(CROSS_COMPILE)nm:${NM}:g' \
+ -e 's:$(CROSS_COMPILE)strip:${STRIP}:g' \
+ -e 's:$(CROSS_COMPILE)install:install:g' \
+ -e 's:CPPFLAGS-y:CPPFLAGS:g' \
+ ${S}/Makefile
+}
+
+do_install_append () {
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sysconfdir}/default
+ install -m 0755 ${S}/etc/rc.d/init.d/openl2tpd ${D}${sysconfdir}/init.d/openl2tpd
+ install -m 0755 ${S}/etc/sysconfig/openl2tpd ${D}${sysconfdir}/default/openl2tpd
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -D -m 0644 ${WORKDIR}/openl2tpd.service ${D}${systemd_system_unitdir}/openl2tpd.service
+ sed -i -e 's,@STATEDIR@,${localstatedir},g' \
+ -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+ -e 's,@SBINDIR@,${sbindir},g' \
+ -e 's,@BINDIR@,${bindir},g' \
+ -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
+ -e 's,@BASE_BINDIR@,${base_bindir},g' \
+ ${D}${systemd_system_unitdir}/openl2tpd.service
+ fi
+}
+
+do_install_ptest () {
+ for i in all.tcl configfile.test peer_profile.test ppp_profile.test \
+ session_profile.test session.test system.test test_procs.tcl \
+ thirdparty_lns.test tunnel_profile.test tunnel.test; do
+ install -m 0755 ${S}/test/$i ${D}${PTEST_PATH}
+ done
+}
+
+RDEPENDS_${PN} = "ppp ppp-l2tp bash"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/0001-include-missing-sys-types.h.patch b/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/0001-include-missing-sys-types.h.patch
new file mode 100644
index 000000000..804bf1234
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/0001-include-missing-sys-types.h.patch
@@ -0,0 +1,28 @@
+From f6c4d2468ae0dadd2f35680d61b98b2a59077328 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 10:31:03 -0700
+Subject: [PATCH] include missing sys/types.h
+
+Fixes errors seen on musl
+pqueue.h:21:3: error: unknown type name 'u_int32_t'
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ pqueue.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/pqueue.h b/pqueue.h
+index c37ba7b..ae4cc6a 100644
+--- a/pqueue.h
++++ b/pqueue.h
+@@ -3,6 +3,7 @@
+
+ #include <time.h>
+ #include <sys/time.h>
++#include <sys/types.h>
+
+ /* wait this many seconds for missing packets before forgetting about them */
+ #define DEFAULT_PACKET_TIMEOUT 0.3
+--
+2.13.2
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/options.pptp b/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/options.pptp
new file mode 100644
index 000000000..f446e22a6
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux/options.pptp
@@ -0,0 +1,30 @@
+#
+# Lock the port
+#
+lock
+
+#
+# We don't need the tunnel server to authenticate itself
+#
+noauth
+
+#
+# Turn off transmission protocols we know won't be used
+#
+nobsdcomp
+nodeflate
+
+#
+# We want MPPE
+# (option naming specific to ppp 2.4.0 with unofficial patch)
+#
+#mppe-40
+mppe-128
+#mppe-stateless
+
+#
+# We want a sane mtu/mru
+# (ppp 2.4.0 with unofficial patch)
+#
+#mtu 1000
+#mru 1000
diff --git a/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.9.0.bb b/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.9.0.bb
new file mode 100644
index 000000000..10c9170fb
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/pptp-linux/pptp-linux_1.9.0.bb
@@ -0,0 +1,31 @@
+SUMMARY = "Client for Microsoft PPTP VPNs"
+DESCRIPTION = "PPTP Client is a Linux, FreeBSD, NetBSD \
+ and OpenBSD client for the proprietary Microsoft Point-to-Point \
+ Tunneling Protocol, PPTP. Allows connection to a PPTP based \
+ Virtual Private Network (VPN) as used by employers and some \
+ cable and ADSL internet service providers."
+HOMEPAGE = "http://pptpclient.sourceforge.net"
+SECTION = "net"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/sourceforge/pptpclient/pptp-${PV}.tar.gz \
+ file://options.pptp \
+ file://0001-include-missing-sys-types.h.patch \
+ "
+
+SRC_URI[md5sum] = "b2117b377f65294a9786f80f0235d308"
+SRC_URI[sha256sum] = "0b1e8cbfc578d3f5ab12ee87c5c2c60419abfe9cc445690a8a19c320b11c9201"
+
+S = "${WORKDIR}/pptp-${PV}"
+
+EXTRA_OEMAKE = "-e MAKEFLAGS="
+
+do_install() {
+ install -d ${D}${sbindir} ${D}${sysconfdir}/ppp ${D}${mandir}/man8
+ install -m 555 pptp ${D}${sbindir}
+ install -m 644 pptp.8 ${D}${mandir}/man8
+ install -m 644 ${WORKDIR}/options.pptp ${D}${sysconfdir}/ppp
+}
+
+RDEPENDS_${PN} = "ppp"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service
new file mode 100644
index 000000000..76f9f61e7
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/bgpd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=BGP routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/bgpd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/bgpd.pid
+ExecStart=@SBINDIR@/bgpd -d $bgpd_options -f @SYSCONFDIR@/quagga/bgpd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/bgpd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service
new file mode 100644
index 000000000..9bfe7b65e
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/isisd.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=IS-IS routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/isisd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+ExecStart=@SBINDIR@/isisd -d $isisd_options -f /etc/quagga/isisd.conf
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service
new file mode 100644
index 000000000..a2e493b42
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospf6d.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=OSPF routing daemon for IPv6
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ospf6d.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ospf6d.pid
+ExecStart=@SBINDIR@/ospf6d -d $ospf6d_options -f @SYSCONFDIR@/quagga/ospf6d.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ospf6d.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service
new file mode 100644
index 000000000..0c62cbce5
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ospfd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=OSPF routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ospfd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ospfd.pid
+ExecStart=@SBINDIR@/ospfd -d $ospfd_options -f @SYSCONFDIR@/quagga/ospfd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ospfd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default
new file mode 100644
index 000000000..4c4bc2307
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.default
@@ -0,0 +1,12 @@
+# If this option is set the /etc/init.d/quagga script automatically loads
+# the config via "vtysh -b" when the servers are started.
+vtysh_enable=yes
+
+# Bind all daemons to loopback only by default
+zebra_options=" --daemon -A 127.0.0.1"
+bgpd_options=" --daemon -A 127.0.0.1"
+ospfd_options=" --daemon -A 127.0.0.1"
+ospf6d_options="--daemon -A ::1"
+ripd_options=" --daemon -A 127.0.0.1"
+ripngd_options="--daemon -A ::1"
+isisd_options=" --daemon -A 127.0.0.1"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init
new file mode 100644
index 000000000..df1beb712
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.init
@@ -0,0 +1,200 @@
+#!/bin/sh
+#
+# /etc/init.d/quagga -- start/stop the Quagga routing daemons
+#
+# Based on debian version by Endre Hirling <endre@mail.elte.hu> and
+# Christian Hammers <ch@debian.org>.
+#
+
+### BEGIN INIT INFO
+# Provides: quagga
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop the Quagga routing suite
+# Description: Quagga is a routing suite for IP routing protocols like
+# BGP, OSPF, RIP and others. This script contols the main
+# daemon "quagga" as well as the individual protocol daemons.
+### END INIT INFO
+
+# NOTE: sbin must be before bin so we get the iproute2 ip and not the
+# busybox ip command. The busybox one flushes all routes instead of just
+# the dynamic routes
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/sbin
+D_PATH=/usr/sbin
+C_PATH=/etc/quagga
+
+# Keep zebra first and do not list watchquagga!
+DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd"
+
+# Print the name of the pidfile.
+pidfile()
+{
+ echo "/var/run/quagga/$1.pid"
+}
+
+# Check if daemon is started by using the pidfile.
+started()
+{
+ [ -e `pidfile $1` ] && kill -0 `cat \`pidfile $1\`` 2> /dev/null && return 0
+ return 1
+}
+
+# Loads the config via vtysh -b if configured to do so.
+vtysh_b ()
+{
+ # Rember, that all variables have been incremented by 1 in convert_daemon_prios()
+ if [ "$vtysh_enable" = 2 -a -f $C_PATH/Quagga.conf ]; then
+ /usr/bin/vtysh -b
+ fi
+}
+
+# Check if the daemon is activated and if its executable and config files
+# are in place.
+# params: daemon name
+# returns: 0=ok, 1=error
+check_daemon()
+{
+ # If the integrated config file is used the others are not checked.
+ if [ -r "$C_PATH/Quagga.conf" ]; then
+ return 0
+ fi
+
+ # check for config file
+ if [ ! -r "$C_PATH/$1.conf" ]; then
+ return 1
+ fi
+ return 0
+}
+
+# Starts the server if it's not alrady running according to the pid file.
+# The Quagga daemons creates the pidfile when starting.
+start()
+{
+ if ! check_daemon $1; then echo -n " (!$1)"; return; fi
+ echo -n " $1"
+ start-stop-daemon \
+ --start \
+ --pidfile=`pidfile $1` \
+ --exec "$D_PATH/$1" \
+ -- \
+ `eval echo "$""$1""_options"`
+
+}
+
+# Stop the daemon given in the parameter, printing its name to the terminal.
+stop()
+{
+ if ! started "$1" ; then
+ echo -n " (!$1)"
+ return 0
+ else
+ PIDFILE=`pidfile $1`
+ PID=`cat $PIDFILE 2>/dev/null`
+ start-stop-daemon --stop --quiet --exec "$D_PATH/$1"
+ #
+ # Now we have to wait until $DAEMON has _really_ stopped.
+ #
+ if test -n "$PID" && kill -0 $PID 2>/dev/null; then
+ echo -n " (waiting) ."
+ cnt=0
+ while kill -0 $PID 2>/dev/null; do
+ cnt=`expr $cnt + 1`
+ if [ $cnt -gt 60 ]; then
+ # Waited 120 secs now, fail.
+ echo -n "Failed.. "
+ break
+ fi
+ sleep 2
+ echo -n "."
+ done
+ fi
+ echo -n " $1"
+ rm -f `pidfile $1`
+ fi
+}
+
+stop_all()
+{
+ local daemon_list
+ daemon_list=${1:-$DAEMONS}
+
+ echo -n "Stopping Quagga daemons:"
+ for daemon_name in $daemon_list; do
+ stop "$daemon_name"
+ done
+ echo "."
+}
+
+start_all()
+{
+ local daemon_list
+ daemon_list=${1:-$DAEMONS}
+
+ echo -n "Starting Quagga daemons:"
+ for daemon_name in $daemon_list; do
+ start "$daemon_name"
+ done
+ echo "."
+}
+
+status_all()
+{
+ local daemon_list
+ daemon_list=${1:-$DAEMONS}
+ res=1
+
+ echo -n "quagga: "
+ for daemon_name in $daemon_list; do
+ if started "$daemon_name" ; then
+ id=`cat \`pidfile $daemon_name\``
+ echo -n "$daemon_name (pid $id) "
+ res=0
+ fi
+ done
+ if [ $res -eq 0 ]; then
+ echo "is running..."
+ else
+ echo "is stopped..."
+ fi
+ exit $res
+}
+
+#########################################################
+# Main program #
+#########################################################
+
+# Load configuration
+test -f /etc/default/quagga && . /etc/default/quagga
+
+case "$1" in
+ start)
+ cd $C_PATH/
+ start_all $2
+ vtysh_b
+ ;;
+
+ stop)
+ stop_all $2
+ echo "Removing all routes made by zebra."
+ ip route flush proto zebra
+ ;;
+
+ status)
+ status_all $2
+ ;;
+
+ restart|force-reload)
+ $0 stop $2
+ sleep 1
+ $0 start $2
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/quagga {start|stop|restart|status|force-reload} [daemon]"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam
new file mode 100644
index 000000000..3541a975a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/quagga.pam
@@ -0,0 +1,13 @@
+#
+# The PAM configuration file for the quagga `vtysh' service
+#
+
+# This allows root to change user infomation without being
+# prompted for a password
+auth sufficient pam_rootok.so
+
+# The standard Unix authentication modules, used with
+# NIS (man nsswitch) as well as normal /etc/passwd and
+# /etc/shadow entries.
+auth include common-auth
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service
new file mode 100644
index 000000000..1d20389e8
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=RIP routing daemon
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ripd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ripd.pid
+ExecStart=@SBINDIR@/ripd -d $ripd_options -f @SYSCONFDIR@/quagga/ripd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ripd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service
new file mode 100644
index 000000000..0355ad12a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/ripngd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=RIP routing daemon for IPv6
+BindTo=zebra.service
+After=zebra.service
+ConditionPathExists=@SYSCONFDIR@/quagga/ripngd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/ripngd.pid
+ExecStart=@SBINDIR@/ripngd -d $ripngd_options -f @SYSCONFDIR@/quagga/ripngd.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/ripngd.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga
new file mode 100644
index 000000000..1f28c0b24
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga
@@ -0,0 +1,3 @@
+# <type> <owner> <group> <mode> <path> <linksource>
+d quagga quagga 0755 /var/run/quagga none
+d quagga quagga 0755 /var/log/quagga none
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default
new file mode 100644
index 000000000..2d601ec97
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.default
@@ -0,0 +1,12 @@
+# Watchquagga configuration
+#watch_daemons="zebra bgpd ospfd ospf6d ripd ripngd"
+watch_daemons="zebra"
+
+# To enable restarts when multiple daemons are being used, uncomment this line (but first be sure to edit
+# the WATCH_DAEMONS line to reflect the daemons you are actually using):
+#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"
+
+# Since we are using one quagga daemon for now, use the following line. If using
+# multiple daemons, comment the line below and uncoment the line mentioned
+# above.
+watch_options="-z -b_ -r/etc/init.d/quagga_restart_%s"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init
new file mode 100644
index 000000000..5ddd94a3d
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/watchquagga.init
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: watchquagga
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop the Quagga watchdog
+### END INIT INFO
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# Load configuration
+test -f /etc/default/watchquagga && . /etc/default/watchquagga
+
+# Check that there are daemons to be monitored.
+[ -z "$watch_daemons" ] && exit 0
+
+pidfile="/var/run/quagga/watchquagga.pid"
+
+case "$1" in
+ start)
+ echo -n "Starting quagga watchdog daemon: watchquagga"
+ start-stop-daemon --start \
+ --pidfile $pidfile \
+ --exec /usr/sbin/watchquagga \
+ -- -d $watch_options $watch_daemons
+ echo "."
+ ;;
+
+ stop)
+ echo -n "Stopping quagga watchdog daemon: watchquagga"
+ start-stop-daemon --stop --quiet \
+ --pidfile $pidfile
+ echo "."
+ ;;
+
+ status)
+ echo -n "watchquagga "
+ res=1
+ [ -e $pidfile ] && kill -0 `cat $pidfile` 2> /dev/null
+ if [ $? -eq 0 ]; then
+ echo "(pid `cat $pidfile`) is running..."
+ res=0
+ else
+ echo "is stopped..."
+ fi
+ exit $res
+ ;;
+
+ restart|force-reload)
+ $0 stop $2
+ sleep 1
+ $0 start $2
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/watchquagga {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service
new file mode 100644
index 000000000..e4fb6c808
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/files/zebra.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNU Zebra routing manager
+Wants=network.target
+Before=network.target
+ConditionPathExists=@SYSCONFDIR@/quagga/zebra.conf
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/quagga
+PIDFile=@localstatedir@/run/quagga/zebra.pid
+ExecStartPre=@BASE_SBINDIR@/ip route flush proto zebra
+ExecStart=@SBINDIR@/zebra -d $zebra_options -f @SYSCONFDIR@/quagga/zebra.conf
+ExecStopPost=@base_bindir@/rm -rf @localstatedir@/run/quagga/zebra.pid
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc
new file mode 100644
index 000000000..dfd6aa7eb
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga.inc
@@ -0,0 +1,232 @@
+SUMMARY = "BGP/OSPF/RIP routing daemon"
+DESCRIPTION = "Quagga is a routing software suite, providing \
+implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \
+Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
+Quagga is a fork of GNU Zebra which was developed by Kunihiro \
+Ishiguro. The Quagga tree aims to build a more involved community \
+around Quagga than the current centralised model of GNU Zebra."
+HOMEPAGE = "http://www.nongnu.org/quagga/"
+SECTION = "net"
+
+
+LICENSE = "GPL-2.0 & LGPL-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \
+ file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c"
+
+DEPENDS = "readline ncurses perl-native c-ares"
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}"
+SNMP_CONF="${@bb.utils.contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}"
+
+# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
+RDEPENDS_${PN} += "iproute2"
+
+SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga/quagga-${PV}.tar.gz; \
+ file://quagga.init \
+ file://quagga.default \
+ file://watchquagga.init \
+ file://watchquagga.default \
+ file://volatiles.03_quagga \
+ file://quagga.pam \
+ file://bgpd.service \
+ file://isisd.service \
+ file://ospf6d.service \
+ file://ospfd.service \
+ file://ripd.service \
+ file://ripngd.service \
+ file://zebra.service \
+ "
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
+PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
+PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
+
+inherit autotools update-rc.d useradd systemd pkgconfig
+
+SYSTEMD_PACKAGES = "${PN} ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
+SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service"
+SYSTEMD_SERVICE_${PN}-isisd = "isisd.service"
+SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service"
+SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service"
+SYSTEMD_SERVICE_${PN}-ripd = "ripd.service"
+SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service"
+SYSTEMD_SERVICE_${PN} = "zebra.service"
+
+EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
+ --localstatedir=${localstatedir}/run/quagga \
+ --enable-exampledir=${docdir}/quagga/examples/ \
+ --enable-vtysh \
+ --enable-isisd \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \
+ --enable-ospfclient=yes \
+ --enable-multipath=64 \
+ --enable-user=quagga \
+ --enable-group=quagga \
+ --enable-vty-group=quaggavty \
+ --enable-configfile-mask=0640 \
+ --enable-logfile-mask=0640 \
+ --enable-rtadv \
+ --enable-linux24-tcp-md5 \
+ ap_cv_cc_pie=no \
+ ${SNMP_CONF}"
+
+CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
+
+do_install () {
+ # Install init script and default settings
+ install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
+ ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
+ install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
+ install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
+ install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
+ install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
+ install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
+
+ # Install sample configurations for the daemons
+ for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
+ install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
+ done
+
+ for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
+ touch ${D}${sysconfdir}/quagga/$f.conf
+ done
+ chown quagga:quaggavty ${D}${sysconfdir}/quagga
+ chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
+ chmod 750 ${D}${sysconfdir}/quagga
+ chmod 640 ${D}${sysconfdir}/quagga/*.conf
+
+ # Install quagga
+ oe_runmake install DESTDIR=${D} prefix=${prefix} \
+ sbindir=${sbindir} \
+ sysconfdir=${sysconfdir}/quagga \
+ localstatedir=${localstatedir}/run/quagga
+
+ # Fix hardcoded paths
+ sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
+ sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
+ sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
+ sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
+ sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
+
+ # For PAM
+ for feature in ${DISTRO_FEATURES}; do
+ if [ "$feature" = "pam" ]; then
+ install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
+ break
+ fi
+ done
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -d ${D}${sysconfdir}/tmpfiles.d
+ echo "d /var/run/quagga 0755 quagga quagga -" \
+ > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
+ fi
+
+ # Remove sysinit script if sysvinit is not in DISTRO_FEATURES
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
+ rm -rf ${D}${sysconfdir}/init.d/
+ rm -f ${D}${sysconfdir}/default/watchquagga
+ fi
+
+ install -d ${D}${systemd_unitdir}/system
+ for i in bgpd isisd ospf6d ospfd ripd ripngd zebra; do
+ install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
+ done
+ sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
+ -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+ -e 's,@SBINDIR@,${sbindir},g' \
+ -e 's,@base_bindir@,${base_bindir},g' \
+ -e 's,@localstatedir@,${localstatedir},g' \
+ -i ${D}${systemd_unitdir}/system/*.service
+}
+
+DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
+pkg_postinst_${PN} () {
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
+ if [ -n "$D" ]; then
+ OPTS="--root=$D"
+ fi
+ systemctl $OPTS mask quagga.service
+ fi
+}
+
+# Split into a main package and separate per-protocol packages
+PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-bgpd \
+ ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
+ ${PN}-ospfclient ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}"
+
+RDEPENDS_${PN} += "${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
+
+FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*"
+FILES_${PN}-ospf6d = "${sbindir}/ospf6d"
+FILES_${PN}-bgpd = "${sbindir}/bgpd"
+FILES_${PN}-ripd = "${sbindir}/ripd"
+FILES_${PN}-ripngd = "${sbindir}/ripngd"
+FILES_${PN}-isisd = "${sbindir}/isisd"
+FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
+FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
+ ${sysconfdir}/init.d/watchquagga"
+
+# Indicate that the default files are configuration files
+CONFFILES_${PN} = "${sysconfdir}/default/quagga \
+ ${sysconfdir}/quagga/bgpd.conf \
+ ${sysconfdir}/quagga/vtysh.conf \
+ ${sysconfdir}/quagga/isisd.conf \
+ ${sysconfdir}/quagga/ospfd.conf \
+ ${sysconfdir}/quagga/ripngd.conf \
+ ${sysconfdir}/quagga/zebra.conf \
+ ${sysconfdir}/quagga/ripd.conf \
+ ${sysconfdir}/quagga/ospf6d.conf \
+ "
+CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
+
+# Stop the names being rewritten due to the internal shared libraries
+DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
+DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
+
+# Main init script starts all deamons
+# Seperate init script for watchquagga
+INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga"
+INITSCRIPT_NAME_${PN} = "quagga"
+INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
+INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga"
+INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10"
+
+# Add quagga's user and group
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
+USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga -G quaggavty --shell /bin/false quagga"
+
+pkg_postinst_${PN} () {
+ if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
+ ${sysconfdir}/init.d/populate-volatile.sh update
+ fi
+}
+
+# Stop apps before uninstall
+pkg_prerm_${PN} () {
+ ${sysconfdir}/init.d/quagga stop
+}
+
+pkg_prerm_${PN}-ospfd () {
+ ${sysconfdir}/init.d/quagga stop ospfd
+}
+
+pkg_prerm_${PN}-ospf6d () {
+ ${sysconfdir}/init.d/quagga stop ospf6d
+}
+
+pkg_prerm_${PN}-bgpd () {
+ ${sysconfdir}/init.d/quagga stop bgpd
+}
+
+pkg_prerm_${PN}-ripd () {
+ ${sysconfdir}/init.d/quagga stop ripd
+}
+
+pkg_prerm_${PN}-ripngd () {
+ ${sysconfdir}/init.d/quagga stop ripngd
+}
+
+pkg_prerm_${PN}-isisd () {
+ ${sysconfdir}/init.d/quagga stop isisd
+}
diff --git a/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb b/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb
new file mode 100644
index 000000000..a7697a1ae
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/quagga/quagga_1.2.4.bb
@@ -0,0 +1,4 @@
+require quagga.inc
+
+SRC_URI[md5sum] = "eced21b054d71c9e1b7c6ac43286a166"
+SRC_URI[sha256sum] = "e364c082c3309910e1eb7b068bf39ee298e2f2f3f31a6431a5c115193bd653d3"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/Modify-configure.in-and-etc-Makefile.am.patch b/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/Modify-configure.in-and-etc-Makefile.am.patch
new file mode 100644
index 000000000..ecc2d74e7
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/Modify-configure.in-and-etc-Makefile.am.patch
@@ -0,0 +1,84 @@
+From 45b97b474ce2d0ad56828db11edde8562bb47a43 Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Tue, 2 Dec 2014 02:33:53 +0900
+Subject: [PATCH] Modify configure.in and etc/Makefile.am
+
+this patch is from Fedora to fix error:
+"conftest.c:26:9: error: unknown type name 'not'"
+
+Upstream-Status: pending
+
+Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
+---
+ configure.in | 6 +++++-
+ etc/Makefile.am | 9 ++++++---
+ etc/radiusclient.conf.in | 2 +-
+ 3 files changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 812f640..3a8af99 100644
+--- a/configure.in
++++ b/configure.in
+@@ -29,6 +29,9 @@ AC_SUBST(LIBVERSION)
+ pkgsysconfdir=${sysconfdir}/$PACKAGE
+ AC_SUBST(pkgsysconfdir)
+
++pkgdatadir=${datadir}/$PACKAGE
++AC_SUBST(pkgdatadir)
++
+ AC_PROG_LIBTOOL
+
+ AC_PROG_CC
+@@ -118,7 +121,8 @@ then
+ ],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRUCT_UTSNAME_DOMAINNAME),
+- AC_MSG_RESULT(no)
++ AC_MSG_RESULT(no),
++ AC_MSG_RESULT(assume no),
+ )
+ fi
+
+diff --git a/etc/Makefile.am b/etc/Makefile.am
+index 39b6975..a3c403f 100644
+--- a/etc/Makefile.am
++++ b/etc/Makefile.am
+@@ -14,9 +14,11 @@ CLEANFILES = *~ radiusclient.conf
+
+ sbindir = @sbindir@
+ pkgsysconfdir = @pkgsysconfdir@
+-pkgsysconf_DATA = issue port-id-map radiusclient.conf \
+- dictionary dictionary.ascend dictionary.compat dictionary.merit \
+- dictionary.sip
++pkgsysconf_DATA = issue port-id-map radiusclient.conf
++
++pkgdatadir = @pkgdatadir@
++pkgdata_DATA = dictionary dictionary.ascend dictionary.compat \
++ dictionary.merit dictionary.sip
+
+ EXTRA_DIST = issue port-id-map dictionary dictionary.ascend \
+ dictionary.compat dictionary.merit servers radiusclient.conf.in \
+@@ -25,6 +27,7 @@ EXTRA_DIST = issue port-id-map dictionary dictionary.ascend \
+ radiusclient.conf: radiusclient.conf.in
+ sed -e 's|@sbin''dir@|$(sbindir)|g' \
+ -e 's|@pkgsysconf''dir@|$(pkgsysconfdir)|g' \
++ -e 's|@pkgdata''dir@|$(pkgdatadir)|g' \
+ <$(srcdir)/radiusclient.conf.in >radiusclient.conf
+
+ install-data-local: servers
+diff --git a/etc/radiusclient.conf.in b/etc/radiusclient.conf.in
+index 948bc2f..aac9973 100644
+--- a/etc/radiusclient.conf.in
++++ b/etc/radiusclient.conf.in
+@@ -47,7 +47,7 @@ servers @pkgsysconfdir@/servers
+
+ # dictionary of allowed attributes and values
+ # just like in the normal RADIUS distributions
+-dictionary @pkgsysconfdir@/dictionary
++dictionary @pkgdatadir@/dictionary
+
+ # program to call for a RADIUS authenticated login
+ login_radius @sbindir@/login.radius
+--
+1.8.4.2
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/config-site.radiusclient-ng-0.5.6 b/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/config-site.radiusclient-ng-0.5.6
new file mode 100644
index 000000000..a30c144b9
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng/config-site.radiusclient-ng-0.5.6
@@ -0,0 +1 @@
+ac_cv_func_uname=no
diff --git a/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng_0.5.6.bb b/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng_0.5.6.bb
new file mode 100644
index 000000000..95faa65b1
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/radiusclient-ng/radiusclient-ng_0.5.6.bb
@@ -0,0 +1,36 @@
+SUMMARY = "RADIUS protocol client library"
+DESCRIPTION = "Portable, easy-to-use and standard compliant library suitable \
+for developing free and commercial software that need support for a RADIUS \
+protocol (RFCs 2128 and 2139)."
+HOMEPAGE = "http://sourceforge.net/projects/radiusclient-ng.berlios/"
+SECTION = "net"
+
+SRC_URI = "${DEBIAN_MIRROR}/main/r/${BPN}/${BPN}_${PV}.orig.tar.gz \
+ file://Modify-configure.in-and-etc-Makefile.am.patch \
+ file://config-site.radiusclient-ng-${PV}"
+
+SRC_URI[md5sum] = "6fb7d4d0aefafaee7385831ac46a8e9c"
+SRC_URI[sha256sum] = "282a9f1355f190efbb06c0d7c4e062eaa652caf342ed3ad361ac595f72f09f14"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=3e47566c9271b786693d8a08792dbf41"
+
+inherit autotools-brokensep
+
+EXTRA_OECONF += "--disable-static"
+
+do_configure_prepend () {
+ export CONFIG_SITE=./config-site.${P}
+}
+
+do_compile_prepend() {
+ for m in `find . -name "Makefile"` ; do
+ sed -i -e 's:^program_transform_name =.*:program_transform_name =:g' ${m}
+ done
+}
+
+do_install() {
+ oe_runmake DESTDIR=${D} install
+ rm -f ${D}${libdir}/*.la
+ rm -f ${D}${sbindir}/radexample
+}
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0001-ppoe-Dont-include-linux-if_ether.h.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0001-ppoe-Dont-include-linux-if_ether.h.patch
new file mode 100644
index 000000000..7601f0d32
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0001-ppoe-Dont-include-linux-if_ether.h.patch
@@ -0,0 +1,28 @@
+From fdb64d21560bfdafeefccc7d20e105e4857faa99 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 19:20:07 -0700
+Subject: [PATCH] ppoe: Dont include linux/if_ether.h
+
+Fixes build with musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/pppoe.h | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/src/pppoe.h b/src/pppoe.h
+index ec067a0..281879c 100644
+--- a/src/pppoe.h
++++ b/src/pppoe.h
+@@ -127,10 +127,6 @@ typedef unsigned long UINT32_t;
+ #error Could not find a 32-bit integer type
+ #endif
+
+-#ifdef HAVE_LINUX_IF_ETHER_H
+-#include <linux/if_ether.h>
+-#endif
+-
+ #include <netinet/in.h>
+
+ #ifdef HAVE_NETINET_IF_ETHER_H
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0002-Enable-support-for-the-kernel-module.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0002-Enable-support-for-the-kernel-module.patch
new file mode 100644
index 000000000..2103b3888
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/0002-Enable-support-for-the-kernel-module.patch
@@ -0,0 +1,23 @@
+From 31b6eecd7e5ebfb9a37915f28823e5af9d1062b4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Mar 2017 19:24:53 -0700
+Subject: [PATCH] Enable support for the kernel module
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/configure.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/configure.in b/src/configure.in
+index cae0976..951a042 100644
+--- a/src/configure.in
++++ b/src/configure.in
+@@ -33,6 +33,7 @@ AC_CHECK_HEADERS(linux/if_pppox.h, [], [],
+ #include<net/ethernet.h>
+ #include<linux/if.h>
+ #include<linux/in.h>
++#include<linux/in6.h>
+ ])
+
+ dnl Checks for typedefs, structures, and compiler characteristics.
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.in-Error-fix.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.in-Error-fix.patch
new file mode 100644
index 000000000..bbd516fde
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.in-Error-fix.patch
@@ -0,0 +1,57 @@
+From bdd20b7a584a20504dfabb409a41ee2b9ae41657 Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimaohui@cn.fujitsu.com>
+Date: Wed, 19 Aug 2015 13:52:57 +0900
+Subject: [PATCH] configure.in: Error fix.
+
+the error is: conftest.c:9:28: fatal error: ac_nonexistent.h:
+No such file or directory #include <ac_nonexistent.h>
+
+Upstream-Status: pending
+
+Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
+
+---
+ src/configure.in | 30 ------------------------------
+ 1 file changed, 30 deletions(-)
+
+diff --git a/src/configure.in b/src/configure.in
+index 1714e69..cae0976 100644
+--- a/src/configure.in
++++ b/src/configure.in
+@@ -195,36 +195,6 @@ if test "$GCC" = yes; then
+ CFLAGS="$CFLAGS -fno-strict-aliasing -Wall -Wstrict-prototypes"
+ fi
+
+-dnl Figure out packing order of structures
+-AC_CACHE_CHECK([packing order of bit fields],rpppoe_cv_pack_bitfields,[
+-if test "${rpppoe_cv_pack_bitfields+set}" != set ; then
+-AC_TRY_RUN([
+-union foo {
+- struct bar {
+- unsigned int ver:4;
+- unsigned int type:4;
+- } bb;
+- unsigned char baz;
+-};
+-
+-int
+-main(void)
+-{
+- union foo x;
+- x.bb.ver = 1;
+- x.bb.type = 2;
+- if (x.baz == 0x21) {
+- return 1;
+- } else if (x.baz == 0x12) {
+- return 0;
+- } else {
+- return 2;
+- }
+-}], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev,
+-$ECHO "no defaults for cross-compiling"; exit 1)
+-fi
+-])
+-
+ if test "$rpppoe_cv_pack_bitfields" = "rev" ; then
+ AC_MSG_RESULT(reversed)
+ AC_DEFINE([PACK_BITFIELDS_REVERSED], [], [Reversed bitfields])
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.patch
new file mode 100644
index 000000000..be892803e
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure.patch
@@ -0,0 +1,19 @@
+From c96dda04ec024bdef2a15d374e5f8242e041cad4 Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie@linuxfoundation.org>
+Date: Fri, 18 Jul 2014 08:25:16 +0000
+
+---
+ configure.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index ac1a7e4..11b9f31 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1,4 +1,4 @@
+-AC_INIT(src/pppoe.c)
+-AM_INIT_AUTOMAKE([rp-pppoe], [3.8])
++AC_INIT([rp-pppoe], [3.8])
++AM_INIT_AUTOMAKE([foreign])
+ AC_CONFIG_SUBDIRS(src)
+ AC_OUTPUT(Makefile)
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure_in_cross.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure_in_cross.patch
new file mode 100644
index 000000000..3b945934f
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/configure_in_cross.patch
@@ -0,0 +1,153 @@
+From 172907f31d64da4c3f289a439fd605d2ab51b24a Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimaohui@cn.fujitsu.com>
+Date: Wed, 19 Aug 2015 12:17:03 +0900
+Subject: [PATCH] configure in cross
+
+Update the configure script to cross-compiling with OE. This hard-codes
+a few target paths, reworks a few tests to be more friendly for cross
+and drops other tests.
+
+Upstream-Status: Inappropriate [build system specific changes]
+
+---
+ src/configure.in | 66 ++++++++++++++------------------------------------------
+ 1 file changed, 16 insertions(+), 50 deletions(-)
+
+diff --git a/src/configure.in b/src/configure.in
+index 90a07df..1d30243 100644
+--- a/src/configure.in
++++ b/src/configure.in
+@@ -5,6 +5,13 @@ AC_INIT(pppoe.c)
+ dnl pppd directory for kernel-mode PPPoE
+ PPPD_DIR=ppp-2.4.1.pppoe2
+
++dnl hard code some paths
++PPPD=/usr/sbin/pppd
++ID=/usr/bin/id
++ECHO=/bin/echo
++AC_ARG_VAR(PPPD)
++AC_ARG_VAR(ID)
++
+ AC_CONFIG_HEADER(config.h)
+
+ AC_PREFIX_DEFAULT(/usr)
+@@ -45,7 +52,7 @@ ac_cv_struct_sockaddr_ll=no)
+ AC_MSG_RESULT($ac_cv_struct_sockaddr_ll)
+
+ if test "$ac_cv_struct_sockaddr_ll" = yes ; then
+-AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL)
++AC_DEFINE([HAVE_STRUCT_SOCKADDR_LL], [], [Have struct SOCKADDR_LL])
+ fi
+
+ dnl Check for N_HDLC line discipline
+@@ -58,7 +65,7 @@ AC_TRY_COMPILE([
+ ac_cv_n_hdlc=no)
+ AC_MSG_RESULT($ac_cv_n_hdlc)
+ if test "$ac_cv_n_hdlc" = yes ; then
+-AC_DEFINE(HAVE_N_HDLC)
++AC_DEFINE([HAVE_N_HDLC], [], [Have N_HDLC])
+ fi
+
+ AC_ARG_ENABLE(plugin, [ --enable-plugin=pppd_src_path build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no)
+@@ -106,7 +113,7 @@ PPPD_INCDIR=""
+ if test "$ac_cv_header_linux_if_pppox_h" = yes ; then
+ if test "$ac_cv_pluginpath" != no ; then
+ LINUX_KERNELMODE_PLUGIN=rp-pppoe.so
+- AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE)
++ AC_DEFINE([HAVE_LINUX_KERNEL_PPPOE], [], [Have kernel PPPoE])
+ PPPD_INCDIR=$ac_cv_pluginpath
+ fi
+ fi
+@@ -116,7 +123,7 @@ if test "$PPPD_INCDIR" = "" ; then
+ fi
+
+ if test "$ac_cv_debugging" = "yes" ; then
+- AC_DEFINE(DEBUGGING_ENABLED)
++ AC_DEFINE([DEBUGGING_ENABLED], [], [Debugging enabled])
+ fi
+
+ AC_SUBST(LINUX_KERNELMODE_PLUGIN)
+@@ -142,15 +149,8 @@ AC_CHECK_SIZEOF(unsigned short)
+ AC_CHECK_SIZEOF(unsigned int)
+ AC_CHECK_SIZEOF(unsigned long)
+
+-dnl Check for location of pppd
+-AC_PATH_PROG(PPPD, pppd, NOTFOUND, $PATH:/sbin:/usr/sbin:/usr/local/sbin)
+-AC_PATH_PROG(ECHO, echo, echo)
+-
+-dnl Check for setsid (probably Linux-specific)
+-AC_PATH_PROG(SETSID, setsid, "", $PATH:/sbin:/usr/sbin:/usr/local/sbin)
+-
+ dnl Check for an "id" which accepts "-u" option -- hack for Solaris.
+-AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH)
++dnl AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH)
+
+ dnl Check for Linux-specific kernel support for PPPoE
+ AC_MSG_CHECKING(for Linux 2.4.X kernel-mode PPPoE support)
+@@ -195,44 +195,8 @@ if test "$GCC" = yes; then
+ CFLAGS="$CFLAGS -fno-strict-aliasing -Wall -Wstrict-prototypes"
+ fi
+
+-dnl If we couldn't find pppd, die
+-if test "$PPPD" = "NOTFOUND"; then
+- AC_MSG_WARN([*** Oops! I couldn't find pppd, the PPP daemon anywhere.])
+- AC_MSG_WARN([*** You must install pppd, version 2.3.10 or later.])
+- AC_MSG_WARN([*** I will keep going, but it may not work.])
+- PPPD=pppd
+-fi
+-
+-dnl Figure out pppd version. 2.3.7 to 2.3.9 -- issue warning. Less than
+-dnl 2.3.7 -- stop
+-
+-PPPD_VERSION=`$PPPD --version 2>&1 | awk ' /version/ {print $NF}'`
+-
+-case "$PPPD_VERSION" in
+-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)
+- AC_MSG_WARN([*** Oops! Your version of pppd is $PPPD_VERSION, which is too old.])
+- AC_MSG_WARN([*** You need at least 2.3.7 (2.3.10 or newer recommended.])
+- AC_MSG_WARN([*** I will keep going, but it may not work.])
+- ;;
+-
+-2.3.7|2.3.8|2.3.9)
+- AC_MSG_WARN([*** Warning. Your version of pppd is $PPPD_VERSION. You will])
+- AC_MSG_WARN([*** not be able to use connect-on-demand. Upgrade to pppd])
+- AC_MSG_WARN([*** 2.3.10 or newer if you need connect-on-demand.])
+- ;;
+-
+-2*|3*|4*|5*|6*|7*|8*|9*)
+- ;;
+-
+-*)
+- AC_MSG_WARN([*** Oops. I cannot figure out what version of pppd you have.])
+- AC_MSG_WARN([*** All I got back was '$PPPD_VERSION'])
+- AC_MSG_WARN([*** I will keep going, but it may not work.])
+- ;;
+-esac
+-
+ dnl Figure out packing order of structures
+-AC_MSG_CHECKING([packing order of bit fields])
++AC_CACHE_CHECK([packing order of bit fields],rpppoe_cv_pack_bitfields,[
+ if test "${rpppoe_cv_pack_bitfields+set}" != set ; then
+ AC_TRY_RUN([
+ union foo {
+@@ -259,10 +223,11 @@ main(void)
+ }], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev,
+ $ECHO "no defaults for cross-compiling"; exit 0)
+ fi
++])
+
+ if test "$rpppoe_cv_pack_bitfields" = "rev" ; then
+ AC_MSG_RESULT(reversed)
+- AC_DEFINE(PACK_BITFIELDS_REVERSED)
++ AC_DEFINE([PACK_BITFIELDS_REVERSED], [], [Reversed bitfields])
+ else
+ AC_MSG_RESULT(normal)
+ fi
+@@ -326,6 +291,7 @@ AC_SUBST(PPPOE_SERVER_DEPS)
+ AC_SUBST(RDYNAMIC)
+ AC_SUBST(LIBEVENT)
+ AC_SUBST(ECHO)
++AC_SUBST(HAVE_STRUCT_SOCKADDR_LL)
+ AC_SUBST(LDFLAGS)
+
+ datadir_evaluated=`eval echo $datadir`
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/discard-use-of-dnl-in-Makefile.am.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/discard-use-of-dnl-in-Makefile.am.patch
new file mode 100644
index 000000000..9801f6e27
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/discard-use-of-dnl-in-Makefile.am.patch
@@ -0,0 +1,25 @@
+From f658181c58347c3e2b0ee4f0a6a3d19162921471 Mon Sep 17 00:00:00 2001
+From: Ting Liu <b28495@freescale.com>
+Date: Tue, 12 Jun 2012 14:26:16 -0400
+Subject: [PATCH] discard use of dnl in Makefile.am
+
+Since Makefile.am is not processed by m4, but by automake, 'dnl' does
+not introduce a comment.
+
+Signed-off-by: Ting Liu <b28495@freescale.com>
+
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index eff6977..3091c33 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,5 +1,5 @@
+ PACKAGE = rp-pppoe
+ VERSION = 3.8
+
+-dnl AM_CFLAGS = -Wall -DDEBUG
++##dnl AM_CFLAGS = -Wall -DDEBUG
+ SUBDIRS = src
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/dont-swallow-errors.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/dont-swallow-errors.patch
new file mode 100644
index 000000000..8a857888b
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/dont-swallow-errors.patch
@@ -0,0 +1,26 @@
+From a9a7322273c51882af58c35ba288a0fae00ba841 Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimaohui@cn.fujitsu.com>
+Date: Wed, 19 Aug 2015 12:33:41 +0900
+Subject: [PATCH] don't swallow errors
+
+Further fixup to the configure scripts to not swallow errors
+
+Upstream-Status: Pending
+
+---
+ src/configure.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/configure.in b/src/configure.in
+index 1d30243..1714e69 100644
+--- a/src/configure.in
++++ b/src/configure.in
+@@ -221,7 +221,7 @@ main(void)
+ return 2;
+ }
+ }], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev,
+-$ECHO "no defaults for cross-compiling"; exit 0)
++$ECHO "no defaults for cross-compiling"; exit 1)
+ fi
+ ])
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.default b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.default
new file mode 100644
index 000000000..996d57f3c
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.default
@@ -0,0 +1,22 @@
+# PPPoE Server options
+
+# Maximum segment size, not used for in kernel PPPoE
+#MSS=1412
+
+# Device(s) - Space seperated list of devices to listen on
+#DEVICES="eth1"
+
+# Local IP
+#LOCAL_IP=10.0.0.1
+
+# Starting remote IP
+#REMOTE_IP=10.67.15.1
+
+# Service name
+#SERVICE_NAME="acme"
+
+# Maximum number of sessions, default is 16
+#MAX_SESSIONS=64
+
+# Access concentrator name, default is the hostname
+#ACCESS_CONCENTRATOR_NAME="pppoe-rtr-1"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.init b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.init
new file mode 100755
index 000000000..21afe0be3
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.init
@@ -0,0 +1,59 @@
+#! /bin/sh
+
+test -f /usr/sbin/pppoe-server || exit 0
+test -f /etc/default/pppoe-server && . /etc/default/pppoe-server
+
+case $1 in
+ start)
+ OPTIONS=""
+ if [ -n "$MSS" ]; then
+ OPTIONS="$OPTIONS -m $MSS"
+ fi
+ if [ -n "$DEVICES" ]; then
+ for i in $DEVICES; do
+ OPTIONS="$OPTIONS -I $i"
+ done
+ fi
+ if [ -n "$LOCAL_IP" ]; then
+ OPTIONS="$OPTIONS -L $LOCAL_IP"
+ fi
+ if [ -n "$REMOTE_IP" ]; then
+ OPTIONS="$OPTIONS -R $REMOTE_IP"
+ fi
+ if [ -n "$SERVICE_NAME" ]; then
+ OPTIONS="$OPTIONS -S $SERVICE_NAME"
+ fi
+ if [ -n "$MAX_SESSIONS" ]; then
+ OPTIONS="$OPTIONS -N $MAX_SESSIONS"
+ fi
+ if [ -n "$ACCESS_CONCENTRATOR_NAME" ]; then
+ OPTIONS="$OPTIONS -C $ACCESS_CONCENTRATOR_NAME"
+ fi
+ echo -n "Starting PPPoE server: pppoe-server"
+ start-stop-daemon --start --quiet --exec /usr/sbin/pppoe-server -- $OPTIONS
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping PPPoE server: pppoe-server"
+ start-stop-daemon --stop --quiet --exec /usr/sbin/pppoe-server -- $OPTIONS
+ echo "."
+ ;;
+ status)
+ pid=$(pidof pppoe-server)
+ if [ -n "$pid" ] ; then
+ echo "Running with pid $pid"
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/pppoe-server {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.service b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.service
new file mode 100644
index 000000000..41e0b9e85
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-server.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=PPPOE Service
+After=network.target
+
+[Service]
+Type=forking
+EnvironmentFile=-@SYSCONFDIR@/default/pppoe-server
+ExecStart=@SBINDIR@/pppoe-server
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-src-restrictions.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-src-restrictions.patch
new file mode 100644
index 000000000..03697ff1f
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/pppoe-src-restrictions.patch
@@ -0,0 +1,31 @@
+From a6a85ec5c85cbd3c86743b6e2fa391198869bff8 Mon Sep 17 00:00:00 2001
+From: Tom Rini <tom_rini@mentor.com>
+Date: Wed, 27 Jul 2011 03:46:52 +0000
+Subject: [PATCH] rp-pppoe: Port from oe.dev
+
+Relax restrictions on the PPPoE src address, as per debian bug
+293811:
+
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=293811
+
+Upstream-Status: Inappropriate [Backport from Debian]
+
+---
+ src/discovery.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/discovery.c b/src/discovery.c
+index 7ee259d..5213a37 100644
+--- a/src/discovery.c
++++ b/src/discovery.c
+@@ -472,8 +472,8 @@ waitForPADO(PPPoEConnection *conn, int timeout)
+ if (!packetIsForMe(conn, &packet)) continue;
+
+ if (packet.code == CODE_PADO) {
+- if (NOT_UNICAST(packet.ethHdr.h_source)) {
+- printErr("Ignoring PADO packet from non-unicast MAC address");
++ if (BROADCAST(packet.ethHdr.h_source)) {
++ printErr("Ignoring broadcast PADO packet");
+ continue;
+ }
+ #ifdef PLUGIN
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/top-autoconf.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/top-autoconf.patch
new file mode 100644
index 000000000..f64da4fa2
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/top-autoconf.patch
@@ -0,0 +1,41 @@
+From 0b62f71eb5d44d4a57103566ba58022b6304fa4f Mon Sep 17 00:00:00 2001
+From: Tom Rini <tom_rini@mentor.com>
+Date: Wed, 27 Jul 2011 03:46:52 +0000
+Subject: [PATCH] rp-pppoe: Port from oe.dev
+
+The autoconf stuff is all in a subdirectory, which is rather annoying
+as OE expects patches to be applied and autoconf stuff to be done in
+S. This adds enough autoconf at the top level to allow it to be
+called there - all it does is run a sub autoconf stuff in the src
+directory.
+
+Upstream-Status: Inappropriate [build system specific change]
+
+---
+ Makefile.am | 5 +++++
+ configure.in | 4 ++++
+ 2 files changed, 9 insertions(+)
+ create mode 100644 Makefile.am
+ create mode 100644 configure.in
+
+diff --git a/Makefile.am b/Makefile.am
+new file mode 100644
+index 0000000..eff6977
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1,5 @@
++PACKAGE = rp-pppoe
++VERSION = 3.8
++
++dnl AM_CFLAGS = -Wall -DDEBUG
++SUBDIRS = src
+diff --git a/configure.in b/configure.in
+new file mode 100644
+index 0000000..ac1a7e4
+--- /dev/null
++++ b/configure.in
+@@ -0,0 +1,4 @@
++AC_INIT(src/pppoe.c)
++AM_INIT_AUTOMAKE([rp-pppoe], [3.8])
++AC_CONFIG_SUBDIRS(src)
++AC_OUTPUT(Makefile)
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/update-config.patch b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/update-config.patch
new file mode 100644
index 000000000..c759e09aa
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe-3.12/update-config.patch
@@ -0,0 +1,41 @@
+From 4d34e0d7d790ec41b0afb731c7dc1b1ee90dd377 Mon Sep 17 00:00:00 2001
+From: Tom Rini <tom_rini@mentor.com>
+Date: Wed, 27 Jul 2011 03:46:52 +0000
+Subject: [PATCH] rp-pppoe: Port from oe.dev
+
+Set the timeout to 0 since we don't want pppoe to try reconnecting,
+we want whatever is calling it to reconnect. Lots of odd things
+happen when you have pppoe retrying itself.
+
+The path for the plugin is wrong, it's now part of ppp and is in a
+ppp's plugin lib directory. If no path is specified then that's where
+ppp looks, so that's what we do here.
+
+Upstream-Status: Inappropriate [configuration]
+
+---
+ configs/pppoe.conf | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configs/pppoe.conf b/configs/pppoe.conf
+index c222b2f..65618a5 100644
+--- a/configs/pppoe.conf
++++ b/configs/pppoe.conf
+@@ -66,7 +66,7 @@ DEFAULTROUTE=yes
+ # to connect forever after pppoe-start is called. Otherwise, it will
+ # give out after CONNECT_TIMEOUT seconds and will not attempt to
+ # connect again, making it impossible to reach.
+-CONNECT_TIMEOUT=30
++CONNECT_TIMEOUT=0
+
+ # How often in seconds pppoe-start polls to check if link is up
+ CONNECT_POLL=2
+@@ -115,7 +115,7 @@ PPPOE_TIMEOUT=80
+ FIREWALL=NONE
+
+ # Linux kernel-mode plugin for pppd. If you want to try the kernel-mode
+-# plugin, use LINUX_PLUGIN=/etc/ppp/plugins/rp-pppoe.so
++# plugin, use LINUX_PLUGIN=rp-pppoe.so
+ LINUX_PLUGIN=
+
+ # Any extra arguments to pass to pppoe. Normally, use a blank string
diff --git a/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.12.bb b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.12.bb
new file mode 100644
index 000000000..fbe015f5e
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/rp-pppoe/rp-pppoe_3.12.bb
@@ -0,0 +1,77 @@
+SUMMARY = "A user-mode PPPoE client and server suite for Linux"
+HOMEPAGE = "http://www.roaringpenguin.com/products/pppoe"
+SECTION = "net"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=a194eaefae2be54ee3221339b10d0581"
+
+PR = "r10"
+
+SRC_URI = "http://www.roaringpenguin.com/files/download/${BP}.tar.gz \
+ file://top-autoconf.patch \
+ file://configure_in_cross.patch \
+ file://pppoe-src-restrictions.patch \
+ file://update-config.patch \
+ file://dont-swallow-errors.patch \
+ file://discard-use-of-dnl-in-Makefile.am.patch \
+ file://configure.patch \
+ file://pppoe-server.default \
+ file://pppoe-server.init \
+ file://configure.in-Error-fix.patch \
+ file://pppoe-server.service \
+ file://0001-ppoe-Dont-include-linux-if_ether.h.patch \
+ file://0002-Enable-support-for-the-kernel-module.patch \
+ "
+
+SRC_URI[md5sum] = "216eb52b69062b92a64ee37fd71f4b66"
+SRC_URI[sha256sum] = "00794e04031546b0e9b8cf286f2a6d1ccfc4a621b2a3abb2d7ef2a7ab7cc86c2"
+
+inherit autotools-brokensep update-rc.d systemd
+
+do_install_append() {
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/pppoe-server.service ${D}${systemd_unitdir}/system
+ sed -i -e 's#@SYSCONFDIR@#${sysconfdir}#g' ${D}${systemd_unitdir}/system/pppoe-server.service
+ sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/pppoe-server.service
+ install -d ${D}${datadir}/doc/${PN}
+ if [ -f ${D}${datadir}/doc/README ]; then
+ mv ${D}${datadir}/doc/README ${D}${datadir}/doc/${PN}/
+ fi
+}
+
+do_install() {
+ # Install init script and default settings
+ install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d
+ install -m 0644 ${WORKDIR}/pppoe-server.default ${D}${sysconfdir}/default/pppoe-server
+ install -m 0755 ${WORKDIR}/pppoe-server.init ${D}${sysconfdir}/init.d/pppoe-server
+ # Install
+ oe_runmake -C ${S} DESTDIR=${D} docdir=${docdir} install
+ chmod 4755 ${D}${sbindir}/pppoe
+}
+
+SYSTEMD_PACKAGES = "${PN}-server"
+SYSTEMD_SERVICE_${PN}-server = "pppoe-server.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+# Insert server package before main package
+PACKAGES = "${PN}-dbg ${PN}-server ${PN}-relay ${PN}-sniff ${PN} ${PN}-doc"
+
+FILES_${PN}-server = "${sysconfdir}/default/pppoe-server \
+ ${sysconfdir}/init.d/pppoe-server \
+ ${sbindir}/pppoe-server \
+ ${sysconfdir}/ppp/pppoe-server-options"
+FILES_${PN}-relay = "${sbindir}/pppoe-relay"
+FILES_${PN}-sniff = "${sbindir}/pppoe-sniff"
+
+CONFFILES_${PN} = "${sysconfdir}/ppp/pppoe.conf \
+ ${sysconfdir}/ppp/firewall-standalone \
+ ${sysconfdir}/ppp/firewall-masq"
+CONFFILES_${PN}-server = "${sysconfdir}/ppp/pppoe-server-options \
+ ${sysconfdir}/default/pppoe-server"
+
+INITSCRIPT_PACKAGES = "${PN}-server"
+INITSCRIPT_NAME_${PN}-server = "pppoe-server"
+INITSCRIPT_PARAMS_${PN}-server = "defaults 92 8"
+
+RDEPENDS_${PN} = "ppp"
+RDEPENDS_${PN}-server = "${PN}"
+RRECOMMENDS_${PN} = "ppp-oe"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks/makefile-add-ldflags.patch b/meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks/makefile-add-ldflags.patch
new file mode 100644
index 000000000..21464188c
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks/makefile-add-ldflags.patch
@@ -0,0 +1,19 @@
+Add LDFLAGS variable to Makefile.in, make sure the extra linker flags can be passed.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+diff --git a/Makefile.in b/Makefile.in
+index cad6706..0ed55c5 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -50,7 +50,7 @@ ${SAVE}: ${SAVE}.c
+ ${SHCC} ${CFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
+
+ ${SHLIB}: ${OBJS} ${COMMON}.o ${PARSER}.o
+- ${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
++ ${SHCC} ${CFLAGS} ${LDFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
+ ln -sf ${SHLIB} ${LIB_NAME}.so
+
+ %.so: %.c
diff --git a/meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks_1.8beta5.bb b/meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks_1.8beta5.bb
new file mode 100644
index 000000000..b2757f6dd
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/tsocks/tsocks_1.8beta5.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Libraries and wrapper for using a SOCKS proxy"
+DESCRIPTION = "The role of tsocks is to allow non SOCKS aware \
+applications (e.g telnet, ssh, ftp etc) to use SOCKS without any \
+modification. It does this by intercepting the calls that applications \
+make to establish network connections and negotating them through a \
+SOCKS server as necessary."
+HOMEPAGE = "http://sourceforge.net/projects/tsocks/"
+SECTION = "net"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760"
+
+SRC_URI = "http://downloads.sourceforge.net/tsocks/tsocks-${PV}.tar.gz \
+ file://makefile-add-ldflags.patch \
+ "
+
+SRC_URI[md5sum] = "51caefd77e5d440d0bbd6443db4fc0f8"
+SRC_URI[sha256sum] = "849d7ef5af80d03e76cc05ed9fb8fa2bcc2b724b51ebfd1b6be11c7863f5b347"
+
+inherit autotools-brokensep
+
+S = "${WORKDIR}/tsocks-1.8"
+
+FILES_${PN} = "${libdir}/* ${bindir}/tsocks"
+FILES_${PN}-dev = ""
+INSANE_SKIP_${PN} = "dev-so"
+
+EXTRA_OEMAKE = "SHCC='${CC} -fPIC ${LDFLAGS}'"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp/0001-Use-foreign-switch-for-automake.patch b/meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp/0001-Use-foreign-switch-for-automake.patch
new file mode 100644
index 000000000..b932ebbb4
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp/0001-Use-foreign-switch-for-automake.patch
@@ -0,0 +1,28 @@
+From 748bc693cf24baf42e459e12f152349e392b6737 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 20 Dec 2016 21:32:11 -0800
+Subject: [PATCH] Use foreign switch for automake
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 64cc9994..19ccd4a3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -29,7 +29,7 @@ dnl SUCH DAMAGE.
+ dnl
+
+ AC_INIT([libusrsctp], [0.9.3.0])
+-AM_INIT_AUTOMAKE
++AM_INIT_AUTOMAKE([foreign])
+
+ AC_PROG_CC
+ AC_PROG_LIBTOOL
+--
+2.11.0
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp_git.bb b/meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp_git.bb
new file mode 100644
index 000000000..3ec746684
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/usrsctp/usrsctp_git.bb
@@ -0,0 +1,24 @@
+DESCRIPTION = "This is a userland SCTP stack supporting FreeBSD, Linux, Mac OS X and Windows."
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=ffcf846341f3856d79a483eafa18e2a5"
+
+SRCREV = "dbfc1b8c4cf1a46a4d8987ba542d5ff06bdaf14c"
+SRC_URI = "git://github.com/sctplab/usrsctp;protocol=https;branch=master \
+ file://0001-Use-foreign-switch-for-automake.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+DEPENDS += "openssl"
+
+CFLAGS += "-DSCTP_USE_OPENSSL_SHA1 -fPIC"
+LDFLAGS += "-lssl -lcrypto"
+
+PACKAGECONFIG ?= "disablewarnings inet inet6"
+PACKAGECONFIG[disablewarnings] = "--disable-warnings-as-errors,,"
+PACKAGECONFIG[inet] = "--enable-inet,--disable-inet,"
+PACKAGECONFIG[inet6] = "--enable-inet6,--disable-inet6,"
+
+EXTRA_OECONF += "--disable-debug"
diff --git a/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc b/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc
new file mode 100644
index 000000000..d037c7cfc
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd.inc
@@ -0,0 +1,41 @@
+SUMMARY = "Xelerance version of the Layer 2 Tunneling Protocol (L2TP) daemon"
+HOMEPAGE = "http://www.xelerance.com/software/xl2tpd/"
+SECTION = "net"
+DEPENDS = "ppp virtual/kernel"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "git://github.com/xelerance/xl2tpd.git \
+"
+
+S = "${WORKDIR}/git"
+
+inherit update-rc.d
+
+do_compile () {
+ oe_runmake CFLAGS="${CFLAGS} -DLINUX" LDFLAGS="${LDFLAGS}" PREFIX="${prefix}" KERNELSRC=${STAGING_KERNEL_DIR} all
+}
+
+do_install () {
+ oe_runmake PREFIX="${D}${prefix}" install
+
+ install -d ${D}${sysconfdir}/init.d
+ touch ${D}${sysconfdir}/xl2tpd.conf
+ install -m 0755 debian/xl2tpd.init ${D}${sysconfdir}/init.d/xl2tpd
+ sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/xl2tpd
+ sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/xl2tpd
+ sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/xl2tpd
+ sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/xl2tpd
+
+ install -d ${D}${sysconfdir}/default
+ install -m 0644 debian/xl2tpd.default ${D}${sysconfdir}/default/xl2tpd
+}
+
+CONFFILES_${PN} += "${sysconfdir}/xl2tpd.conf ${sysconfdir}/default/xl2tpd"
+
+INITSCRIPT_PACKAGES = "${PN}"
+INITSCRIPT_NAME_${PN} = "xl2tpd"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_1.3.6.bb b/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_1.3.6.bb
new file mode 100644
index 000000000..df2ec52c6
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_1.3.6.bb
@@ -0,0 +1,7 @@
+require xl2tpd.inc
+
+# The SRCREV corresponds to v1.3.6.
+# Adding tag=v1.3.6 to the SRC_URI will force access to the upstream repo.
+#
+SRCREV = "5619e1771048e74b729804e8602f409af0f3faea"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb b/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb
new file mode 100644
index 000000000..88ae5d6f8
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/xl2tpd/xl2tpd_git.bb
@@ -0,0 +1,8 @@
+require xl2tpd.inc
+
+# This is v1.3.6 plus some commits. There is no tag for this commit.
+#
+PV = "1.3.9+git${SRCPV}"
+
+SRCREV = "f114c10ac532051badeca0132b144a2f1596f047"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/0001-zeroconf-Rename-arp_op-to-avoid-namespace-conflicts-.patch b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/0001-zeroconf-Rename-arp_op-to-avoid-namespace-conflicts-.patch
new file mode 100644
index 000000000..b4d6d94b0
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/0001-zeroconf-Rename-arp_op-to-avoid-namespace-conflicts-.patch
@@ -0,0 +1,69 @@
+From 549773fdaf1fb003b84f25df386a07d299cdeb3e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 18 Jul 2017 21:25:33 -0700
+Subject: [PATCH] zeroconf: Rename arp_op to avoid namespace conflicts with C
+ library
+
+on musl e.g. we get
+In file included from /mnt/a/oe/build/tmp/work/corei7-64-bec-linux-musl/zeroconf/0.9-r1/recipe-sysroot/usr/include/net/ethernet.h:10:0,
+
+This is because in musl arp_op is a define which is included
+and causes the conflict
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ zeroconf.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/zeroconf.c b/zeroconf.c
+index 812d34b..f27e907 100644
+--- a/zeroconf.c
++++ b/zeroconf.c
+@@ -14,8 +14,6 @@
+
+ #include <sys/types.h>
+ #include <sys/socket.h>
+-#include <linux/rtnetlink.h>
+-#include <linux/if.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -34,6 +32,8 @@
+ #include <sys/time.h>
+ #include <signal.h>
+ #include <limits.h>
++#include <linux/rtnetlink.h>
++#include <linux/if.h>
+
+ #include "delay.h"
+
+@@ -108,7 +108,7 @@ int arp_conflict(struct intf *intf, struct arp_packet *pkt);
+ void arp_packet_dump(struct arp_packet *pkt);
+ void arp_packet_send(int as,
+ struct intf *intf,
+- short int arp_op,
++ short int arpop,
+ int null_sender);
+ void arp_probe(int as, struct intf *intf);
+ void arp_claim(int as, struct intf *intf);
+@@ -1591,7 +1591,7 @@ int arp_conflict(struct intf *intf, struct arp_packet *pkt)
+
+ void arp_packet_send(int as,
+ struct intf *intf,
+- short int arp_op,
++ short int arpop,
+ int null_sender)
+ {
+
+@@ -1605,7 +1605,7 @@ void arp_packet_send(int as,
+ ap.arp.ar_pro = htons(ARP_IP_PROTO);
+ ap.arp.ar_hln = ETH_ALEN;
+ ap.arp.ar_pln = 4; /* octets in IPv4 address */
+- ap.arp.ar_op = htons(arp_op);
++ ap.arp.ar_op = htons(arpop);
+
+ /* filling with 0xff sets the destination to
+ * the broadcast link-layer address for free
+--
+2.13.3
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch
new file mode 100644
index 000000000..328e574a9
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/compilefix.patch
@@ -0,0 +1,19 @@
+| zeroconf.c: In function 'main':
+| zeroconf.c:145: error: 'PATH_MAX' undeclared (first use in this function)
+
+RP - 4/9/09
+
+Upstream-Status: Pending
+
+Index: zeroconf-0.9/zeroconf.c
+===================================================================
+--- zeroconf-0.9.orig/zeroconf.c 2009-09-04 10:05:25.000000000 +0100
++++ zeroconf-0.9/zeroconf.c 2009-09-04 10:05:42.000000000 +0100
+@@ -33,6 +33,7 @@
+ #include <net/if_arp.h>
+ #include <sys/time.h>
+ #include <signal.h>
++#include <limits.h>
+
+ #include "delay.h"
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf
new file mode 100644
index 000000000..0c9d15ba1
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/debian-zeroconf
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+if [ ! -x /usr/sbin/zeroconf ]; then
+ exit 0
+fi
+
+# IPv4 link-local addresses (zeroconf) are
+# only applicable on the 'inet' address family
+[ "X$ADDRFAM" != "Xinet" ] && exit 0
+
+# However there are some methods where it doesn't
+# make any sense to configure an IPv4LL address
+
+# not on loopback
+[ "X$METHOD" = "Xloopback" ] && exit 0
+
+# not on ppp or wvdial either
+[ "X$METHOD" = "Xppp" ] && exit 0
+[ "X$METHOD" = "Xwvdial" ] && exit 0
+
+# The administrator may have blacklisted interfaces
+# or only want zeroconf in a fallback situation
+[ -f /etc/default/zeroconf ] &&
+ . /etc/default/zeroconf
+
+[ -n "$DISABLE" ] && exit 0
+
+for BLACK in $IFBLACKLIST; do
+ case $IFACE in
+ $BLACK)
+ exit 0
+ ;;
+ esac
+done
+
+# should we only allocate an address if we do not already have one?
+if [ -n "$FALLBACK" ]; then
+ /sbin/ip addr show $IFACE scope global | grep -q "inet"
+ IP=$?
+ if [ $IP -eq 0 ]; then
+ /sbin/ip route add 169.254.0.0/16 dev $IFACE
+ exit 0
+ fi
+fi
+
+# otherwise, run if we aren't already going
+if [ ! -r /var/run/zeroconf.$IFACE.pid ]; then
+ /usr/sbin/zeroconf -i $IFACE
+fi
+
+exit 0
diff --git a/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/makefile-add-ldflags.patch b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/makefile-add-ldflags.patch
new file mode 100644
index 000000000..c5a4414db
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/makefile-add-ldflags.patch
@@ -0,0 +1,19 @@
+Add LDFLAGS variable to Makefile, make sure the extra linker flags can be passed.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+diff --git a/Makefile b/Makefile
+index 77f3364..c98083f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -18,7 +18,7 @@ clean:
+
+ zeroconf: zeroconf.o delay.o
+ $(Q)echo "Creating $@"
+- $(Q)$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
++ $(Q)$(CC) $(CFLAGS) ${LDFLAGS} -o $@ $^ $(LIBS)
+
+
+ # Automatic dependency generation
diff --git a/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default
new file mode 100644
index 000000000..cc07b275f
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf/zeroconf-default
@@ -0,0 +1,17 @@
+# Default for zeroconf
+
+# disable zeroconf
+# If you want to disable zeroconf completely, uncomment the following line
+# this may be useful if you are debugging zeroconf or starting it manually
+#DISABLE=yes
+
+# black-listed interfaces
+# Interfaces which you never wish to have zeroconf run on should
+# be listed here. e.g. "eth2 wlan1" in a space seperated string
+IFBLACKLIST=""
+
+# fallback only
+# If you would only like a link-local address if you were unable to
+# obtain an address via DHCP then uncomment the following line
+#FALLBACK=yes
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb
new file mode 100644
index 000000000..753d83298
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/zeroconf/zeroconf_0.9.bb
@@ -0,0 +1,37 @@
+SUMMARY = "IPv4 link-local address allocator"
+DESCRIPTION = "Zeroconf is a program that is used to claim IPv4 \
+link-local addresses. IPv4 link-local addresses are useful when setting \
+up ad-hoc networking between devices without the involvement of a either \
+a DHCP server or network administrator. \
+These addresses are allocated from the 169.254.0.0/16 address range and \
+are normally attached to each Ethernet device in your computer. \
+Addresses are assigned randomly by each host and, in case of collision, \
+both hosts (are supposed to) renumber."
+AUTHOR = "Anand Kumria <wildfire@progsoc.uts.edu.au>"
+HOMEPAGE = "http://www.progsoc.org/~wildfire/zeroconf/"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4325afd396febcb659c36b49533135d4 \
+ file://zeroconf.c;beginline=1;endline=13;md5=a5bada96e1e34b08eb7446b28e2630b2"
+SECTION = "net"
+
+PR = "r1"
+
+SRC_URI = "http://www.progsoc.org/~wildfire/zeroconf/download/${BPN}-${PV}.tar.gz \
+ file://compilefix.patch \
+ file://makefile-add-ldflags.patch \
+ file://zeroconf-default \
+ file://debian-zeroconf \
+ file://0001-zeroconf-Rename-arp_op-to-avoid-namespace-conflicts-.patch \
+ "
+
+SRC_URI[md5sum] = "bdafb16b008ebb5633e4e581f77821d2"
+SRC_URI[sha256sum] = "a8c74df127753e2310fa1e072f3c9ca44a404bb0bbce9cfec7a84c6dff8bec7b"
+
+do_install () {
+ install -d ${D}${sbindir}
+ install -d ${D}${sysconfdir}/network/if-up.d
+ install -d ${D}${sysconfdir}/default
+ install -c -m 755 ${S}/zeroconf ${D}${sbindir}/zeroconf
+ install -c -m 755 ${WORKDIR}/debian-zeroconf ${D}${sysconfdir}/network/if-up.d/zeroconf
+ install -c ${WORKDIR}/zeroconf-default ${D}${sysconfdir}/default/zeroconf
+}
OpenPOWER on IntegriCloud