From 31aabd0e8b5d7f4d782e744575a673303e1c1ab1 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 29 Jan 2019 10:31:03 -0500 Subject: [PATCH] fix el init script inserting duplicate iptables rules closes #696 Change-Id: Ie7d7bc6ec152c8b9cbae08422338563169158f97 (cherry picked from commit aaccc106307427774f9f1840a9af9a1bd632a2b4) --- el/rtpengine.init | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/el/rtpengine.init b/el/rtpengine.init index 27f9459d5..736f243b5 100644 --- a/el/rtpengine.init +++ b/el/rtpengine.init @@ -169,10 +169,14 @@ start() { firewall-cmd --reload else for fw in iptables ip6tables;do - $fw -N rtpengine # We insert the rtpengine rule at the top of the input chain - $fw -t filter -I INPUT -j rtpengine - $fw -I rtpengine -p udp -j RTPENGINE --id "$TABLE" + if ! $fw -t filter -C INPUT -j rtpengine 2> /dev/null; then + $fw -N rtpengine + $fw -t filter -I INPUT -j rtpengine + fi + if ! $fw -I rtpengine -p udp -j RTPENGINE --id "$TABLE" 2> /dev/null; then + $fw -I rtpengine -p udp -j RTPENGINE --id "$TABLE" + fi done fi