Change in osmo-dev[master]: net/templates/run.sh: fix check for masquerade

osmith gerrit-no-reply at lists.osmocom.org
Wed Jul 7 14:49:44 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/24875 )


Change subject: net/templates/run.sh: fix check for masquerade
......................................................................

net/templates/run.sh: fix check for masquerade

Replace the old check with an exact check for the given rule. The old
check doesn't work on my system if docker is running and sets up other
masquerading rules.

Change-Id: I30c22fe4e7683611e8dada329dbf7d51f78b6016
---
M net/templates/run.sh
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/75/24875/1

diff --git a/net/templates/run.sh b/net/templates/run.sh
index 0eacb0f..8ddef94 100755
--- a/net/templates/run.sh
+++ b/net/templates/run.sh
@@ -13,7 +13,8 @@
 
 sudo true || exit 1
 
-if [ -z "$(sudo iptables -L -t nat | grep MASQUERADE)" ]; then
+if ! sudo iptables -t nat -C POSTROUTING -s ${GGSN_NET} -o $dev -j MASQUERADE 2>/dev/null; then
+  echo "Adding iptables rule for masquerade"
   sudo iptables -t nat -A POSTROUTING -s ${GGSN_NET} -o $dev -j MASQUERADE
 fi
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/24875
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: I30c22fe4e7683611e8dada329dbf7d51f78b6016
Gerrit-Change-Number: 24875
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210707/347e2864/attachment.htm>


More information about the gerrit-log mailing list