diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2008-02-08 16:30:58 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2008-02-08 16:30:58 -0800 |
commit | 60c98d5e240a1b1ddac9928d975d43c82cefabb4 (patch) | |
tree | 07adf9b00bfbb69bef9800160e4a6570c0434227 | |
parent | 5b6d22043d674daa80efe3b72f39d951b75ccd82 (diff) | |
download | vyatta-nat-60c98d5e240a1b1ddac9928d975d43c82cefabb4.tar.gz vyatta-nat-60c98d5e240a1b1ddac9928d975d43c82cefabb4.zip |
merge ports in show output
-rw-r--r-- | scripts/VyattaNatRule.pm | 29 | ||||
-rw-r--r-- | xsl/show_nat_rules.xsl | 100 |
2 files changed, 12 insertions, 117 deletions
diff --git a/scripts/VyattaNatRule.pm b/scripts/VyattaNatRule.pm index eda8526..5f237db 100644 --- a/scripts/VyattaNatRule.pm +++ b/scripts/VyattaNatRule.pm @@ -382,43 +382,22 @@ sub outputXml { outputXmlElem("out_interface", $self->{_outbound_if}, $fh); outputXmlElem("src_addr", $self->{_source}->{_addr}, $fh); outputXmlElem("src_network", $self->{_source}->{_net}, $fh); - outputXmlElem("src_ports", join(',', @{$self->{_source}->{_port_num}}), $fh); - outputXmlElem("src_ports_apps", join(',', @{$self->{_source}->{_port_name}}), - $fh); - outputXmlElem("src_port_start", $self->{_source}->{_port_range}->{_start}, - $fh); - outputXmlElem("src_port_stop", $self->{_source}->{_port_range}->{_stop}, - $fh); + outputXmlElem("src_ports", $self->{_source}->{_port}, $fh); outputXmlElem("dst_addr", $self->{_destination}->{_addr}, $fh); outputXmlElem("dst_network", $self->{_destination}->{_net}, $fh); - outputXmlElem("dst_ports", join(',', @{$self->{_destination}->{_port_num}}), - $fh); - outputXmlElem("dst_ports_apps", - join(',', @{$self->{_destination}->{_port_name}}), $fh); - outputXmlElem("dst_port_start", - $self->{_destination}->{_port_range}->{_start}, $fh); - outputXmlElem("dst_port_stop", - $self->{_destination}->{_port_range}->{_stop}, $fh); + outputXmlElem("dst_ports", $self->{_destination}->{_port}, $fh); outputXmlElem("in_addr", $self->{_inside_addr}->{_addr}, $fh); outputXmlElem("in_addr_start", $self->{_inside_addr}->{_range}->{_start}, $fh); outputXmlElem("in_addr_stop", $self->{_inside_addr}->{_range}->{_stop}, $fh); - outputXmlElem("in_port", $self->{_inside_addr}->{_port_num}, $fh); - outputXmlElem("in_port_start", - $self->{_inside_addr}->{_port_range}->{_start}, $fh); - outputXmlElem("in_port_stop", - $self->{_inside_addr}->{_port_range}->{_stop}, $fh); + outputXmlElem("in_port", $self->{_inside_addr}->{_port}, $fh); outputXmlElem("out_addr", $self->{_outside_addr}->{_addr}, $fh); outputXmlElem("out_addr_start", $self->{_outside_addr}->{_range}->{_start}, $fh); outputXmlElem("out_addr_stop", $self->{_outside_addr}->{_range}->{_stop}, $fh); - outputXmlElem("out_port", $self->{_outside_addr}->{_port_num}, $fh); - outputXmlElem("out_port_start", - $self->{_outside_addr}->{_port_range}->{_start}, $fh); - outputXmlElem("out_port_stop", - $self->{_outside_addr}->{_port_range}->{_stop}, $fh); + outputXmlElem("out_port", $self->{_outside_addr}->{_port}, $fh); # no proto? ($self->{_proto}) } diff --git a/xsl/show_nat_rules.xsl b/xsl/show_nat_rules.xsl index e9fdbc9..a86233c 100644 --- a/xsl/show_nat_rules.xsl +++ b/xsl/show_nat_rules.xsl @@ -172,21 +172,13 @@ <xsl:text>&newln;</xsl:text> - - <xsl:if test="src_ports!='' or dst_ports!=''"> + <xsl:if test="src_ports!=''"> <xsl:variable name="src_ports_d"> <xsl:call-template name="decode"> <xsl:with-param name="encoded" select="src_ports"/> </xsl:call-template> </xsl:variable> - <xsl:variable name="dst_ports_d"> - <xsl:call-template name="decode"> - <xsl:with-param name="encoded" select="dst_ports"/> - </xsl:call-template> - </xsl:variable> - - <xsl:value-of select="$pad6"/> <xsl:value-of select="$pad6"/> <xsl:value-of select="$pad6"/> <xsl:value-of select="$pad11"/> @@ -201,102 +193,26 @@ <xsl:value-of select="substring($pad20,1,$pad20_len - string-length($src_ports_d))"/> </xsl:when> </xsl:choose> - - <xsl:choose> - <xsl:when test="$dst_ports_d!=''"> - <xsl:value-of select="$dst_ports_d"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length($dst_ports_d))"/> - </xsl:when> - </xsl:choose> <xsl:text>&newln;</xsl:text> </xsl:if> - - <xsl:if test="src_ports_apps!='' or dst_ports_apps!=''"> - <xsl:variable name="src_ports_apps_d"> - <xsl:call-template name="decode"> - <xsl:with-param name="encoded" select="src_ports_apps"/> - </xsl:call-template> - </xsl:variable> - - <xsl:variable name="dst_ports_apps_d"> + <xsl:if test="dst_ports!=''"> + <xsl:variable name="dst_ports_d"> <xsl:call-template name="decode"> - <xsl:with-param name="encoded" select="dst_ports_apps"/> + <xsl:with-param name="encoded" select="dst_ports"/> </xsl:call-template> </xsl:variable> <xsl:value-of select="$pad6"/> <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad11"/> - <xsl:value-of select="$pad11"/> - - <xsl:choose> - <xsl:when test="$src_ports_apps_d=''"> - <xsl:value-of select="$pad20"/> - </xsl:when> - <xsl:when test="$src_ports_apps_d!=''"> - <xsl:value-of select="$src_ports_apps_d"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length($src_ports_apps_d))"/> - </xsl:when> - </xsl:choose> - - <xsl:choose> - <xsl:when test="$dst_ports_apps_d!=''"> - <xsl:value-of select="$dst_ports_apps_d"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length($dst_ports_apps_d))"/> - </xsl:when> - </xsl:choose> - <xsl:text>&newln;</xsl:text> - </xsl:if> - - <xsl:if test="src_port_start!='' or dst_port_start!=''"> - <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad11"/> - <xsl:value-of select="$pad11"/> - - <xsl:choose> - <xsl:when test="src_port_start=''"> - <xsl:value-of select="$pad20"/> - </xsl:when> - <xsl:when test="src_port_start!=''"> - <xsl:value-of select="src_port_start"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length(src_port_start))"/> - </xsl:when> - </xsl:choose> - - <xsl:choose> - <xsl:when test="dst_port_start!=''"> - <xsl:value-of select="dst_port_start"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length(dst_port_start))"/> - </xsl:when> - </xsl:choose> - <xsl:text>&newln;</xsl:text> - </xsl:if> - - <xsl:if test="src_port_stop!='' or dst_port_stop!=''"> - <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad6"/> - <xsl:value-of select="$pad6"/> <xsl:value-of select="$pad11"/> <xsl:value-of select="$pad11"/> + <xsl:value-of select="$pad20"/> <xsl:choose> - <xsl:when test="src_port_stop=''"> - <xsl:value-of select="$pad20"/> - </xsl:when> - <xsl:when test="src_port_stop!=''"> - <xsl:value-of select="src_port_stop"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length(src_port_stop))"/> - </xsl:when> - </xsl:choose> - - <xsl:choose> - <xsl:when test="dst_port_stop!=''"> - <xsl:value-of select="dst_port_stop"/> - <xsl:value-of select="substring($pad20,1,$pad20_len - string-length(dst_port_stop))"/> + <xsl:when test="$dst_ports_d!=''"> + <xsl:value-of select="$dst_ports_d"/> + <xsl:value-of select="substring($pad20,1,$pad20_len - string-length($dst_ports_d))"/> </xsl:when> </xsl:choose> <xsl:text>&newln;</xsl:text> |