|
| 1 | +From 016cfe1b6abe8e96f4bf0b27ed9ed422267bc3ad Mon Sep 17 00:00:00 2001 |
| 2 | +From: Ilkka Nurlund < [email protected]> |
| 3 | +Date: Mon, 10 Apr 2023 06:36:04 +0000 |
| 4 | +Subject: [PATCH 1/2] nta.c/leg_find: Fix 'by method' leg matching condition |
| 5 | + |
| 6 | + In certain cases 'leg_method' might be null so the IF statement: |
| 7 | + |
| 8 | + if (leg_method && method_name && !su_casematch(method_name, leg_method)) |
| 9 | + continue; |
| 10 | + |
| 11 | + is not working at all despite 'method_name' is not null. It leads to |
| 12 | + leg matching process returns false positive at: |
| 13 | + |
| 14 | + if (loose_match == NULL) |
| 15 | + loose_match = leg; |
| 16 | +--- |
| 17 | + libsofia-sip-ua/nta/nta.c | 2 +- |
| 18 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 | + |
| 20 | +diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c |
| 21 | +index e360b7ed..f0ad0539 100644 |
| 22 | +--- a/libsofia-sip-ua/nta/nta.c |
| 23 | ++++ b/libsofia-sip-ua/nta/nta.c |
| 24 | +@@ -5120,7 +5120,7 @@ nta_leg_t *leg_find(nta_agent_t const *sa, |
| 25 | + |
| 26 | + if (leg_url && request_uri && url_cmp(leg_url, request_uri)) |
| 27 | + continue; |
| 28 | +- if (leg_method && method_name && !su_casematch(method_name, leg_method)) |
| 29 | ++ if (leg_method == NULL || method_name && !su_casematch(method_name, leg_method)) |
| 30 | + continue; |
| 31 | + |
| 32 | + /* Perfect match if both local and To have tag |
| 33 | + |
| 34 | +From 6cf8d6a6e2fb3d7fa10657fd9b9d63017093bce1 Mon Sep 17 00:00:00 2001 |
| 35 | +From: Ilkka Nurlund < [email protected]> |
| 36 | +Date: Mon, 10 Apr 2023 08:13:22 +0000 |
| 37 | +Subject: [PATCH 2/2] nta.c/incoming_find: Fix "Merged Request" case matching |
| 38 | + /RFC3261 8.2.2.2; 17.2.3/ |
| 39 | + |
| 40 | + Implements missing matching rules (17.2.3.1 and 17.2.3.2) |
| 41 | +--- |
| 42 | + libsofia-sip-ua/nta/nta.c | 14 ++++++++++---- |
| 43 | + 1 file changed, 10 insertions(+), 4 deletions(-) |
| 44 | + |
| 45 | +diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c |
| 46 | +index f0ad0539..d6d4d748 100644 |
| 47 | +--- a/libsofia-sip-ua/nta/nta.c |
| 48 | ++++ b/libsofia-sip-ua/nta/nta.c |
| 49 | +@@ -6238,10 +6238,16 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent, |
| 50 | + |
| 51 | + /* RFC3261 - section 8.2.2.2 Merged Requests */ |
| 52 | + if (return_merge) { |
| 53 | +- if (irq->irq_cseq->cs_method == cseq->cs_method && |
| 54 | +- strcmp(irq->irq_cseq->cs_method_name, |
| 55 | +- cseq->cs_method_name) == 0) |
| 56 | +- *return_merge = irq, return_merge = NULL; |
| 57 | ++ /* RFC3261 - section 17.2.3 Matching Requests to Server Transactions */ |
| 58 | ++ if (irq->irq_via->v_branch && |
| 59 | ++ su_casematch(irq->irq_via->v_branch, v->v_branch) && |
| 60 | ++ su_casematch(irq->irq_via->v_host, v->v_host) && |
| 61 | ++ su_strmatch(irq->irq_via->v_port, v->v_port)) { |
| 62 | ++ if (irq->irq_cseq->cs_method == cseq->cs_method && |
| 63 | ++ strcmp(irq->irq_cseq->cs_method_name, |
| 64 | ++ cseq->cs_method_name) == 0) |
| 65 | ++ *return_merge = irq, return_merge = NULL; |
| 66 | ++ } |
| 67 | + } |
| 68 | + } |
0 commit comments