Module: sip-router Branch: master Commit: 01f76bb99cfd4cebb580ed10ecd478049b038f48 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=01f76bb9...
Author: Charles Chance charles.chance@sipcentric.com Committer: Charles Chance charles.chance@sipcentric.com Date: Thu Mar 6 13:35:46 2014 +0000
nat_traversal: added RFC6598 shared address space to client NAT tests
---
modules/nat_traversal/README | 24 +++++++++++--------- modules/nat_traversal/doc/nat_traversal_admin.xml | 6 +++- modules/nat_traversal/nat_traversal.c | 1 + 3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/modules/nat_traversal/README b/modules/nat_traversal/README index a9a9f13..93ee58b 100644 --- a/modules/nat_traversal/README +++ b/modules/nat_traversal/README @@ -10,7 +10,7 @@ Dan Pascu
- Copyright � 2008 Dan Pascu + Copyright © 2008 Dan Pascu __________________________________________________________________
Table of Contents @@ -405,7 +405,7 @@ Chapter 1. Admin Guide each endpoint will receive exactly one keepalive message. A negative value or zero will disable the keepalive functionality.
- Default value is "60". + Default value is “60”.
Example 1.1. Setting the keepalive_interval parameter ... @@ -418,7 +418,7 @@ modparam("nat_traversal", "keepalive_interval", 90) for this purpose are NOTIFY and OPTIONS. NOTIFY generates smaller replies from user agents, but they are almost entirely negative replies. Apparently almost none of the user agents understand that the - purpose of the NOTIFY with a "keep-alive" event is to keep NAT open, + purpose of the NOTIFY with a “keep-alive” event is to keep NAT open, even though many user agents send such NOTIFY requests themselves. However this does not affect the result at all, since the purpose is to trigger a response from the user agent behind NAT, positive or negative @@ -433,7 +433,7 @@ modparam("nat_traversal", "keepalive_interval", 90) times bigger than negative replies or replies to NOTIFY requests. For this reason the default value for the used method is NOTIFY.
- Default value is "NOTIFY". + Default value is “NOTIFY”.
Example 1.2. Setting the keepalive_method parameter ... @@ -448,7 +448,7 @@ modparam("nat_traversal", "keepalive_method", "OPTIONS") keepalive message, which is the same interface on which the request that triggered keepalive functionality arrived.
- Default value is "sip:keepalive@proxy_ip" with proxy_ip being the + Default value is “sip:keepalive@proxy_ip” with proxy_ip being the actual IP of the outgoing interface.
Example 1.3. Setting the keepalive_from parameter @@ -487,7 +487,7 @@ MyHeader: some_value\r\n") case it will store it in the Kamailio working directory, or an absolute path.
- Default value is undefined "keepalive_state". + Default value is undefined “keepalive_state”.
Example 1.5. Setting the keepalive_state_file parameter ... @@ -501,7 +501,7 @@ tate") 5.2. fix_contact() 5.3. nat_keepalive()
-5.1. client_nat_test(type) +5.1. client_nat_test(type)
Check if the client is behind NAT. What tests are performed is specified by the type parameter which is an integer given by the sum of @@ -509,12 +509,14 @@ tate") numbers corresponding to individual tests are shown below:
* 1 - tests if client has a private IP address (as defined by - RFC1918) in the Contact field of the SIP message. + RFC1918) or one from shared address space (RFC6598) in the Contact + field of the SIP message. * 2 - tests if client has contacted Kamailio from an address that is different from the one in the Via field. Both the IP and port are compared by this test. * 4 - tests if client has a private IP address (as defined by - RFC1918) in the top Via field of the SIP message. + RFC1918) or one from shared address space (RFC6598) in the top Via + field of the SIP message.
For example calling client_nat_test("3") will perform test 1 and test 2 and return true if at least one succeeds, otherwise false. @@ -529,7 +531,7 @@ if (client_nat_test("3")) { } ...
-5.2. fix_contact() +5.2. fix_contact()
Will replace the IP and port in the Contact header with the IP and port the SIP message was received from. Usually called after a succesful @@ -545,7 +547,7 @@ if (client_nat_test("3")) { } ...
-5.3. nat_keepalive() +5.3. nat_keepalive()
Trigger keepalive functionality for the source address of the request. When called it only sets some internal flags, which will trigger later diff --git a/modules/nat_traversal/doc/nat_traversal_admin.xml b/modules/nat_traversal/doc/nat_traversal_admin.xml index 8d03189..d796d6c 100644 --- a/modules/nat_traversal/doc/nat_traversal_admin.xml +++ b/modules/nat_traversal/doc/nat_traversal_admin.xml @@ -515,7 +515,8 @@ modparam("nat_traversal", "keepalive_state_file", "/var/run/kamailio/keepalive_s <itemizedlist> <listitem><para> 1 - tests if client has a private IP address (as defined by RFC1918) - in the Contact field of the SIP message. + or one from shared address space (RFC6598) in the Contact field + of the SIP message. </para></listitem> <listitem><para> 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 </para></listitem> <listitem><para> 4 - tests if client has a private IP address (as defined by RFC1918) - in the top Via field of the SIP message. + or one from shared address space (RFC6598) in the top Via field + of the SIP message. </para></listitem> </itemizedlist> </para> diff --git a/modules/nat_traversal/nat_traversal.c b/modules/nat_traversal/nat_traversal.c index 92ddd4c..8c5dbbb 100644 --- a/modules/nat_traversal/nat_traversal.c +++ b/modules/nat_traversal/nat_traversal.c @@ -225,6 +225,7 @@ static NetInfo rfc1918nets[] = { {"10.0.0.0", 0x0a000000UL, 0xff000000UL}, {"172.16.0.0", 0xac100000UL, 0xfff00000UL}, {"192.168.0.0", 0xc0a80000UL, 0xffff0000UL}, + {"100.64.0.0", 0x64400000UL, 0xffc00000UL}, // include rfc6598 shared address space as technically the same for our purpose {NULL, 0UL, 0UL} };