]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip: Add disable_tcp_switch option.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 3 Nov 2014 17:54:20 +0000 (17:54 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 3 Nov 2014 17:54:20 +0000 (17:54 +0000)
When a packet exceeds the MTU, pjproject will switch from UDP to TCP.  In
some circumstances (on some networks), this can cause some issues with
messages not getting sent to the correct destination - and can also cause
connections to get dropped due to quirks in pjproject deciding to
terminate TCP connections with no messages.

While fixing the routing/messaging issues is important, having a
configuration option in Asterisk that tells pjproject to not switch over
to TCP would be useful.  That way, if some glitch is discovered on some
other network/site, we can at least disable the behavior until a fix is
put into place.

AFS-197 #close

Review: https://reviewboard.asterisk.org/r/4137/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@427129 65c4cc65-6c06-0410-ace0-fbb531ad65f3

UPGRADE.txt
configs/pjsip.conf.sample
res/res_pjsip.c
res/res_pjsip/config_system.c

index 0b595d83f4cc343416a667a5e0d3f9d05d8624d9..4a28e123911f6d7ed84acd4e3dde8ab6b12c5a5f 100644 (file)
@@ -28,6 +28,10 @@ PJSIP:
    OpenSSL names are available on their system for the pjsip.conf cipher
    option.
 
+ - Added the pjsip.conf system type disable_tcp_switch option.  The option
+   allows the user to disable switching from UDP to TCP transports described
+   by RFC 3261 section 18.1.1.
+
 From 12.6.0 to 12.6.1:
 - Due to the POODLE vulnerability (see 
   https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566), the
index 51cdf2eeb15eb71d74f73c5b51cec77fcf474eaa..fd602fe7c66dfa8b82c5681452a1912f9887d3bb 100644 (file)
                                 ; should be disposed of (default: "60")
 ;threadpool_max_size=0  ; Maximum number of threads in the res_pjsip threadpool
                         ; A value of 0 indicates no maximum (default: "0")
+;disable_tcp_switch=no  ; Disable automatic switching from UDP to TCP transports
+                        ; if outgoing request is too large.
+                        ; See RFC 3261 section 18.1.1.
+                        ; (default: "no")
 ;type=  ; Must be of type system (default: "")
 
 ;==========================GLOBAL SECTION OPTIONS=========================
index 25fda1d52a20054a19495d63d87d6d75d6ef32b9..168fed54f23e12d2792ffb855717e41b47484344 100644 (file)
                                        <synopsis>Maximum number of threads in the res_pjsip threadpool.
                                        A value of 0 indicates no maximum.</synopsis>
                                </configOption>
+                               <configOption name="disable_tcp_switch" default="no">
+                                       <synopsis>Disable automatic switching from UDP to TCP transports.</synopsis>
+                                       <description><para>
+                                               Disable automatic switching from UDP to TCP transports if outgoing
+                                               request is too large.  See RFC 3261 section 18.1.1.
+                                       </para></description>
+                               </configOption>
                                <configOption name="type">
                                        <synopsis>Must be of type 'system'.</synopsis>
                                </configOption>
index 7f8da85978e16f84d8cb6bceda061b8655d58acf..4d0ab467b5f5e2fba55a2ef975ceb5ef11085517 100644 (file)
@@ -49,6 +49,8 @@ struct system_config {
                /*! Maxumum number of threads in the threadpool */
                int max_size;
        } threadpool;
+       /*! Nonzero to disable switching from UDP to TCP transport */
+       unsigned int disable_tcp_switch;
 };
 
 static struct ast_threadpool_options sip_threadpool_options = {
@@ -95,6 +97,7 @@ static int system_apply(const struct ast_sorcery *system_sorcery, void *obj)
 
        if (system->compactheaders) {
                extern pj_bool_t pjsip_use_compact_form;
+
                pjsip_use_compact_form = PJ_TRUE;
        }
 
@@ -103,6 +106,9 @@ static int system_apply(const struct ast_sorcery *system_sorcery, void *obj)
        sip_threadpool_options.idle_timeout = system->threadpool.idle_timeout;
        sip_threadpool_options.max_size = system->threadpool.max_size;
 
+       pjsip_cfg()->endpt.disable_tcp_switch =
+               system->disable_tcp_switch ? PJ_TRUE : PJ_FALSE;
+
        return 0;
 }
 
@@ -141,6 +147,8 @@ int ast_sip_initialize_system(void)
                        OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.idle_timeout));
        ast_sorcery_object_field_register(system_sorcery, "system", "threadpool_max_size", "0",
                        OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.max_size));
+       ast_sorcery_object_field_register(system_sorcery, "system", "disable_tcp_switch", "no",
+                       OPT_BOOL_T, 1, FLDSET(struct system_config, disable_tcp_switch));
 
        ast_sorcery_load(system_sorcery);