Browse code

nat_traversal: added RFC6598 shared address space to client NAT tests (cherry picked from commit 01f76bb99cfd4cebb580ed10ecd478049b038f48)

Charles Chance authored on 06/03/2014 13:35:46
Showing 3 changed files
... ...
@@ -10,7 +10,7 @@ Dan Pascu
10 10
 
11 11
    <dan@ag-projects.com>
12 12
 
13
-   Copyright � 2008 Dan Pascu
13
+   Copyright © 2008 Dan Pascu
14 14
      __________________________________________________________________
15 15
 
16 16
    Table of Contents
... ...
@@ -405,7 +405,7 @@ Chapter 1. Admin Guide
405 405
    each endpoint will receive exactly one keepalive message. A negative
406 406
    value or zero will disable the keepalive functionality.
407 407
 
408
-   Default value is "60".
408
+   Default value is “60”.
409 409
 
410 410
    Example 1.1. Setting the keepalive_interval parameter
411 411
 ...
... ...
@@ -418,7 +418,7 @@ modparam("nat_traversal", "keepalive_interval", 90)
418 418
    for this purpose are NOTIFY and OPTIONS. NOTIFY generates smaller
419 419
    replies from user agents, but they are almost entirely negative
420 420
    replies. Apparently almost none of the user agents understand that the
421
-   purpose of the NOTIFY with a "keep-alive" event is to keep NAT open,
421
+   purpose of the NOTIFY with a “keep-alive” event is to keep NAT open,
422 422
    even though many user agents send such NOTIFY requests themselves.
423 423
    However this does not affect the result at all, since the purpose is to
424 424
    trigger a response from the user agent behind NAT, positive or negative
... ...
@@ -433,7 +433,7 @@ modparam("nat_traversal", "keepalive_interval", 90)
433 433
    times bigger than negative replies or replies to NOTIFY requests. For
434 434
    this reason the default value for the used method is NOTIFY.
435 435
 
436
-   Default value is "NOTIFY".
436
+   Default value is “NOTIFY”.
437 437
 
438 438
    Example 1.2. Setting the keepalive_method parameter
439 439
 ...
... ...
@@ -448,7 +448,7 @@ modparam("nat_traversal", "keepalive_method", "OPTIONS")
448 448
    keepalive message, which is the same interface on which the request
449 449
    that triggered keepalive functionality arrived.
450 450
 
451
-   Default value is "sip:keepalive@proxy_ip" with proxy_ip being the
451
+   Default value is “sip:keepalive@proxy_ip” with proxy_ip being the
452 452
    actual IP of the outgoing interface.
453 453
 
454 454
    Example 1.3. Setting the keepalive_from parameter
... ...
@@ -487,7 +487,7 @@ MyHeader: some_value\r\n")
487 487
    case it will store it in the Kamailio working directory, or an absolute
488 488
    path.
489 489
 
490
-   Default value is undefined "keepalive_state".
490
+   Default value is undefined “keepalive_state”.
491 491
 
492 492
    Example 1.5. Setting the keepalive_state_file parameter
493 493
 ...
... ...
@@ -501,7 +501,7 @@ tate")
501 501
    5.2. fix_contact()
502 502
    5.3. nat_keepalive()
503 503
 
504
-5.1. client_nat_test(type)
504
+5.1.  client_nat_test(type)
505 505
 
506 506
    Check if the client is behind NAT. What tests are performed is
507 507
    specified by the type parameter which is an integer given by the sum of
... ...
@@ -509,12 +509,14 @@ tate")
509 509
    numbers corresponding to individual tests are shown below:
510 510
 
511 511
      * 1 - tests if client has a private IP address (as defined by
512
-       RFC1918) in the Contact field of the SIP message.
512
+       RFC1918) or one from shared address space (RFC6598) in the Contact
513
+       field of the SIP message.
513 514
      * 2 - tests if client has contacted Kamailio from an address that is
514 515
        different from the one in the Via field. Both the IP and port are
515 516
        compared by this test.
516 517
      * 4 - tests if client has a private IP address (as defined by
517
-       RFC1918) in the top Via field of the SIP message.
518
+       RFC1918) or one from shared address space (RFC6598) in the top Via
519
+       field of the SIP message.
518 520
 
519 521
    For example calling client_nat_test("3") will perform test 1 and test 2
520 522
    and return true if at least one succeeds, otherwise false.
... ...
@@ -529,7 +531,7 @@ if (client_nat_test("3")) {
529 531
 }
530 532
 ...
531 533
 
532
-5.2. fix_contact()
534
+5.2.  fix_contact()
533 535
 
534 536
    Will replace the IP and port in the Contact header with the IP and port
535 537
    the SIP message was received from. Usually called after a succesful
... ...
@@ -545,7 +547,7 @@ if (client_nat_test("3")) {
545 547
 }
546 548
 ...
547 549
 
548
-5.3. nat_keepalive()
550
+5.3.  nat_keepalive()
549 551
 
550 552
    Trigger keepalive functionality for the source address of the request.
551 553
    When called it only sets some internal flags, which will trigger later
... ...
@@ -515,7 +515,8 @@ modparam("nat_traversal", "keepalive_state_file", "/var/run/kamailio/keepalive_s
515 515
         <itemizedlist>
516 516
         <listitem><para>
517 517
           1 - tests if client has a private IP address (as defined by RFC1918)
518
-              in the Contact field of the SIP message.
518
+              or one from shared address space (RFC6598) in the Contact field 
519
+              of the SIP message.
519 520
         </para></listitem>
520 521
         <listitem><para>
521 522
           2 - tests if client has contacted &kamailio; from an address that
... ...
@@ -524,7 +525,8 @@ modparam("nat_traversal", "keepalive_state_file", "/var/run/kamailio/keepalive_s
524 525
         </para></listitem>
525 526
         <listitem><para>
526 527
           4 - tests if client has a private IP address (as defined by RFC1918)
527
-              in the top Via field of the SIP message.
528
+              or one from shared address space (RFC6598) in the top Via field 
529
+              of the SIP message.
528 530
         </para></listitem>
529 531
         </itemizedlist>
530 532
       </para>
... ...
@@ -225,6 +225,7 @@ static NetInfo rfc1918nets[] = {
225 225
     {"10.0.0.0",    0x0a000000UL, 0xff000000UL},
226 226
     {"172.16.0.0",  0xac100000UL, 0xfff00000UL},
227 227
     {"192.168.0.0", 0xc0a80000UL, 0xffff0000UL},
228
+    {"100.64.0.0",  0x64400000UL, 0xffc00000UL}, // include rfc6598 shared address space as technically the same for our purpose
228 229
     {NULL,          0UL,          0UL}
229 230
 };
230 231