diff --git a/ChangeLog b/ChangeLog index 57dfad3..97818cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 0.5.7 ===== - 13-Jun-2004: - fix: get_ip_by_host() and buffers for reentrant functions + 18-Jun-2004: - 2 fixes for using a port number != 5060 (by Miguel Angel) + 13-Jun-2004: - fix: get_ip_by_host() and buffer allocation for reentrant + gethostbyname_r() functions + - if compiled for fli4l 2.0.x, don't use reentrant + gethostbyname_r() - in some cases it fails reproduceably + when running under fli4l (however, the same binary + does behave properly under an old SUSE libc5 system) 12-Jun-2004: - use SIGUSR2 for dmalloc debugging (SIGUSR1 is occupied with old libc5 & threads) - reworked calling parameters for passing SIP data diff --git a/README b/README index 2f8365d..c338bbd 100644 --- a/README +++ b/README @@ -94,6 +94,14 @@ If siproxd crashes, a stack backtrace usually is helpful to me: 4) copy-paste all the output and include it in your problem report. + +SENDING A PATCH +=============== +If you send a patch, please make the diff using "diff -Naur" and +include the version of siproxd you used to patch. It makes it a lot +easier for me to merge it. + + WHAT SIPROXD DOES ================= Siproxd's purpose is to act as an SIP proxy for softphones located diff --git a/src/register.c b/src/register.c index d40b18a..9cb6f57 100644 --- a/src/register.c +++ b/src/register.c @@ -366,12 +366,16 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) { if (force_lcl_masq) { struct in_addr addr; char *addrstr; + char *portstr; + if (get_ip_by_ifname(configuration.outbound_if, &addr) != STS_SUCCESS) { ERROR("can't find outbound interface %s - configuration error?", configuration.outbound_if); return STS_FAILURE; } + + /* host part */ addrstr = utils_inet_ntoa(addr); DEBUGC(DBCLASS_REG,"masquerading UA %s@%s local %s@%s", (url1_contact->username) ? url1_contact->username : "*NULL*", @@ -379,8 +383,14 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) { (url1_contact->username) ? url1_contact->username : "*NULL*", addrstr); urlmap[i].masq_url->host=realloc(urlmap[i].masq_url->host, - strlen(addrstr)+1); + strlen(addrstr)+1); strcpy(urlmap[i].masq_url->host, addrstr); + + /* port number if required */ + if (configuration.sip_listen_port != SIP_PORT) { + urlmap[i].masq_url->port=realloc(urlmap[i].masq_url->port, 16); + sprintf(portstr, "%i", configuration.sip_listen_port); + } } } else { /* if new entry */ diff --git a/src/siproxd.c b/src/siproxd.c index 946f4a2..fb545a5 100644 --- a/src/siproxd.c +++ b/src/siproxd.c @@ -377,10 +377,13 @@ int main (int argc, char *argv[]) if (access & ACCESSCTL_REG) { osip_uri_t *url; struct in_addr addr1, addr2, addr3; + int dest_port; url = osip_message_get_uri(ticket.sipmsg); + dest_port= (url->port)?atoi(url->port):SIP_PORT; if ( (get_ip_by_host(url->host, &addr1) == STS_SUCCESS) && + (configuration.sip_listen_port == dest_port) && (get_ip_by_ifname(configuration.inbound_if,&addr2) == STS_SUCCESS) && (get_ip_by_ifname(configuration.outbound_if,&addr3) ==