MT#6475 check method (ACK or PRACK) before deleting transaction

commit 22b8f00398f7fcffc291063c19dae46a11f41227
Author: Raphael Coeffic <rco@iptel.org>
Date:   Tue Apr 15 14:49:49 2014 +0200

    sip: b/f: check method (ACK or PRACK) before deleting transaction

    In case PRACK is received after 200, the transaction would be removed without checking the method.

(cherry picked from commit 99ca300e96)
mr3.2.2
Andrew Pogrebennyk 12 years ago
parent 3535b53fb8
commit ed3c56aacb
Notes: Jenkins User 11 years ago
jenkins_trigger: false

@ -123,4 +123,5 @@ sipwise/0122-b-f-b2bua-if-200-to-INV-without-SDP-use-SDP-from-18x.patch
sipwise/sw_vsc.patch
sipwise/0001-fix-sems-process-returns-always-0-when-daemonized.patch
sipwise/0002-core-fix-return-status-pipe-machinery-in-non-daemon-.patch
sipwise/0123-MT-6475-check-method-ACK-or-PRACK-before-deleting-tr.patch
no_config.patch

@ -0,0 +1,80 @@
From ade15d176e363612c489013c70563eca542d457e Mon Sep 17 00:00:00 2001
From: Andrew Pogrebennyk <apogrebennyk@sipwise.com>
Date: Wed, 16 Apr 2014 10:40:00 +0200
Subject: [PATCH] MT#6475 check method (ACK or PRACK) before deleting
transaction
commit 22b8f00398f7fcffc291063c19dae46a11f41227
Author: Raphael Coeffic <rco@iptel.org>
Date: Tue Apr 15 14:49:49 2014 +0200
sip: b/f: check method (ACK or PRACK) before deleting transaction
In case PRACK is received after 200, the transaction would be removed without checking the method.
---
core/sip/trans_layer.cpp | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/core/sip/trans_layer.cpp b/core/sip/trans_layer.cpp
index 277f44c..67775a5 100644
--- a/core/sip/trans_layer.cpp
+++ b/core/sip/trans_layer.cpp
@@ -1588,22 +1588,31 @@ int _trans_layer::update_uas_reply(trans_bucket* bucket, sip_trans* t, int reply
int _trans_layer::update_uas_request(trans_bucket* bucket, sip_trans* t, sip_msg* msg)
{
DBG("update_uas_request(t=%p)\n", t);
+ int method = msg->u.request->method;
+
+ if(method != sip_request::ACK &&
+ method != sip_request::PRACK) {
- if(msg->u.request->method != sip_request::ACK &&
- msg->u.request->method != sip_request::PRACK){
ERROR("Bug? Recvd non PR-/ACK request for existing UAS transact.!?\n");
return -1;
}
-
+
switch(t->state){
+ case TS_PROCEEDING:
+ // ACK or PRACK after non-reliable 1xx???
+ return -1;
+
case TS_PROCEEDING_REL:
- // stop retransmissions
- t->clear_timer(STIMER_G);
- t->clear_timer(STIMER_H);
+ if(method == sip_request::PRACK) {
+ // stop retransmissions
+ t->clear_timer(STIMER_G);
+ t->clear_timer(STIMER_H);
+ }
return t->state;
- case TS_COMPLETED:
+ case TS_COMPLETED: // non-2xx-ACK
+ if(method != sip_request::ACK) return -1;
t->state = TS_CONFIRMED;
t->clear_timer(STIMER_G);
@@ -1615,13 +1624,15 @@ int _trans_layer::update_uas_request(trans_bucket* bucket, sip_trans* t, sip_msg
case TS_CONFIRMED:
return t->state;
- case TS_TERMINATED_200:
+ case TS_TERMINATED_200: // 2xx-ACK
+ if(method != sip_request::ACK) return -1;
// remove transaction
bucket->remove(t);
return TS_REMOVED;
default:
DBG("Bug? Unknown state at this point: %i\n",t->state);
+ break;
}
return -1;
--
1.8.5.2 (Apple Git-48)
Loading…
Cancel
Save