- siproxd can use another outbound proxy itself
- Linux 2.4.x: siproxd with RTP relay could hang on termination. Fixed.
This commit is contained in:
parent
d24377ebd1
commit
0f2e1a72c7
@ -1,3 +1,10 @@
|
||||
0.5.0
|
||||
=====
|
||||
1-Nov-2003: - siproxd can use another outbound proxy itself
|
||||
- Linux 2.4.x: siproxd with RTP relay could hang
|
||||
on termination. Fixed.
|
||||
|
||||
|
||||
0.4.2
|
||||
=====
|
||||
31-Oct-2003: - released 0.4.2
|
||||
|
||||
9
RELNOTES
9
RELNOTES
@ -61,9 +61,16 @@ Known bugs:
|
||||
|
||||
|
||||
-----
|
||||
md5sum for siproxd-0.4.2.tar.gz:
|
||||
md5sum for siproxd-0.4.2.tar.gz: 7d56df3eff47a31864b5e095d0356bf8
|
||||
|
||||
GnuPG signature for siproxd-0.4.2.tar.gz archive:
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.2.1 (GNU/Linux)
|
||||
|
||||
iD8DBQA/osl2CfzBioe83JQRAvr1AKCspShf4x8WINgSNE+fv4fbxXW2wACgosAh
|
||||
Ts/iejZ6FwNTbhKg4pdA5zE=
|
||||
=iMHa
|
||||
-----END PGP SIGNATURE-----
|
||||
|
||||
|
||||
GnuPG: pub 1024D/87BCDC94 2000-03-19 Thomas Ries <tries@gmx.net>
|
||||
|
||||
@ -30,8 +30,8 @@ dnl
|
||||
dnl Release Version
|
||||
dnl
|
||||
SPD_MAJOR_VERSION=0
|
||||
SPD_MINOR_VERSION=4
|
||||
SPD_MICRO_VERSION=2
|
||||
SPD_MINOR_VERSION=5
|
||||
SPD_MICRO_VERSION=0
|
||||
|
||||
SPD_VERSION=$SPD_MAJOR_VERSION.$SPD_MINOR_VERSION.$SPD_MICRO_VERSION
|
||||
|
||||
|
||||
@ -144,3 +144,13 @@ debug_level = 0x00000000
|
||||
# mask_host=<10.0.1.1> -- inbound IP address of proxy
|
||||
# masked_host=<my.public.host> -- outbound hostname proxy
|
||||
|
||||
######################################################################
|
||||
# Outbound proxy
|
||||
#
|
||||
# Siproxd itself can be told to send all traffic to another
|
||||
# outbound proxy.
|
||||
# You can use this feature to 'chain' multiple siproxd proxys
|
||||
# if you have several masquerading firewalls to cross.
|
||||
#
|
||||
# outbound_proxy_host = my.outboundproxy.org
|
||||
# outbound_proxy_port = 5060
|
||||
|
||||
91
src/proxy.c
91
src/proxy.c
@ -191,7 +191,7 @@ INFO("stopping RTP proxy stream for: %s@%s",
|
||||
/*
|
||||
* from the internal masqueraded host to an external host
|
||||
*/
|
||||
case REQTYP_OUTGOING:
|
||||
case REQTYP_OUTGOING:
|
||||
/* get destination address */
|
||||
url=osip_message_get_uri(request);
|
||||
|
||||
@ -291,6 +291,30 @@ INFO("stopping RTP proxy stream for: %s@%s",
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* check if we need to send to an outbound proxy
|
||||
*/
|
||||
if ((type == REQTYP_OUTGOING) && (configuration.outbound_proxy_host)) {
|
||||
sts = get_ip_by_host(configuration.outbound_proxy_host, &sendto_addr);
|
||||
if (sts == STS_FAILURE) {
|
||||
DEBUGC(DBCLASS_PROXY, "proxy_request: cannot resolve outbound "
|
||||
" proxy host [%s]", configuration.outbound_proxy_host);
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
if (configuration.outbound_proxy_port) {
|
||||
port=configuration.outbound_proxy_port;
|
||||
} else {
|
||||
port = 5060;
|
||||
}
|
||||
} else {
|
||||
/* the host part already has been resolved above*/
|
||||
if (url->port) {
|
||||
port=atoi(url->port);
|
||||
} else {
|
||||
port=SIP_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
sts = osip_message_to_str(request, &buffer);
|
||||
if (sts != 0) {
|
||||
@ -298,13 +322,6 @@ INFO("stopping RTP proxy stream for: %s@%s",
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
/* send to destination */
|
||||
if (url->port) {
|
||||
port=atoi(url->port);
|
||||
} else {
|
||||
port=SIP_PORT;
|
||||
}
|
||||
|
||||
sipsock_send_udp(&sip_socket, sendto_addr, port, buffer, strlen(buffer), 1);
|
||||
osip_free (buffer);
|
||||
return STS_SUCCESS;
|
||||
@ -322,7 +339,7 @@ int proxy_response (osip_message_t *response) {
|
||||
int i;
|
||||
int sts;
|
||||
int type;
|
||||
struct in_addr addr;
|
||||
struct in_addr sendto_addr;
|
||||
osip_via_t *via;
|
||||
osip_contact_t *contact;
|
||||
int port;
|
||||
@ -439,18 +456,43 @@ int proxy_response (osip_message_t *response) {
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
/* get target address from VIA header */
|
||||
via = (osip_via_t *) osip_list_get (response->vias, 0);
|
||||
if (via == NULL) {
|
||||
ERROR("proxy_response: list_get via failed");
|
||||
return STS_FAILURE;
|
||||
}
|
||||
/*
|
||||
* check if we need to send to an outbound proxy
|
||||
*/
|
||||
if ((type == RESTYP_OUTGOING) && (configuration.outbound_proxy_host)) {
|
||||
/* have an outbound proxy - use it to send the packet */
|
||||
sts = get_ip_by_host(configuration.outbound_proxy_host, &sendto_addr);
|
||||
if (sts == STS_FAILURE) {
|
||||
DEBUGC(DBCLASS_PROXY, "proxy_request: cannot resolve outbound "
|
||||
" proxy host [%s]", configuration.outbound_proxy_host);
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
sts = get_ip_by_host(via->host, &addr);
|
||||
if (sts == STS_FAILURE) {
|
||||
DEBUGC(DBCLASS_PROXY, "proxy_response: cannot resolve via [%s]",
|
||||
via->host);
|
||||
return STS_FAILURE;
|
||||
if (configuration.outbound_proxy_port) {
|
||||
port=configuration.outbound_proxy_port;
|
||||
} else {
|
||||
port = 5060;
|
||||
}
|
||||
} else {
|
||||
/* get target address and port from VIA header */
|
||||
via = (osip_via_t *) osip_list_get (response->vias, 0);
|
||||
if (via == NULL) {
|
||||
ERROR("proxy_response: list_get via failed");
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
sts = get_ip_by_host(via->host, &sendto_addr);
|
||||
if (sts == STS_FAILURE) {
|
||||
DEBUGC(DBCLASS_PROXY, "proxy_response: cannot resolve VIA [%s]",
|
||||
via->host);
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
if (via->port) {
|
||||
port=atoi(via->port);
|
||||
} else {
|
||||
port=SIP_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
sts = osip_message_to_str(response, &buffer);
|
||||
@ -459,14 +501,7 @@ int proxy_response (osip_message_t *response) {
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
/* send to destination */
|
||||
if (via->port) {
|
||||
port=atoi(via->port);
|
||||
} else {
|
||||
port=SIP_PORT;
|
||||
}
|
||||
|
||||
sipsock_send_udp(&sip_socket, addr, port, buffer, strlen(buffer), 1);
|
||||
sipsock_send_udp(&sip_socket, sendto_addr, port, buffer, strlen(buffer), 1);
|
||||
osip_free (buffer);
|
||||
return STS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -142,8 +142,10 @@ static int parse_config (FILE *configfile) {
|
||||
{ "proxy_auth_realm", TYP_STRING, &configuration.proxy_auth_realm },
|
||||
{ "proxy_auth_passwd", TYP_STRING, &configuration.proxy_auth_passwd },
|
||||
{ "proxy_auth_pwfile", TYP_STRING, &configuration.proxy_auth_pwfile },
|
||||
{ "mask_host", TYP_STRINGA, &configuration.mask_host },
|
||||
{ "masked_host", TYP_STRINGA, &configuration.masked_host },
|
||||
{ "mask_host", TYP_STRINGA,&configuration.mask_host },
|
||||
{ "masked_host", TYP_STRINGA,&configuration.masked_host },
|
||||
{ "outbound_proxy_host", TYP_STRING, &configuration.outbound_proxy_host },
|
||||
{ "outbound_proxy_port", TYP_INT4, &configuration.outbound_proxy_port },
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
@ -127,6 +127,7 @@ static void *rtpproxy_main(void *arg) {
|
||||
tv.tv_usec = 0;
|
||||
|
||||
num_fd=select(fd_max+1, &fdset, NULL, NULL, &tv);
|
||||
pthread_testcancel();
|
||||
if ((num_fd<0) && (errno==EINTR)) {
|
||||
/*
|
||||
* wakeup due to a change in the proxy table:
|
||||
@ -534,6 +535,7 @@ void rtpproxy_kill( void ) {
|
||||
|
||||
if (rtpproxy_tid) {
|
||||
pthread_cancel(rtpproxy_tid);
|
||||
pthread_kill(rtpproxy_tid, SIGALRM);
|
||||
pthread_join(rtpproxy_tid, &thread_status);
|
||||
}
|
||||
|
||||
|
||||
@ -186,8 +186,12 @@ int main (int argc, char *argv[])
|
||||
INFO("daemonizing done (pid=%i)", getpid());
|
||||
#endif
|
||||
|
||||
/* initialize the RTP proxy thread */
|
||||
rtpproxy_init();
|
||||
/* initialize the RTP proxy */
|
||||
sts=rtpproxy_init();
|
||||
if (sts != STS_SUCCESS) {
|
||||
ERROR("unable to initialize RTP proxy - aborting");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* init the oSIP parser */
|
||||
parser_init();
|
||||
|
||||
@ -139,6 +139,8 @@ struct siproxd_config {
|
||||
char *proxy_auth_pwfile;
|
||||
stringa_t mask_host;
|
||||
stringa_t masked_host;
|
||||
char *outbound_proxy_host;
|
||||
int outbound_proxy_port;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user