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 111b0a769c
pull/1373/head
Guillem Jover 4 years ago
parent 111b0a769c
commit 8ae52f8ccb

@ -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

@ -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]

@ -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');

Loading…
Cancel
Save