added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,97 @@
From d527a0b7b63e43263384540b5525714484bb089f Mon Sep 17 00:00:00 2001
From: Mingli Yu <Mingli.Yu@windriver.com>
Date: Mon, 3 Sep 2018 14:40:56 +0800
Subject: [PATCH] libfdcore/sctp.c: update the old sctp api check
The initial sctp api check for freediameter as below:
===
commit d3c5e991cb532ea09684d69fb4d0d58e9bc39a0c
Author: Sebastien Decugis <sdecugis@freediameter.net>
Date: Mon Jun 3 12:05:37 2013 +0800
Add some compliancy to RFC6458. Not tested however as Ubuntu does not support this yet
[snip]
+/* Use old draft-ietf-tsvwg-sctpsocket-17 API ? If not defined, RFC6458 API will be used */
+/* #define OLD_SCTP_SOCKET_API */
+
+/* Automatically fallback to old API if some of the new symbols are not defined */
+#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
+# define OLD_SCTP_SOCKET_API
+#endif
===
SCTP_RECVRCVINFO is defined in <linux/sctp.h>,
but <linux/sctp.h> is't included in the source code
previouly. So defined(SCTP_RECVRCVINFO) can be 0
and it make old sctp socket api definiton in effect
as below:
# define OLD_SCTP_SOCKET_API
After lksctp-tools upgrade to 1.0.18, there is below
commit introduced:
===
commit 3c8bd0d26b64611c690f33f5802c734b0642c1d8
Author: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Tue Apr 17 20:17:14 2018 -0300
sctp.h: make use kernel UAPI header
and with that, remove tons of duplicated declarations. These were
lagging behind the kernel header, which is always the most updated one,
and as the library is intended to be run only on Linux, there is no
reason that we cannot re-use what is in there.
That said, this patch drops all duplicated declarations and includes
linux/sctp.h to bring them into lksctp-tools.
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
[snip]
#include <stdint.h>
#include <linux/types.h>
#include <sys/socket.h>
+#include <linux/sctp.h>
[snip]
===
And above logic make defined(SCTP_RECVRCVINFO) to
be 1 and the old sctp socket api macro as below
won't be defined.
# define OLD_SCTP_SOCKET_API
And it encouters below build error:
| /build/freediameter/1.2.1-r0/freeDiameter-1.2.1/libfdcore/sctp.c:1262:9: error: 'SCTP_SEND_FAILED_EVENT' undeclared (first use in this function); did you mean 'SCTP_SEND_FAILED'?
case SCTP_SEND_FAILED_EVENT:
^~~~~~~~~~~~~~~~~~~~~~
SCTP_SEND_FAILED
| /build/freediameter/1.2.1-r0/freeDiameter-1.2.1/libfdcore/sctp.c:1262:9: note: each undeclared identifier is reported only once for each function it appears in
| /build/freediameter/1.2.1-r0/freeDiameter-1.2.1/libfdcore/sctp.c:1274:9: error: 'SCTP_NOTIFICATIONS_STOPPED_EVENT' undeclared (first use in this function); did you mean 'SCTP_AUTHENTICATION_EVENT'?
case SCTP_NOTIFICATIONS_STOPPED_EVENT:
Update the old sctp socket api check to fix
the above build error.
Upstream-Status: Pending
Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
libfdcore/sctp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libfdcore/sctp.c b/libfdcore/sctp.c
index c80a497..83440c7 100644
--- a/libfdcore/sctp.c
+++ b/libfdcore/sctp.c
@@ -48,7 +48,7 @@
/* #define OLD_SCTP_SOCKET_API */
/* Automatically fallback to old API if some of the new symbols are not defined */
-#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
+#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_NOTIFICATIONS_STOPPED_EVENT)) || (!defined(SCTP_SNDINFO)))
# define OLD_SCTP_SOCKET_API
#endif
--
2.7.4

View File

@@ -0,0 +1,92 @@
From 935fcac46e2790e0e297ca855b8033895c1b8941 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Wed, 24 Aug 2022 13:45:32 +0800
Subject: [PATCH] tests: use EXTENSIONS_DIR
Use EXTENSIONS_DIR to replace BUILD_DIR as the BUILD_DIR is meanlingless
on target and also fix buildpaths issue.
Upstream-Status: Inappropriate [OE ptest specific]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
tests/CMakeLists.txt | 1 +
tests/testloadext.c | 12 ++++++------
tests/testmesg_stress.c | 12 ++++++------
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8b698ce..2c83cbb 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -37,6 +37,7 @@ SET(TEST_LIST
ADD_DEFINITIONS(-DTEST_DEBUG)
ADD_DEFINITIONS(-DBUILD_DIR="${CMAKE_BINARY_DIR}")
+ADD_DEFINITIONS(-DEXTENSIONS_DIR="${EXTENSIONS_DIR}")
INCLUDE_DIRECTORIES( "../libfdproto" )
INCLUDE_DIRECTORIES( "../libfdcore" )
diff --git a/tests/testloadext.c b/tests/testloadext.c
index 452737f..3fffef5 100644
--- a/tests/testloadext.c
+++ b/tests/testloadext.c
@@ -35,9 +35,9 @@
#include "tests.h"
-#ifndef BUILD_DIR
-#error "Missing BUILD_DIR information"
-#endif /* BUILD_DIR */
+#ifndef EXTENSIONS_DIR
+#error "Missing EXTENSIONS_DIR information"
+#endif /* EXTENSIONS_DIR */
#include <sys/types.h>
#include <dirent.h>
@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
CHECK( 0, fd_rtdisp_init() );
/* 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'", EXTENSIONS_DIR);
+ CHECK( 0, (dir = opendir (EXTENSIONS_DIR)) == NULL ? 1 : 0 );
+ pathlen = snprintf(fullname, sizeof(fullname), EXTENSIONS_DIR "/");
while ((dp = readdir (dir)) != NULL) {
char * dot = strrchr(dp->d_name, '.');
diff --git a/tests/testmesg_stress.c b/tests/testmesg_stress.c
index 310a9d2..97dfe07 100644
--- a/tests/testmesg_stress.c
+++ b/tests/testmesg_stress.c
@@ -38,9 +38,9 @@
#include <libgen.h>
#include <dlfcn.h>
-#ifndef BUILD_DIR
-#error "Missing BUILD_DIR information"
-#endif /* BUILD_DIR */
+#ifndef EXTENSIONS_DIR
+#error "Missing EXTENSIONS_DIR information"
+#endif /* EXTENSIONS_DIR */
/* The number of times each operation is repeated to measure the average operation time */
@@ -73,9 +73,9 @@ static void load_all_extensions(char * prefix)
struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends);
/* 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/");
+ LOG_D("Loading %s*.fdx from: '%s'", EXTENSIONS_DIR, prefix ?: "");
+ CHECK( 0, (dir = opendir (EXTENSIONS_DIR)) == NULL ? 1 : 0 );
+ pathlen = snprintf(fullname, sizeof(fullname), EXTENSIONS_DIR "/");
while ((dp = readdir (dir)) != NULL) {
char * dot = strrchr(dp->d_name, '.');
--
2.25.1

View File

@@ -0,0 +1,223 @@
Replace murmurhash algorithm with Robert Jenkin's hash algorithm
Upstream-Status: Pending
From test result, murmurhash algorithm does not work in big endian
processor, so replace it with Robert Jenkin's hash which has worked
in linux kernel for many years and has more adaptability.
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
libfdproto/ostr.c | 192 +++++++++++++++++++++--------------------------------
1 file changed, 74 insertions(+), 118 deletions(-)
diff --git a/libfdproto/ostr.c b/libfdproto/ostr.c
index 8f29b48..ce1f4dd 100644
--- a/libfdproto/ostr.c
+++ b/libfdproto/ostr.c
@@ -430,128 +430,84 @@ after_proto:
/********************************************************************************************************/
-/* Hash function -- credits to Austin Appleby, thank you ^^ */
-/* See http://murmurhash.googlepages.com for more information on this function */
-
-/* the strings are NOT always aligned properly (ex: received in RADIUS message), so we use the aligned MurmurHash2 function as needed */
-#define _HASH_MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
-uint32_t fd_os_hash ( uint8_t * string, size_t len )
+/*
+ * Robert Jenkin's hash function.
+ * http://burtleburtle.net/bob/hash/evahash.html
+ * This is in the public domain.
+ */
+#define mix(a, b, c) \
+ do { \
+ a = a - b; a = a - c; a = a ^ (c >> 13); \
+ b = b - c; b = b - a; b = b ^ (a << 8); \
+ c = c - a; c = c - b; c = c ^ (b >> 13); \
+ a = a - b; a = a - c; a = a ^ (c >> 12); \
+ b = b - c; b = b - a; b = b ^ (a << 16); \
+ c = c - a; c = c - b; c = c ^ (b >> 5); \
+ a = a - b; a = a - c; a = a ^ (c >> 3); \
+ b = b - c; b = b - a; b = b ^ (a << 10); \
+ c = c - a; c = c - b; c = c ^ (b >> 15); \
+ } while (0)
+
+unsigned hash_rjenkins(const char *str, unsigned length)
{
- uint32_t hash = len;
- uint8_t * data = string;
-
- const unsigned int m = 0x5bd1e995;
- const int r = 24;
- int align = (long)string & 3;
-
- if (!align || (len < 4)) {
- /* In case data is aligned, MurmurHash2 function */
- while(len >= 4)
- {
- /* Mix 4 bytes at a time into the hash */
- uint32_t k = *(uint32_t *)data; /* We don't care about the byte order */
-
- _HASH_MIX(hash, k, m);
-
- data += 4;
- len -= 4;
- }
-
- /* Handle the last few bytes of the input */
- switch(len) {
- case 3: hash ^= data[2] << 16;
- case 2: hash ^= data[1] << 8;
- case 1: hash ^= data[0];
- hash *= m;
- }
-
- } else {
- /* Unaligned data, use alignment-safe slower version */
-
- /* Pre-load the temp registers */
- uint32_t t = 0, d = 0;
- switch(align)
- {
- case 1: t |= data[2] << 16;
- case 2: t |= data[1] << 8;
- case 3: t |= data[0];
- }
- t <<= (8 * align);
-
- data += 4-align;
- len -= 4-align;
-
- /* From this point, "data" can be read by chunks of 4 bytes */
-
- int sl = 8 * (4-align);
- int sr = 8 * align;
-
- /* Mix */
- while(len >= 4)
- {
- uint32_t k;
-
- d = *(unsigned int *)data;
- k = (t >> sr) | (d << sl);
-
- _HASH_MIX(hash, k, m);
-
- t = d;
-
- data += 4;
- len -= 4;
- }
-
- /* Handle leftover data in temp registers */
- d = 0;
- if(len >= align)
- {
- uint32_t k;
-
- switch(align)
- {
- case 3: d |= data[2] << 16;
- case 2: d |= data[1] << 8;
- case 1: d |= data[0];
- }
-
- k = (t >> sr) | (d << sl);
- _HASH_MIX(hash, k, m);
-
- data += align;
- len -= align;
-
- /* Handle tail bytes */
-
- switch(len)
- {
- case 3: hash ^= data[2] << 16;
- case 2: hash ^= data[1] << 8;
- case 1: hash ^= data[0];
- hash *= m;
- };
- }
- else
- {
- switch(len)
- {
- case 3: d |= data[2] << 16;
- case 2: d |= data[1] << 8;
- case 1: d |= data[0];
- case 0: hash ^= (t >> sr) | (d << sl);
- hash *= m;
- }
- }
-
+ const unsigned char *k = (const unsigned char *)str;
+ uint32_t a, b, c; /* the internal state */
+ uint32_t len; /* how many key bytes still need mixing */
+
+ /* Set up the internal state */
+ len = length;
+ a = 0x9e3779b9; /* the golden ratio; an arbitrary value */
+ b = a;
+ c = 0; /* variable initialization of internal state */
+
+ /* handle most of the key */
+ while (len >= 12) {
+ a = a + (k[0] + ((uint32_t)k[1] << 8) + ((uint32_t)k[2] << 16) +
+ ((uint32_t)k[3] << 24));
+ b = b + (k[4] + ((uint32_t)k[5] << 8) + ((uint32_t)k[6] << 16) +
+ ((uint32_t)k[7] << 24));
+ c = c + (k[8] + ((uint32_t)k[9] << 8) + ((uint32_t)k[10] << 16) +
+ ((uint32_t)k[11] << 24));
+ mix(a, b, c);
+ k = k + 12;
+ len = len - 12;
+ }
+ /* handle the last 11 bytes */
+ c = c + length;
+ switch (len) { /* all the case statements fall through */
+ case 11:
+ c = c + ((uint32_t)k[10] << 24);
+ case 10:
+ c = c + ((uint32_t)k[9] << 16);
+ case 9:
+ c = c + ((uint32_t)k[8] << 8);
+ /* the first byte of c is reserved for the length */
+ case 8:
+ b = b + ((uint32_t)k[7] << 24);
+ case 7:
+ b = b + ((uint32_t)k[6] << 16);
+ case 6:
+ b = b + ((uint32_t)k[5] << 8);
+ case 5:
+ b = b + k[4];
+ case 4:
+ a = a + ((uint32_t)k[3] << 24);
+ case 3:
+ a = a + ((uint32_t)k[2] << 16);
+ case 2:
+ a = a + ((uint32_t)k[1] << 8);
+ case 1:
+ a = a + k[0];
+ /* case 0: nothing left to add */
}
+ mix(a, b, c);
- /* Do a few final mixes of the hash to ensure the last few
- bytes are well-incorporated. */
- hash ^= hash >> 13;
- hash *= m;
- hash ^= hash >> 15;
+ return c;
+}
- return hash;
+uint32_t fd_os_hash ( uint8_t * string, size_t len )
+{
+ return hash_rjenkins(string, len);
}
--
1.7.10.4

View File

@@ -0,0 +1,250 @@
# This is a sample configuration file for freeDiameter daemon.
# Most of the options can be omitted, as they default to reasonable values.
# Only TLS-related options must be configured properly in usual setups.
# It is possible to use "include" keyword to import additional files
# e.g.: include "/etc/freeDiameter.d/*.conf"
# This is exactly equivalent as copy & paste the content of the included file(s)
# where the "include" keyword is found.
##############################################################
## Peer identity and realm
# The Diameter Identity of this daemon.
# This must be a valid FQDN that resolves to the local host.
# Default: hostname's FQDN
#Identity = "aaa.koganei.freediameter.net";
# The Diameter Realm of this daemon.
# Default: the domain part of Identity (after the first dot).
#Realm = "koganei.freediameter.net";
##############################################################
## Transport protocol configuration
# The port this peer is listening on for incoming connections (TCP and SCTP).
# Default: 3868. Use 0 to disable.
#Port = 3868;
# The port this peer is listening on for incoming TLS-protected connections (TCP and SCTP).
# See TLS_old_method for more information about TLS flavours.
# Note: we use TLS/SCTP instead of DTLS/SCTP at the moment. This will change in future version of freeDiameter.
# Default: 5868. Use 0 to disable.
#SecPort = 5868;
# Use RFC3588 method for TLS protection, where TLS is negociated after CER/CEA exchange is completed
# on the unsecure connection. The alternative is RFC6733 mechanism, where TLS protects also the
# CER/CEA exchange on a dedicated secure port.
# This parameter only affects outgoing connections.
# The setting can be also defined per-peer (see Peers configuration section).
# Default: use RFC6733 method with separate port for TLS.
#TLS_old_method;
# Disable use of TCP protocol (only listen and connect over SCTP)
# Default : TCP enabled
#No_TCP;
# Disable use of SCTP protocol (only listen and connect over TCP)
# Default : SCTP enabled
#No_SCTP;
# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option.
# Prefer TCP instead of SCTP for establishing new connections.
# This setting may be overwritten per peer in peer configuration blocs.
# Default : SCTP is attempted first.
#Prefer_TCP;
# Default number of streams per SCTP associations.
# This setting may be overwritten per peer basis.
# Default : 30 streams
#SCTP_streams = 30;
##############################################################
## Endpoint configuration
# Disable use of IP addresses (only IPv6)
# Default : IP enabled
#No_IP;
# Disable use of IPv6 addresses (only IP)
# Default : IPv6 enabled
#No_IPv6;
# Specify local addresses the server must bind to
# Default : listen on all addresses available.
#ListenOn = "202.249.37.5";
#ListenOn = "2001:200:903:2::202:1";
#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
##############################################################
## Server configuration
# How many Diameter peers are allowed to be connecting at the same time ?
# This parameter limits the number of incoming connections from the time
# the connection is accepted until the first CER is received.
# Default: 5 unidentified clients in paralel.
#ThreadsPerServer = 5;
##############################################################
## TLS Configuration
# TLS is managed by the GNUTLS library in the freeDiameter daemon.
# You may find more information about parameters and special behaviors
# in the relevant documentation.
# http://www.gnu.org/software/gnutls/manual/
# Credentials of the local peer
# The X509 certificate and private key file to use for the local peer.
# The files must contain PKCS-1 encoded RSA key, in PEM format.
# (These parameters are passed to gnutls_certificate_set_x509_key_file function)
# Default : NO DEFAULT
#TLS_Cred = "<x509 certif file.PEM>" , "<x509 private key file.PEM>";
#TLS_Cred = "/etc/ssl/certs/freeDiameter.pem", "/etc/ssl/private/freeDiameter.key";
# Certificate authority / trust anchors
# The file containing the list of trusted Certificate Authorities (PEM list)
# (This parameter is passed to gnutls_certificate_set_x509_trust_file function)
# The directive can appear several times to specify several files.
# Default : GNUTLS default behavior
#TLS_CA = "<file.PEM>";
# Certificate Revocation List file
# The information about revoked certificates.
# The file contains a list of trusted CRLs in PEM format. They should have been verified before.
# (This parameter is passed to gnutls_certificate_set_x509_crl_file function)
# Note: openssl CRL format might have interoperability issue with GNUTLS format.
# Default : GNUTLS default behavior
#TLS_CRL = "<file.PEM>";
# GNU TLS Priority string
# This string allows to configure the behavior of GNUTLS key exchanges
# algorithms. See gnutls_priority_init function documentation for information.
# You should also refer to the Diameter required TLS support here:
# http://tools.ietf.org/html/rfc6733#section-13.1
# Default : "NORMAL"
# Example: TLS_Prio = "NONE:+VERS-TLS1.1:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL";
#TLS_Prio = "NORMAL";
# Diffie-Hellman parameters size
# Set the number of bits for generated DH parameters
# Valid value should be 768, 1024, 2048, 3072 or 4096.
# (This parameter is passed to gnutls_dh_params_generate2 function,
# it usually should match RSA key size)
# Default : 1024
#TLS_DH_Bits = 1024;
# Alternatively, you can specify a file to load the PKCS#3 encoded
# DH parameters directly from. This accelerates the daemon start
# but is slightly less secure. If this file is provided, the
# TLS_DH_Bits parameters has no effect.
# Default : no default.
#TLS_DH_File = "<file.PEM>";
##############################################################
## Timers configuration
# The Tc timer of this peer.
# It is the delay before a new attempt is made to reconnect a disconnected peer.
# The value is expressed in seconds. The recommended value is 30 seconds.
# Default: 30
#TcTimer = 30;
# The Tw timer of this peer.
# It is the delay before a watchdog message is sent, as described in RFC 3539.
# The value is expressed in seconds. The default value is 30 seconds. Value must
# be greater or equal to 6 seconds. See details in the RFC.
# Default: 30
#TwTimer = 30;
##############################################################
## Applications configuration
# Disable the relaying of Diameter messages?
# For messages not handled locally, the default behavior is to forward the
# message to another peer if any is available, according to the routing
# algorithms. In addition the "0xffffff" application is advertised in CER/CEA
# exchanges.
# Default: Relaying is enabled.
#NoRelay;
# Number of server threads that can handle incoming messages at the same time.
# Default: 4
#AppServThreads = 4;
# Other applications are configured by loaded extensions.
##############################################################
## Extensions configuration
# The freeDiameter framework merely provides support for
# Diameter Base Protocol. The specific application behaviors,
# as well as advanced functions, are provided
# by loadable extensions (plug-ins).
# These extensions may in addition receive the name of a
# configuration file, the format of which is extension-specific.
#
# Format:
#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
#
# Examples:
#LoadExtension = "extensions/sample.fdx";
#LoadExtension = "extensions/sample.fdx":"conf/sample.conf";
# Extensions are named as follow:
# dict_* for extensions that add content to the dictionary definitions.
# dbg_* for extensions useful only to retrieve more information on the framework execution.
# acl_* : Access control list, to control which peers are allowed to connect.
# rt_* : routing extensions that impact how messages are forwarded to other peers.
# app_* : applications, these extensions usually register callbacks to handle specific messages.
# test_* : dummy extensions that are useful only in testing environments.
# The dbg_msg_dump.fdx extension allows you to tweak the way freeDiameter displays some
# information about some events. This extension does not actually use a configuration file
# but receives directly a parameter in the string passed to the extension. Here are some examples:
## LoadExtension = "dbg_msg_dumps.fdx" : "0x1111"; # Removes all default hooks, very quiet even in case of errors.
## LoadExtension = "dbg_msg_dumps.fdx" : "0x2222"; # Display all events with few details.
## LoadExtension = "dbg_msg_dumps.fdx" : "0x0080"; # Dump complete information about sent and received messages.
# The four digits respectively control: connections, routing decisions, sent/received messages, errors.
# The values for each digit are:
# 0 - default - keep the default behavior
# 1 - quiet - remove any specific log
# 2 - compact - display only a summary of the information
# 4 - full - display the complete information on a single long line
# 8 - tree - display the complete information in an easier to read format spanning several lines.
##############################################################
## Peers configuration
# The local server listens for incoming connections. By default,
# all unknown connecting peers are rejected. Extensions can override this behavior (e.g., acl_wl).
#
# In addition to incoming connections, the local peer can
# be configured to establish and maintain connections to some
# Diameter nodes and allow connections from these nodes.
# This is achieved with the ConnectPeer directive described below.
#
# Note that the configured Diameter Identity MUST match
# the information received inside CEA, or the connection will be aborted.
#
# Format:
#ConnectPeer = "diameterid" [ { parameter1; parameter2; ...} ] ;
# Parameters that can be specified in the peer's parameter list:
# No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method;
# No_TLS; # assume transparent security instead of TLS. DTLS is not supported yet (will change in future versions).
# Port = 5868; # The port to connect to
# TcTimer = 30;
# TwTimer = 30;
# ConnectTo = "202.249.37.5";
# ConnectTo = "2001:200:903:2::202:1";
# TLS_Prio = "NORMAL";
# Realm = "realm.net"; # Reject the peer if it does not advertise this realm.
# Examples:
#ConnectPeer = "aaa.wide.ad.jp";
#ConnectPeer = "old.diameter.serv" { TcTimer = 60; TLS_old_method; No_SCTP; Port=3868; } ;
##############################################################

View File

@@ -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 $?

View File

@@ -0,0 +1,11 @@
[Unit]
Description=freediameter daemon
After=network.target
[Service]
Type=simple
PIDFile=/run/freediameter.pid
ExecStart=@BINDIR@/freeDiameterd
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,22 @@
CMakeLists: add an option to install tests
Upstream-Status: Inappropriate [OE ptest specific]
Original author: Yao Zhao <yao.zhao@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index da8da1b..de04059 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -113,4 +113,9 @@ ENDFOREACH( TEST )
####
## INSTALL section ##
-# we do not install the tests
+# install the tests
+SET(INSTALL_TEST_SUFFIX /opt/${FD_PROJECT_NAME}-tests CACHE PATH "Directory where the test binary is installed.")
+
+INSTALL(TARGETS ${TEST_LIST}
+ RUNTIME DESTINATION ${INSTALL_TEST_SUFFIX}
+ COMPONENT freeDiameter-common)

View File

@@ -0,0 +1,10 @@
#!/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
cmake -E cmake_echo_color --cyan "Running tests..."
ctest --force-new-ctest-process