From 22eebc872b059835385f79b06ddab1eef38ac44f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 16 Aug 2012 15:53:57 +0000 Subject: [PATCH 1/4] IPv6 socket requires IPv4 PKTINFO for setting source address correctly --- daemon/call.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/call.c b/daemon/call.c index d7a1590..190f6ea 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -287,6 +287,7 @@ forward: mh.msg_name = &sin; mh.msg_namelen = sizeof(sin); +ipv4_src: ch->cmsg_len = CMSG_LEN(sizeof(*pi)); ch->cmsg_level = IPPROTO_IP; ch->cmsg_type = IP_PKTINFO; @@ -307,6 +308,9 @@ forward: mh.msg_name = &sin6; mh.msg_namelen = sizeof(sin6); + if (IN6_IS_ADDR_V4MAPPED(&sin6.sin6_addr)) + goto ipv4_src; + ch->cmsg_len = CMSG_LEN(sizeof(*pi6)); ch->cmsg_level = IPPROTO_IPV6; ch->cmsg_type = IPV6_PKTINFO; From e77fce5157693895a4f726c72dd480a0e85fb0c5 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 16 Aug 2012 15:58:31 +0000 Subject: [PATCH 2/4] adding to changelog --- debian/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/changelog b/debian/changelog index 394e591..7971450 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ ngcp-mediaproxy-ng (2.0.0) unstable; urgency=low * Fixes traffic class setting for IPv6 * Fix bug that messed up packet stats for in-kernel streams * Various minor performance tweaks and bug fixes + * Fix setting IPv4 source address when running with IPv6 enabled -- Richard Fuchs Fri, 10 Aug 2012 10:21:53 -0400 From bd3fe6f7b25f2fec2760998daf7e1104c3c67487 Mon Sep 17 00:00:00 2001 From: Jon Bonilla Date: Wed, 22 Aug 2012 09:22:24 +0000 Subject: [PATCH 3/4] Revert commit 9539 and re-add init stuff --- debian/ngcp-mediaproxy-ng-daemon.default | 19 ++++ debian/ngcp-mediaproxy-ng-daemon.init | 138 +++++++++++++++++++++++ debian/rules | 2 +- 3 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 debian/ngcp-mediaproxy-ng-daemon.default create mode 100755 debian/ngcp-mediaproxy-ng-daemon.init diff --git a/debian/ngcp-mediaproxy-ng-daemon.default b/debian/ngcp-mediaproxy-ng-daemon.default new file mode 100644 index 0000000..3d2966b --- /dev/null +++ b/debian/ngcp-mediaproxy-ng-daemon.default @@ -0,0 +1,19 @@ +RUN_MEDIAPROXY=no +LISTEN=25060 +LISTEN_UDP=12222 +# ADDRESS=... +# ADV_ADDRESS=... +# ADDRESS_IPV6=... +# ADV_ADDRESS_IPV6=... +TIMEOUT=60 +SILENT_TIMEOUT=3600 +PIDFILE=/var/run/ngcp-mediaproxy-ng-daemon.pid +FORK=yes +# TOS=184 +TABLE=0 +# NO_FALLBACK=yes +# PORT_MIN=30000 +# PORT_MAX=50000 +# REDIS=127.0.0.1:6379 +# REDIS_DB=1 +# B2B_URL=http://127.0.0.1:8090/ diff --git a/debian/ngcp-mediaproxy-ng-daemon.init b/debian/ngcp-mediaproxy-ng-daemon.init new file mode 100755 index 0000000..816f48a --- /dev/null +++ b/debian/ngcp-mediaproxy-ng-daemon.init @@ -0,0 +1,138 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: mediaproxy-ng +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Ngcp Mediaproxy-ng +# Description: Proxy for RTP and other media streams +### END INIT INFO + + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=ngcp-mediaproxy-ng-daemon +DESC="RTP/media proxy" +RUN_MEDIAPROXY=no +TABLE=0 + +case $(dirname $0) in + /*) FULLPATH=$(dirname $0);; + *) FULLPATH=$(pwd)/$(dirname $0);; +esac + +DAEMON=`which mediaproxy-ng` +DEFAULTS=/etc/default/${NAME} + +test -f $DAEMON || exit 0 + +# Load startup options if available +if [ -f $DEFAULTS ]; then + . $DEFAULTS || true +fi + +if [ "$RUN_MEDIAPROXY" != "yes" ]; then + echo "mediaproxy-ng not yet configured. Edit $DEFAULTS first." + exit 0 +fi +[ -z "$PIDFILE" ] && PIDFILE="/var/run/mediaproxy-ng.pid" + +set -e + +. /lib/lsb/init-functions + +OPTIONS="" + +[ -z "$ADDRESS" ] || OPTIONS="$OPTIONS --ip=$ADDRESS" +[ -z "$LISTEN" ] || OPTIONS="$OPTIONS --listen=$LISTEN" +[ -z "$LISTEN_UDP" ] || OPTIONS="$OPTIONS --listen-udp=$LISTEN_UDP" +[ -z "$TIMEOUT" ] || OPTIONS="$OPTIONS --timeout=$TIMEOUT" +[ -z "$SILENT_TIMEOUT" ] || OPTIONS="$OPTIONS --silent-timeout=$SILENT_TIMEOUT" +[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE" +[ -z "$TOS" ] || OPTIONS="$OPTIONS --tos=$TOS" +[ -z "$PORT_MIN" ] || OPTIONS="$OPTIONS --port-min=$PORT_MIN" +[ -z "$PORT_MAX" ] || OPTIONS="$OPTIONS --port-max=$PORT_MAX" +[ -z "$ADV_ADDRESS" ] || OPTIONS="$OPTIONS --advertised-ip=$ADV_ADDRESS" +[ -z "$ADDRESS_IPV6" ] || OPTIONS="$OPTIONS --ip6=$ADDRESS_IPV6" +[ -z "$ADV_ADDRESS_IPV6" ] || OPTIONS="$OPTIONS --advertised-ip6=$ADV_ADDRESS_IPV6" +[ -z "$REDIS" ] || OPTIONS="$OPTIONS --redis=$REDIS" +[ -z "$REDIS_DB" ] || OPTIONS="$OPTIONS --redis-db=$REDIS_DB" +[ -z "$B2B_URL" ] || OPTIONS="$OPTIONS --b2b-url=$B2B_URL" +[ -z "$NO_FALLBACK" -o \( "$NO_FALLBACK" != "1" -a "$NO_FALLBACK" != "yes" \) ] || OPTIONS="$OPTIONS --no-fallback" +OPTIONS="$OPTIONS --table=$TABLE" +if test "$FORK" = "no" ; then + OPTIONS="$OPTIONS --foreground" +fi + +case "$1" in + start) + + echo -n "Starting $DESC: $NAME" + set +e + modprobe xt_MEDIAPROXY + echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null + iptables -D INPUT -j MEDIAPROXY --id $TABLE 2>/dev/null + iptables -D INPUT -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null + ip6tables -D INPUT -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null + iptables -I INPUT -p udp -j MEDIAPROXY --id $TABLE + ip6tables -I INPUT -p udp -j MEDIAPROXY --id $TABLE + set -e + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $OPTIONS || echo -n " already running" + log_end_msg $? + ;; + stop) + echo -n "Stopping $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON + if [ "$?" -ne 0 ]; then + return $? + fi + set +e + echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null + iptables -D INPUT -j MEDIAPROXY --id $TABLE 2>/dev/null + iptables -D INPUT -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null + ip6tables -D INPUT -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null + rmmod ipt_MEDIAPROXY 2>/dev/null + rmmod xt_MEDIAPROXY 2>/dev/null + set -e + rm -f $PIDFILE + log_end_msg $? + ;; + restart|force-reload) + + echo -n "Restarting $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --pidfile \ + $PIDFILE --exec $DAEMON + if [ "$?" -ne 0 ]; then + return $? + fi + rm -f $PIDFILE + sleep 1 + set +e + if [ -e /proc/mediaproxy/control ]; then + echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null + fi + iptables -D INPUT -j MEDIAPROXY --id $TABLE 2>/dev/null + iptables -D INPUT -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null + ip6tables -D INPUT -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null + rmmod ipt_MEDIAPROXY 2>/dev/null + rmmod xt_MEDIAPROXY 2>/dev/null + modprobe xt_MEDIAPROXY + iptables -I INPUT -p udp -j MEDIAPROXY --id $TABLE + ip6tables -I INPUT -p udp -j MEDIAPROXY --id $TABLE + set -e + start-stop-daemon --start --quiet --pidfile \ + $PIDFILE --exec $DAEMON -- $OPTIONS + log_end_msg $? + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/rules b/debian/rules index d9254d8..7060253 100755 --- a/debian/rules +++ b/debian/rules @@ -83,7 +83,7 @@ install: build dh_link -p$@ -P$(b)/$@ dh_installdocs -p$@ -P$(b)/$@ dh_installchangelogs -p$@ -P$(b)/$@ -# dh_installinit -p$@ -P$(b)/$@ + dh_installinit -p$@ -P$(b)/$@ dh_install -p$@ -P$(b)/$@ dh_strip --dbg-package=ngcp-mediaproxy-ng-dbg dh_compress -p$@ -P$(b)/$@ From d4fa99728e2ff1d9d965816eb2a13f8874caeb7b Mon Sep 17 00:00:00 2001 From: Jon Bonilla Date: Thu, 23 Aug 2012 23:16:15 +0000 Subject: [PATCH 4/4] update changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7971450..8d0a088 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ngcp-mediaproxy-ng (2.0.1) unstable; urgency=low + + * re-add init stuff + + -- Jon Bonilla Fri, 24 Aug 2012 01:15:43 +0200 + ngcp-mediaproxy-ng (2.0.0) unstable; urgency=low * Support XMLRPC callback to B2BUA/SBC to break calls upon RTP timeout