@ -15,7 +15,6 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=ngcp-rtpengine-daemon
DESC="RTP/media proxy"
TABLE=0
MANAGE_IPTABLES=yes
DAEMON=$(which rtpengine)
DEFAULTS=/etc/default/${NAME}
@ -37,7 +36,6 @@ fi
OPTIONS=""
START_OPTIONS=""
MODPROBE_OPTIONS=""
if [ ! -z "$INTERFACES" ]; then
for interface in $INTERFACES; do
@ -125,30 +123,16 @@ fi
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
PUID=$(id -u "$SET_USER" 2> /dev/null)
test -z "$PUID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_uid=$PUID"
if test -z "$SET_GROUP"; then
PGID=$(id -g "$SET_USER" 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
PGID=$(grep "^$SET_GROUP:" /etc/group | cut -d: -f3 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
if [ -x /usr/sbin/ngcp-virt-identify ]; then
if /usr/sbin/ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
case "$1" in
start)
set +e
@ -165,23 +149,7 @@ case "$1" in
;;
esac
fi
if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then
if [ "$MANAGE_IPTABLES" = "yes" ]; then
# shellcheck disable=SC2086
modprobe xt_RTPENGINE $MODPROBE_OPTIONS
iptables -N rtpengine 2> /dev/null
iptables -D INPUT -j rtpengine 2> /dev/null
iptables -I INPUT -j rtpengine
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
ip6tables -N rtpengine 2> /dev/null
ip6tables -D INPUT -j rtpengine 2> /dev/null
ip6tables -I INPUT -j rtpengine
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
fi
fi
ngcp-rtpengine-iptables-setup start
set -e
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
@ -197,17 +165,7 @@ case "$1" in
return $?
fi
set +e
if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then
sleep 1
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" > /proc/rtpengine/control 2>/dev/null
fi
if [ "$MANAGE_IPTABLES" = "yes" ]; then
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
rmmod xt_RTPENGINE 2>/dev/null
fi
fi
ngcp-rtpengine-iptables-setup stop
set -e
rm -f $PIDFILE
log_end_msg $?