summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasudeva Kamath <vasudeva.kamath@in.abb.com>2015-11-05 11:41:42 +0530
committerVasudeva Kamath <vasudeva.kamath@in.abb.com>2015-11-05 11:41:42 +0530
commit45e4c2fb3437afd655d56034a0d9eaaf680e0191 (patch)
tree1248504d146825f045886f4e631059ba74e61a31
parent81232d7fb5e57cad5132cbfa2cc9aa7d538d5c7c (diff)
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.
-rwxr-xr-xport_forward28
1 files 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 <<EOF
$(basename $0) [options] <in-interface> <out-interface> <port> <destination>
- --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 <destination_ip:port>
+
+ 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 <destination_ip:port>
(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|\