Skip to content

Commit

Permalink
main/sofia-sip: merged patch that fixes unexpected 482 merged request
Browse files Browse the repository at this point in the history
  • Loading branch information
fcolista committed Apr 25, 2023
1 parent 27182c3 commit 868d6dc
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main/sofia-sip/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Maintainer: Francesco Colista <[email protected]>
pkgname=sofia-sip
pkgver=1.13.14
pkgrel=0
pkgrel=1
pkgdesc="RFC3261 compliant SIP User-Agent library"
url="https://github.com/freeswitch/sofia-sip"
arch="all"
Expand All @@ -12,7 +12,8 @@ makedepends="automake autoconf libtool m4
glib-dev openssl1.1-compat-dev lksctp-tools-dev"
checkdepends="check-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/freeswitch/sofia-sip/archive/v$pkgver.tar.gz"
source="$pkgname-$pkgver.tar.gz::https://github.com/freeswitch/sofia-sip/archive/v$pkgver.tar.gz
fix-unexpected-482-merge-request.patch"

# secfixes:
# 1.13.11-r0:
Expand Down Expand Up @@ -51,4 +52,5 @@ doc() {
}
sha512sums="
0a0b30e99251f32a3e4d5c1b0e167ae7cffaf93f2e8b9c84ecc96543181418da000a3bc7ea933da42b2943a66e2cef6c690aeda5504e2ead381c9448c77fcf2c sofia-sip-1.13.14.tar.gz
6763a295be4e450e1806be14f22ab4813af238b6ee75d95dbc20b38f7e98d4aa49b8e67a97007e6a4015f8abf54b5d4ae62e38951762e8701ffa2afe90a049d4 fix-unexpected-482-merge-request.patch
"
68 changes: 68 additions & 0 deletions main/sofia-sip/fix-unexpected-482-merge-request.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
From 016cfe1b6abe8e96f4bf0b27ed9ed422267bc3ad Mon Sep 17 00:00:00 2001
From: Ilkka Nurlund <[email protected]>
Date: Mon, 10 Apr 2023 06:36:04 +0000
Subject: [PATCH 1/2] nta.c/leg_find: Fix 'by method' leg matching condition

In certain cases 'leg_method' might be null so the IF statement:

if (leg_method && method_name && !su_casematch(method_name, leg_method))
continue;

is not working at all despite 'method_name' is not null. It leads to
leg matching process returns false positive at:

if (loose_match == NULL)
loose_match = leg;
---
libsofia-sip-ua/nta/nta.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c
index e360b7ed..f0ad0539 100644
--- a/libsofia-sip-ua/nta/nta.c
+++ b/libsofia-sip-ua/nta/nta.c
@@ -5120,7 +5120,7 @@ nta_leg_t *leg_find(nta_agent_t const *sa,

if (leg_url && request_uri && url_cmp(leg_url, request_uri))
continue;
- if (leg_method && method_name && !su_casematch(method_name, leg_method))
+ if (leg_method == NULL || method_name && !su_casematch(method_name, leg_method))
continue;

/* Perfect match if both local and To have tag

From 6cf8d6a6e2fb3d7fa10657fd9b9d63017093bce1 Mon Sep 17 00:00:00 2001
From: Ilkka Nurlund <[email protected]>
Date: Mon, 10 Apr 2023 08:13:22 +0000
Subject: [PATCH 2/2] nta.c/incoming_find: Fix "Merged Request" case matching
/RFC3261 8.2.2.2; 17.2.3/

Implements missing matching rules (17.2.3.1 and 17.2.3.2)
---
libsofia-sip-ua/nta/nta.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c
index f0ad0539..d6d4d748 100644
--- a/libsofia-sip-ua/nta/nta.c
+++ b/libsofia-sip-ua/nta/nta.c
@@ -6238,10 +6238,16 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,

/* RFC3261 - section 8.2.2.2 Merged Requests */
if (return_merge) {
- if (irq->irq_cseq->cs_method == cseq->cs_method &&
- strcmp(irq->irq_cseq->cs_method_name,
- cseq->cs_method_name) == 0)
- *return_merge = irq, return_merge = NULL;
+ /* RFC3261 - section 17.2.3 Matching Requests to Server Transactions */
+ if (irq->irq_via->v_branch &&
+ su_casematch(irq->irq_via->v_branch, v->v_branch) &&
+ su_casematch(irq->irq_via->v_host, v->v_host) &&
+ su_strmatch(irq->irq_via->v_port, v->v_port)) {
+ if (irq->irq_cseq->cs_method == cseq->cs_method &&
+ strcmp(irq->irq_cseq->cs_method_name,
+ cseq->cs_method_name) == 0)
+ *return_merge = irq, return_merge = NULL;
+ }
}
}

0 comments on commit 868d6dc

Please sign in to comment.