From 5b17e619510c929eb04dee5f9ac3c33b823dd25e Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 26 Jun 2023 11:45:26 -0400 Subject: [PATCH] MT#55283 add modprobe.d fragment If the kernel module is loaded automatically/implicitly through insertion of an iptables rule, it gets loaded with only the default module parameters. Add a modprobe.d fragment to handle this case. Change-Id: I08659e2f0db8fed401cbcce6edee51e942da1f3e (cherry picked from commit 85b8a765d19681332884af9315c6f099e26b2a7a) --- debian/ngcp-rtpengine-daemon.postinst | 12 ++++++++++++ debian/ngcp-rtpengine-daemon.postrm | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/debian/ngcp-rtpengine-daemon.postinst b/debian/ngcp-rtpengine-daemon.postinst index f7be6d0b0..9712b77d8 100644 --- a/debian/ngcp-rtpengine-daemon.postinst +++ b/debian/ngcp-rtpengine-daemon.postinst @@ -43,6 +43,18 @@ if [ "$1" = configure ]; then chmod 0770 "$DIR" fi done + # set up modprobe.d fragment for auto-load usage + if ! [ -f /etc/modprobe.d/rtpengine.conf ] || grep -q DPKG-GENERATED /etc/modprobe.d/rtpengine.conf; then + OPTIONS="options xt_RTPENGINE proc_mask=0x7" + + PUID=$(id -u rtpengine 2> /dev/null) + test -z "$PUID" || OPTIONS="$OPTIONS proc_uid=$PUID" + PGID=$(id -g rtpengine 2> /dev/null) + test -z "$PGID" || OPTIONS="$OPTIONS proc_gid=$PGID" + + ( echo "# DPKG-GENERATED FILE"; + echo "$OPTIONS" ) > /etc/modprobe.d/rtpengine.conf + fi fi #DEBHELPER# diff --git a/debian/ngcp-rtpengine-daemon.postrm b/debian/ngcp-rtpengine-daemon.postrm index 1826fe80b..7dc97dbd3 100644 --- a/debian/ngcp-rtpengine-daemon.postrm +++ b/debian/ngcp-rtpengine-daemon.postrm @@ -5,6 +5,10 @@ set -e if [ "$1" = purge ]; then deluser --quiet --system rtpengine > /dev/null || true delgroup --quiet --system rtpengine > /dev/null || true + + if [ -f /etc/modprobe.d/rtpengine.conf ] && grep -q DPKG-GENERATED /etc/modprobe.d/rtpengine.conf; then + rm -f /etc/modprobe.d/rtpengine.conf + fi fi #DEBHELPER#