- some fixes in sockbind() (FreeBSD) by Jeremy Shaw

- added doc/devel.txt with issues to keep the code portable
This commit is contained in:
Thomas Ries 2003-11-24 22:58:44 +00:00
parent 4f96757513
commit db2d3e22d8
6 changed files with 15 additions and 10 deletions

View File

@ -1,5 +1,6 @@
0.5.0
=====
24-Nov-2003: - some fixes in sockbind() (FreeBSD) by Jeremy Shaw
23-Nov-2003: - got the gethostbyname() failure problem solved.
(the resolver needs a shared lib that was tried
to load AFTER chrooting...)

8
doc/devel.txt Normal file
View File

@ -0,0 +1,8 @@
Portability issues:
FreeBSD:
- #include <sys/types.h>
before
#include <netinet/in.h>

View File

@ -20,10 +20,7 @@
#include "config.h"
#ifdef _BSD
#include <sys/types.h>
#endif
#include <netinet/in.h>
#include <osipparser2/osip_parser.h>

View File

@ -348,8 +348,8 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, int media_stream_no,
port, sock, freeidx);
/* found an unused port? No -> RTP port pool fully allocated */
if (port == 0) {
ERROR("rtp_relay_start_fwd: no RTP port available. Check rtp_port_* config!");
if ((port == 0) || (sock == 0)) {
ERROR("rtp_relay_start_fwd: no RTP port available or bind() failed");
sts = STS_FAILURE;
goto unlock_and_exit;
}

View File

@ -28,7 +28,6 @@
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
@ -56,7 +55,7 @@ static int listen_socket=0;
int sipsock_listen (void) {
struct in_addr ipaddr;
memset(&ipaddr, 0, sizeof(struct in_addr));
memset(&ipaddr, 0, sizeof(ipaddr));
listen_socket=sockbind(ipaddr, configuration.sip_listen_port, 1);
if (listen_socket == 0) return STS_FAILURE; /* failure*/
@ -180,6 +179,8 @@ int sockbind(struct in_addr ipaddr, int localport, int errflg) {
int sts;
int sock;
memset(&my_addr, 0, sizeof(my_addr));
my_addr.sin_family = AF_INET;
memcpy(&my_addr.sin_addr.s_addr, &ipaddr, sizeof(struct in_addr));
my_addr.sin_port = htons(localport);

View File

@ -151,8 +151,6 @@ int get_ip_by_host(char *hostname, struct in_addr *addr) {
#endif
}
#elif defined(HAVE_GETHOSTBYNAME)
#warning "did not find reentrant version of gethostbyname_r()"
#warning "depending of your OS this may or may not work"
hostentry=gethostbyname(hostname);
if (hostentry == NULL) error = h_errno;
#else
@ -234,7 +232,7 @@ void secure_enviroment (void) {
*/
if (configuration.chrootjail) {
/* !!!
* Before chrooting I must at leat once trigger the resolver
* Before chrooting I must at least once trigger the resolver
* as it loads some dynamic libraries. Once chrootet
* these libraries will *not* be found and gethostbyname()
* calls will simply fail (return NULL pointer and h_errno=0).