diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ser/Makefile | 3 | ||||
-rw-r--r-- | net/ser/distinfo | 2 | ||||
-rw-r--r-- | net/ser/files/patch-Makefile.defs | 45 | ||||
-rw-r--r-- | net/ser/files/patch-modules::acc::acc_mod.c | 8 | ||||
-rw-r--r-- | net/ser/files/patch-modules::acc::etc::sip_dictionary | 110 | ||||
-rw-r--r-- | net/ser/files/patch-modules::auth_radius::Makefile | 14 | ||||
-rw-r--r-- | net/ser/files/patch-modules::auth_radius::authrad_mod.c | 6 | ||||
-rw-r--r-- | net/ser/files/patch-modules::nathelper::README | 15 | ||||
-rw-r--r-- | net/ser/files/patch-modules::nathelper::nathelper.c | 649 | ||||
-rw-r--r-- | net/ser/files/patch-modules::tm::t_lookup.c | 14 | ||||
-rw-r--r-- | net/ser/pkg-plist | 6 |
11 files changed, 162 insertions, 710 deletions
diff --git a/net/ser/Makefile b/net/ser/Makefile index b72677a28be8..013d6351fafb 100644 --- a/net/ser/Makefile +++ b/net/ser/Makefile @@ -6,8 +6,7 @@ # PORTNAME= ser -PORTVERSION= 0.8.11 -PORTREVISION= 1 +PORTVERSION= 0.8.12 CATEGORIES= net MASTER_SITES= ftp://ftp.berlios.de/pub/ser/${PORTVERSION}/src/ DISTNAME= ${PORTNAME}-${PORTVERSION}_src diff --git a/net/ser/distinfo b/net/ser/distinfo index a36fb25b03a2..0a04e9a89028 100644 --- a/net/ser/distinfo +++ b/net/ser/distinfo @@ -1 +1 @@ -MD5 (ser-0.8.11_src.tar.gz) = 47510a4794f6d8bb788e49eaa31e0b63 +MD5 (ser-0.8.12_src.tar.gz) = 952fadd9f76e128ee9a4be350a647713 diff --git a/net/ser/files/patch-Makefile.defs b/net/ser/files/patch-Makefile.defs index 16ba44a8cf37..6c95c3b07ebd 100644 --- a/net/ser/files/patch-Makefile.defs +++ b/net/ser/files/patch-Makefile.defs @@ -1,9 +1,9 @@ $FreeBSD$ ---- Makefile.defs.orig Mon Sep 1 20:47:57 2003 -+++ Makefile.defs Thu Sep 25 10:57:58 2003 -@@ -114,10 +114,11 @@ +--- Makefile.defs.orig Thu Nov 20 12:57:22 2003 ++++ Makefile.defs Wed Feb 4 14:27:53 2004 +@@ -123,10 +123,11 @@ INSTALL-TOUCH = touch # used to create the file first (good to # make solaris install work) # INSTALL-CFG = $(INSTALL) -m 644 @@ -19,21 +19,21 @@ $FreeBSD$ #set some vars from the environment (and not make builtins) CC := $(shell echo "$${CC}") -@@ -265,10 +266,10 @@ +@@ -275,10 +276,10 @@ + -DPKG_MALLOC \ -DSHM_MEM -DSHM_MMAP \ - -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \ -DDNS_IP_HACK \ - -DUSE_IPV6 \ - -DUSE_TCP \ -DDISABLE_NAGLE \ - -DF_MALLOC \ -+ #-DUSE_IPV6 \ -+ #-DUSE_TCP \ -+ #-DF_MALLOC \ - # -DDBG_QM_MALLOC \ - #-DF_MALLOC \ - #-DNO_DEBUG \ -@@ -374,8 +375,8 @@ ++ # -DUSE_IPV6 \ ++ # -DUSE_TCP \ ++ # -DF_MALLOC \ + # -DDBG_QM_MALLOC \ + # -DDBG_QM_MALLOC \ + # -DF_MALLOC \ +@@ -398,8 +399,8 @@ found_lock_method=yes endif @@ -44,7 +44,7 @@ $FreeBSD$ # setting CFLAGS ifeq ($(mode), release) #if i386 -@@ -383,7 +384,7 @@ +@@ -407,7 +408,7 @@ # if gcc ifeq ($(CC_NAME), gcc) #common stuff @@ -53,7 +53,7 @@ $FreeBSD$ -Wall \ #if gcc 3.0 ifeq ($(CC_SHORTVER), 3.0) -@@ -409,7 +410,7 @@ +@@ -433,7 +434,7 @@ else # CC_NAME, gcc ifeq ($(CC_NAME), icc) @@ -62,7 +62,7 @@ $FreeBSD$ -tpp6 -xK #-openmp #optimize for PIII # -prefetch doesn't seem to work #( ty to inline acroos files, unroll loops,prefetch, -@@ -428,7 +429,7 @@ +@@ -452,7 +453,7 @@ #if gcc ifeq ($(CC_NAME), gcc) #common stuff @@ -71,7 +71,7 @@ $FreeBSD$ -Wall\ #-Wcast-align \ #-Wmissing-prototypes -@@ -486,7 +487,7 @@ +@@ -510,7 +511,7 @@ # if gcc ifeq ($(CC_NAME), gcc) #common stuff @@ -80,16 +80,3 @@ $FreeBSD$ -Wall \ #if gcc 3.0 ifeq ($(CC_SHORTVER), 3.0) -@@ -638,9 +639,11 @@ - ifneq ($(found_lock_method), yes) - DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems - found_lock_method=yes -+ LIBS= -pthread -lfl #dlopen is in libc -+ else -+ LIBS= -lfl #dlopen is in libc - endif - YACC=yacc -- LIBS= -lfl #dlopen is in libc - endif - - ifeq ($(OS), openbsd) diff --git a/net/ser/files/patch-modules::acc::acc_mod.c b/net/ser/files/patch-modules::acc::acc_mod.c index f7096b3c8a50..106634782b6f 100644 --- a/net/ser/files/patch-modules::acc::acc_mod.c +++ b/net/ser/files/patch-modules::acc::acc_mod.c @@ -1,9 +1,9 @@ $FreeBSD$ ---- modules/acc/acc_mod.c 2003/07/06 18:04:54 1.1 -+++ modules/acc/acc_mod.c 2003/07/06 18:05:26 -@@ -92,7 +92,7 @@ +--- modules/acc/acc_mod.c 2004/02/05 19:49:04 1.1 ++++ modules/acc/acc_mod.c 2004/02/05 19:49:16 +@@ -93,7 +93,7 @@ int log_level=L_NOTICE; char *log_fmt=DEFAULT_LOG_FMT; #ifdef RAD_ACC @@ -11,4 +11,4 @@ $FreeBSD$ +char *radius_config = (CFG_DIR "radiusclient.conf"); int radius_flag = 0; int radius_missed_flag = 0; - int service_type = PW_SIP; + int service_type = PW_SIP_SESSION; diff --git a/net/ser/files/patch-modules::acc::etc::sip_dictionary b/net/ser/files/patch-modules::acc::etc::sip_dictionary new file mode 100644 index 000000000000..d37c76c5a871 --- /dev/null +++ b/net/ser/files/patch-modules::acc::etc::sip_dictionary @@ -0,0 +1,110 @@ + +$FreeBSD$ + +--- modules/acc/etc/sip_dictionary.orig Sat Apr 5 06:05:19 2003 ++++ modules/acc/etc/sip_dictionary Wed Dec 17 08:33:05 2003 +@@ -23,6 +23,14 @@ + # 7 = 1 (integer encoding) + # + ++VENDOR Cisco 9 ++ATTRIBUTE Cisco-AVPair 1 string Cisco ++ATTRIBUTE h323-credit-time 102 string Cisco ++ATTRIBUTE h323-return-code 103 string Cisco ++ATTRIBUTE h323-preferred-lang 107 string Cisco ++ATTRIBUTE h323-billing-model 109 string Cisco ++ATTRIBUTE h323-currency 110 string Cisco ++ + # + # Following are the proper new names. Use these. + # +@@ -99,39 +107,42 @@ + # Experiment SIP-specific attributes: + # These attributes are tied between client & server + # +-ATTRIBUTE Sip-Method 101 integer +-ATTRIBUTE Sip-Response-Code 102 integer +-ATTRIBUTE Sip-CSeq 103 string +-ATTRIBUTE Sip-To-Tag 104 string +-ATTRIBUTE Sip-From-Tag 105 string +-ATTRIBUTE Sip-Branch-ID 106 string ++ATTRIBUTE Sip-Method 101 integer ++ATTRIBUTE Sip-Response-Code 102 integer ++ATTRIBUTE Sip-CSeq 103 string ++ATTRIBUTE Sip-To-Tag 104 string ++ATTRIBUTE Sip-From-Tag 105 string ++ATTRIBUTE Sip-Branch-ID 106 string + ATTRIBUTE Sip-Translated-Request-URI 107 string + ATTRIBUTE Sip-Source-IP-Address 108 ipaddr +-ATTRIBUTE Sip-Source-Port 109 integer +-ATTRIBUTE Sip-User-ID 110 string +-ATTRIBUTE Sip-User-realm 111 string +-ATTRIBUTE Sip-User-nonce 112 string +-ATTRIBUTE Sip-User-method 113 string +-ATTRIBUTE Sip-User-digest-uri 114 string +-ATTRIBUTE Sip-User-nonce_count 115 string +-ATTRIBUTE Sip-User-qop 116 string +-ATTRIBUTE Sip-User-opaque 117 string +-ATTRIBUTE Sip-User-response 118 string +-ATTRIBUTE Sip_User-cnonce 119 string ++ATTRIBUTE Sip-Source-Port 109 integer ++ATTRIBUTE Sip-User-ID 110 string ++ATTRIBUTE Sip-User-Realm 111 string ++ATTRIBUTE Sip-User-Nonce 112 string ++ATTRIBUTE Sip-User-Method 113 string ++ATTRIBUTE Sip-User-Digest-URI 114 string ++ATTRIBUTE Sip-User-Nonce-Count 115 string ++ATTRIBUTE Sip-User-QOP 116 string ++ATTRIBUTE Sip-User-Opaque 117 string ++ATTRIBUTE Sip-User-Response 118 string ++ATTRIBUTE Sip-User-CNonce 119 string + ++ATTRIBUTE Sip-URI-User 208 string ++ATTRIBUTE Sip-Group 211 string ++ATTRIBUTE Sip-RPId 213 string + +-ATTRIBUTE Digest-Response 206 string +-ATTRIBUTE Digest-Attributes 207 string +-ATTRIBUTE Digest-Realm 1063 string +-ATTRIBUTE Digest-Nonce 1064 string +-ATTRIBUTE Digest-Method 1065 string +-ATTRIBUTE Digest-URI 1066 string +-ATTRIBUTE Digest-QOP 1067 string +-ATTRIBUTE Digest-Algorithm 1068 string +-ATTRIBUTE Digest-Body-Digest 1069 string +-ATTRIBUTE Digest-CNonce 1070 string +-ATTRIBUTE Digest-Nonce-Count 1071 string +-ATTRIBUTE Digest-User-Name 1072 string ++ATTRIBUTE Digest-Response 206 string ++ATTRIBUTE Digest-Attributes 207 string ++ATTRIBUTE Digest-Realm 1063 string ++ATTRIBUTE Digest-Nonce 1064 string ++ATTRIBUTE Digest-Method 1065 string ++ATTRIBUTE Digest-URI 1066 string ++ATTRIBUTE Digest-QOP 1067 string ++ATTRIBUTE Digest-Algorithm 1068 string ++ATTRIBUTE Digest-Body-Digest 1069 string ++ATTRIBUTE Digest-CNonce 1070 string ++ATTRIBUTE Digest-Nonce-Count 1071 string ++ATTRIBUTE Digest-User-Name 1072 string + + + +@@ -165,6 +176,9 @@ + VALUE Service-Type Outbound-User 5 + VALUE Service-Type Administrative-User 6 + VALUE Service-Type NAS-Prompt-User 7 ++VALUE Service-Type Call-Check 10 ++VALUE Service-Type Group-Check 12 ++VALUE Service-Type Sip-Session 15 + + # Framed Protocols + +@@ -196,6 +210,7 @@ + VALUE Acct-Status-Type Stop 2 + VALUE Acct-Status-Type Accounting-On 7 + VALUE Acct-Status-Type Accounting-Off 8 ++VALUE Acct-Status-Type Failed 15 + + # Authentication Types + diff --git a/net/ser/files/patch-modules::auth_radius::Makefile b/net/ser/files/patch-modules::auth_radius::Makefile new file mode 100644 index 000000000000..8a79fe50adba --- /dev/null +++ b/net/ser/files/patch-modules::auth_radius::Makefile @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- modules/auth_radius/Makefile.orig Fri May 23 18:43:42 2003 ++++ modules/auth_radius/Makefile Sun Aug 17 14:29:38 2003 +@@ -8,6 +8,7 @@ + include ../../Makefile.defs + auto_gen= + NAME=auth_radius.so +-LIBS=-L$(LOCALBASE)/lib -L/usr/pkg/lib -lradiusclient ++DEFS+=-I$(LOCALBASE)/include ++LIBS=-L$(LOCALBASE)/lib -L/usr/pkg/lib -lradiusclient + + include ../../Makefile.modules diff --git a/net/ser/files/patch-modules::auth_radius::authrad_mod.c b/net/ser/files/patch-modules::auth_radius::authrad_mod.c index a6fb67ad749e..fda7661e6825 100644 --- a/net/ser/files/patch-modules::auth_radius::authrad_mod.c +++ b/net/ser/files/patch-modules::auth_radius::authrad_mod.c @@ -1,14 +1,14 @@ $FreeBSD$ ---- modules/auth_radius/authrad_mod.c.orig Sat May 3 00:36:29 2003 -+++ modules/auth_radius/authrad_mod.c Mon Sep 8 01:28:58 2003 +--- modules/auth_radius/authrad_mod.c 2004/02/05 19:49:04 1.1 ++++ modules/auth_radius/authrad_mod.c 2004/02/05 19:49:21 @@ -59,7 +59,7 @@ /* * Module parameter variables */ -char* radius_config = "/usr/local/etc/radiusclient/radiusclient.conf"; +char* radius_config = (CFG_DIR "radiusclient.conf"); - int service_type = PW_SIP; + int service_type = PW_SIP_SESSION; diff --git a/net/ser/files/patch-modules::nathelper::README b/net/ser/files/patch-modules::nathelper::README deleted file mode 100644 index 46db1a3c6b1e..000000000000 --- a/net/ser/files/patch-modules::nathelper::README +++ /dev/null @@ -1,15 +0,0 @@ - -$FreeBSD$ - ---- modules/nathelper/README.orig Sun Jul 6 17:32:22 2003 -+++ modules/nathelper/README Sun Jul 6 20:53:30 2003 -@@ -43,3 +43,9 @@ - address with source address of the message) - Desc: Rewrites SDP body in accordance with mode flag - Example: if (search("User-Agent: Cisco ATA.*") {fix_nated_sdp(3);}; -+ -+Name: force_rtp_proxy -+Params: none -+Desc: Rewrites SDP body to ensure that media is passed throuth RTP -+ proxy -+Example: if (search("User-Agent: Cisco ATA.*") {force_rtp_proxy(3);}; diff --git a/net/ser/files/patch-modules::nathelper::nathelper.c b/net/ser/files/patch-modules::nathelper::nathelper.c deleted file mode 100644 index 4acb99ff3e5b..000000000000 --- a/net/ser/files/patch-modules::nathelper::nathelper.c +++ /dev/null @@ -1,649 +0,0 @@ - -$FreeBSD$ - ---- modules/nathelper/nathelper.c.orig Mon Jun 23 22:34:37 2003 -+++ modules/nathelper/nathelper.c Sat Aug 2 09:03:54 2003 -@@ -5,6 +5,10 @@ - * we received this message from - * fix_nated_sdp() - replaces IP address in the SDP with IP address - * and/or adds direction=active option to the SDP -+ * force_rtp_proxy() - rewrite IP address and UDP port in the SDP -+ * body in such a way that RTP traffic visits -+ * RTP proxy running on the same machine as a -+ * ser itself - * - * Beware, those functions will only work correctly if the UA supports - * symmetric signalling and media (not all do)!!! -@@ -48,9 +52,15 @@ - #include "../../timer.h" - #include "../../ut.h" - #include "../registrar/sip_msg.h" -+#include <sys/types.h> -+#include <sys/uio.h> -+#include <sys/un.h> -+#include <ctype.h> -+#include <errno.h> - #include <stdio.h> - #include <stdlib.h> - #include <string.h> -+#include <unistd.h> - - MODULE_VERSION - -@@ -58,6 +68,14 @@ - static int fix_nated_sdp_f(struct sip_msg *, char *, char *); - static int update_clen(struct sip_msg *, int); - static int extract_mediaip(str *, str *); -+static int extract_mediaport(str *, str *); -+static int alter_mediaip(struct sip_msg *, str *, str *, str *, int *, int); -+static int alter_mediaport(struct sip_msg *, str *, str *, str *, int *, int); -+static int fixate_sdp_f(struct sip_msg *, char *, char *); -+static char *send_rtpp_command(str *, char, int); -+static int unforce_rtp_proxy_f(struct sip_msg *, char *, char *); -+static int force_rtp_proxy_f(struct sip_msg *, char *, char *); -+ - static void timer(unsigned int, void *); - inline static int fixup_str2int(void**, int); - static int mod_init(void); -@@ -71,12 +89,15 @@ - static cmd_export_t cmds[]={ - {"fix_nated_contact", fix_nated_contact_f, 0, 0, REQUEST_ROUTE | ONREPLY_ROUTE }, - {"fix_nated_sdp", fix_nated_sdp_f, 1, fixup_str2int, REQUEST_ROUTE | ONREPLY_ROUTE }, -- {0,0,0,0,0} -+ {"fixate_sdp", fixate_sdp_f, 0, 0, REQUEST_ROUTE | ONREPLY_ROUTE }, -+ {"force_rtp_proxy", force_rtp_proxy_f, 0, 0, REQUEST_ROUTE | ONREPLY_ROUTE }, -+ {"unforce_rtp_proxy", unforce_rtp_proxy_f, 0, 0, REQUEST_ROUTE | ONREPLY_ROUTE }, -+ {0, 0, 0, 0, 0} - }; - - static param_export_t params[]={ - {"natping_interval", INT_PARAM, &natping_interval}, -- {0,0,0} -+ {0, 0, 0} - }; - - struct module_exports exports={ -@@ -268,21 +289,28 @@ - - #define ADD_ADIRECTION 0x01 - #define FIX_MEDIAIP 0x02 -+#define ADD_ANORTPPROXY 0x04 - - #define ADIRECTION "a=direction:active\r\n" --#define ADIRECTION_LEN 21 -+#define ADIRECTION_LEN 20 - - #define AOLDMEDIAIP "a=oldmediaip:" - #define AOLDMEDIAIP_LEN 13 - -+#define AOLDMEDIPRT "a=oldmediaport:" -+#define AOLDMEDIPRT_LEN 15 -+ -+#define ANORTPPROXY "a=nortpproxy:yes\r\n" -+#define ANORTPPROXY_LEN 18 -+ - #define CLEN_LEN 10 - - static int - fix_nated_sdp_f(struct sip_msg* msg, char* str1, char* str2) - { -- str body, mediaip; -- int level, added_len, offset, len; -- char *buf, *cp; -+ str body, body1, oldip, oldip1, newip; -+ int level, added_len; -+ char *buf; - struct lump* anchor; - - level = (int)(long)str1; -@@ -293,82 +321,66 @@ - return -1; - } - -- if (level & ADD_ADIRECTION) { -+ if (level & (ADD_ADIRECTION | ADD_ANORTPPROXY)) { - anchor = anchor_lump(&(msg->add_rm), - body.s + body.len - msg->buf, 0, 0); - if (anchor == NULL) { - LOG(L_ERR, "ERROR: fix_nated_sdp: anchor_lump failed\n"); - return -1; - } -- buf = pkg_malloc(ADIRECTION_LEN * sizeof(char)); -- if (buf == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n"); -- return -1; -+ if (level & ADD_ADIRECTION) { -+ buf = pkg_malloc(ADIRECTION_LEN * sizeof(char)); -+ if (buf == NULL) { -+ LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n"); -+ return -1; -+ } -+ memcpy(buf, ADIRECTION, ADIRECTION_LEN); -+ if (insert_new_lump_after(anchor, buf, ADIRECTION_LEN, 0) == NULL) { -+ LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ added_len += ADIRECTION_LEN; - } -- memcpy(buf, ADIRECTION, ADIRECTION_LEN); -- if (insert_new_lump_after(anchor, buf, ADIRECTION_LEN - 1, 0) == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n"); -- pkg_free(buf); -- return -1; -+ if (level & ADD_ANORTPPROXY) { -+ buf = pkg_malloc(ANORTPPROXY_LEN * sizeof(char)); -+ if (buf == NULL) { -+ LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n"); -+ return -1; -+ } -+ memcpy(buf, ANORTPPROXY, ANORTPPROXY_LEN); -+ if (insert_new_lump_after(anchor, buf, ANORTPPROXY_LEN, 0) == NULL) { -+ LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ added_len += ANORTPPROXY_LEN; - } -- added_len += ADIRECTION_LEN - 1; - } - - if (level & FIX_MEDIAIP) { -- if (extract_mediaip(&body, &mediaip) == -1) { -+ if (extract_mediaip(&body, &oldip) == -1) { - LOG(L_ERR, "ERROR: fix_nated_sdp: can't extract media IP from the SDP\n"); - goto finalise; - } -- -- /* check that updating mediaip is really necessary */ -- if (7 == mediaip.len && memcmp("0.0.0.0", mediaip.s, 7) == 0) -- goto finalise; -- cp = ip_addr2a(&msg->rcv.src_ip); -- len = strlen(cp); -- if (len == mediaip.len && memcmp(cp, mediaip.s, len) == 0) -- goto finalise; -- -- anchor = anchor_lump(&(msg->add_rm), -- body.s + body.len - msg->buf, 0, 0); -- if (anchor == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: anchor_lump failed\n"); -- return -1; -- } -- buf = pkg_malloc(AOLDMEDIAIP_LEN + mediaip.len + CRLF_LEN); -- if (buf == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n"); -- return -1; -- } -- memcpy(buf, AOLDMEDIAIP, AOLDMEDIAIP_LEN); -- memcpy(buf + AOLDMEDIAIP_LEN, mediaip.s, mediaip.len); -- memcpy(buf + AOLDMEDIAIP_LEN + mediaip.len, CRLF, CRLF_LEN); -- if (insert_new_lump_after(anchor, buf, -- AOLDMEDIAIP_LEN + mediaip.len + CRLF_LEN, 0) == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n"); -- pkg_free(buf); -- return -1; -+ body1.s = oldip.s + oldip.len; -+ body1.len = body.s + body.len - body1.s; -+ if (extract_mediaip(&body1, &oldip1) == -1) { -+ oldip1.len = 0; - } -- added_len += AOLDMEDIAIP_LEN + mediaip.len + CRLF_LEN; - -- buf = pkg_malloc(len); -- if (buf == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n"); -- return -1; -- } -- offset = mediaip.s - msg->buf; -- anchor = del_lump(&msg->add_rm, offset, mediaip.len, 0); -- if (anchor == NULL) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: del_lump failed\n"); -- pkg_free(buf); -+ newip.s = ip_addr2a(&msg->rcv.src_ip); -+ newip.len = strlen(newip.s); -+ if (alter_mediaip(msg, &body, &oldip, &newip, -+ &added_len, 1) == -1) { -+ LOG(L_ERR, "ERROR: fix_nated_sdp: can't alter media IP"); - return -1; - } -- memcpy(buf, cp, len); -- if (insert_new_lump_after(anchor, buf, len, 0) == 0) { -- LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n"); -- pkg_free(buf); -+ if (oldip1.len > 0 && alter_mediaip(msg, &body, &oldip1, &newip, -+ &added_len, 0) == -1) { -+ LOG(L_ERR, "ERROR: fix_nated_sdp: can't alter media IP"); - return -1; - } -- added_len += len - mediaip.len; - } - - finalise: -@@ -425,7 +437,7 @@ - cp = cp1 + 2; - } - if (cp1 == NULL) { -- LOG(L_ERR, "ERROR: extract_mediaip: no `c=' in SDP\n"); -+ LOG(L_DBG, "ERROR: extract_mediaip: no `c=' in SDP\n"); - return -1; - } - mediaip->s = cp1 + 2; -@@ -449,6 +461,418 @@ - LOG(L_ERR, "ERROR: extract_mediaip: no `IP4' in `c=' field\n"); - return -1; - } -+ return 1; -+} -+ -+static int -+extract_mediaport(str *body, str *mediaport) -+{ -+ char *cp, *cp1; -+ int len; -+ -+ cp1 = NULL; -+ for (cp = body->s; (len = body->s + body->len - cp) > 0;) { -+ cp1 = ser_memmem(cp, "m=", len, 2); -+ if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r') -+ break; -+ cp = cp1 + 2; -+ } -+ if (cp1 == NULL) { -+ LOG(L_ERR, "ERROR: extract_mediaport: no `m=' in SDP\n"); -+ return -1; -+ } -+ mediaport->s = cp1 + 2; -+ mediaport->len = eat_line(mediaport->s, body->s + body->len - -+ mediaport->s) - mediaport->s; -+ trim_len(mediaport->len, mediaport->s, *mediaport); -+ -+ if (mediaport->len < 7 || memcmp(mediaport->s, "audio", 5) != 0 || -+ !isspace(mediaport->s[5])) { -+ LOG(L_ERR, "ERROR: extract_mediaport: can't parse `m=' in SDP\n"); -+ return -1; -+ } -+ cp = eat_space_end(mediaport->s + 5, mediaport->s + mediaport->len); -+ mediaport->len = eat_token_end(cp, mediaport->s + mediaport->len) - cp; -+ mediaport->s = cp; -+ return 1; -+} -+ -+static int -+alter_mediaip(struct sip_msg *msg, str *body, str *oldip, str *newip, -+ int *clendelta, int preserve) -+{ -+ char *buf; -+ int offset; -+ struct lump* anchor; -+ -+ /* check that updating mediaip is really necessary */ -+ if (7 == oldip->len && memcmp("0.0.0.0", oldip->s, 7) == 0) -+ return 0; -+ if (newip->len == oldip->len && -+ memcmp(newip->s, oldip->s, newip->len) == 0) -+ return 0; -+ -+ if (preserve != 0) { -+ anchor = anchor_lump(&(msg->add_rm), -+ body->s + body->len - msg->buf, 0, 0); -+ if (anchor == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaip: anchor_lump failed\n"); -+ return -1; -+ } -+ buf = pkg_malloc(AOLDMEDIAIP_LEN + oldip->len + CRLF_LEN); -+ if (buf == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaip: out of memory\n"); -+ return -1; -+ } -+ memcpy(buf, AOLDMEDIAIP, AOLDMEDIAIP_LEN); -+ memcpy(buf + AOLDMEDIAIP_LEN, oldip->s, oldip->len); -+ memcpy(buf + AOLDMEDIAIP_LEN + oldip->len, CRLF, CRLF_LEN); -+ if (insert_new_lump_after(anchor, buf, -+ AOLDMEDIAIP_LEN + oldip->len + CRLF_LEN, 0) == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaip: insert_new_lump_after failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ *clendelta += AOLDMEDIAIP_LEN + oldip->len + CRLF_LEN; -+ } -+ -+ buf = pkg_malloc(newip->len); -+ if (buf == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaip: out of memory\n"); -+ return -1; -+ } -+ offset = oldip->s - msg->buf; -+ anchor = del_lump(&msg->add_rm, offset, oldip->len, 0); -+ if (anchor == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaip: del_lump failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ memcpy(buf, newip->s, newip->len); -+ if (insert_new_lump_after(anchor, buf, newip->len, 0) == 0) { -+ LOG(L_ERR, "ERROR: alter_mediaip: insert_new_lump_after failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ *clendelta += newip->len - oldip->len; -+ return 0; -+} -+ -+static int -+alter_mediaport(struct sip_msg *msg, str *body, str *oldport, str *newport, -+ int *clendelta, int preserve) -+{ -+ char *buf; -+ int offset; -+ struct lump* anchor; -+ -+ /* check that updating mediaport is really necessary */ -+ if (newport->len == oldport->len && -+ memcmp(newport->s, oldport->s, newport->len) == 0) -+ return 0; -+ -+ if (preserve != 0) { -+ anchor = anchor_lump(&(msg->add_rm), -+ body->s + body->len - msg->buf, 0, 0); -+ if (anchor == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaport: anchor_lump failed\n"); -+ return -1; -+ } -+ buf = pkg_malloc(AOLDMEDIPRT_LEN + oldport->len + CRLF_LEN); -+ if (buf == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaport: out of memory\n"); -+ return -1; -+ } -+ memcpy(buf, AOLDMEDIPRT, AOLDMEDIPRT_LEN); -+ memcpy(buf + AOLDMEDIPRT_LEN, oldport->s, oldport->len); -+ memcpy(buf + AOLDMEDIPRT_LEN + oldport->len, CRLF, CRLF_LEN); -+ if (insert_new_lump_after(anchor, buf, -+ AOLDMEDIPRT_LEN + oldport->len + CRLF_LEN, 0) == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaport: insert_new_lump_after failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ *clendelta += AOLDMEDIPRT_LEN + oldport->len + CRLF_LEN; -+ } -+ -+ buf = pkg_malloc(newport->len); -+ if (buf == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaport: out of memory\n"); -+ return -1; -+ } -+ offset = oldport->s - msg->buf; -+ anchor = del_lump(&msg->add_rm, offset, oldport->len, 0); -+ if (anchor == NULL) { -+ LOG(L_ERR, "ERROR: alter_mediaport: del_lump failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ memcpy(buf, newport->s, newport->len); -+ if (insert_new_lump_after(anchor, buf, newport->len, 0) == 0) { -+ LOG(L_ERR, "ERROR: alter_mediaport: insert_new_lump_after failed\n"); -+ pkg_free(buf); -+ return -1; -+ } -+ *clendelta += newport->len - oldport->len; -+ return 0; -+} -+ -+static int -+fixate_sdp_f(struct sip_msg* msg, char* str1, char* str2) -+{ -+ char *cp, *cp1; -+ int len, cldelta; -+ str body, body1, newip, newip1, newport, dest, oldip, oldport; -+ struct sip_uri ruri; -+ struct hdr_field *hdr; -+ struct via_body *rvia; -+ -+ if (msg->first_line.type == SIP_REQUEST && -+ msg->first_line.u.request.method_value == METHOD_INVITE) { -+ LOG(L_ERR, "DEBUG: fixate_sdp: request\n"); -+ if (msg->parsed_uri_ok) { -+ dest = msg->parsed_uri.host; -+ } else { -+ if (parse_uri(msg->new_uri.s, msg->new_uri.len, &ruri) < 0) { -+ LOG(L_ERR, "ERROR: fixate_sdp: can't parse request uri\n"); -+ return -1; -+ } -+ dest = ruri.host; -+ } -+ } else if (msg->first_line.type == SIP_REPLY) { -+ LOG(L_ERR, "DEBUG: fixate_sdp: reply\n"); -+ rvia = NULL; -+ for (hdr=msg->headers; hdr; hdr=hdr->next) { -+ if (hdr->type == HDR_VIA) -+ rvia = hdr->parsed; -+ } -+ if (rvia == NULL) { -+ LOG(L_ERR, "ERROR: fixate_sdp: no or incorrect Via in reply\n"); -+ return -1; -+ } -+ if (rvia->received != NULL) { -+ dest = rvia->received->value; -+ } else { -+ dest = rvia->host; -+ } -+ } else { -+ return -1; -+ } -+ -+ if (extract_body(msg, &body) == -1 || body.len == 0) -+ return -1; -+ if (extract_mediaip(&body, &newip) == -1) { -+ LOG(L_ERR, "ERROR: fixate_sdp: can't extract media IP from the SDP\n"); -+ return -1; -+ } -+ body1.s = newip.s + newip.len; -+ body1.len = body.s + body.len - body1.s; -+ if (extract_mediaip(&body1, &newip1) == -1) { -+ newip1.len = 0; -+ } -+ if (newip.len != dest.len || memcmp(newip.s, dest.s, dest.len) != 0) -+ return -1; -+ if (extract_mediaport(&body, &newport) == -1) { -+ LOG(L_ERR, "ERROR: fixate_sdp: can't extract media port from the SDP\n"); -+ return -1; -+ } -+ -+ for (cp = body.s; (len = body.s + body.len - cp) >= AOLDMEDIAIP_LEN;) { -+ cp1 = ser_memmem(cp, AOLDMEDIAIP, len, AOLDMEDIAIP_LEN); -+ if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r') -+ break; -+ cp = cp1 + AOLDMEDIAIP_LEN; -+ } -+ if (cp1 == NULL) { -+ oldip.len = 0; -+ } else { -+ oldip.s = cp1 + AOLDMEDIAIP_LEN; -+ oldip.len = eat_line(oldip.s, body.s + body.len - -+ oldip.s) - oldip.s; -+ trim_len(oldip.len, oldip.s, oldip); -+ } -+ if (newip.len == oldip.len && -+ memcmp(newip.s, oldip.s, newip.len) == 0) -+ oldip.len = 0; -+ -+ for (cp = body.s; (len = body.s + body.len - cp) >= AOLDMEDIPRT_LEN;) { -+ cp1 = ser_memmem(cp, AOLDMEDIPRT, len, AOLDMEDIPRT_LEN); -+ if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r') -+ break; -+ cp = cp1 + AOLDMEDIPRT_LEN; -+ } -+ if (cp1 == NULL) { -+ oldport.len = 0; -+ } else { -+ oldport.s = cp1 + AOLDMEDIPRT_LEN; -+ oldport.len = eat_line(oldport.s, body.s + body.len - -+ oldport.s) - oldport.s; -+ trim_len(oldport.len, oldport.s, oldport); -+ } -+ if (newport.len == oldport.len && -+ memcmp(newport.s, oldport.s, newport.len) == 0) -+ oldport.len = 0; -+ -+ cldelta = 0; -+ -+ if (oldip.len != 0) { -+ if (alter_mediaip(msg, &body, &newip, &oldip, -+ &cldelta, 0) == -1) -+ return -1; -+ if (newip1.len > 0 && alter_mediaip(msg, &body1, &newip1, -+ &oldip, &cldelta, 0) == -1) -+ return -1; -+ } -+ if (oldport.len != 0 && -+ alter_mediaport(msg, &body, &newport, &oldport, &cldelta, 0) == -1) -+ return -1; -+ -+ if (cldelta == 0) -+ return 1; -+ -+ return (update_clen(msg, body.len + cldelta)); -+} -+ -+static char * -+send_rtpp_command(str *callid, char command, int getreply) -+{ -+ struct sockaddr_un addr; -+ int fd, len; -+ struct iovec v[3]; -+ static char buf[16]; -+ char cmd[2] = {' ', ' '}; -+ -+ memset(&addr, 0, sizeof(addr)); -+ addr.sun_family = AF_LOCAL; -+ strncpy(addr.sun_path, "/var/run/rtpproxy.sock", -+ sizeof(addr.sun_path) - 1); -+#if !defined(__linux__) -+ addr.sun_len = strlen(addr.sun_path); -+#endif -+ -+ fd = socket(AF_LOCAL, SOCK_STREAM, 0); -+ if (fd < 0) { -+ LOG(L_ERR, "ERROR: send_rtpp_command: can't create socket\n"); -+ return NULL; -+ } -+ if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { -+ close(fd); -+ LOG(L_ERR, "ERROR: send_rtpp_command: can't connect to RTP proxy\n"); -+ return NULL; -+ } -+ -+ cmd[0] = command; -+ v[0].iov_base = cmd; -+ v[0].iov_len = 2; -+ v[1].iov_base = callid->s; -+ v[1].iov_len = callid->len; -+ v[2].iov_base = "\n"; -+ v[2].iov_len = 1; -+ do { -+ len = writev(fd, v, 3); -+ } while (len == -1 && errno == EINTR); -+ if (len <= 0) { -+ close(fd); -+ LOG(L_ERR, "ERROR: send_rtpp_command: can't send command to a RTP proxy\n"); -+ return NULL; -+ } -+ -+ if (getreply != 0) { -+ do { -+ len = read(fd, buf, sizeof(buf) - 1); -+ } while (len == -1 && errno == EINTR); -+ close(fd); -+ if (len <= 0) { -+ LOG(L_ERR, "ERROR: send_rtpp_command: can't read reply from a RTP proxy\n"); -+ return NULL; -+ } -+ buf[len] = '\0'; -+ } -+ -+ return buf; -+} -+ -+static int -+unforce_rtp_proxy_f(struct sip_msg* msg, char* str1, char* str2) -+{ -+ -+ if (msg->callid == NULL || msg->callid->body.len <= 0) { -+ LOG(L_ERR, "ERROR: unforce_rtp_proxy: no Call-Id field\n"); -+ return -1; -+ } -+ send_rtpp_command(&(msg->callid->body), 'D', 0); -+ -+ return 1; -+} -+ -+static int -+force_rtp_proxy_f(struct sip_msg* msg, char* str1, char* str2) -+{ -+ str body, body1, oldport, oldip, oldip1, newport, newip; -+ int create, port, cldelta, len; -+ char buf[16]; -+ char *cp, *cp1; -+ -+ if (msg->first_line.type == SIP_REQUEST && -+ msg->first_line.u.request.method_value == METHOD_INVITE) { -+ create = 1; -+ } else if (msg->first_line.type == SIP_REPLY) { -+ create = 0; -+ } else { -+ return -1; -+ } -+ if (msg->callid == NULL || msg->callid->body.len <= 0) { -+ LOG(L_ERR, "ERROR: force_rtp_proxy: no Call-Id field\n"); -+ return -1; -+ } -+ if (extract_body(msg, &body) == -1 || body.len == 0) -+ return -1; -+ for (cp = body.s; (len = body.s + body.len - cp) >= ANORTPPROXY_LEN;) { -+ cp1 = ser_memmem(cp, ANORTPPROXY, len, ANORTPPROXY_LEN); -+ if (cp1 == NULL) -+ break; -+ if (cp1[-1] == '\n' || cp1[-1] == '\r') -+ return 1; -+ cp = cp1 + ANORTPPROXY_LEN; -+ } -+ if (extract_mediaip(&body, &oldip) == -1) { -+ LOG(L_ERR, "ERROR: force_rtp_proxy: can't extract media IP from the message\n"); -+ return -1; -+ } -+ body1.s = oldip.s + oldip.len; -+ body1.len = body.s + body.len - body1.s; -+ if (extract_mediaip(&body1, &oldip1) == -1) { -+ oldip1.len = 0; -+ } -+ if (extract_mediaport(&body, &oldport) == -1) { -+ LOG(L_ERR, "ERROR: force_rtp_proxy: can't extract media port from the message\n"); -+ return -1; -+ } -+ cp = send_rtpp_command(&(msg->callid->body), create ? 'U' : 'L', 1); -+ if (cp == NULL) -+ return -1; -+ port = atoi(cp); -+ if (port <= 0 || port > 65535) -+ return -1; -+ -+ newport.s = buf; -+ newport.len = sprintf(buf, "%d", port); -+ newip.s = ip_addr2a(&msg->rcv.dst_ip); -+ newip.len = strlen(newip.s); -+ -+ cldelta = 0; -+ if (alter_mediaip(msg, &body, &oldip, &newip, &cldelta, 0) == -1) -+ return -1; -+ if (oldip1.len > 0 && -+ alter_mediaip(msg, &body1, &oldip1, &newip, &cldelta, 0) == -1) -+ return -1; -+ if (alter_mediaport(msg, &body, &oldport, &newport, &cldelta, 0) == -1) -+ return -1; -+ -+ if (cldelta == 0) -+ return 1; -+ -+ return (update_clen(msg, body.len + cldelta)); - return 1; - } - diff --git a/net/ser/files/patch-modules::tm::t_lookup.c b/net/ser/files/patch-modules::tm::t_lookup.c index c3de97915c98..3f46b1294098 100644 --- a/net/ser/files/patch-modules::tm::t_lookup.c +++ b/net/ser/files/patch-modules::tm::t_lookup.c @@ -1,25 +1,25 @@ $FreeBSD$ ---- modules/tm/t_lookup.c 2003/07/29 04:01:00 1.1 -+++ modules/tm/t_lookup.c 2003/07/29 04:05:47 -@@ -94,8 +94,8 @@ +--- modules/tm/t_lookup.c.orig Thu Aug 21 22:33:58 2003 ++++ modules/tm/t_lookup.c Mon Dec 15 20:59:56 2003 +@@ -96,8 +96,8 @@ #include "t_lookup.h" #define EQ_VIA_LEN(_via)\ - ( (p_msg->via1->bsize-(p_msg->_via->name.s-(p_msg->_via->hdr.s+p_msg->_via->hdr.len)))==\ - (t_msg->via1->bsize-(t_msg->_via->name.s-(t_msg->_via->hdr.s+t_msg->_via->hdr.len))) ) -+ ( (p_msg->_via->port_str.s + p_msg->_via->port_str.len - p_msg->_via->name.s)==\ -+ (t_msg->_via->port_str.s + t_msg->_via->port_str.len - t_msg->_via->name.s) ) ++ ( (p_msg->_via->port_str.len > 0 ? (p_msg->_via->port_str.s + p_msg->_via->port_str.len - p_msg->_via->name.s) : p_msg->_via->name.len) ==\ ++ (t_msg->_via->port_str.len > 0 ? (t_msg->_via->port_str.s + t_msg->_via->port_str.len - t_msg->_via->name.s) : t_msg->_via->name.len) ) -@@ -113,7 +113,7 @@ +@@ -115,7 +115,7 @@ #define EQ_VIA_STR(_via)\ ( memcmp( t_msg->_via->name.s,\ p_msg->_via->name.s,\ - (t_msg->via1->bsize-(t_msg->_via->name.s-(t_msg->_via->hdr.s+t_msg->_via->hdr.len)))\ -+ (t_msg->_via->port_str.s+t_msg->_via->port_str.len - t_msg->_via->name.s)\ ++ (t_msg->_via->port_str.len > 0 ? (t_msg->_via->port_str.s+t_msg->_via->port_str.len - t_msg->_via->name.s) : t_msg->_via->name.len) \ )==0 ) diff --git a/net/ser/pkg-plist b/net/ser/pkg-plist index 566bba4535a9..a531c3d98bc8 100644 --- a/net/ser/pkg-plist +++ b/net/ser/pkg-plist @@ -5,17 +5,20 @@ etc/ser/sip_dictionary lib/ser/modules/acc.so lib/ser/modules/auth.so lib/ser/modules/auth_db.so +lib/ser/modules/auth_diameter.so lib/ser/modules/auth_radius.so lib/ser/modules/dbtext.so lib/ser/modules/domain.so lib/ser/modules/enum.so lib/ser/modules/exec.so lib/ser/modules/group.so +lib/ser/modules/mangler.so lib/ser/modules/maxfwd.so lib/ser/modules/msilo.so lib/ser/modules/mysql.so lib/ser/modules/nathelper.so lib/ser/modules/pa.so +lib/ser/modules/pdt.so lib/ser/modules/permissions.so lib/ser/modules/pike.so lib/ser/modules/print.so @@ -41,16 +44,19 @@ share/doc/ser/README-MODULES share/doc/ser/README.acc share/doc/ser/README.auth share/doc/ser/README.auth_db +share/doc/ser/README.auth_diameter share/doc/ser/README.auth_radius share/doc/ser/README.dbtext share/doc/ser/README.domain share/doc/ser/README.enum share/doc/ser/README.exec share/doc/ser/README.group +share/doc/ser/README.mangler share/doc/ser/README.maxfwd share/doc/ser/README.msilo share/doc/ser/README.nathelper share/doc/ser/README.pa +share/doc/ser/README.pdt share/doc/ser/README.permissions share/doc/ser/README.pike share/doc/ser/README.print |