From d957485bb72167f52d2563c574b7df3d9708e0f6 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 12 May 2008 17:56:47 -0700 Subject: fix for bug 3246: show error message when NAT rule has no "type". --- scripts/VyattaNatRule.pm | 4 +++- scripts/vyatta-update-nat.pl | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/VyattaNatRule.pm b/scripts/VyattaNatRule.pm index a920f72..bd0c598 100644 --- a/scripts/VyattaNatRule.pm +++ b/scripts/VyattaNatRule.pm @@ -220,7 +220,7 @@ sub rule_str { } elsif ($self->{_type} ne "masquerade") { return (undef, "outside-address not specified"); } - } else { + } elsif ($self->{_type} eq "destination") { # type is destination if ($self->{_exclude}) { $rule_str .= "-j RETURN"; @@ -279,6 +279,8 @@ sub rule_str { } else { return (undef, "inside-address not specified"); } + } else { + return (undef, "rule type not specified/valid"); } # source rule string diff --git a/scripts/vyatta-update-nat.pl b/scripts/vyatta-update-nat.pl index acfc0b8..4f95ad9 100755 --- a/scripts/vyatta-update-nat.pl +++ b/scripts/vyatta-update-nat.pl @@ -108,8 +108,8 @@ for $rule (@rule_keys) { my ($str, $err) = $nrule->rule_str(); if (!defined($str)) { # rule check failed => return error - print OUT "ERROR: $err\n"; - print STDERR "ERROR: $err\n"; + print OUT "NAT configuration error: $err\n"; + print STDERR "NAT configuration error: $err\n"; exit 5; } -- cgit v1.2.3