[Serusers] SER + rtpproxy

Andrei Pelinescu-Onciul pelinescu-onciul at fokus.fraunhofer.de
Thu Sep 30 15:55:58 CEST 2004


On Sep 29, 2004 at 13:33, Soren (Home) <soren at tanesha.net> wrote:
> Hi Andrei,
> 
> The problem to me is, that almost never it returns true, since most
> clients have buildin STUN today.
> 
> However, X-lite, Grandstream and some others I've tried all send the
> public IP address also for Symmetric NATs, hence Client<->Client will not
> work without rtpproxy.

I thought X-Lite was one of the few which got it right.
> 
> Any suggestions on how to solve that with nat_uac_test ?

Try the attached patch. It adds a new nat_uac_test flag (16) that will
test for differences between the source port of the message and the port
in via.
Usage:
nat_uac_test("16")
or to include all the common tests:
nat_uac_test("19")   ( private ip in contact | src ip != ip in via | src
port != port in via)

(like all the other via tests, it makes sense only for requests)


Andrei
-------------- next part --------------
--- modules/nathelper/nathelper.c	9 Sep 2004 10:38:00 -0000	1.63
+++ modules/nathelper/nathelper.c	30 Sep 2004 13:37:16 -0000
@@ -111,8 +111,8 @@
  * 2004-03-22	Fix get_body position (should be called before get_callid)
  * 				(andrei)
  * 2004-03-24	Fix newport for null ip address case (e.g onhold re-INVITE)
-* 				(andrei)
- * 
+ * 				(andrei)
+ * 2004-09-30	added received port != via port test (andrei) 
  *
  */
 
@@ -167,6 +167,7 @@
 #define	NAT_UAC_TEST_RCVD	0x02
 #define	NAT_UAC_TEST_V_1918	0x04
 #define	NAT_UAC_TEST_S_1918	0x08
+#define	NAT_UAC_TEST_RPORT	0x10
 
 /* Handy macros */
 #define	STR2IOVEC(sx, ix)	{(ix).iov_base = (sx).s; (ix).iov_len = (sx).len;}
@@ -678,6 +679,11 @@
 
 	/* return true if any of the NAT-UAC tests holds */
 
+	/* test if the source port is different from the port in Via */
+	if ((tests & NAT_UAC_TEST_RPORT) &&
+		 (msg->rcv.src_port!=(msg->via1->port?msg->via1->port:SIP_PORT)) ){
+		return 1;
+	}
 	/*
 	 * test if source address of signaling is different from
 	 * address advertised in Via


More information about the sr-users mailing list