Skip to contentSkip to conversation

update vblade and add freediameter and keepalived

PATCH In review [email protected] 3 participants 9 messages May 12, 2017 – May 17, 2017

lore
Share & tools
lore
#0 lore raw

cover update vblade and add freediameter and keepalived

From: Jackie Huang <[email protected]>

---
The following changes since commit fc03b3d9382dd5b6a8fff5f84e4c86a1acc9a73a:

drbd-utils: fix dependency for perl under small-fs (2017-05-09 12:29:15 -0400)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib.git jhuang0/r_upstream-diameter-keepalived-vblade_170512_0
http://git.pokylinux.org/cgit.cgi//log/?h=jhuang0/r_upstream-diameter-keepalived-vblade_170512_0

Jackie Huang (3):
keepalived: add new recipe
freediameter: add new recipe
vblade: update to version 22

 .../recipes-daemons/keepalived/keepalived_1.3.5.bb |  49 +++++
 .../recipes-daemons/vblade/files/vblade.conf       |   2 +
 .../recipes-daemons/vblade/files/vblade.init       | 193 ++++++++++++++++++
 .../recipes-daemons/vblade/files/vblade.service    |  11 +
 .../vblade/files/volatiles.99_vblade               |   1 +
 .../recipes-daemons/vblade/vblade_20.bb            |  22 --
 .../recipes-daemons/vblade/vblade_22.bb            |  51 +++++
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223 +++++++++++++++++++++
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb             |   7 +
 15 files changed, 823 insertions(+), 22 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived_1.3.5.bb
 create mode 100644 meta-networking/recipes-daemons/vblade/files/vblade.conf
 create mode 100644 meta-networking/recipes-daemons/vblade/files/vblade.init
 create mode 100644 meta-networking/recipes-daemons/vblade/files/vblade.service
 create mode 100644 meta-networking/recipes-daemons/vblade/files/volatiles.99_vblade
 delete mode 100644 meta-networking/recipes-daemons/vblade/vblade_20.bb
 create mode 100644 meta-networking/recipes-daemons/vblade/vblade_22.bb
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch
 create mode 100755 meta-networking/recipes-protocols/freediameter/files/freediameter.init
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/freediameter.service
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/install_test.patch
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/run-ptest
 create mode 100644 meta-networking/recipes-protocols/freediameter/freediameter.inc
 create mode 100644 meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 keepalived: add new recipe

From: Jackie Huang <[email protected]>

keepalived is a High Availability monitor built
upon LVS, VRRP and service pollers.

---
 .../recipes-daemons/keepalived/keepalived_1.3.5.bb | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived_1.3.5.bb
meta-networking/recipes-daemons/keepalived/keepalived_1.3.5.bb new file +49 -0
new file mode 100644
index 000000000..5e7e6e49f
@@ -0,0 +1,49 @@
+SUMMARY = "High Availability monitor built upon LVS, VRRP and service pollers"
+DESCRIPTION = "Keepalived is a routing software written in C. The main goal \
+of this project is to provide simple and robust facilities for loadbalancing \
+and high-availability to Linux system and Linux based infrastructures. \
+Loadbalancing framework relies on well-known and widely used Linux Virtual \
+Server (IPVS) kernel module providing Layer4 loadbalancing \
+"
+HOMEPAGE = "http://www.keepalived.org/"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "http://www.keepalived.org/software/${BP}.tar.gz"
+
+SRC_URI[md5sum] = "9964d295ec9d34ed3408b57d28847b68"
+SRC_URI[sha256sum] = "c0114d86ea4c896557beb0d9367819a423ffba772bc5d7c548dc455e6b3bd048"
+
+DEPENDS = "libnfnetlink openssl"
+
+inherit autotools pkgconfig systemd update-rc.d
+
+PACKAGECONFIG ??= "libnl snmp \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
+"
+PACKAGECONFIG[libnl] = "--enable-libnl,--disable-libnl,libnl"
+PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp"
+PACKAGECONFIG[systemd] = "--with-init=systemd --with-systemdsystemunitdir=${systemd_system_unitdir},--with-init=SYSV,systemd"
+
+EXTRA_OECONF = "--disable-libiptc"
+EXTRA_OEMAKE = "initdir=${sysconfdir}/init.d"
+
+do_install_append() {
+    if [ -f ${D}${sysconfdir}/init.d/${BPN} ]; then
+        chmod 0755 ${D}${sysconfdir}/init.d/${BPN}
+        sed -i 's#rc.d/##' ${D}${sysconfdir}/init.d/${BPN}
+    fi
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -D -m 0644 ${B}/${BPN}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN}.service
+    fi
+}
+
+FILES_${PN} += "${datadir}/snmp/mibs/KEEPALIVED-MIB.txt"
+
+INITSCRIPT_NAME = "keepalived"
+INITSCRIPT_PARAMS = "remove"
+
+SYSTEMD_SERVICE_${PN} = "keepalived.service"
+SYSTEMD_AUTO_ENABLE ?= "disable"
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 freediameter: add new recipe

In reply to [email protected]

From: Jackie Huang <[email protected]>

freeDiameter is an open source Diameter protocol implementation. It provides an extensible platform for deploying a Diameter network for your Authentication, Authorization and Accounting needs.

---
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223 +++++++++++++++++++++
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb             |   7 +
 8 files changed, 516 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch
 create mode 100755 meta-networking/recipes-protocols/freediameter/files/freediameter.init
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/freediameter.service
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/install_test.patch
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/run-ptest
 create mode 100644 meta-networking/recipes-protocols/freediameter/freediameter.inc
 create mode 100644 meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb
meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch new file +223 -0
new file mode 100644
index 000000000..71a5a1ae4
@@ -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 <[email protected]>
+---
+ 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
+
meta-networking/recipes-protocols/freediameter/files/freediameter.init new file +72 -0

72 lines not on this page · raw message

meta-networking/recipes-protocols/freediameter/files/freediameter.service new file +11 -0
new file mode 100644
index 000000000..514481b43
@@ -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
meta-networking/recipes-protocols/freediameter/files/install_test.patch new file +22 -0
new file mode 100644
index 000000000..151037d69
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+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)
meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch new file +72 -0

72 lines not on this page · raw message

meta-networking/recipes-protocols/freediameter/files/run-ptest new file +11 -0
new file mode 100644
index 000000000..d0ca8d962
@@ -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
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +98 -0

98 lines not on this page · raw message

meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb new file +7 -0
new file mode 100644
index 000000000..3fb929aa0
@@ -0,0 +1,7 @@
+include freediameter.inc
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35"
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] = "bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"
Signature · 1 line
2.11.0
#3 lore raw

Re: [meta-networking][PATCH 2/3] freediameter: add new recipe

Quoted 6 lines · On Fri, May 12, 2017 at 03:09:01PM +0800, [email protected] wrote:

From: Jackie Huang <[email protected]>

freeDiameter is an open source Diameter protocol implementation. It provides an extensible platform for deploying a Diameter network for your Authentication, Authorization and Accounting needs.

lksctp-tools is blacklisted for builds with gold causing:

ERROR: Nothing PROVIDES 'lksctp-tools' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb DEPENDS on or otherwise requires it)
ERROR: lksctp-tools was skipped: Recipe is blacklisted: BROKEN: fails to link against sctp_connectx symbol
ERROR: Nothing RPROVIDES 'freediameter' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter'
NOTE: Runtime target 'freediameter' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['freediameter']
ERROR: Nothing RPROVIDES 'freediameter-dev' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter-dev'
NOTE: Runtime target 'freediameter-dev' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['freediameter-dev']

Quoted 593 lines
---
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223 +++++++++++++++++++++
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb             |   7 +
 8 files changed, 516 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch
 create mode 100755 meta-networking/recipes-protocols/freediameter/files/freediameter.init
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/freediameter.service
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/install_test.patch
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch
 create mode 100644 meta-networking/recipes-protocols/freediameter/files/run-ptest
 create mode 100644 meta-networking/recipes-protocols/freediameter/freediameter.inc
 create mode 100644 meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb
meta-networking/recipes-protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch new file +223 -0
new file mode 100644
index 000000000..71a5a1ae4
@@ -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 <[email protected]>
+---
+ 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
+
meta-networking/recipes-protocols/freediameter/files/freediameter.init new file +72 -0
new file mode 100755
index 000000000..e63a42a7c
@@ -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 $?
meta-networking/recipes-protocols/freediameter/files/freediameter.service new file +11 -0
new file mode 100644
index 000000000..514481b43
@@ -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
meta-networking/recipes-protocols/freediameter/files/install_test.patch new file +22 -0
new file mode 100644
index 000000000..151037d69
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+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)
meta-networking/recipes-protocols/freediameter/files/pass-ptest-env.patch new file +72 -0
new file mode 100644
index 000000000..ea857af7d
@@ -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 <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+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, '.');
meta-networking/recipes-protocols/freediameter/files/run-ptest new file +11 -0
new file mode 100644
index 000000000..d0ca8d962
@@ -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
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +98 -0
new file mode 100644
index 000000000..6880d26f2
@@ -0,0 +1,98 @@
+SUMMARY = "An open source implementation of the diameter protocol"
+DESCRIPTION = "\
+freeDiameter is an open source Diameter protocol implementation. 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"
+
+pkgname = "freeDiameter"
+
+SRC_URI = "http://www.freediameter.net/hg/${pkgname}/archive/${PV}.tar.gz;downloadfilename=${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)} \
+           "
+
+S = "${WORKDIR}/${pkgname}-${PV}"
+
+PTEST_PATH = "${libdir}/${pkgname}/ptest"
+
+inherit cmake update-rc.d ptest systemd
+
+EXTRA_OECMAKE = " \
+    -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${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}/${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
+
+do_install_append() {
+    # install the sample configuration file
+    install -d -m 0755 ${D}${sysconfdir}/${pkgname}
+    for i in ${S}/doc/*.conf.sample; do
+        install -m 0644 $i ${D}${sysconfdir}/${pkgname}/
+    done
+    mv ${D}${sysconfdir}/${pkgname}/freediameter.conf.sample \
+      ${D}${sysconfdir}/${pkgname}/freeDiameter.conf.sample
+
+    # 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
+}
+
+do_install_ptest() {
+    sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${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}/${pkgname}/.debug/*"
+
+# include the extensions in main package
+FILES_${PN} += "${libdir}/${pkgname}/*"
+
+RDEPENDS_${PN} = "glib-2.0 gnutls libidn"
+RDEPENDS_${PN}-ptest = "cmake"
+
+INITSCRIPT_NAME = "${BPN}"
+INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "freediameter.service"
+SYSTEMD_AUTO_ENABLE = "disable"
meta-networking/recipes-protocols/freediameter/freediameter_1.2.1.bb new file +7 -0
new file mode 100644
index 000000000..3fb929aa0
@@ -0,0 +1,7 @@
+include freediameter.inc
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35"
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] = "bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"
Signature · 7 lines
2.11.0

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#4 lore raw

Re: [meta-networking][PATCH 2/3] freediameter: add new recipe

Quoted 10 lines

-----Original Message-----
From: Martin Jansa [mailto:[email protected]]
Sent: Tuesday, May 16, 2017 22:34
To: Huang, Jie (Jackie)
Cc: [email protected]
Subject: Re: [oe] [meta-networking][PATCH 2/3] freediameter: add new recipe

On Fri, May 12, 2017 at 03:09:01PM +0800, [email protected] wrote:

Quoted 8 lines
Quoted 6 lines

From: Jackie Huang <[email protected]>

freeDiameter is an open source Diameter protocol implementation. It provides an extensible platform for deploying a Diameter network for your Authentication, Authorization and Accounting needs.

lksctp-tools is blacklisted for builds with gold causing:

Sorry I didn't build with gold so I didn't meet the issue, so I need to wait until lksctp-tools is fixed for builds with gold or I need to fix it myself, right?

Thanks,
Jackie

Quoted 674 lines

ERROR: Nothing PROVIDES 'lksctp-tools' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb DEPENDS on or otherwise requires it)
ERROR: lksctp-tools was skipped: Recipe is blacklisted: BROKEN: fails to link against sctp_connectx symbol
ERROR: Nothing RPROVIDES 'freediameter' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter'
NOTE: Runtime target 'freediameter' is unbuildable, removing... Missing or unbuildable dependency chain was: ['freediameter']
ERROR: Nothing RPROVIDES 'freediameter-dev' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta- networking/recipes-protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter-dev'
NOTE: Runtime target 'freediameter-dev' is unbuildable, removing... Missing or unbuildable dependency chain was: ['freediameter-dev']

Quoted 4 lines
---
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223

+++++++++++++++++++++

Quoted 9 lines
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb             |   7 +
 8 files changed, 516 insertions(+)
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert- Jenkin-s-ha.patch

Quoted 1 line
 create mode 100755 meta-networking/recipes-

protocols/freediameter/files/freediameter.init

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/freediameter.service

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/install_test.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/pass-ptest-env.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/run-ptest

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter.inc

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter_1.2.1.bb

Review

Quoted 2 lines
(quoted diff) +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch b/meta- networking/recipes-protocols/freediameter/files/Replace-murmurhash- algorithm-with-Robert-Jenkin-s-ha.patch

meta-networking/recipes-protocols/freediameter/files/Replace-

Quoted 4 lines

new file mode 100644
index 000000000..71a5a1ae4

meta-networking/recipes-protocols/freediameter/files/Replace- new file +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch

Quoted 12 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +11 -0
@@ -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 <[email protected]>
+---
+ libfdproto/ostr.c |  192 +++++++++++++++++++++--------------------------------

meta-networking/recipes-protocols/freediameter/files/Replace- line 21

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+ 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:
+
+
+

/**************************************************************** ****************************************/

meta-networking/recipes-protocols/freediameter/files/Replace- line 23

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-/* Hash function -- credits to Austin Appleby, thank you ^^ */
+-/* See http://murmurhash.googlepages.com for more information on this

function */

meta-networking/recipes-protocols/freediameter/files/Replace- line 25

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-
+-/* the strings are NOT always aligned properly (ex: received in RADIUS

message), so we use the aligned MurmurHash2 function as needed */

Quoted 25 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +25 -0
+-#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;
+-

meta-networking/recipes-protocols/freediameter/files/Replace- line 60

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+-	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 */

Review

Quoted 164 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +163 -0
+-
+-			_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
+
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.init b/meta-networking/recipes- protocols/freediameter/files/freediameter.init

meta-networking/recipes-

Quoted 4 lines

new file mode 100755
index 000000000..e63a42a7c

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.init

Review

Quoted 74 lines
meta-networking/recipes- new file +72 -0
@@ -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 $?
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.service b/meta-networking/recipes- protocols/freediameter/files/freediameter.service

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..514481b43

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.service

Review

Quoted 13 lines
meta-networking/recipes- new file +11 -0
@@ -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
(quoted diff) +0 -0

protocols/freediameter/files/install_test.patch b/meta-networking/recipes- protocols/freediameter/files/install_test.patch

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..151037d69

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/install_test.patch

Quoted 9 lines
meta-networking/recipes- new file +8 -0
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt

meta-networking/recipes- line 18

Quoted 10 lines
meta-networking/recipes- new file +10 -0
+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.")

Review

Quoted 5 lines
meta-networking/recipes- new file +4 -0
++
++INSTALL(TARGETS ${TEST_LIST}
++        RUNTIME DESTINATION ${INSTALL_TEST_SUFFIX}
++        COMPONENT freeDiameter-common)
(quoted diff) +0 -0

env.patch b/meta-networking/recipes-protocols/freediameter/files/pass-ptest- env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest-

Quoted 4 lines

new file mode 100644
index 000000000..ea857af7d

meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +0 -0

env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 12

Quoted 13 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +12 -0
@@ -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 <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-

1.2.0/tests/testloadext.c

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 13

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testloadext.c	2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 14

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testloadext.c	2014-02-19

20:08:03.871403924 +0800

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+@@ -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 @@

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 34

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+ 	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/");

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 45

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +11 -0
++
+ 	/* 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

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 46

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testmesg_stress.c	2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 47

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testmesg_stress.c	2014-02-19

20:08:03.928403924 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 56

Quoted 9 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +9 -0
+@@ -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);

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 62

Quoted 6 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +6 -0
+
++	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/");

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 65

Quoted 3 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +3 -0
++
+ 	/* Find all extensions which have been compiled along the test */
+-	LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?:

"");

Review

Quoted 8 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +7 -0
+-	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, '.');
(quoted diff) +0 -0

b/meta-networking/recipes-protocols/freediameter/files/run-ptest

Review

Quoted 17 lines

new file mode 100644
index 000000000..d0ca8d962

meta-networking/recipes-protocols/freediameter/files/run-ptest new file +11 -0
@@ -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
(quoted diff) +0 -0

b/meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 8 lines

new file mode 100644
index 000000000..6880d26f2

meta-networking/recipes-protocols/freediameter/freediameter.inc new file +3 -0
@@ -0,0 +1,98 @@
+SUMMARY = "An open source implementation of the diameter protocol"
+DESCRIPTION = "\
+freeDiameter is an open source Diameter protocol implementation. It \

meta-networking/recipes-protocols/freediameter/freediameter.inc line 13

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+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"
+
+pkgname = "freeDiameter"
+
+SRC_URI =

"http://www.freediameter.net/hg/${pkgname}/archive/${PV}.tar.gz;downloadfi lename=${pkgname}-${PV}.tar.gz \

Quoted 27 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +27 -0
+           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)} \
+           "
+
+S = "${WORKDIR}/${pkgname}-${PV}"
+
+PTEST_PATH = "${libdir}/${pkgname}/ptest"
+
+inherit cmake update-rc.d ptest systemd
+
+EXTRA_OECMAKE = " \
+    -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${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} \

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    -DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${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

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +11 -0
+# These need MySQL support
+
+# -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support
+
+# -DALL_EXTENSIONS=ON will enable all
+
+do_install_append() {
+    # install the sample configuration file
+    install -d -m 0755 ${D}${sysconfdir}/${pkgname}
+    for i in ${S}/doc/*.conf.sample; do
+        install -m 0644 $i ${D}${sysconfdir}/${pkgname}/

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    done
+    mv ${D}${sysconfdir}/${pkgname}/freediameter.conf.sample \
+      ${D}${sysconfdir}/${pkgname}/freeDiameter.conf.sample
+
+    # 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}

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+
+    # install for systemd
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/freediameter.service

${D}${systemd_system_unitdir}

meta-networking/recipes-protocols/freediameter/freediameter.inc line 76

Quoted 1 line
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +1 -0
+    sed -i -e 's,@BINDIR@,${bindir},g'

${D}${systemd_system_unitdir}/*.service

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+}
+
+do_install_ptest() {
+    sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${pkgname}/#"

${D}${PTEST_PATH}/run-ptest

Review

Quoted 19 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +18 -0
+    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}/${pkgname}/.debug/*"
+
+# include the extensions in main package
+FILES_${PN} += "${libdir}/${pkgname}/*"
+
+RDEPENDS_${PN} = "glib-2.0 gnutls libidn"
+RDEPENDS_${PN}-ptest = "cmake"
+
+INITSCRIPT_NAME = "${BPN}"
+INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "freediameter.service"
+SYSTEMD_AUTO_ENABLE = "disable"
(quoted diff) +0 -0

protocols/freediameter/freediameter_1.2.1.bb b/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..3fb929aa0

meta-networking/recipes- new file +0 -0

protocols/freediameter/freediameter_1.2.1.bb

meta-networking/recipes- line 4

Quoted 5 lines
meta-networking/recipes- new file +4 -0
@@ -0,0 +1,7 @@
+include freediameter.inc
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35"

meta-networking/recipes- line 7

Quoted 3 lines
meta-networking/recipes- new file +3 -0
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] =

"bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"

Quoted 8 lines

--
2.11.0

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
Martin 'JaMa' Jansa jabber: [email protected]

#5 lore raw

Re: [meta-networking][PATCH 2/3] freediameter: add new recipe

Quoted 17 lines · Jie (Jackie)
Quoted 17 lines

-----Original Message-----
From: Martin Jansa [mailto:[email protected]]
Sent: Tuesday, May 16, 2017 22:34
To: Huang, Jie (Jackie)
Cc: [email protected]
Subject: Re: [oe] [meta-networking][PATCH 2/3] freediameter: add new recipe

Quoted 6 lines · On Fri, May 12, 2017 at 03:09:01PM +0800, [email protected] wrote:

From: Jackie Huang <[email protected]>

freeDiameter is an open source Diameter protocol implementation. It provides an extensible platform for deploying a Diameter network for your Authentication, Authorization and Accounting needs.

Quoted 5 lines
Quoted 1 line

lksctp-tools is blacklisted for builds with gold causing:

Sorry I didn't build with gold so I didn't meet the issue, so I need to wait until lksctp-tools is fixed for builds with gold or I need to fix it myself, right?

I'm not inclined to merge patches on top of broken recipes, so, yeah, that would be ideal.

-J.

Quoted 678 lines

Thanks,
Jackie

Quoted 674 lines

ERROR: Nothing PROVIDES 'lksctp-tools' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb DEPENDS on or otherwise requires it)
ERROR: lksctp-tools was skipped: Recipe is blacklisted: BROKEN: fails to link against sctp_connectx symbol
ERROR: Nothing RPROVIDES 'freediameter' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter'
NOTE: Runtime target 'freediameter' is unbuildable, removing... Missing or unbuildable dependency chain was: ['freediameter']
ERROR: Nothing RPROVIDES 'freediameter-dev' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta- networking/recipes-protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter-dev'
NOTE: Runtime target 'freediameter-dev' is unbuildable, removing... Missing or unbuildable dependency chain was: ['freediameter-dev']

Quoted 4 lines
---
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223

+++++++++++++++++++++

Quoted 9 lines
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb             |   7 +
 8 files changed, 516 insertions(+)
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert- Jenkin-s-ha.patch

Quoted 1 line
 create mode 100755 meta-networking/recipes-

protocols/freediameter/files/freediameter.init

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/freediameter.service

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/install_test.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/pass-ptest-env.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/run-ptest

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter.inc

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter_1.2.1.bb

Review

Quoted 2 lines
(quoted diff) +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch b/meta- networking/recipes-protocols/freediameter/files/Replace-murmurhash- algorithm-with-Robert-Jenkin-s-ha.patch

meta-networking/recipes-protocols/freediameter/files/Replace-

Quoted 4 lines

new file mode 100644
index 000000000..71a5a1ae4

meta-networking/recipes-protocols/freediameter/files/Replace- new file +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch

Quoted 12 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +11 -0
@@ -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 <[email protected]>
+---
+ libfdproto/ostr.c |  192 +++++++++++++++++++++--------------------------------

meta-networking/recipes-protocols/freediameter/files/Replace- line 21

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+ 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:
+
+
+

/**************************************************************** ****************************************/

meta-networking/recipes-protocols/freediameter/files/Replace- line 23

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-/* Hash function -- credits to Austin Appleby, thank you ^^ */
+-/* See http://murmurhash.googlepages.com for more information on this

function */

meta-networking/recipes-protocols/freediameter/files/Replace- line 25

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-
+-/* the strings are NOT always aligned properly (ex: received in RADIUS

message), so we use the aligned MurmurHash2 function as needed */

Quoted 25 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +25 -0
+-#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;
+-

meta-networking/recipes-protocols/freediameter/files/Replace- line 60

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+-	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 */

Review

Quoted 164 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +163 -0
+-
+-			_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
+
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.init b/meta-networking/recipes- protocols/freediameter/files/freediameter.init

meta-networking/recipes-

Quoted 4 lines

new file mode 100755
index 000000000..e63a42a7c

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.init

Review

Quoted 74 lines
meta-networking/recipes- new file +72 -0
@@ -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 $?
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.service b/meta-networking/recipes- protocols/freediameter/files/freediameter.service

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..514481b43

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.service

Review

Quoted 13 lines
meta-networking/recipes- new file +11 -0
@@ -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
(quoted diff) +0 -0

protocols/freediameter/files/install_test.patch b/meta-networking/recipes- protocols/freediameter/files/install_test.patch

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..151037d69

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/install_test.patch

Quoted 9 lines
meta-networking/recipes- new file +8 -0
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt

meta-networking/recipes- line 18

Quoted 10 lines
meta-networking/recipes- new file +10 -0
+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.")

Review

Quoted 5 lines
meta-networking/recipes- new file +4 -0
++
++INSTALL(TARGETS ${TEST_LIST}
++        RUNTIME DESTINATION ${INSTALL_TEST_SUFFIX}
++        COMPONENT freeDiameter-common)
(quoted diff) +0 -0

env.patch b/meta-networking/recipes-protocols/freediameter/files/pass-ptest- env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest-

Quoted 4 lines

new file mode 100644
index 000000000..ea857af7d

meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +0 -0

env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 12

Quoted 13 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +12 -0
@@ -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 <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-

1.2.0/tests/testloadext.c

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 13

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testloadext.c	2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 14

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testloadext.c	2014-02-19

20:08:03.871403924 +0800

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+@@ -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 @@

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 34

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+ 	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/");

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 45

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +11 -0
++
+ 	/* 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

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 46

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testmesg_stress.c	2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 47

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testmesg_stress.c	2014-02-19

20:08:03.928403924 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 56

Quoted 9 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +9 -0
+@@ -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);

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 62

Quoted 6 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +6 -0
+
++	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/");

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 65

Quoted 3 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +3 -0
++
+ 	/* Find all extensions which have been compiled along the test */
+-	LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?:

"");

Review

Quoted 8 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +7 -0
+-	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, '.');
(quoted diff) +0 -0

b/meta-networking/recipes-protocols/freediameter/files/run-ptest

Review

Quoted 17 lines

new file mode 100644
index 000000000..d0ca8d962

meta-networking/recipes-protocols/freediameter/files/run-ptest new file +11 -0
@@ -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
(quoted diff) +0 -0

b/meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 8 lines

new file mode 100644
index 000000000..6880d26f2

meta-networking/recipes-protocols/freediameter/freediameter.inc new file +3 -0
@@ -0,0 +1,98 @@
+SUMMARY = "An open source implementation of the diameter protocol"
+DESCRIPTION = "\
+freeDiameter is an open source Diameter protocol implementation. It \

meta-networking/recipes-protocols/freediameter/freediameter.inc line 13

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+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"
+
+pkgname = "freeDiameter"
+
+SRC_URI =

"http://www.freediameter.net/hg/${pkgname}/archive/${PV}.tar.gz;downloadfi lename=${pkgname}-${PV}.tar.gz \

Quoted 27 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +27 -0
+           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)} \
+           "
+
+S = "${WORKDIR}/${pkgname}-${PV}"
+
+PTEST_PATH = "${libdir}/${pkgname}/ptest"
+
+inherit cmake update-rc.d ptest systemd
+
+EXTRA_OECMAKE = " \
+    -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${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} \

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    -DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${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

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +11 -0
+# These need MySQL support
+
+# -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support
+
+# -DALL_EXTENSIONS=ON will enable all
+
+do_install_append() {
+    # install the sample configuration file
+    install -d -m 0755 ${D}${sysconfdir}/${pkgname}
+    for i in ${S}/doc/*.conf.sample; do
+        install -m 0644 $i ${D}${sysconfdir}/${pkgname}/

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    done
+    mv ${D}${sysconfdir}/${pkgname}/freediameter.conf.sample \
+      ${D}${sysconfdir}/${pkgname}/freeDiameter.conf.sample
+
+    # 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}

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+
+    # install for systemd
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/freediameter.service

${D}${systemd_system_unitdir}

meta-networking/recipes-protocols/freediameter/freediameter.inc line 76

Quoted 1 line
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +1 -0
+    sed -i -e 's,@BINDIR@,${bindir},g'

${D}${systemd_system_unitdir}/*.service

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+}
+
+do_install_ptest() {
+    sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${pkgname}/#"

${D}${PTEST_PATH}/run-ptest

Review

Quoted 19 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +18 -0
+    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}/${pkgname}/.debug/*"
+
+# include the extensions in main package
+FILES_${PN} += "${libdir}/${pkgname}/*"
+
+RDEPENDS_${PN} = "glib-2.0 gnutls libidn"
+RDEPENDS_${PN}-ptest = "cmake"
+
+INITSCRIPT_NAME = "${BPN}"
+INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "freediameter.service"
+SYSTEMD_AUTO_ENABLE = "disable"
(quoted diff) +0 -0

protocols/freediameter/freediameter_1.2.1.bb b/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..3fb929aa0

meta-networking/recipes- new file +0 -0

protocols/freediameter/freediameter_1.2.1.bb

meta-networking/recipes- line 4

Quoted 5 lines
meta-networking/recipes- new file +4 -0
@@ -0,0 +1,7 @@
+include freediameter.inc
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35"

meta-networking/recipes- line 7

Quoted 3 lines
meta-networking/recipes- new file +3 -0
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] =

"bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"

Quoted 8 lines

--
2.11.0

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
Martin 'JaMa' Jansa jabber: [email protected]

Signature · 2 lines
-Joe MacDonald.
:wq
#6 lore raw

Re: [meta-networking][PATCH 2/3] freediameter: add new recipe

In reply to Huang, Jie (Jackie)

Or you can Skip this recipe when ld-is-gold is used (with comment explaining that it's because of lksctp-tools).

Quoted 738 lines · Jie (Jackie)
Quoted 8 lines

-----Original Message-----
From: Martin Jansa [mailto:[email protected]]
Sent: Tuesday, May 16, 2017 22:34
To: Huang, Jie (Jackie)
Cc: [email protected]
Subject: Re: [oe] [meta-networking][PATCH 2/3] freediameter: add new

recipe

Quoted 2 lines

On Fri, May 12, 2017 at 03:09:01PM +0800, [email protected]

Quoted 8 lines · wrote:
Quoted 6 lines

From: Jackie Huang <[email protected]>

freeDiameter is an open source Diameter protocol implementation. It provides an extensible platform for deploying a Diameter network for your Authentication, Authorization and Accounting needs.

lksctp-tools is blacklisted for builds with gold causing:

Sorry I didn't build with gold so I didn't meet the issue, so I need to wait
until lksctp-tools is fixed for builds with gold or I need to fix it myself, right?

Thanks,
Jackie

Quoted 6 lines

ERROR: Nothing PROVIDES 'lksctp-tools' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb DEPENDS on or otherwise requires it)
ERROR: lksctp-tools was skipped: Recipe is blacklisted: BROKEN: fails to

link

Quoted 40 lines

against sctp_connectx symbol
ERROR: Nothing RPROVIDES 'freediameter' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter'
NOTE: Runtime target 'freediameter' is unbuildable, removing... Missing or unbuildable dependency chain was: ['freediameter']
ERROR: Nothing RPROVIDES 'freediameter-dev' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta- networking/recipes-protocols/freediameter/freediameter_1.2.1.bb RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter-dev'
NOTE: Runtime target 'freediameter-dev' is unbuildable, removing... Missing or unbuildable dependency chain was: ['freediameter-dev']

Quoted 4 lines
---
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223

+++++++++++++++++++++

Quoted 9 lines
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb             |   7 +
 8 files changed, 516 insertions(+)
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert- Jenkin-s-ha.patch

Quoted 1 line
 create mode 100755 meta-networking/recipes-

protocols/freediameter/files/freediameter.init

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/freediameter.service

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/install_test.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/pass-ptest-env.patch

Quoted 8 lines
Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/run-ptest

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter.inc

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter_1.2.1.bb

Review

Quoted 2 lines
(quoted diff) +0 -0

Replace-

Quoted 8 lines

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch b/meta- networking/recipes-protocols/freediameter/files/Replace-murmurhash- algorithm-with-Robert-Jenkin-s-ha.patch

meta-networking/recipes-protocols/freediameter/files/Replace-

Quoted 4 lines

new file mode 100644
index 000000000..71a5a1ae4

meta-networking/recipes-protocols/freediameter/files/Replace- new file +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch

Quoted 12 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 11

Quoted 12 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +11 -0
@@ -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 <[email protected]>
+---
+ libfdproto/ostr.c |  192 +++++++++++++++++++++---------

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

Quoted 4 lines
Quoted 4 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +4 -0
+ 1 file changed, 74 insertions(+), 118 deletions(-)
+
+diff --git a/libfdproto/ostr.c b/libfdproto/ostr.c
+index 8f29b48..ce1f4dd 100644
Quoted 10 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 21

Quoted 6 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +6 -0
+--- a/libfdproto/ostr.c
++++ b/libfdproto/ostr.c
+@@ -430,128 +430,84 @@ after_proto:
+
+
+

/**************************************************************** ****************************************/

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-/* Hash function -- credits to Austin Appleby, thank you ^^ */
+-/* See http://murmurhash.googlepages.com for more information on

this

Quoted 3 lines

function */

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-
+-/* the strings are NOT always aligned properly (ex: received in

RADIUS

Quoted 2 lines

message), so we use the aligned MurmurHash2 function as needed */

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/Replace- new file +1 -0
+-#define _HASH_MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^=

k; }

Quoted 34 lines
Quoted 24 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +24 -0
+-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;
+-

meta-networking/recipes-protocols/freediameter/files/Replace- line 60

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+-  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
Quoted 33 lines

about the byte order */

Quoted 32 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +32 -0
+-
+-                  _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 */

Quoted 62 lines
Quoted 62 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +62 -0
+-
+-          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;
Quoted 8 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 162

Quoted 8 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +8 -0
++  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

*/

Quoted 4 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 166

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +4 -0
++
++  /* handle most of the key */
++  while (len >= 12) {
++          a = a + (k[0] + ((uint32_t)k[1] << 8) + ((uint32_t)k[2] <<

16) +

Quoted 2 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 168

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
++                   ((uint32_t)k[3] << 24));
++          b = b + (k[4] + ((uint32_t)k[5] << 8) + ((uint32_t)k[6] <<

16) +

Quoted 2 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 170

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
++                   ((uint32_t)k[7] << 24));
++          c = c + (k[8] + ((uint32_t)k[9] << 8) + ((uint32_t)k[10]

<< 16) +

Quoted 9 lines

meta-networking/recipes-protocols/freediameter/files/Replace- line 179

Quoted 9 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +9 -0
++                   ((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

*/

Quoted 38 lines
Quoted 38 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +38 -0
++  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 )
++{
Quoted 8 lines

Review

Quoted 7 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +6 -0
++  return hash_rjenkins(string, len);
+ }
+
+--
+1.7.10.4
+
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.init

b/meta-networking/recipes-

Quoted 6 lines

protocols/freediameter/files/freediameter.init

meta-networking/recipes-

Quoted 4 lines

new file mode 100755
index 000000000..e63a42a7c

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.init

Quoted 12 lines

meta-networking/recipes- line 11

Quoted 12 lines
meta-networking/recipes- new file +11 -0
@@ -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,

Quoted 1 line

meta-networking/recipes- line 12

Quoted 1 line
meta-networking/recipes- new file +1 -0
+#       designed for Authentication, Authorization and Accounting.

Diameter is

Quoted 54 lines
Quoted 54 lines
meta-networking/recipes- new file +54 -0
+#       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
+   ;;
Quoted 8 lines

Review

Quoted 7 lines
meta-networking/recipes- new file +6 -0
+  *)
+   echo $"Usage: $prog {start|stop|status|restart}"
+   exit 2
+esac
+
+exit $?
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.service

b/meta-networking/recipes-

Quoted 6 lines

protocols/freediameter/files/freediameter.service

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..514481b43

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.service

Quoted 14 lines

Review

Quoted 13 lines
meta-networking/recipes- new file +11 -0
@@ -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
(quoted diff) +0 -0

protocols/freediameter/files/install_test.patch

b/meta-networking/recipes-

Quoted 26 lines

protocols/freediameter/files/install_test.patch

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..151037d69

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/install_test.patch

Quoted 9 lines
meta-networking/recipes- new file +8 -0
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt

meta-networking/recipes- line 18

Quoted 10 lines
meta-networking/recipes- new file +10 -0
+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.")

Quoted 5 lines

Review

Quoted 5 lines
meta-networking/recipes- new file +4 -0
++
++INSTALL(TARGETS ${TEST_LIST}
++        RUNTIME DESTINATION ${INSTALL_TEST_SUFFIX}
++        COMPONENT freeDiameter-common)
(quoted diff) +0 -0

pass-ptest-

Quoted 1 line

env.patch b/meta-networking/recipes-protocols/freediameter/files/

pass-ptest-

Quoted 9 lines

env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest-

Quoted 4 lines

new file mode 100644
index 000000000..ea857af7d

meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +0 -0

env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 2

Quoted 3 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +2 -0
@@ -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

Quoted 11 lines

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 12

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+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 <[email protected]>
+Signed-off-by: Jackie Huang <[email protected]>
+
+diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-

1.2.0/tests/testloadext.c

Quoted 22 lines

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 13

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testloadext.c    2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 14

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testloadext.c 2014-02-19

20:08:03.871403924 +0800

Quoted 18 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +18 -0
+@@ -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);

Quoted 7 lines

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 34

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +2 -0
++  else
++          pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR

"/extensions/");

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +4 -0
++
+   /* 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 );

Quoted 1 line

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 39

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+-  pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR

"/extensions/");

Quoted 6 lines

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 45

Quoted 6 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +6 -0
++  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-

Quoted 13 lines

1.2.0/tests/testmesg_stress.c

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 46

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testmesg_stress.c        2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 47

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testmesg_stress.c     2014-02-19

20:08:03.928403924 +0800

Quoted 8 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +8 -0
+@@ -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);

Quoted 6 lines

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 56

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+   struct fd_list ext_with_depends =

FD_LIST_INITIALIZER(ext_with_depends);

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +4 -0
+
++  char *ext_dir = getenv("EXTENSIONS_DIR");
++  if (ext_dir)
++          pathlen = snprintf(fullname, sizeof(fullname), "%s",

ext_dir);

Quoted 6 lines

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 62

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +2 -0
++  else
++          pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR

"/extensions/");

Quoted 3 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +3 -0
++
+   /* Find all extensions which have been compiled along the test */
+-  LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions",

prefix ?:

Quoted 2 lines

"");

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+-  CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 :

0 );

Quoted 1 line

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 67

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+-  pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR

"/extensions/");

Quoted 6 lines

Review

Quoted 6 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +5 -0
++  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, '.');
(quoted diff) +0 -0

run-ptest

Quoted 10 lines

b/meta-networking/recipes-protocols/freediameter/files/run-ptest

Quoted 9 lines

new file mode 100644
index 000000000..d0ca8d962

meta-networking/recipes-protocols/freediameter/files/run-ptest new file +4 -0
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if ! lsmod | grep -q sctp && ! modprobe sctp 2>/dev/null; then
+        echo "Couldn't load kernel module sctp."
Quoted 8 lines

Review

Quoted 8 lines
meta-networking/recipes-protocols/freediameter/files/run-ptest new file +7 -0
+        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
(quoted diff) +0 -0

freediameter.inc

Quoted 15 lines

b/meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 5 lines

new file mode 100644
index 000000000..6880d26f2

meta-networking/recipes-protocols/freediameter/freediameter.inc line 9

Quoted 9 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +9 -0
@@ -0,0 +1,98 @@
+SUMMARY = "An open source implementation of the diameter protocol"
+DESCRIPTION = "\
+freeDiameter is an open source Diameter protocol implementation. 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"

Quoted 5 lines

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+
+pkgname = "freeDiameter"
+
+SRC_URI =

"http://www.freediameter.net/hg/${pkgname}/archive/${PV}.

tar.gz;downloadfi

Quoted 2 lines

lename=${pkgname}-${PV}.tar.gz \

Quoted 1 line
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +1 -0
+           file://Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch

\

Quoted 118 lines
Quoted 26 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +26 -0
+           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)} \
+           "
+
+S = "${WORKDIR}/${pkgname}-${PV}"
+
+PTEST_PATH = "${libdir}/${pkgname}/ptest"
+
+inherit cmake update-rc.d ptest systemd
+
+EXTRA_OECMAKE = " \
+    -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${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} \

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    -DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${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

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +11 -0
+# These need MySQL support
+
+# -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support
+
+# -DALL_EXTENSIONS=ON will enable all
+
+do_install_append() {
+    # install the sample configuration file
+    install -d -m 0755 ${D}${sysconfdir}/${pkgname}
+    for i in ${S}/doc/*.conf.sample; do
+        install -m 0644 $i ${D}${sysconfdir}/${pkgname}/

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    done
+    mv ${D}${sysconfdir}/${pkgname}/freediameter.conf.sample \
+      ${D}${sysconfdir}/${pkgname}/freeDiameter.conf.sample
+
+    # 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}

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+
+    # install for systemd
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/freediameter.service

${D}${systemd_system_unitdir}

meta-networking/recipes-protocols/freediameter/freediameter.inc line 76

Quoted 1 line
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +1 -0
+    sed -i -e 's,@BINDIR@,${bindir},g'

${D}${systemd_system_unitdir}/*.service

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+}
+
+do_install_ptest() {
+    sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${pkgname}/#"

${D}${PTEST_PATH}/run-ptest

Review

Quoted 19 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +18 -0
+    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}/${pkgname}/.debug/*"
+
+# include the extensions in main package
+FILES_${PN} += "${libdir}/${pkgname}/*"
+
+RDEPENDS_${PN} = "glib-2.0 gnutls libidn"
+RDEPENDS_${PN}-ptest = "cmake"
+
+INITSCRIPT_NAME = "${BPN}"
+INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "freediameter.service"
+SYSTEMD_AUTO_ENABLE = "disable"
(quoted diff) +0 -0

protocols/freediameter/freediameter_1.2.1.bb b/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..3fb929aa0

meta-networking/recipes- new file +0 -0

protocols/freediameter/freediameter_1.2.1.bb

meta-networking/recipes- line 4

Quoted 5 lines
meta-networking/recipes- new file +4 -0
@@ -0,0 +1,7 @@
+include freediameter.inc
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35"

meta-networking/recipes- line 7

Quoted 3 lines
meta-networking/recipes- new file +3 -0
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] =

"bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"

Quoted 8 lines

--
2.11.0

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
Martin 'JaMa' Jansa jabber: [email protected]

#7 lore raw

Re: [meta-networking][PATCH 2/3] freediameter: add new recipe

Thanks, I will investigate if lksctp-tools can be fixed easily, if not, I will skip the recipe as you suggest.

Thanks,
Jackie

From: Martin Jansa [mailto:[email protected]]
Sent: Wednesday, May 17, 2017 14:32
To: Huang, Jie (Jackie)
Cc: [email protected]
Subject: Re: [oe] [meta-networking][PATCH 2/3] freediameter: add new recipe

Or you can Skip this recipe when ld-is-gold is used (with comment explaining that it's because of lksctp-tools).

Quoted 8 lines · On Wed, May 17, 2017 at 3:06 AM, Huang, Jie (Jackie)…

-----Original Message-----
From: Martin Jansa [mailto:[email protected]<mailto:[email protected]>]
Sent: Tuesday, May 16, 2017 22:34
To: Huang, Jie (Jackie)
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [oe] [meta-networking][PATCH 2/3] freediameter: add new recipe

On Fri, May 12, 2017 at 03:09:01PM +0800, [email protected]<mailto:[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines

From: Jackie Huang <[email protected]<mailto:[email protected]>>

freeDiameter is an open source Diameter protocol implementation. It provides an extensible platform for deploying a Diameter network for your Authentication, Authorization and Accounting needs.

lksctp-tools is blacklisted for builds with gold causing:

Sorry I didn't build with gold so I didn't meet the issue, so I need to wait until lksctp-tools is fixed for builds with gold or I need to fix it myself, right?

Thanks,
Jackie

Quoted 674 lines

ERROR: Nothing PROVIDES 'lksctp-tools' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb> DEPENDS on or otherwise requires it)
ERROR: lksctp-tools was skipped: Recipe is blacklisted: BROKEN: fails to link
against sctp_connectx symbol
ERROR: Nothing RPROVIDES 'freediameter' (but /home/jenkins/oe/world/shr- core/meta-openembedded/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb> RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter'
NOTE: Runtime target 'freediameter' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['freediameter']
ERROR: Nothing RPROVIDES 'freediameter-dev' (but /home/jenkins/oe/world/shr-core/meta-openembedded/meta- networking/recipes-protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb> RDEPENDS on or otherwise requires it)
ERROR: No eligible RPROVIDERs exist for 'freediameter-dev'
NOTE: Runtime target 'freediameter-dev' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['freediameter-dev']

Quoted 4 lines
---
 ...murhash-algorithm-with-Robert-Jenkin-s-ha.patch | 223

+++++++++++++++++++++

Quoted 9 lines
 .../freediameter/files/freediameter.init           |  72 +++++++
 .../freediameter/files/freediameter.service        |  11 +
 .../freediameter/files/install_test.patch          |  22 ++
 .../freediameter/files/pass-ptest-env.patch        |  72 +++++++
 .../recipes-protocols/freediameter/files/run-ptest |  11 +
 .../freediameter/freediameter.inc                  |  98 +++++++++
 .../freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb>             |   7 +
 8 files changed, 516 insertions(+)
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/Replace-murmurhash-algorithm-with-Robert- Jenkin-s-ha.patch

Quoted 1 line
 create mode 100755 meta-networking/recipes-

protocols/freediameter/files/freediameter.init

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/freediameter.service

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/install_test.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/pass-ptest-env.patch

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/files/run-ptest

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter.inc

Quoted 1 line
 create mode 100644 meta-networking/recipes-

protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb>

Review

Quoted 2 lines
(quoted diff) +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch b/meta- networking/recipes-protocols/freediameter/files/Replace-murmurhash- algorithm-with-Robert-Jenkin-s-ha.patch

meta-networking/recipes-protocols/freediameter/files/Replace-

Quoted 4 lines

new file mode 100644
index 000000000..71a5a1ae4

meta-networking/recipes-protocols/freediameter/files/Replace- new file +0 -0

murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch

Quoted 12 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +11 -0
@@ -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 <[email protected]<mailto:[email protected]>>
+---
+ libfdproto/ostr.c |  192 +++++++++++++++++++++--------------------------------

meta-networking/recipes-protocols/freediameter/files/Replace- line 21

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+ 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:
+
+
+

/**************************************************************** ****************************************/

meta-networking/recipes-protocols/freediameter/files/Replace- line 23

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-/* Hash function -- credits to Austin Appleby, thank you ^^ */
+-/* See http://murmurhash.googlepages.com for more information on this

function */

meta-networking/recipes-protocols/freediameter/files/Replace- line 25

Quoted 2 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +2 -0
+-
+-/* the strings are NOT always aligned properly (ex: received in RADIUS

message), so we use the aligned MurmurHash2 function as needed */

Quoted 25 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +25 -0
+-#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;
+-

meta-networking/recipes-protocols/freediameter/files/Replace- line 60

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +10 -0
+-  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 */

Review

Quoted 164 lines
meta-networking/recipes-protocols/freediameter/files/Replace- new file +163 -0
+-
+-                  _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
+
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.init b/meta-networking/recipes- protocols/freediameter/files/freediameter.init

meta-networking/recipes-

Quoted 4 lines

new file mode 100755
index 000000000..e63a42a7c

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.init

Review

Quoted 74 lines
meta-networking/recipes- new file +72 -0
@@ -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 $?
(quoted diff) +0 -0

protocols/freediameter/files/freediameter.service b/meta-networking/recipes- protocols/freediameter/files/freediameter.service

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..514481b43

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/freediameter.service

Review

Quoted 13 lines
meta-networking/recipes- new file +11 -0
@@ -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
(quoted diff) +0 -0

protocols/freediameter/files/install_test.patch b/meta-networking/recipes- protocols/freediameter/files/install_test.patch

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..151037d69

meta-networking/recipes- new file +0 -0

protocols/freediameter/files/install_test.patch

Quoted 9 lines
meta-networking/recipes- new file +8 -0
@@ -0,0 +1,22 @@
+CMakeLists: add an option to install tests
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Original author: Yao Zhao <[email protected]<mailto:[email protected]>>
+Signed-off-by: Jackie Huang <[email protected]<mailto:[email protected]>>
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt

meta-networking/recipes- line 18

Quoted 10 lines
meta-networking/recipes- new file +10 -0
+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.")

Review

Quoted 5 lines
meta-networking/recipes- new file +4 -0
++
++INSTALL(TARGETS ${TEST_LIST}
++        RUNTIME DESTINATION ${INSTALL_TEST_SUFFIX}
++        COMPONENT freeDiameter-common)
(quoted diff) +0 -0

env.patch b/meta-networking/recipes-protocols/freediameter/files/pass-ptest- env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest-

Quoted 4 lines

new file mode 100644
index 000000000..ea857af7d

meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +0 -0

env.patch

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 12

Quoted 13 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +12 -0
@@ -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 <[email protected]<mailto:[email protected]>>
+Signed-off-by: Jackie Huang <[email protected]<mailto:[email protected]>>
+
+diff -Nur freeDiameter-1.2.0.orig/tests/testloadext.c freeDiameter-

1.2.0/tests/testloadext.c

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 13

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testloadext.c    2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 14

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testloadext.c 2014-02-19

20:08:03.871403924 +0800

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+@@ -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 @@

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 34

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +10 -0
+   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/");

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 45

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +11 -0
++
+   /* 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

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 46

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
+--- freeDiameter-1.2.0.orig/tests/testmesg_stress.c        2014-02-19

17:33:24.785405032 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 47

Quoted 1 line
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +1 -0
++++ freeDiameter-1.2.0/tests/testmesg_stress.c     2014-02-19

20:08:03.928403924 +0800

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 56

Quoted 9 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +9 -0
+@@ -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);

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 62

Quoted 6 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +6 -0
+
++  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/");

meta-networking/recipes-protocols/freediameter/files/pass-ptest- line 65

Quoted 3 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +3 -0
++
+   /* Find all extensions which have been compiled along the test */
+-  LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?:

"");

Review

Quoted 8 lines
meta-networking/recipes-protocols/freediameter/files/pass-ptest- new file +7 -0
+-  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, '.');
(quoted diff) +0 -0

b/meta-networking/recipes-protocols/freediameter/files/run-ptest

Review

Quoted 17 lines

new file mode 100644
index 000000000..d0ca8d962

meta-networking/recipes-protocols/freediameter/files/run-ptest new file +11 -0
@@ -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
(quoted diff) +0 -0

b/meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 8 lines

new file mode 100644
index 000000000..6880d26f2

meta-networking/recipes-protocols/freediameter/freediameter.inc new file +3 -0
@@ -0,0 +1,98 @@
+SUMMARY = "An open source implementation of the diameter protocol"
+DESCRIPTION = "\
+freeDiameter is an open source Diameter protocol implementation. It \

meta-networking/recipes-protocols/freediameter/freediameter.inc line 13

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+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"
+
+pkgname = "freeDiameter"
+
+SRC_URI =

"http://www.freediameter.net/hg/${pkgname}/archive/${PV}.tar.gz;downloadfi<http://www.freediameter.net/hg/$%7bpkgname%7d/archive/$%7bPV%7d.tar.gz;downloadfi> lename=${pkgname}-${PV}.tar.gz \

Quoted 27 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +27 -0
+           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)} \
+           "
+
+S = "${WORKDIR}/${pkgname}-${PV}"
+
+PTEST_PATH = "${libdir}/${pkgname}/ptest"
+
+inherit cmake update-rc.d ptest systemd
+
+EXTRA_OECMAKE = " \
+    -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${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} \

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    -DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${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

Quoted 11 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +11 -0
+# These need MySQL support
+
+# -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support
+
+# -DALL_EXTENSIONS=ON will enable all
+
+do_install_append() {
+    # install the sample configuration file
+    install -d -m 0755 ${D}${sysconfdir}/${pkgname}
+    for i in ${S}/doc/*.conf.sample; do
+        install -m 0644 $i ${D}${sysconfdir}/${pkgname}/

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 10 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +10 -0
+    done
+    mv ${D}${sysconfdir}/${pkgname}/freediameter.conf.sample \
+      ${D}${sysconfdir}/${pkgname}/freeDiameter.conf.sample
+
+    # 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}

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+
+    # install for systemd
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/freediameter.service

${D}${systemd_system_unitdir}

meta-networking/recipes-protocols/freediameter/freediameter.inc line 76

Quoted 1 line
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +1 -0
+    sed -i -e 's,@BINDIR@,${bindir},g'

${D}${systemd_system_unitdir}/*.service

meta-networking/recipes-protocols/freediameter/freediameter.inc

Quoted 4 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +4 -0
+}
+
+do_install_ptest() {
+    sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${pkgname}/#"

${D}${PTEST_PATH}/run-ptest

Review

Quoted 19 lines
meta-networking/recipes-protocols/freediameter/freediameter.inc new file +18 -0
+    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}/${pkgname}/.debug/*"
+
+# include the extensions in main package
+FILES_${PN} += "${libdir}/${pkgname}/*"
+
+RDEPENDS_${PN} = "glib-2.0 gnutls libidn"
+RDEPENDS_${PN}-ptest = "cmake"
+
+INITSCRIPT_NAME = "${BPN}"
+INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "freediameter.service"
+SYSTEMD_AUTO_ENABLE = "disable"
(quoted diff) +0 -0

protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb> b/meta-networking/recipes- protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb>

meta-networking/recipes-

Quoted 4 lines

new file mode 100644
index 000000000..3fb929aa0

meta-networking/recipes- new file +0 -0

protocols/freediameter/freediameter_1.2.1.bb<http://freediameter_1.2.1.bb>

meta-networking/recipes- line 4

Quoted 5 lines
meta-networking/recipes- new file +4 -0
@@ -0,0 +1,7 @@
+include freediameter.inc
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35<file:///\\LICENSE;md5=892b2ed6ae815488a08416ff7ee74a35>"

meta-networking/recipes- line 7

Quoted 3 lines
meta-networking/recipes- new file +3 -0
+
+SRC_URI[md5sum] = "61b1062aa144b5f12eed514611e6d697"
+SRC_URI[sha256sum] =

"bd7f105542e9903e776aa006c6931c1f5d3d477cb59af33a9162422efa477097"

Quoted 8 lines

--
2.11.0

--
_______________________________________________
Openembedded-devel mailing list [email protected]<mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
Martin 'JaMa' Jansa jabber: [email protected]<mailto:[email protected]>

#8 lore raw

PATCH 3/3 vblade: update to version 22

In reply to [email protected]

From: Jackie Huang <[email protected]>

Update to version 22 and add support for systemd and sysvinit, the scripts and conf files are taken from Fedora.

---
 .../recipes-daemons/vblade/files/vblade.conf       |   2 +
 .../recipes-daemons/vblade/files/vblade.init       | 193 +++++++++++++++++++++
 .../recipes-daemons/vblade/files/vblade.service    |  11 ++
 .../vblade/files/volatiles.99_vblade               |   1 +
 .../vblade/{vblade_20.bb => vblade_22.bb}          |  37 +++-
 5 files changed, 240 insertions(+), 4 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/vblade/files/vblade.conf
 create mode 100644 meta-networking/recipes-daemons/vblade/files/vblade.init
 create mode 100644 meta-networking/recipes-daemons/vblade/files/vblade.service
 create mode 100644 meta-networking/recipes-daemons/vblade/files/volatiles.99_vblade
 rename meta-networking/recipes-daemons/vblade/{vblade_20.bb => vblade_22.bb} (23%)
meta-networking/recipes-daemons/vblade/files/vblade.conf new file +2 -0
new file mode 100644
index 000000000..e8b93ec37
@@ -0,0 +1,2 @@
+# network_device shelf slot file/disk/partition mac[,mac[,mac]]
+#eth0 0 0 /dev/sdb 00:11:22:33:44:55
meta-networking/recipes-daemons/vblade/files/vblade.init new file +193 -0

193 lines not on this page · raw message

meta-networking/recipes-daemons/vblade/files/vblade.service new file +11 -0
new file mode 100644
index 000000000..83a4d5dcb
@@ -0,0 +1,11 @@
+[Unit]
+Description=Virtual EtherDrive blade AoE target
+After=syslog.target network.target
+
+[Service]
+Type=forking
+ExecStart=@BINDIR@/vblade.init start
+ExecStop=@BINDIR@/vblade.init stop
+
+[Install]
+WantedBy=multi-user.target
meta-networking/recipes-daemons/vblade/files/volatiles.99_vblade new file +1 -0
new file mode 100644
index 000000000..64a5881c0
@@ -0,0 +1 @@
+d root root 0755 /var/run/vblade none
meta-networking/recipes-daemons/vblade/vblade_22.bb renamed from meta-networking/recipes-daemons/vblade/vblade_20.bb +33 -4
similarity index 23%
rename from meta-networking/recipes-daemons/vblade/vblade_20.bb
rename to meta-networking/recipes-daemons/vblade/vblade_22.bb
index 344c7462c..d7b1dfaad 100644
@@ -4,19 +4,48 @@ SECTION = "admin"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/aoetools/${BPN}-${PV}.tgz \
+SRC_URI = "${SOURCEFORGE_MIRROR}/aoetools/${BP}.tar.gz \
            file://cross.patch \
            file://makefile-add-ldflags.patch \
+           file://${BPN}.conf \
+           file://${BPN}.init \
+           file://${BPN}.service \
+           file://volatiles.99_vblade \
           "
 
-SRC_URI[md5sum] = "3c80e4a6bc7d66ae0c235b88cb44bd59"
-SRC_URI[sha256sum] = "c8fe2fc4f2fba8e07e5cfdf17335982584eef2cd5c78bf8b1db93f2b56e7121d"
+SRC_URI[md5sum] = "510d98ba0f231284a5fbe2da11cb2d6e"
+SRC_URI[sha256sum] = "a990378f273f10eb431e42954a871aed52714035bbab28c54cef600c458356bb"
 
-inherit autotools-brokensep
+inherit autotools-brokensep update-rc.d systemd
 
 do_install() {
     install -D -m 0755 ${S}/vblade ${D}/${sbindir}/vblade
     install -D -m 0755 ${S}/vbladed ${D}/${sbindir}/vbladed
     install -D -m 0644 ${S}/vblade.8 ${D}/${mandir}/man8/vblade.8
+
+    install -D -m 0644 ${WORKDIR}/${BPN}.conf ${D}/${sysconfdir}/${BPN}.conf
+    install -D -m 0755 ${WORKDIR}/${BPN}.init ${D}/${sysconfdir}/init.d/${BPN}
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+        install -d ${D}/${sysconfdir}/default/volatiles
+        install -m 0755 ${WORKDIR}/volatiles.99_vblade ${D}/${sysconfdir}/default/volatiles/99_vblade
+    fi
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}/${bindir}
+        install -m 0755 ${WORKDIR}/${BPN}.init ${D}/${bindir}/
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /var/run/${BPN} 0755 root root -" > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
+
+        install -d ${D}${systemd_system_unitdir}
+        install -m 0644 ${WORKDIR}/vblade.service ${D}${systemd_system_unitdir}
+        sed -e 's,@BINDIR@,${bindir},g' -i ${D}${systemd_system_unitdir}/*.service
+    fi
+
 }
 
+INITSCRIPT_NAME = "vblade"
+INITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE_${PN} = "vblade.service"
+SYSTEMD_AUTO_ENABLE = "disable"
Signature · 1 line
2.11.0