From 8ae52f8ccb8b937313ea08c54e65c1330609efa0 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 13 Sep 2021 14:10:11 +0200 Subject: [PATCH] TT#137760 Fix table handling The default value for the kernel table in rtpengine is -1, so the helper should default to use the same to match in case the parameter is not set in the config file. Remove an explicit --table passed to the daemon in the el init script, and remove fallback initialization handling already done by the new helper. Change-Id: Ie4ec50a34e467f829279ad626a5b0e3b15acfd16 Fixes: commit 111b0a769c67e595318abb987eeb31ca0305ed7b --- el/rtpengine.init | 23 ----------------------- el/rtpengine.service | 2 +- utils/rtpengine-get-table | 2 +- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/el/rtpengine.init b/el/rtpengine.init index 8b970079c..a945d979c 100644 --- a/el/rtpengine.init +++ b/el/rtpengine.init @@ -48,29 +48,6 @@ build_opts() { if [[ $TABLE -ge 0 ]];then MODULE=1 fi - else - # configfile exists? - if [ ! -f "$configfile" ];then - echo "Error: $configfile not present" >&2 - exit 6 - fi - - # get table variable from config - table="$(grep -Ei '^table' "$configfile" | cut -d\ -f3)" - if [ -z "$table" ];then - table="$(grep -Ei '^table' "$configfile" | cut -d= -f3)" - fi - - # error if directive is not presented in config - if [ -z "$table" ];then - echo "Error: directive table= is not present in $configfile" >&2 - exit 6 - fi - - # enable iptables module if derective set and positive - if [[ $table -ge 0 ]];then - MODULE=1 - fi fi # interfaces diff --git a/el/rtpengine.service b/el/rtpengine.service index ce373da1d..4f2721d28 100644 --- a/el/rtpengine.service +++ b/el/rtpengine.service @@ -8,7 +8,7 @@ EnvironmentFile=/etc/sysconfig/rtpengine Environment=CFGFILE=/etc/rtpengine/rtpengine.conf PIDFile=/run/rtpengine.pid ExecStartPre=/usr/sbin/ngcp-rtpengine-iptables-setup start -ExecStart=/usr/sbin/rtpengine --no-log-timestamps --pidfile=${PIDFile} --config-file=${CFGFILE} --table=${TABLE} +ExecStart=/usr/sbin/rtpengine --no-log-timestamps --pidfile=${PIDFile} --config-file=${CFGFILE} ExecStopPost=/usr/sbin/ngcp-rtpengine-iptables-setup stop [Install] diff --git a/utils/rtpengine-get-table b/utils/rtpengine-get-table index 188418fc2..d5bdf4d37 100755 --- a/utils/rtpengine-get-table +++ b/utils/rtpengine-get-table @@ -22,7 +22,7 @@ my %options = ( 'help' => sub { showusage(); exit 0 }, 'config-file' => '/etc/rtpengine/rtpengine.conf', 'config-section' => 'rtpengine', - 'fallback-table' => 0, + 'fallback-table' => -1, ); Getopt::Long::Configure('require_order');