From 45e4c2fb3437afd655d56034a0d9eaaf680e0191 Mon Sep 17 00:00:00 2001 From: Vasudeva Kamath Date: Thu, 5 Nov 2015 11:41:42 +0530 Subject: port_forward: rearrange cmdline arguments Arguments were not used as per the help message. Rearranged the arguments to match the help message. Also refactored help message. --- port_forward | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/port_forward b/port_forward index f0b74d1..111c4ec 100755 --- a/port_forward +++ b/port_forward @@ -6,16 +6,20 @@ usage() { cat < - --clear Clear the previous rules before inserting new ones + --clear Clear the previous rules before inserting new + ones - in-interface Interface on which incoming traffic is expected - out-interface Interface to which incoming traffic is to be + --protocol Protocol for the rules to use. + + in-interface Interface on which incoming traffic is expected + out-interface Interface to which incoming traffic is to be forwarded. - port Port to be forwarded. Can be integer or string - from /etc/services. - destination IP and port of the destination system to which - traffic needs to be forwarded. This should be in - form + + port Port to be forwarded. Can be integer or string + from /etc/services. + destination IP and port of the destination system to which + traffic needs to be forwarded. This should be in + form (C) 2015 Vasudev Kamath - This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute @@ -46,10 +50,10 @@ if [ $# -ne 4 ]; then exit 2 fi -PORT="$1" -DESTINATION="$2" -IN_INTERFACE="$3" -OUT_INTERFACE="$4" +IN_INTERFACE="$1" +OUT_INTERFACE="$2" +PORT="$3" +DESTINATION="$4" # Get the incoming interface IP. This is used for SNAT. IN_IP=$(ip addr show $IN_INTERFACE|\ -- cgit v1.2.3