Upgrade 3CX to v18 and get it hosted free!

One way Voice with Linux SIP conntrack

Author image

One way voice problem is seen on device running behind NAT, if call is initiated from device to Soft phone which is not running on SIP Server m/c.
( Softphone and SIP server, running on diffrent m/c)
Following is Setup

                                                                                              |-------- Softphone
    VoIP device behind NAT-------- Host (running SIP conntrack)-----------
                                                                                              |
                                                                                              ---------SIP Server 

When invite message is sent set_expected_rtp_rtcp function defined in nf_conntrack_sip.c makes expected connection tracking entry using nf_ct_expect_init function

nf_ct_expect_init function fills source mask value as 0xFFFFFFFF. Since Source mask is 0xFFFFFFFF, that means connection tracking module expects, exact SRC IP address but if VoIP phone is not running on same m/c as SIP server, IP address of VoIP Phone is not really know while sending the INVITE message. ( INVITE message goes to SIP server).

Because of which following are expected connections

<UDP PROTO NUM> <SIP SERVER IP ADDRESS:0 -> <Public IP address of phone behind NAT>:<RTP Port number of Phone behind NAT>

<UDP PROTO NUM> <SIP SERVER IP ADDRESS:0 -> <Public IP address of phone behind NAT>:<RTCP Port number of Phone behind NAT>

But the incoming packets will as following

<UDP PROTO NUM> <External VoIP Phone IP:<RTP Port number> > <IP address of phone behind NAT>:<RTP Port number of Phone behind NAT>

<UDP PROTO NUM> <External VoIP Phone IP:<RTCP Port number> -> <IP address of phone behind NAT>:<RTCP Port number of Phone behind NAT>

So there will never a hit with expected connection and we see 1 way voice problem,

To resolve this problem in expected connection entry, we should ignore Source IP address, one way is to make MASK value as 0x0.
In nf_ct_expect_init function.

Following is code diff

[root@sw-dev netfilter]# diff nf_conntrack_expect.c nf_conntrack_expect.c.fix
265c265,266
<               memset(&exp->mask.src.u3, 0xFF, len);
---
>               //memset(&exp->mask.src.u3, 0xFF, len);
>               memset(&exp->mask.src.u3, 0x00, len);

Obviously above fix opens up security hole.


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.
Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.