diff options
author | An-Cheng Huang <ancheng@build-vm.localdomain> | 2007-12-19 15:27:04 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@build-vm.localdomain> | 2007-12-19 15:27:04 -0800 |
commit | 56880bec43eef6af8301cdfbe9c764b4257bd24b (patch) | |
tree | a7ba2a4a6c73f93e0a94e2d2db9cda264bfec254 | |
parent | 561ec07cb56696b05f683a325098c06422d00f86 (diff) | |
download | vyatta-nat-56880bec43eef6af8301cdfbe9c764b4257bd24b.tar.gz vyatta-nat-56880bec43eef6af8301cdfbe9c764b4257bd24b.zip |
* add completion help/value check.
* fix show command.
-rwxr-xr-x | scripts/vyatta-show-nat.pl | 2 | ||||
-rw-r--r-- | templates-cfg/service/nat/rule/node.tag/inbound-interface/node.def | 5 | ||||
-rw-r--r-- | templates-cfg/service/nat/rule/node.tag/outbound-interface/node.def | 5 | ||||
-rw-r--r-- | templates-cfg/service/nat/rule/node.tag/protocols/node.def | 5 | ||||
-rw-r--r-- | templates-cfg/service/nat/rule/node.tag/type/node.def | 7 | ||||
-rw-r--r-- | xsl/url-decode.xsl | 48 |
6 files changed, 63 insertions, 9 deletions
diff --git a/scripts/vyatta-show-nat.pl b/scripts/vyatta-show-nat.pl index 5ae67b8..bb25500 100755 --- a/scripts/vyatta-show-nat.pl +++ b/scripts/vyatta-show-nat.pl @@ -32,7 +32,7 @@ while (<STATS>) { } close STATS; -open(RENDER, "| /opt/vyatta/libexec/xorp/render_xml $xsl_file") or exit 1; +open(RENDER, "| /opt/vyatta/sbin/render_xml $xsl_file") or exit 1; # begin print RENDER "<opcommand name='natrules'><format type='row'>\n"; 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 c87d281..533a592 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 @@ -1,5 +1,4 @@ type: txt help: "Inbound interface of NAT traffic" -## iptables allow any interface names. -#syntax: exec "sh -c 'if grep -q '\\''^ \\+$(@):'\\'' /proc/net/dev; \ -#then exit 0; else exit 1; fi' " ; "invalid interface $(@)" +#allowed: ls /sys/class/net 2>/dev/null +#comp_help:Enter a network interface name, for example, "eth0" 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 bf3e8a2..096629f 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 @@ -1,5 +1,4 @@ type: txt help: "Outbound interface for NAT traffic" -## iptables allow any interface names. -#syntax: exec "sh -c 'if grep -q '\\''^ \\+$(@):'\\'' /proc/net/dev; \ -#then exit 0; else exit 1; fi' " ; "invalid interface $(@)" +#allowed: ls /sys/class/net 2>/dev/null +#comp_help:Enter a network interface name, for example, "eth0" diff --git a/templates-cfg/service/nat/rule/node.tag/protocols/node.def b/templates-cfg/service/nat/rule/node.tag/protocols/node.def index 75ccb86..619fad9 100644 --- a/templates-cfg/service/nat/rule/node.tag/protocols/node.def +++ b/templates-cfg/service/nat/rule/node.tag/protocols/node.def @@ -1,3 +1,8 @@ type: txt help: "Protocol to NAT (this can be a protocol name in /etc/protocols, a protocol number, or \"all\")" syntax: exec "/opt/vyatta/sbin/vyatta-validate-type.pl protocol_negate '$(@)'" ; "invalid protocol \"$(@)\"" +#comp_help:Possible completions: +# <name> A protocol name, for example, "tcp" +# <number> A protocol number +# all All protocols +#(Note: a protocol can also be negated, for example, "!tcp") diff --git a/templates-cfg/service/nat/rule/node.tag/type/node.def b/templates-cfg/service/nat/rule/node.tag/type/node.def index 9df10a9..831dd3b 100644 --- a/templates-cfg/service/nat/rule/node.tag/type/node.def +++ b/templates-cfg/service/nat/rule/node.tag/type/node.def @@ -1,4 +1,7 @@ type: txt help: "Source, destination, or masquerade NAT" -syntax: ($(@) == "source" || $(@) == "destination" || $(@) == "masquerade") ; \ -"invalid type $(@)" +syntax: $(@) in "source", "destination", "masquerade"; "invalid type $(@)" +#comp_help:Possible completions: +# source Source NAT +# destination Destination NAT +# masquerade Masquerade NAT diff --git a/xsl/url-decode.xsl b/xsl/url-decode.xsl new file mode 100644 index 0000000..6e3db40 --- /dev/null +++ b/xsl/url-decode.xsl @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- Obtained from http://skew.org/xml/stylesheets/url-encode/url-decode.xsl --> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:output method="text" indent="no" encoding="iso-8859-1"/> + +<!-- <xsl:param name="url" select="'urn:check%20out%20my%20r%E9sum%E9'"/>--> + + <xsl:variable name="hex" select="'0123456789ABCDEF'"/> + <xsl:variable name="ascii"> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable> + <xsl:variable name="latin1"> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:variable> + +<!-- <xsl:template match="/"> + <xsl:call-template name="decode"> + <xsl:with-param name="encoded" select="$url"/> + </xsl:call-template> + </xsl:template> --> + + <xsl:template name="decode"> + <xsl:param name="encoded"/> + <xsl:choose> + <xsl:when test="contains($encoded,'%')"> + <xsl:value-of select="substring-before($encoded,'%')"/> + <xsl:variable name="hexpair" select="translate(substring(substring-after($encoded,'%'),1,2),'abcdef','ABCDEF')"/> + <xsl:variable name="decimal" select="(string-length(substring-before($hex,substring($hexpair,1,1))))*16 + string-length(substring-before($hex,substring($hexpair,2,1)))"/> + <xsl:choose> + <xsl:when test="$decimal < 127 and $decimal > 31"> + <xsl:value-of select="substring($ascii,$decimal - 31,1)"/> + </xsl:when> + <xsl:when test="$decimal > 159"> + <xsl:value-of select="substring($latin1,$decimal - 159,1)"/> + </xsl:when> + <xsl:otherwise>?</xsl:otherwise> + </xsl:choose> + <xsl:call-template name="decode"> + <xsl:with-param name="encoded" select="substring(substring-after($encoded,'%'),3)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$encoded"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> |