diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-11-26 16:45:16 -0800 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-11-26 16:45:16 -0800 |
commit | 2f8f5a76cf2e0e1cd9be03785618c627b4619667 (patch) | |
tree | a4eabb1ca1cfb1fb2d34266127b9ff4129c28c88 /templates-cfg | |
parent | 8b9f431452f2d24e5d43b743bf8d3b5b11b36c66 (diff) | |
download | vyatta-nat-2f8f5a76cf2e0e1cd9be03785618c627b4619667.tar.gz vyatta-nat-2f8f5a76cf2e0e1cd9be03785618c627b4619667.zip |
Fix Bug 3887 Generate a warning message when NAT inbound/outbound-interface does not match a configured interface
Diffstat (limited to 'templates-cfg')
-rw-r--r-- | templates-cfg/service/nat/rule/node.tag/inbound-interface/node.def | 12 | ||||
-rw-r--r-- | templates-cfg/service/nat/rule/node.tag/outbound-interface/node.def | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/templates-cfg/service/nat/rule/node.tag/inbound-interface/node.def b/templates-cfg/service/nat/rule/node.tag/inbound-interface/node.def index b9cd4ee..ffd4d5a 100644 --- a/templates-cfg/service/nat/rule/node.tag/inbound-interface/node.def +++ b/templates-cfg/service/nat/rule/node.tag/inbound-interface/node.def @@ -2,3 +2,15 @@ type: txt help: Set inbound interface of NAT traffic allowed: ls /sys/class/net 2>/dev/null comp_help:Enter a network interface name, for example, "eth0" +commit:expression: exec " + intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev)) + intf_array_len=${#intf_array[*]} + i=0 + while [ $i -lt $intf_array_len ]; do + temp=${intf_array[$i]%:*} + if [ \"$temp\" == \"$VAR(@)\" ] ; then + exit 0 + fi + let i++ + done + echo NAT configuration warning: interface $VAR(@) does not exist on this system " diff --git a/templates-cfg/service/nat/rule/node.tag/outbound-interface/node.def b/templates-cfg/service/nat/rule/node.tag/outbound-interface/node.def index a9b0b4e..1bfe558 100644 --- a/templates-cfg/service/nat/rule/node.tag/outbound-interface/node.def +++ b/templates-cfg/service/nat/rule/node.tag/outbound-interface/node.def @@ -2,3 +2,15 @@ type: txt help: Set outbound interface for NAT traffic allowed: ls /sys/class/net 2>/dev/null comp_help:Enter a network interface name, for example, "eth0" +commit:expression: exec " + intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev)) + intf_array_len=${#intf_array[*]} + i=0 + while [ $i -lt $intf_array_len ]; do + temp=${intf_array[$i]%:*} + if [ \"$temp\" == \"$VAR(@)\" ] ; then + exit 0 + fi + let i++ + done + echo NAT configuration warning: interface $VAR(@) does not exist on this system " |