Inserted the debug funcion.
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Debugging function
|
||||
debug() {
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
echo "DEBUG: "$1 $2 $3
|
||||
fi;
|
||||
}
|
||||
|
||||
# Task type variables
|
||||
NSENTER=$NSENTER
|
||||
PREROUTING=$PREROUTING
|
||||
POSTROUTING=$POSTROUTING
|
||||
|
||||
# Mandatory task variables
|
||||
NAME=$NAME-$COMMENT
|
||||
CHAIN=$CHAIN
|
||||
NAME=$NAME
|
||||
COMMENT=$COMMENT
|
||||
NAME=$NAME-$COMMENT
|
||||
PROTOCOL=$TYPE
|
||||
|
||||
EXTRA_OPTIONS="$2 $3 $4"
|
||||
|
||||
# turn on debug mode by extra option "debug"
|
||||
if [[ "$(echo "$EXTRA_OPTIONS" | grep debug)" != "" ]] ; then
|
||||
DEBUG=1
|
||||
fi;
|
||||
|
||||
|
||||
##############################
|
||||
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
@@ -81,6 +97,8 @@ if [[ "$NSENTER" == "true" ]] ; then
|
||||
if [[ "$PREROUTING" == "true" ]] || [[ "$POSTROUTING" == "true" ]] ; then
|
||||
iptables="nsenter -t $(docker inspect --format {{.State.Pid}} $NAME) -n -- $IPTABLES -t nat";
|
||||
|
||||
debug "iptables: "$IPTABLES;
|
||||
|
||||
if [[ "$PREROUTING" == "true" ]] ; then
|
||||
prerouting;
|
||||
|
||||
|
Reference in New Issue
Block a user