[sr-dev] update_sock_struct_from_ip() [forward.h] question

Camille Oudot camille.oudot at orange.com
Wed Sep 23 12:41:56 CEST 2015


Hi,

I was investigating an issue we had on siptrace with homer: the
destination port of all SIP responses to our websocket SIP client was
always set to 5060 in the HEP headers of the traced packets sent to
Homer, but the websocket client is not actually communicating on port
5060.

When I set the global config option `force_rport=yes`, the trace
dst port started to be correct.

Digging further, I found this macro in forward.h:

1  /* use src_ip, port=src_port if rport, via port if via port, 5060 otherwise */
2  #define update_sock_struct_from_ip(  to, msg ) \
3    init_su((to), &(msg)->rcv.src_ip, \
4        (((msg)->via1->rport)|| \
5         (((msg)->msg_flags|global_req_flags)&FL_FORCE_RPORT))? \
6                (msg)->rcv.src_port: \
7                ((msg)->via1->port)?(msg)->via1->port: SIP_PORT )

And I suspect that to conform to the description, line 4 should be:

4        (((msg)->rcv.src_port)|| \

instead. This way, I shouldn't need to set `force_rport=yes` to have
the tm callbacks containing the correct response dst port.

Any thoughts on this?

-- 
Camille



More information about the sr-dev mailing list