Siproxd uses random port to send SIP messages

Christof Meerwald <cmeerw-S0/[email protected]> Sun, 8 Feb 2004 14:39:07 +0100
Newsgroups gmane.network.siproxd
Message-ID <[email protected]>
Hi,

I am unable to connect to sipgate.de via siproxd and I have tracked it down
to a problem in siproxd: when siproxd forwards a SIP message it uses a
random local port to send the UDP packet. sipgate.de seems to use this
address to send replies to, but siproxd doesn't listen on this port and so
the reply is lost.

Here is a tcpdump:

14:21:57.348815 62.241.36.165.3769 > 217.10.79.9.5060:  udp 553 (DF)
14:21:57.358810 217.10.79.9.5060 > 62.241.36.165.3769:  udp 689 (DF) [tos 0x10]
14:22:01.275851 62.241.36.165.3769 > 217.10.79.9.5060:  udp 553 (DF)
14:22:01.285601 217.10.79.9.5060 > 62.241.36.165.3769:  udp 689 (DF) [tos 0x10]
14:22:05.320897 62.241.36.165.3769 > 217.10.79.9.5060:  udp 553 (DF)
14:22:05.331116 217.10.79.9.5060 > 62.241.36.165.3769:  udp 690 (DF) [tos 0x10]
14:22:09.306329 62.241.36.165.3769 > 217.10.79.9.5060:  udp 553 (DF)
14:22:09.317900 217.10.79.9.5060 > 62.241.36.165.3769:  udp 690 (DF) [tos 0x10]

As you can see, replies are sent to port 3769 on my machine, but siproxd
doesn't expect replies to be sent to this port (it only listens on port 5060
for replies).


Fixing the problem is simple (use the same socket for sending and receiving
SIP messages):

- remove the line "int sip_socket=0;" in src/siproxd.c
- rename the "listen_socket" in src/sock.c to "sip_socket"


bye, Christof

-- 
http://cmeerw.org                                 JID: [email protected]
mailto cmeerw at web.de


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn