diff -r 8f552d1cd671 -r 67e813202d53 opensips/opensips.patch --- a/opensips/opensips.patch Wed Sep 21 14:02:13 2011 +0200 +++ b/opensips/opensips.patch Wed Sep 21 14:04:16 2011 +0200 @@ -1,29 +1,96 @@ +Index: main.c +diff -Nau main.c.orig main.c +--- main.c.orig 2009-12-10 14:11:03.590141302 +0100 ++++ main.c 2009-12-10 14:11:07.246237908 +0100 +@@ -1038,6 +1038,10 @@ + ret=-1; + my_argc=argc; my_argv=argv; + ++ /* if (!log_stderr), that's not usable yet! '/ ++ /* ...so unconditionally log to syslog for now */ ++ openlog(argv[0], LOG_PID|LOG_CONS, log_facility); ++ + /*init pkg mallocs (before parsing cfg or cmd line !)*/ + if (init_pkg_mallocs()==-1) + goto error00; +@@ -1370,6 +1374,11 @@ + + /* init_daemon? */ + if (!dont_fork){ ++ /* shortly after main() we called openlog(3) to log */ ++ /* the initialization, but since daemonize() has its */ ++ /* own syslog(3) handling, we need to close the log first */ ++ closelog(); /* close the initialization logging logic */ ++ + if ( daemonize((log_name==0)?argv[0]:log_name, &own_pgid) <0 ) + goto error; + } Index: Makefile.defs ---- Makefile.defs.orig 2009-03-23 19:32:01 +0100 -+++ Makefile.defs 2009-03-24 19:10:36 +0100 -@@ -1161,6 +1161,8 @@ +diff -Nau Makefile.defs.orig Makefile.defs +--- Makefile.defs.orig 2007-12-13 14:39:06.000000000 +0100 ++++ Makefile.defs 2008-01-14 16:48:02.811615000 +0100 +@@ -220,7 +220,7 @@ + else + doc-dir = doc/$(MAIN_NAME)/ + man-dir = man/ +- data-dir = $(MAIN_NAME)/ ++ data-dir = share/$(MAIN_NAME)/ + LOCALBASE ?= $(SYSBASE)/local + endif + endif +@@ -1432,6 +1432,10 @@ + LIBS+= -lsctp + endif - endif #mode=release - ++#conditionally add libfsl +LDFLAGS += -L$(prefix)/lib +LIBS += -lfsl ++ + ifneq ($(found_lock_method), yes) + $(warning No locking method found so far, trying SYS V sems) + DEFS+= -DUSE_SYSV_SEM # try sys v sems +Index: scripts/opensipsctl.8 +diff -Nau scripts/opensipsctl.8.orig scripts/opensipsctl.8 +--- scripts/opensipsctl.8.orig 2009-03-25 00:22:16.771365571 +0100 ++++ scripts/opensipsctl.8 2009-03-25 00:22:34.295365555 +0100 +@@ -20,8 +20,6 @@ - #*FLAGS used for compiling the modules - ifeq ($(CC_NAME), gcc) -@@ -1397,8 +1399,8 @@ + .SH FILES + .PD 0 +-.I /etc/opensips/.opensipsctlrc +-.br + .I /usr/local/etc/opensips/.opensipsctlrc + .br + .I ~/.opensipsctlrc +Index: scripts/osipsconsole +diff -Nau scripts/osipsconsole.orig scripts/osipsconsole +--- scripts/osipsconsole.orig 2009-12-08 03:31:32.633224883 +0100 ++++ scripts/osipsconsole 2009-12-08 03:31:51.119960848 +0100 +@@ -30,7 +30,6 @@ + use Term::ReadLine; + use DBI; + use POSIX; +-use Frontier::RPC2; + use IO::Socket; + use Socket; + #use Net::IP; +@@ -378,6 +377,12 @@ + } + } - #add libssl if needed - ifneq ($(TLS),) --DEFS+= -I$(LOCALBASE)/ssl/include -I$(LOCALBASE)/include -I$(SYSBASE)/include/openssl --LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl -lcrypto -+DEFS+= -I$(prefix)/include -+LIBS+= -L$(prefix)/lib -lssl -lcrypto - endif - - #add libsctp if needed ++ if ( $MD5 eq "" ) { ++ if ( $arr[0] =~ /^\s*MD5/ ) { ++ $MD5 = $arr[1]; ++ } ++ } ++ + if ( $AWK eq "" ) { + if ( $arr[0] =~ /^\s*AWK/ ) { + $AWK = $arr[1]; Index: modules/permissions/parse_config.c ---- modules/permissions/parse_config.c.orig 2009-03-23 19:31:32 +0100 -+++ modules/permissions/parse_config.c 2009-03-24 19:10:36 +0100 +diff -Nau modules/permissions/parse_config.c.orig modules/permissions/parse_config.c +--- modules/permissions/parse_config.c.orig 2008-08-03 15:54:01 +0200 ++++ modules/permissions/parse_config.c 2008-08-09 11:58:55 +0200 @@ -114,8 +114,11 @@ except = strstr(str, " EXCEPT "); if (except) { @@ -48,18 +115,82 @@ *e_exceptions = NULL; } -Index: rtpproxy-1.2.1/main.c ---- rtpproxy-1.2.1/main.c.orig 2009-03-24 05:46:13 +0100 -+++ rtpproxy-1.2.1/main.c 2009-03-24 19:10:36 +0100 -@@ -88,7 +88,11 @@ - bindhost = NULL; - - if ((n = resolve(ia, pf, bindhost, servname, AI_PASSIVE)) != 0) -+#if defined(__sun__) -+ errx(1, "setbindhost"); -+#else - errx(1, "setbindhost: %s", gai_strerror(n)); -+#endif +Index: modules/nathelper/nathelper.c +diff -Nau modules/nathelper/nathelper.c.orig modules/nathelper/nathelper.c +--- modules/nathelper/nathelper.c.orig 2010-12-20 14:33:50.000000000 +0100 ++++ modules/nathelper/nathelper.c 2011-01-26 17:48:40.685941382 +0100 +@@ -288,6 +288,9 @@ + return 0; } - static void ++/* MSvB macros */ ++#define OPENSIPS_NOOP ((void)0) ++ + + + +@@ -805,6 +808,7 @@ + #define FIX_MEDIP 0x02 + #define ADD_ANORTPPROXY 0x04 + #define FIX_ORGIP 0x08 ++#define FIX_RTCPIP 0x10 + + #define ADIRECTION "a=direction:active" + #define ADIRECTION_LEN (sizeof(ADIRECTION) - 1) +@@ -821,7 +825,9 @@ + { + char *buf; + int offset; ++ int binlump; + struct lump* anchor; ++ struct lump* templump; + str omip, nip, oip; + + /* check that updating mediaip is really necessary */ +@@ -852,7 +858,19 @@ + memcpy(buf, CRLF, CRLF_LEN); + memcpy(buf + CRLF_LEN, omip.s, omip.len); + memcpy(buf + CRLF_LEN + omip.len, oldip->s, oldip->len); +- if (insert_new_lump_after(anchor, buf, ++ ++ /* if the oldmediaip string is already */ ++ /* in the body then don't add it again */ ++ binlump = 0; ++ for (templump = msg->body_lumps; templump; templump = templump->next) ++ if (templump->op == LUMP_ADD && strstr(templump->u.value, buf)) ++ binlump = 1; ++ for (templump = msg->add_rm; templump; templump = templump->next) ++ if (templump->op == LUMP_ADD && strstr(templump->u.value, buf)) ++ binlump = 1; ++ if (strstr(body->s, buf) || binlump) ++ pkg_free(buf); ++ else if (insert_new_lump_after(anchor, buf, + omip.len + oldip->len + CRLF_LEN, 0) == NULL) { + LM_ERR("insert_new_lump_after failed\n"); + pkg_free(buf); +@@ -1038,6 +1056,12 @@ + p= p->next; + } + ++ if (level & FIX_RTCPIP) { ++ /* Iterate all a=rtcp: and replace ips in them. */ ++ if (replace_sdp_ip(msg, &body, "a=rtcp:", str2?&ip:0)==-1) ++ return -1; ++ } ++ + return 1; + } + +Index: parser/sdp/sdp_helpr_funcs.c +diff -Nau parser/sdp/sdp_helpr_funcs.c.orig parser/sdp/sdp_helpr_funcs.c +--- parser/sdp/sdp_helpr_funcs.c.orig 2010-12-08 15:14:06.000000000 +0100 ++++ parser/sdp/sdp_helpr_funcs.c 2011-01-27 00:39:50.128212053 +0100 +@@ -392,7 +392,7 @@ + + cp1 = NULL; + for (cp = body->s; (len = body->s + body->len - cp) > 0;) { +- cp1 = (char*)ser_memmem(cp, line, len, 2); ++ cp1 = (char*)ser_memmem(cp, line, len, strlen(line)); + if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r') + break; + cp = cp1 + 2;