Module: kamailio Branch: master Commit: c09a29369f03f6c5e621a94b5b853047490568aa URL: https://github.com/kamailio/kamailio/commit/c09a29369f03f6c5e621a94b5b853047...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-09-16T10:42:19+02:00
core: use advertised port for recv socket only when set
---
Modified: src/core/msg_translator.c
---
Diff: https://github.com/kamailio/kamailio/commit/c09a29369f03f6c5e621a94b5b853047... Patch: https://github.com/kamailio/kamailio/commit/c09a29369f03f6c5e621a94b5b853047...
---
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index 19713e1b1cc..bc68a920ef6 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -631,7 +631,7 @@ static inline int lumps_len( }; \ break; \ case SUBST_RCV_PORT: \ - if(msg->rcv.bind_address && STR_WITHVAL(recv_port_str)) { \ + if(STR_WITHVAL(recv_port_str)) { \ new_len += recv_port_str->len; \ } else { \ LM_CRIT(" rcv port - null bind_address\n"); \ @@ -864,9 +864,11 @@ static inline int lumps_len( recv_address_str = &(msg->rcv.bind_address->address_str); recv_af = msg->rcv.bind_address->address.af; } - if(msg->rcv.bind_address->useinfo.port_no > 0) { - recv_port_str = &(msg->rcv.bind_address->useinfo.port_no_str); - recv_port_no = msg->rcv.bind_address->useinfo.port_no; + if(msg->rcv.bind_address->useinfo.name.len > 0) { + if(msg->rcv.bind_address->useinfo.port_no > 0) { + recv_port_str = &(msg->rcv.bind_address->useinfo.port_no_str); + recv_port_no = msg->rcv.bind_address->useinfo.port_no; + } } else { recv_port_str = &(msg->rcv.bind_address->port_no_str); recv_port_no = msg->rcv.bind_address->port_no; @@ -1055,7 +1057,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf, }; \ break; \ case SUBST_RCV_PORT: \ - if(msg->rcv.bind_address && STR_WITHVAL(recv_port_str)) { \ + if(STR_WITHVAL(recv_port_str)) { \ memcpy(new_buf + offset, recv_port_str->s, \ recv_port_str->len); \ offset += recv_port_str->len; \ @@ -1396,9 +1398,11 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf, recv_address_str = &(msg->rcv.bind_address->address_str); recv_af = msg->rcv.bind_address->address.af; } - if(msg->rcv.bind_address->useinfo.port_no > 0) { - recv_port_str = &(msg->rcv.bind_address->useinfo.port_no_str); - recv_port_no = msg->rcv.bind_address->useinfo.port_no; + if(msg->rcv.bind_address->useinfo.name.len > 0) { + if(msg->rcv.bind_address->useinfo.port_no > 0) { + recv_port_str = &(msg->rcv.bind_address->useinfo.port_no_str); + recv_port_no = msg->rcv.bind_address->useinfo.port_no; + } } else { recv_port_str = &(msg->rcv.bind_address->port_no_str); recv_port_no = msg->rcv.bind_address->port_no;