Browse code

Merge pull request #1 from kamailio/master

pull

Riccardo-78 authored on 08/04/2021 12:10:03 • GitHub committed on 08/04/2021 12:10:03
Showing 320 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,40 @@
1
+---
2
+name: build
3
+'on':
4
+  push:
5
+    branches:
6
+      - master
7
+  pull_request:
8
+    branches:
9
+      - master
10
+  # Allows you to run this workflow manually from the Actions tab
11
+  workflow_dispatch:
12
+jobs:
13
+  build:
14
+    runs-on: ubuntu-latest
15
+    container:
16
+      image: kamailio/pkg-kamailio-docker:dev-${{ matrix.distribution }}
17
+      volumes:
18
+        - ${{ github.workspace }}:/code
19
+      env:
20
+        DIST: ${{ matrix.distribution }}
21
+        CC: ${{ matrix.compilier }}
22
+    strategy:
23
+      matrix:
24
+        include:
25
+          - distribution: buster
26
+            compilier: gcc
27
+          - distribution: buster
28
+            compilier: clang
29
+          - distribution: sid
30
+            compilier: gcc
31
+          - distribution: sid
32
+            compilier: clang
33
+    steps:
34
+      - uses: actions/checkout@v2
35
+      - uses: ammaraskar/gcc-problem-matcher@0.1
36
+      - name: build
37
+        run: |
38
+          cd /code
39
+          ./test/travis/build_travis.sh
40
+        shell: bash
... ...
@@ -50,3 +50,6 @@ libiname.lst
50 50
 *.7
51 51
 # vscode tmp files
52 52
 .vscode
53
+# compiling tools files
54
+.clangd
55
+compile_commands.json
53 56
deleted file mode 100644
... ...
@@ -1,28 +0,0 @@
1
-sudo: required
2
-language: c
3
-compiler:
4
-  - gcc
5
-  - clang
6
-env:
7
-  - DIST=buster
8
-  - DIST=sid
9
-services:
10
-  - docker
11
-before_install:
12
-  - docker pull kamailio/pkg-kamailio-docker:dev-$DIST
13
-script: docker run -v $TRAVIS_BUILD_DIR:/code:rw kamailio/pkg-kamailio-docker:dev-$DIST /bin/bash -c "cd /code; CC=$CC DIST=$DIST ./test/travis/build_travis.sh"
14
-branches:
15
-  only:
16
-    - 'master'
17
-    - '/^5\.[0-9]+$/'
18
-notifications:
19
-  irc:
20
-    channels:
21
-      - "chat.freenode.net#kamailio-dev"
22
-    on_success: never
23
-    on_failure: always
24
-  email:
25
-    recipients:
26
-      - sr-dev@lists.kamailio.org
27
-    on_success: never
28
-    on_failure: always
... ...
@@ -1,6 +1,6 @@
1 1
 # Kamailio - The Open Source SIP Server
2 2
 
3
-[![Build Status](https://travis-ci.org/kamailio/kamailio.svg?branch=master)](https://travis-ci.org/kamailio/kamailio)
3
+[![Build Status](https://github.com/kamailio/kamailio/actions/workflows/main.yml/badge.svg)](https://github.com/kamailio/kamailio/actions)
4 4
 [![Code Triage Badge](https://www.codetriage.com/kamailio/kamailio/badges/users.svg)](https://www.codetriage.com/kamailio/kamailio)
5 5
 
6 6
 Project Website:
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.5 - default configuration script
3
+# Kamailio SIP Server v5.5 - default configuration script
4 4
 #     - web: https://www.kamailio.org
5 5
 #     - git: https://github.com/kamailio/kamailio
6 6
 #
... ...
@@ -851,9 +851,9 @@ route[NATMANAGE] {
851 851
 
852 852
 #!ifdef WITH_RTPENGINE
853 853
 	if(nat_uac_test("8")) {
854
-		rtpengine_manage("replace-origin replace-session-connection");
854
+		rtpengine_manage("SIP-source-address replace-origin replace-session-connection");
855 855
 	} else {
856
-		rtpengine_manage("trust-address replace-origin replace-session-connection");
856
+		rtpengine_manage("replace-origin replace-session-connection");
857 857
 	}
858 858
 #!else
859 859
 	if(nat_uac_test("8")) {
... ...
@@ -1,7 +1,7 @@
1 1
 #
2 2
 # TelcoSuite (V3) Proxy-CSCF
3 3
 #
4
-# Kamailio (OpenSER) SIP Server
4
+# Kamailio SIP Server
5 5
 #     - web: http://www.kamailio.org
6 6
 #     - git: http://sip-router.org
7 7
 #
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.0 - default configuration script
3
+# Kamailio SIP Server v5.0 - default configuration script
4 4
 #     - web: http://www.kamailio.org
5 5
 #     - git: http://sip-router.org
6 6
 #
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.2 - default configuration script
3
+# Kamailio SIP Server v5.2 - default configuration script
4 4
 #     - web: https://www.kamailio.org
5 5
 #     - git: https://github.com/kamailio/kamailio
6 6
 #
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.2 - default configuration script
3
+# Kamailio SIP Server v5.2 - default configuration script
4 4
 #     - web: https://www.kamailio.org
5 5
 #     - git: https://github.com/kamailio/kamailio
6 6
 #
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.1 - default basic configuration script
3
+# Kamailio SIP Server v5.1 - default basic configuration script
4 4
 #     - web: http://www.kamailio.org
5 5
 #     - git: http://sip-router.org
6 6
 #
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.1 - default advanced configuration script
3
+# Kamailio SIP Server v5.1 - default advanced configuration script
4 4
 #     - web: http://www.kamailio.org
5 5
 #     - git: http://sip-router.org
6 6
 #
... ...
@@ -1,6 +1,6 @@
1 1
 #!KAMAILIO
2 2
 #
3
-# Kamailio (OpenSER) SIP Server v5.3 - default configuration script
3
+# Kamailio SIP Server v5.3 - default configuration script
4 4
 #     - web: https://www.kamailio.org
5 5
 #     - git: https://github.com/kamailio/kamailio
6 6
 #
7 7
new file mode 100644
... ...
@@ -0,0 +1,14 @@
1
+# Kamailio OSS Fuzz Integration #
2
+
3
+OSS-Fuzz is a free service run by Google that performs continuous fuzzing of
4
+various open source projects.
5
+
6
+  * https://github.com/google/oss-fuzz
7
+
8
+OSS-Fuzz pull request to integrate Kamailio:
9
+
10
+  * https://github.com/google/oss-fuzz/pull/5279
11
+
12
+Initial pull request in Kamailio, with additional details:
13
+
14
+  * https://github.com/kamailio/kamailio/pull/2660
0 15
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+#include "../parser/parse_uri.c"
2
+
3
+int
4
+LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
5
+    struct sip_uri uri;
6
+    parse_uri(data, size, &uri);
7
+    return 0;
8
+}
... ...
@@ -2,17 +2,17 @@ Kamailio example CA
2 2
 ===================
3 3
 
4 4
 This directory contains an already generated TLS certificate that can be
5
-used in your Kamailio configuration. It's a generic certificate with the 
5
+used in your Kamailio configuration. It's a generic certificate with the
6 6
 main purpose of serving as example and for testings.
7 7
 
8 8
 IMPORTANT: it's not a trustable certificate - the CA is also an example.
9 9
 
10 10
 All TLS configuration files may be found in "user" directory. If you want to
11
-generate your own certificate, you may find in the "rootCA" directory the 
11
+generate your own certificate, you may find in the "rootCA" directory the
12 12
 root CA to sign your request with. Use "kamctl tls userCERT" command to
13
-create a new certificate; the rootCA password is "openser".
13
+create a new certificate; the rootCA password is "kamailio".
14 14
 
15
-What is the purpose of these default CA and certificate? First to make an 
15
+What is the purpose of these default CA and certificate? First to make an
16 16
 out-of-the box TLS configuration for users not so familiar with SSL/TLS.
17 17
 Second, to give access to the same CA root to a large community in order to
18 18
 encourage testings and interconnections via TLS with minimum of troubles.
... ...
@@ -32,7 +32,7 @@ policy           = req_policy
32 32
 
33 33
 
34 34
 #
35
-# Information to be moved from 
35
+# Information to be moved from
36 36
 # request to the certificate
37 37
 #
38 38
 nameopt          = ca_default
... ...
@@ -3,11 +3,11 @@ Certificate:
3 3
         Version: 3 (0x2)
4 4
         Serial Number: 1 (0x1)
5 5
         Signature Algorithm: sha1WithRSAEncryption
6
-        Issuer: CN=OpenSER, ST=SIP, C=IP/emailAddress=team@openser.org, O=openser.org
6
+        Issuer: CN=Kamailio, ST=SIP, C=IP/emailAddress=team@kamailio.org, O=kamailio.org
7 7
         Validity
8 8
             Not Before: Oct 28 19:16:29 2005 GMT
9 9
             Not After : Oct 28 19:16:29 2006 GMT
10
-        Subject: C=IP, ST=SIP, O=OpenSER project, OU=OpenSER TLS tester, CN=OpenSER/emailAddress=team@openser.org
10
+        Subject: C=IP, ST=SIP, O=Kamailio Project, OU=Kamailio TLS Tester, CN=Kamailio/emailAddress=team@kamailio.org
11 11
         Subject Public Key Info:
12 12
             Public Key Algorithm: rsaEncryption
13 13
             RSA Public Key: (512 bit)
... ...
@@ -1 +1 @@
1
-V	061028191629Z		01	unknown	/C=IP/ST=SIP/O=OpenSER project/OU=OpenSER TLS tester/CN=OpenSER/emailAddress=team@openser.org
1
+V	061028191629Z		01	unknown	/C=IP/ST=SIP/O=Kamailio project/OU=Kamailio TLS Tester/CN=Kamailio/emailAddress=team@kamailio.org
... ...
@@ -3,11 +3,11 @@ Certificate:
3 3
         Version: 3 (0x2)
4 4
         Serial Number: 1 (0x1)
5 5
         Signature Algorithm: sha1WithRSAEncryption
6
-        Issuer: CN=OpenSER, ST=SIP, C=IP/emailAddress=team@openser.org, O=openser.org
6
+        Issuer: CN=Kamailio, ST=SIP, C=IP/emailAddress=team@kamailio.org, O=kamailio.org
7 7
         Validity
8 8
             Not Before: Oct 28 19:16:29 2005 GMT
9 9
             Not After : Oct 28 19:16:29 2006 GMT
10
-        Subject: C=IP, ST=SIP, O=OpenSER project, OU=OpenSER TLS tester, CN=OpenSER/emailAddress=team@openser.org
10
+        Subject: C=IP, ST=SIP, O=Kamailio Project, OU=Kamailio TLS Tester, CN=Kamailio/emailAddress=team@kamailio.org
11 11
         Subject Public Key Info:
12 12
             Public Key Algorithm: rsaEncryption
13 13
             RSA Public Key: (512 bit)
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,3 +1,15 @@
1
+kamailio (5.5.0~pre0) unstable; urgency=medium
2
+
3
+  * version set 5.5.0~pre0
4
+
5
+ -- Victor Seva <vseva@debian.org>  Thu, 01 Apr 2021 19:06:42 +0200
6
+
7
+kamailio (5.5.0~dev5) unstable; urgency=medium
8
+
9
+  * version set 5.5.0~dev5
10
+
11
+ -- Victor Seva <vseva@debian.org>  Wed, 24 Mar 2021 12:08:26 +0100
12
+
1 13
 kamailio (5.5.0~dev4) unstable; urgency=medium
2 14
 
3 15
   * version set 5.5.0~dev4
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -3,7 +3,7 @@
3 3
 # Startup script for Kamailio
4 4
 #
5 5
 # chkconfig: 345 85 15
6
-# description: Kamailio (OpenSER) - the Open Source SIP Server
6
+# description: Kamailio - the Open Source SIP Server
7 7
 #
8 8
 # processname: kamailio
9 9
 # pidfile: /run/kamailio.pid
... ...
@@ -12,8 +12,8 @@
12 12
 ### BEGIN INIT INFO
13 13
 # Provides: kamailio
14 14
 # Required-Start: $local_fs $network
15
-# Short-Description: Kamailio (OpenSER) - the Open Source SIP Server
16
-# Description: Kamailio (former OpenSER) is an Open Source SIP Server released
15
+# Short-Description: Kamailio - the Open Source SIP Server
16
+# Description: Kamailio is an Open Source SIP Server released
17 17
 # 	under GPL, able to handle thousands of call setups per second.
18 18
 ### END INIT INFO
19 19
 
... ...
@@ -1,5 +1,5 @@
1 1
 [Unit]
2
-Description=Kamailio (OpenSER) - the Open Source SIP Server
2
+Description=Kamailio - the Open Source SIP Server
3 3
 Wants=network-online.target
4 4
 After=network-online.target
5 5
 
... ...
@@ -1448,6 +1448,7 @@ fi
1448 1448
 %doc %{_docdir}/kamailio/modules/README.ipops
1449 1449
 %doc %{_docdir}/kamailio/modules/README.kemix
1450 1450
 %doc %{_docdir}/kamailio/modules/README.kex
1451
+%doc %{_docdir}/kamailio/modules/README.lrkproxy
1451 1452
 %doc %{_docdir}/kamailio/modules/README.malloc_test
1452 1453
 %doc %{_docdir}/kamailio/modules/README.mangler
1453 1454
 %doc %{_docdir}/kamailio/modules/README.matrix
... ...
@@ -1606,6 +1607,7 @@ fi
1606 1607
 %{_libdir}/kamailio/modules/ipops.so
1607 1608
 %{_libdir}/kamailio/modules/kemix.so
1608 1609
 %{_libdir}/kamailio/modules/kex.so
1610
+%{_libdir}/kamailio/modules/lrkproxy.so
1609 1611
 %{_libdir}/kamailio/modules/malloc_test.so
1610 1612
 %{_libdir}/kamailio/modules/mangler.so
1611 1613
 %{_libdir}/kamailio/modules/matrix.so
... ...
@@ -107,7 +107,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
107 107
 VERSION = 5
108 108
 PATCHLEVEL = 5
109 109
 SUBLEVEL =  0
110
-EXTRAVERSION = -dev4
110
+EXTRAVERSION = -pre0
111 111
 
112 112
 # memory manager switcher
113 113
 # 0 - f_malloc (fast malloc)
... ...
@@ -23,7 +23,7 @@ mod_list_extra=avp auth_diameter call_control call_obj dmq domainpolicy msrp \
23 23
 			carrierroute pdb qos sca seas sms sst timer tmrec uac_redirect \
24 24
 			xhttp xhttp_rpc xprint jsonrpcs nosip dmq_usrloc statsd rtjson \
25 25
 			log_custom keepalive ss7ops app_sqlang acc_diameter evrexec \
26
-			sipjson xhttp_prom
26
+			sipjson lrkproxy xhttp_prom
27 27
 
28 28
 # - common modules depending on database
29 29
 mod_list_db=acc alias_db auth_db avpops cfg_db db_text db_flatstore \
... ...
@@ -184,6 +184,15 @@ mod_list_uuid=uuid
184 184
 # - modules depending on ev library
185 185
 mod_list_ev=evapi
186 186
 
187
+# - modules depending on libjwt library
188
+mod_list_jwt=jwt
189
+
190
+# - modules depending on libwebsockets library
191
+mod_list_lwsc=lwsc
192
+
193
+# - modules depending on libstirshaken library
194
+mod_list_stirshaken=stirshaken
195
+
187 196
 # - modules depending on kazoo/rabbitmq
188 197
 mod_list_kazoo=kazoo
189 198
 
... ...
@@ -256,6 +265,9 @@ mod_list_all=$(sort $(mod_list_basic) $(mod_list_extra) \
256 265
 			   $(mod_list_kafka) \
257 266
 			   $(mod_list_mqtt) \
258 267
 			   $(mod_list_secsipid) \
268
+			   $(mod_list_jwt) \
269
+			   $(mod_list_lwsc) \
270
+			   $(mod_list_stirshaken) \
259 271
 			   $(mod_list_rtp_media_server)
260 272
 
261 273
 
... ...
@@ -446,6 +458,15 @@ module_group_kuuid=$(mod_list_uuid)
446 458
 # pkg libev modules
447 459
 module_group_kev=$(mod_list_ev)
448 460
 
461
+# pkg jwt module
462
+module_group_kjwt=$(mod_list_jwt)
463
+
464
+# pkg lwsc module
465
+module_group_klwsc=$(mod_list_lwsc)
466
+
467
+# pkg stirshaken module
468
+module_group_kstirshaken=$(mod_list_stirshaken)
469
+
449 470
 # pkg kazoo module
450 471
 module_group_kkazoo=$(mod_list_kazoo)
451 472
 
... ...
@@ -434,7 +434,7 @@ int base64url_enc(char *in, int ilen, char *out, int osize)
434 434
 	int  i;
435 435
 	int  r;
436 436
 	char *p;
437
-	int  block;
437
+	unsigned int  block;
438 438
 	int  olen;
439 439
 
440 440
 	olen = (((ilen+2)/3)<<2);
... ...
@@ -465,7 +465,7 @@ int base64url_enc(char *in, int ilen, char *out, int osize)
465 465
 int base64url_dec(char *in, int ilen, char *out, int osize)
466 466
 {
467 467
 	int n;
468
-	int block;
468
+	unsigned int block;
469 469
 	int idx;
470 470
 	int i;
471 471
 	int j;
... ...
@@ -493,7 +493,7 @@ int base64url_dec(char *in, int ilen, char *out, int osize)
493 493
 	for(i=0, idx=0; i<end; idx+=3) {
494 494
 		block = 0;
495 495
 		for(j=0; j<4 && i<end ; j++) {
496
-			c = _ksr_b64url_decmap[(int)in[i++]];
496
+			c = _ksr_b64url_decmap[(unsigned char)in[i++]];
497 497
 			if(c<0) {
498 498
 				LM_ERR("invalid input string\"%.*s\"\n", ilen, in);
499 499
 				return -1;
... ...
@@ -467,6 +467,9 @@ VERBOSE_STARTUP		"verbose_startup"
467 467
 
468 468
 SERVER_ID     "server_id"
469 469
 ROUTE_LOCKS_SIZE     "route_locks_size"
470
+WAIT_WORKER1_MODE     "wait_worker1_mode"
471
+WAIT_WORKER1_TIME     "wait_worker1_time"
472
+WAIT_WORKER1_USLEEP   "wait_worker1_usleep"
470 473
 
471 474
 KEMI     "kemi"
472 475
 ONSEND_ROUTE_CALLBACK	"onsend_route_callback"
... ...
@@ -989,6 +992,9 @@ IMPORTFILE      "import_file"
989 992
 <INITIAL>{VERBOSE_STARTUP}		{	count(); yylval.strval=yytext;
990 993
 									return VERBOSE_STARTUP; }
991 994
 <INITIAL>{ROUTE_LOCKS_SIZE}  { count(); yylval.strval=yytext; return ROUTE_LOCKS_SIZE; }
995
+<INITIAL>{WAIT_WORKER1_MODE}  { count(); yylval.strval=yytext; return WAIT_WORKER1_MODE; }
996
+<INITIAL>{WAIT_WORKER1_TIME}  { count(); yylval.strval=yytext; return WAIT_WORKER1_TIME; }
997
+<INITIAL>{WAIT_WORKER1_USLEEP}  { count(); yylval.strval=yytext; return WAIT_WORKER1_USLEEP; }
992 998
 <INITIAL>{SERVER_ID}  { count(); yylval.strval=yytext; return SERVER_ID;}
993 999
 <INITIAL>{KEMI}  { count(); yylval.strval=yytext; return KEMI;}
994 1000
 <INITIAL>{REPLY_ROUTE_CALLBACK}  { count(); yylval.strval=yytext; return REPLY_ROUTE_CALLBACK;}
... ...
@@ -1587,7 +1593,7 @@ static char* addchar(struct str_buf* dst, char c)
1587 1593
 
1588 1594
 static char* addstr(struct str_buf* dst_b, char* src, int len)
1589 1595
 {
1590
-	char *tmp;
1596
+	char *tmp = NULL;
1591 1597
 	unsigned size;
1592 1598
 	unsigned used;
1593 1599
 
... ...
@@ -1606,6 +1612,10 @@ static char* addstr(struct str_buf* dst_b, char* src, int len)
1606 1612
 		dst_b->crt=dst_b->s+used;
1607 1613
 		dst_b->left=size-used;
1608 1614
 	}
1615
+	if(dst_b->crt==NULL) {
1616
+		LM_CRIT("unexpected null dst buffer\n");
1617
+		ksr_exit(-1);
1618
+	}
1609 1619
 	memcpy(dst_b->crt, src, len);
1610 1620
 	dst_b->crt+=len;
1611 1621
 	*(dst_b->crt)=0;
... ...
@@ -1792,13 +1802,14 @@ static int sr_push_yy_state(char *fin, int mode)
1792 1802
 		fp = fopen(newf, "r" );
1793 1803
 		if ( fp==NULL )
1794 1804
 		{
1795
-			pkg_free(newf);
1796 1805
 			if(mode==0)
1797 1806
 			{
1798 1807
 				LM_CRIT("cannot open included file: %s (%s)\n", fbuf, newf);
1808
+				pkg_free(newf);
1799 1809
 				return -1;
1800 1810
 			} else {
1801 1811
 				LM_DBG("importing file ignored: %s (%s)\n", fbuf, newf);
1812
+				pkg_free(newf);
1802 1813
 				return 0;
1803 1814
 			}
1804 1815
 		}
... ...
@@ -1917,11 +1928,16 @@ ksr_ppdefine_t* pp_get_define(int idx)
1917 1928
 	return &pp_defines[idx];
1918 1929
 }
1919 1930
 
1920
-static int pp_lookup(int len, const char * text)
1931
+static int pp_lookup(int len, const char *text)
1921 1932
 {
1922 1933
 	str var = {(char *)text, len};
1923 1934
 	int i;
1924 1935
 
1936
+	if(len<=0 || text==NULL) {
1937
+		LM_ERR("invalid parameters");
1938
+		return -1;
1939
+	}
1940
+
1925 1941
 	for (i=0; i<pp_num_defines; i++)
1926 1942
 		if (STR_EQ(pp_defines[i].name, var))
1927 1943
 			return i;
... ...
@@ -1935,10 +1951,15 @@ int pp_define_set_type(int type)
1935 1951
 	return 0;
1936 1952
 }
1937 1953
 
1938
-int pp_define(int len, const char * text)
1954
+int pp_define(int len, const char *text)
1939 1955
 {
1940 1956
 	int ppos;
1941 1957
 
1958
+	if(len<=0 || text==NULL) {
1959
+		LM_ERR("invalid parameters");
1960
+		return -1;
1961
+	}
1962
+
1942 1963
 	LM_DBG("defining id: %.*s\n", len, text);
1943 1964
 
1944 1965
 	if (pp_num_defines == MAX_DEFINES) {
... ...
@@ -2000,7 +2021,7 @@ int pp_define_set(int len, char *text)
2000 2021
 		LM_BUG("BUG: the index in define table not set yet\n");
2001 2022
 		return -1;
2002 2023
 	}
2003
-	if(len<=0) {
2024
+	if(len<=0 || text==NULL) {
2004 2025
 		LM_DBG("no define value - ignoring\n");
2005 2026
 		return 0;
2006 2027
 	}
... ...
@@ -2036,7 +2057,7 @@ int pp_define_set(int len, char *text)
2036 2057
 	return 0;
2037 2058
 }
2038 2059
 
2039
-int pp_define_env(const char * text, int len)
2060
+int pp_define_env(const char *text, int len)
2040 2061
 {
2041 2062
 	char *r;
2042 2063
 	str defname;
... ...
@@ -2077,7 +2098,7 @@ int pp_define_env(const char * text, int len)
2077 2098
 	return 0;
2078 2099
 }
2079 2100
 
2080
-str *pp_define_get(int len, const char * text)
2101
+str *pp_define_get(int len, const char *text)
2081 2102
 {
2082 2103
 	str var = {(char *)text, len};
2083 2104
 	int i;
... ...
@@ -2119,7 +2140,7 @@ static int pp_ifdef_type(int type)
2119 2140
  * ifndef defined   -> 0
2120 2141
  * ifndef undefined -> 1
2121 2142
  */
2122
-static void pp_ifdef_var(int len, const char * text)
2143
+static void pp_ifdef_var(int len, const char *text)
2123 2144
 {
2124 2145
 	pp_ifdef_stack[pp_sptr] ^= (pp_lookup(len, text) < 0);
2125 2146
 }
... ...
@@ -498,6 +498,9 @@ extern char *default_routename;
498 498
 %token VERSION_TABLE_CFG
499 499
 %token VERBOSE_STARTUP
500 500
 %token ROUTE_LOCKS_SIZE
501
+%token WAIT_WORKER1_MODE
502
+%token WAIT_WORKER1_TIME
503
+%token WAIT_WORKER1_USLEEP
501 504
 %token CFG_DESCRIPTION
502 505
 %token SERVER_ID
503 506
 %token KEMI
... ...
@@ -1702,6 +1705,12 @@ assign_stm:
1702 1705
 	| VERBOSE_STARTUP EQUAL error { yyerror("boolean value expected"); }
1703 1706
 	| ROUTE_LOCKS_SIZE EQUAL NUMBER { ksr_route_locks_size=$3; }
1704 1707
 	| ROUTE_LOCKS_SIZE EQUAL error { yyerror("number expected"); }
1708
+	| WAIT_WORKER1_MODE EQUAL NUMBER { ksr_wait_worker1_mode=$3; }
1709
+	| WAIT_WORKER1_MODE EQUAL error { yyerror("number expected"); }
1710
+	| WAIT_WORKER1_TIME EQUAL NUMBER { ksr_wait_worker1_time=$3; }
1711
+	| WAIT_WORKER1_TIME EQUAL error { yyerror("number expected"); }
1712
+	| WAIT_WORKER1_USLEEP EQUAL NUMBER { ksr_wait_worker1_usleep=$3; }
1713
+	| WAIT_WORKER1_USLEEP EQUAL error { yyerror("number expected"); }
1705 1714
     | SERVER_ID EQUAL NUMBER { server_id=$3; }
1706 1715
 	| SERVER_ID EQUAL error  { yyerror("number expected"); }
1707 1716
 	| KEMI DOT ONSEND_ROUTE_CALLBACK EQUAL STRING {
... ...
@@ -45,6 +45,7 @@
45 45
 #define TLS_PKEY_FILE "cert.pem" 	/*!< The certificate private key file */
46 46
 #define TLS_CERT_FILE "cert.pem"	/*!< The certificate file */
47 47
 #define TLS_CA_FILE 0			/*!< no CA list file by default */
48
+#define TLS_CA_PATH 0			/*!< no CA directory path by default */
48 49
 #define TLS_CRL_FILE 0 /*!< no CRL by default */
49 50
 
50 51
 #define CHILD_NO    8			/*!< default number of child processes started */
... ...
@@ -95,6 +96,7 @@
95 96
 #define MY_BRANCH ";branch="
96 97
 #define MY_BRANCH_LEN (sizeof(MY_BRANCH) - 1)
97 98
 
99
+#define MAX_PORT_VAL 65535
98 100
 #define MAX_PORT_LEN 7 /* ':' + max 5 letters + \0 */
99 101
 
100 102
 #define CRLF "\r\n"
... ...
@@ -4012,7 +4012,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
4012 4012
 	size = e->total_size;
4013 4013
 	if (rdata_size) {
4014 4014
 		/* we have to extend the entry */
4015
-		rounded_size = ROUND_POINTER(size); /* size may not have been 
4015
+		rounded_size = ROUND_POINTER(size); /* size may not have been
4016 4016
 												rounded previously */
4017 4017
 		switch (e->type) {
4018 4018
 			case T_A:
... ...
@@ -4064,7 +4064,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
4064 4064
 	/* fix the pointers inside the rr structures */
4065 4065
 	last_rr = NULL;
4066 4066
 	for (rr=new->rr_lst; rr; rr=rr->next) {
4067
-		rr->rdata = (void*)translate_pointer((char*)new, (char*)e, 
4067
+		rr->rdata = (void*)translate_pointer((char*)new, (char*)e,
4068 4068
 												(char*)rr->rdata);
4069 4069
 		if (rr->next)
4070 4070
 			rr->next = (struct dns_rr*)translate_pointer((char*)new, (char*)e,
... ...
@@ -4074,6 +4074,10 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
4074 4074
 
4075 4075
 		switch(e->type){
4076 4076
 			case T_NAPTR:
4077
+				if(rr->rdata==NULL) {
4078
+					LM_WARN("null rdata filed for type: %u\n", e->type);
4079
+					break;
4080
+				}
4077 4081
 				/* there are pointers inside the NAPTR rdata stucture */
4078 4082
 				((struct naptr_rdata*)rr->rdata)->flags =
4079 4083
 					translate_pointer((char*)new, (char*)e,
... ...
@@ -4092,6 +4096,10 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
4092 4096
 						((struct naptr_rdata*)rr->rdata)->repl);
4093 4097
 				break;
4094 4098
 			case T_TXT:
4099
+				if(rr->rdata==NULL) {
4100
+					LM_WARN("null rdata filed for type: %u\n", e->type);
4101
+					break;
4102
+				}
4095 4103
 				/* there are pointers inside the TXT structure */
4096 4104
 				for (i=0; i<((struct txt_rdata*)rr->rdata)->cstr_no; i++){
4097 4105
 					((struct txt_rdata*)rr->rdata)->txt[i].cstr=
... ...
@@ -4100,6 +4108,10 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
4100 4108
 				}
4101 4109
 				break;
4102 4110
 			case T_EBL:
4111
+				if(rr->rdata==NULL) {
4112
+					LM_WARN("null rdata filed for type: %u\n", e->type);
4113
+					break;
4114
+				}
4103 4115
 				/* there are pointers inside the EBL structure */
4104 4116
 				((struct ebl_rdata*)rr->rdata)->separator =
4105 4117
 					translate_pointer((char*)new, (char*)e,
... ...
@@ -4140,7 +4152,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e,
4140 4152
  * If there is an existing record with the same name and value
4141 4153
  * (ip address in case of A/AAAA record, name in case of SRV record)
4142 4154
  * only the remaining fields are updated.
4143
- * 
4155
+ *
4144 4156
  * Note that permanent records cannot be overwritten unless
4145 4157
  * the new record is also permanent. A permanent record
4146 4158
  * completely replaces a non-permanent one.
... ...
@@ -860,7 +860,6 @@ int msg_get_src_addr(sip_msg_t *msg, str *uri, int mode)
860 860
 		p += TRANSPORT_PARAM_LEN;
861 861
 
862 862
 		memcpy(p, proto.s, proto.len);
863
-		p += proto.len;
864 863
 	}
865 864
 
866 865
 	uri->s = buf;
... ...
@@ -1113,6 +1112,130 @@ int uri_trim_rcv_alias(str *uri, str *nuri)
1113 1112
 	return 1;
1114 1113
 }
1115 1114
 
1115
+/**
1116
+ * encode sip uri to uri alias parameter format
1117
+ * - param: iuri - input sip uri
1118
+ * - param: ualias - output uri alias value in format: address~port~proto
1119
+ *   * ualias->s must point to a buffer of size ualias->len, at least iuri->len
1120
+ *   * ualias->len is adjusted to the output value length
1121
+ * - return 0 on success, negative on error
1122
+ */
1123
+int ksr_uri_alias_encode(str *iuri, str *ualias)
1124
+{
1125
+	sip_uri_t puri;
1126
+	char *p;
1127
+
1128
+	if (parse_uri (iuri->s, iuri->len, &puri) < 0) {
1129
+		LM_ERR("failed to parse uri [%.*s]\n", iuri->len, iuri->s);
1130
+		return -1;
1131
+	}
1132
+
1133
+	/*host~port~proto*/
1134
+	if(puri.host.len + 16 >= ualias->len) {
1135
+		LM_ERR("not enough space to build uri alias - buf size: %d\n",
1136
+				ualias->len);
1137
+		return -1;
1138
+	}
1139
+	p = ualias->s;
1140
+	memcpy(p, puri.host.s, puri.host.len);
1141
+	p += puri.host.len;
1142
+	*p++ = '~';
1143
+	if(puri.port.len>0) {
1144
+		memcpy(p, puri.port.s, puri.port.len);
1145
+		p += puri.port.len;
1146
+	} else {
1147
+		if(puri.proto==PROTO_TLS || puri.proto==PROTO_WSS) {
1148
+			memcpy(p, "5061", 4);
1149
+		} else {
1150
+			memcpy(p, "5060", 4);
1151
+		}
1152
+		p += 4;
1153
+	}
1154
+	*p++ = '~';
1155
+	*p++ = ((puri.proto)?puri.proto:1) + '0';
1156
+	ualias->len = p - ualias->s;
1157
+	ualias->s[ualias->len] = '\0';
1158
+
1159
+	LM_DBG("encoded <%.*s> => [%.*s]\n",
1160
+			iuri->len, iuri->s, ualias->len, ualias->s);
1161
+
1162
+	return 0;
1163
+}
1164
+
1165
+/**
1166
+ * decode uri alias parameter to a sip uri
1167
+ * - param: ualias - uri alias value in format: address~port~proto
1168
+ * - param: ouri - output uri - ouri->s must point to a buffer of size ouri->len
1169
+ *   * ouri->len is adjusted to the output value length
1170
+ * - return 0 on success, negative on error
1171
+ */
1172
+int ksr_uri_alias_decode(str *ualias, str *ouri)
1173
+{
1174
+	int n;
1175
+	char *p;
1176
+	int nproto;
1177
+	str sproto;
1178
+
1179
+	/* 24 => sip:...;transport=sctp */
1180
+	if(ualias->len + 24 >= ouri->len) {
1181
+		LM_ERR("received uri alias is too long: %d\n", ualias->len);
1182
+		return -1;
1183
+	}
1184
+
1185
+	/* received=ip~port~proto */
1186
+	memcpy(ouri->s, "sip:", 4);
1187
+	memcpy(ouri->s + 4, ualias->s, ualias->len);
1188
+	ouri->s[4 + ualias->len] = '\0';
1189
+	p = ouri->s + 4;
1190
+	n = 0;
1191
+	while(*p!='\0') {
1192
+		if(*p=='~') {
1193
+			n++;
1194
+			if(n==1) {
1195
+				/* port */
1196
+				*p = ':';
1197
+			} else if(n==2) {
1198
+				/* proto */
1199
+				*p = ';';
1200
+				p++;
1201
+				if(*p=='\0') {
1202
+					LM_ERR("invalid received format\n");
1203
+					goto error;
1204
+				}
1205
+				nproto = *p - '0';
1206
+				if(nproto == PROTO_NONE) {
1207
+					nproto = PROTO_UDP;
1208
+				}
1209
+				if (nproto != PROTO_UDP) {
1210
+					proto_type_to_str(nproto, &sproto);
1211
+					if (sproto.len == 0) {
1212
+						LM_ERR("unknown proto in received param\n");
1213
+						goto error;
1214
+					}
1215
+					memcpy(p, "transport=", 10);
1216
+					p += 10;
1217
+					memcpy(p, sproto.s, sproto.len);
1218
+					p += sproto.len;
1219
+				} else {
1220
+					/* go back one byte to overwrite ';' */
1221
+					p--;
1222
+				}
1223
+				ouri->len = (int)(p - ouri->s);
1224
+				ouri->s[ouri->len] = '\0';
1225
+				break;
1226
+			} else {
1227
+				LM_ERR("invalid number of separators (%d)\n", n);
1228
+				goto error;
1229
+			}
1230
+		}
1231
+		p++;
1232
+	}
1233
+	return 0;
1234
+
1235
+error:
1236
+	return -1;
1237
+}
1238
+
1116 1239
 /* address of record (aor) management */
1117 1240
 
1118 1241
 /* address of record considered case sensitive
... ...
@@ -285,6 +285,8 @@ int setbflagsval(unsigned int branch, flag_t val);
285 285
 int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri);
286 286
 int uri_restore_rcv_alias(str *uri, str *nuri, str *suri);
287 287
 int uri_trim_rcv_alias(str *uri, str *nuri);
288
+int ksr_uri_alias_encode(str *iuri, str *ualias);
289
+int ksr_uri_alias_decode(str *ualias, str *ouri);
288 290
 
289 291
 int init_dst_set(void);
290 292
 
... ...
@@ -175,9 +175,9 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
175 175
 					_sr_events_list.net_data_recv = f;
176 176
 				else return -1;
177 177
 			break;
178
-		case SREV_NET_DATA_SEND:
179
-				if(_sr_events_list.net_data_send==0)
180
-					_sr_events_list.net_data_send = f;
178
+		case SREV_NET_DATA_SENT:
179
+				if(_sr_events_list.net_data_sent==0)
180
+					_sr_events_list.net_data_sent = f;
181 181
 				else return -1;
182 182
 			break;
183 183
 		case SREV_SIP_REPLY_OUT:
... ...
@@ -329,10 +329,10 @@ int sr_event_exec(int type, sr_event_param_t *evp)
329 329
 					ret = _sr_events_list.net_data_recv(evp);
330 330
 					return ret;
331 331
 				} else return 1;
332
-		case SREV_NET_DATA_SEND:
333
-				if(unlikely(_sr_events_list.net_data_send!=0))
332
+		case SREV_NET_DATA_SENT:
333
+				if(unlikely(_sr_events_list.net_data_sent!=0))
334 334
 				{
335
-					ret = _sr_events_list.net_data_send(evp);
335
+					ret = _sr_events_list.net_data_sent(evp);
336 336
 					return ret;
337 337
 				} else return 1;
338 338
 		case SREV_SIP_REPLY_OUT:
... ...
@@ -394,8 +394,8 @@ int sr_event_enabled(int type)
394 394
 				return (_sr_events_list.tcp_closed!=0)?1:0;
395 395
 		case SREV_NET_DATA_RECV:
396 396
 				return (_sr_events_list.net_data_recv!=0)?1:0;
397
-		case SREV_NET_DATA_SEND:
398
-				return (_sr_events_list.net_data_send!=0)?1:0;
397
+		case SREV_NET_DATA_SENT:
398
+				return (_sr_events_list.net_data_sent!=0)?1:0;
399 399
 		case SREV_SIP_REPLY_OUT:
400 400
 				return (_sr_events_list.sip_reply_out[0]!=0)?1:0;
401 401
 		case SREV_TCP_WS_CLOSE:
... ...
@@ -36,7 +36,7 @@
36 36
 #define SREV_STUN_IN			12
37 37
 #define SREV_TCP_CLOSED			13
38 38
 #define SREV_NET_DATA_RECV		14
39
-#define SREV_NET_DATA_SEND		15
39
+#define SREV_NET_DATA_SENT		15
40 40
 #define SREV_SIP_REPLY_OUT		16
41 41
 #define SREV_TCP_WS_CLOSE		17
42 42
 
... ...
@@ -70,7 +70,7 @@ typedef struct sr_event_cb {
70 70
 	sr_event_cb_f rcv_nosip;
71 71
 	sr_event_cb_f tcp_closed;
72 72
 	sr_event_cb_f net_data_recv;
73
-	sr_event_cb_f net_data_send;
73
+	sr_event_cb_f net_data_sent;
74 74
 	sr_event_cb_f sip_reply_out[SREV_CB_LIST_SIZE];
75 75
 	sr_event_cb_f tcp_ws_close[SREV_CB_LIST_SIZE];
76 76
 } sr_event_cb_t;
... ...
@@ -111,7 +111,7 @@ int is_check_self_func_list_set(void);
111 111
  *         that generated them; use 0 if you don't want this)
112 112
  * buf, len = buffer
113 113
  * flags = control internal behavior
114
- *    * 1 - skip executing event SREV_NET_DATA_OUT
114
+ *    * 1 - skip executing events: SREV_NET_DATA_OUT, SREV_NET_DATA_SEND
115 115
  * returns: 0 if ok, -1 on error*/
116 116
 
117 117
 static inline int msg_send_buffer(struct dest_info* dst, char* buf, int len,
... ...
@@ -331,7 +331,7 @@ done:
331 331
 		netinfo.data.len = outb.len;
332 332
 		netinfo.dst = dst;
333 333
 		evp.data = (void*)&netinfo;
334
-		sr_event_exec(SREV_NET_DATA_SEND, &evp);
334
+		sr_event_exec(SREV_NET_DATA_SENT, &evp);
335 335
 	}
336 336
 
337 337
 	if(outb.s != buf)
... ...
@@ -218,6 +218,11 @@ extern str _ksr_xavp_via_fields;
218 218
 extern int ksr_sip_parser_mode;
219 219
 extern int ksr_cfg_print_mode;
220 220
 
221
+extern int ksr_wait_worker1_mode;
222
+extern int ksr_wait_worker1_time;
223
+extern int ksr_wait_worker1_usleep;
224
+extern int *ksr_wait_worker1_done;
225
+
221 226
 extern char *_sr_uri_host_extra_chars;
222 227
 extern unsigned char *_ksr_hname_extra_chars;
223 228
 
... ...
@@ -380,7 +380,7 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
380 380
 	struct rvalue* rv;
381 381
 	int ret;
382 382
 
383
-	ret=0;
383
+	ret=-1;
384 384
 	rv=rval_expr_eval(h, msg, rve);
385 385
 	if (unlikely(rv==0)){
386 386
 		LM_ERR("rval expression evaluation failed (%d,%d-%d,%d)\n",
... ...
@@ -404,9 +404,7 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
404 404
 		LM_ERR("assignment failed at pos: (%d,%d-%d,%d)\n",
405 405
 			rve->fpos.s_line, rve->fpos.s_col,
406 406
 			rve->fpos.e_line, rve->fpos.e_col);
407
-	}
408
-	else
409
-	{
407
+	} else {
410 408
 		if(unlikely(_log_assign_action!=NULL))
411 409
 			_log_assign_action(msg, lv);
412 410
 	}
... ...
@@ -414,5 +412,5 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
414 412
 	return ret;
415 413
 error:
416 414
 	if (rv) rval_destroy(rv);
417
-	return -1;
415
+	return ret;
418 416
 }
... ...
@@ -1,5 +1,20 @@
1 1
 #if defined(TLSF_MALLOC)
2 2
 
3
+/**
4
+ * Copyright inside tlsf_malloc.h
5
+ */
6
+
7
+/**
8
+ * Sync'ed on Apr 6, 2021 with https://github.com/mattconte/tlsf
9
+ * - last commit:
10
+ * https://github.com/mattconte/tlsf/commit/deff9ab509341f264addbd3c8ada533678591905
11
+ *
12
+ * Summary of Kamailio specific changes:
13
+ * - fields to keep the usage statistics
14
+ * - alloc info structure for debug (file name, line, ...)
15
+ * - prototypes with debug info parameters
16
+ */
17
+
3 18
 #include <assert.h>
4 19
 #include <limits.h>
5 20
 #include <stddef.h>
... ...
@@ -7,15 +22,207 @@
7 22
 #include <stdlib.h>
8 23
 #include <string.h>
9 24
 
10
-#include "tlsf_malloc.h"
11
-#include "tlsf_malloc_bits.h"
12
-#include "src_loc.h"
13
-#include "memdbg.h"
14
-#include "memapi.h"
15 25
 #include "../dprint.h"
16 26
 #include "../cfg/cfg.h"
17 27
 #include "../globals.h"
18 28
 
29
+#include "src_loc.h"
30
+#include "memdbg.h"
31
+#include "memapi.h"
32
+
33
+#include "tlsf_malloc.h"
34
+
35
+#if defined(__cplusplus)
36
+#define tlsf_decl inline
37
+#else
38
+#define tlsf_decl static
39
+#endif
40
+
41
+/*
42
+** Architecture-specific bit manipulation routines.
43
+**
44
+** TLSF achieves O(1) cost for malloc and free operations by limiting
45
+** the search for a free block to a free list of guaranteed size
46
+** adequate to fulfill the request, combined with efficient free list
47
+** queries using bitmasks and architecture-specific bit-manipulation
48
+** routines.
49
+**
50
+** Most modern processors provide instructions to count leading zeroes
51
+** in a word, find the lowest and highest set bit, etc. These
52
+** specific implementations will be used when available, falling back
53
+** to a reasonably efficient generic implementation.
54
+**
55
+** NOTE: TLSF spec relies on ffs/fls returning value 0..31.
56
+** ffs/fls return 1-32 by default, returning 0 for error.
57
+*/
58
+
59
+/*
60
+** Detect whether or not we are building for a 32- or 64-bit (LP/LLP)
61
+** architecture. There is no reliable portable method at compile-time.
62
+*/
63
+#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) \
64
+	|| defined (_WIN64) || defined (__LP64__) || defined (__LLP64__)
65
+#define TLSF_64BIT
66
+#endif
67
+
68
+/*
69
+** gcc 3.4 and above have builtin support, specialized for architecture.
70
+** Some compilers masquerade as gcc; patchlevel test filters them out.
71
+*/
72
+#if defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) \
73
+	&& defined (__GNUC_PATCHLEVEL__)
74
+
75
+#if defined (__SNC__)
76
+/* SNC for Playstation 3. */
77
+
78
+tlsf_decl int tlsf_ffs(unsigned int word)
79
+{
80
+	const unsigned int reverse = word & (~word + 1);
81
+	const int bit = 32 - __builtin_clz(reverse);
82
+	return bit - 1;
83
+}
84
+
85
+#else
86
+
87
+tlsf_decl int tlsf_ffs(unsigned int word)
88
+{
89
+	return __builtin_ffs(word) - 1;
90
+}
91
+
92
+#endif
93
+
94
+tlsf_decl int tlsf_fls(unsigned int word)
95
+{
96
+	const int bit = word ? 32 - __builtin_clz(word) : 0;
97
+	return bit - 1;
98
+}
99
+
100
+#elif defined (_MSC_VER) && (_MSC_VER >= 1400) && (defined (_M_IX86) || defined (_M_X64))
101
+/* Microsoft Visual C++ support on x86/X64 architectures. */
102
+
103
+#include <intrin.h>
104
+
105
+#pragma intrinsic(_BitScanReverse)
106
+#pragma intrinsic(_BitScanForward)
107
+
108
+tlsf_decl int tlsf_fls(unsigned int word)
109
+{
110
+	unsigned long index;
111
+	return _BitScanReverse(&index, word) ? index : -1;
112
+}
113
+
114
+tlsf_decl int tlsf_ffs(unsigned int word)
115
+{
116
+	unsigned long index;
117
+	return _BitScanForward(&index, word) ? index : -1;
118
+}
119
+
120
+#elif defined (_MSC_VER) && defined (_M_PPC)
121
+/* Microsoft Visual C++ support on PowerPC architectures. */
122
+
123
+#include <ppcintrinsics.h>
124
+
125
+tlsf_decl int tlsf_fls(unsigned int word)
126
+{
127
+	const int bit = 32 - _CountLeadingZeros(word);
128
+	return bit - 1;
129
+}
130
+
131
+tlsf_decl int tlsf_ffs(unsigned int word)
132
+{
133
+	const unsigned int reverse = word & (~word + 1);
134
+	const int bit = 32 - _CountLeadingZeros(reverse);
135
+	return bit - 1;
136
+}
137
+
138
+#elif defined (__ARMCC_VERSION)
139
+/* RealView Compilation Tools for ARM */
140
+
141
+tlsf_decl int tlsf_ffs(unsigned int word)
142
+{
143
+	const unsigned int reverse = word & (~word + 1);
144
+	const int bit = 32 - __clz(reverse);
145
+	return bit - 1;
146
+}
147
+
148
+tlsf_decl int tlsf_fls(unsigned int word)
149
+{
150
+	const int bit = word ? 32 - __clz(word) : 0;
151
+	return bit - 1;
152
+}
153
+
154
+#elif defined (__ghs__)
155
+/* Green Hills support for PowerPC */
156
+
157
+#include <ppc_ghs.h>
158
+
159
+tlsf_decl int tlsf_ffs(unsigned int word)
160
+{
161
+	const unsigned int reverse = word & (~word + 1);
162
+	const int bit = 32 - __CLZ32(reverse);
163
+	return bit - 1;
164
+}
165
+
166
+tlsf_decl int tlsf_fls(unsigned int word)
167
+{
168
+	const int bit = word ? 32 - __CLZ32(word) : 0;
169
+	return bit - 1;
170
+}
171
+
172
+#else
173
+/* Fall back to generic implementation. */
174
+
175
+tlsf_decl int tlsf_fls_generic(unsigned int word)
176
+{
177
+	int bit = 32;
178
+
179
+	if (!word) bit -= 1;
180
+	if (!(word & 0xffff0000)) { word <<= 16; bit -= 16; }
181
+	if (!(word & 0xff000000)) { word <<= 8; bit -= 8; }
182
+	if (!(word & 0xf0000000)) { word <<= 4; bit -= 4; }
183
+	if (!(word & 0xc0000000)) { word <<= 2; bit -= 2; }
184
+	if (!(word & 0x80000000)) { word <<= 1; bit -= 1; }
185
+
186
+	return bit;
187
+}
188
+
189
+/* Implement ffs in terms of fls. */
190
+tlsf_decl int tlsf_ffs(unsigned int word)
191
+{
192
+	return tlsf_fls_generic(word & (~word + 1)) - 1;
193
+}
194
+
195
+tlsf_decl int tlsf_fls(unsigned int word)
196
+{
197
+	return tlsf_fls_generic(word) - 1;
198
+}
199