diff options
author | Gaurav Sinha <gaurav.sinha@vyatta.com> | 2011-11-21 15:03:47 -0800 |
---|---|---|
committer | Gaurav Sinha <gaurav.sinha@vyatta.com> | 2011-11-21 15:03:47 -0800 |
commit | 6be89f24d462ff526378adb4073f6d1bf8f1860e (patch) | |
tree | 2b1432464430571a954544e2412d2da7bbd50d4a /scripts | |
parent | 2f69d3f971203567573b48a48692e30b16337e7b (diff) | |
download | vyatta-conntrack-6be89f24d462ff526378adb4073f6d1bf8f1860e.tar.gz vyatta-conntrack-6be89f24d462ff526378adb4073f6d1bf8f1860e.zip |
bug 7411: IPv6 check added to show / delete
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-delete-conntrack.pl | 17 | ||||
-rwxr-xr-x | scripts/vyatta-show-conntrack.pl | 17 |
2 files changed, 24 insertions, 10 deletions
diff --git a/scripts/vyatta-delete-conntrack.pl b/scripts/vyatta-delete-conntrack.pl index 4062a37..ceccdd8 100755 --- a/scripts/vyatta-delete-conntrack.pl +++ b/scripts/vyatta-delete-conntrack.pl @@ -235,7 +235,9 @@ if ($family eq "ipv4") { $sourcePort = substr($address[1], 1); my( $success, $err ) = isValidPortNumber($sourcePort); if (validateType('ipv6', $sourceIP, 'quiet')) { - #Valid ipv6 address. + if ($sourceIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid source IPv6 address\n"; + } } else { if(!defined($success)) { die "Please enter a valid source IPv6 address and port \n"; @@ -249,7 +251,9 @@ if ($family eq "ipv4") { } else { #IPv6-address without port if (validateType('ipv6', $sourceIP, 'quiet')) { - #Valid ipv6 address. + if ($sourceIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid source IPv6 address\n"; + } } else { die "Please enter a valid source IPv6 address\n"; } @@ -267,7 +271,9 @@ if ($family eq "ipv4") { $destPort = substr($address[1], 1); my( $success, $err ) = isValidPortNumber($destPort); if (validateType('ipv6', $destIP, 'quiet')) { - #Valid ipv6 address. + if ($destIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid destination IPv6 address\n"; + } } else { if(!defined($success)) { die "Please enter a valid destination IPv6 address and port \n"; @@ -281,8 +287,9 @@ if ($family eq "ipv4") { } else { #IPv6-address without port if (validateType('ipv6', $destIP, 'quiet')) { - #Valid ipv6 address. - #$command .= " -d $destIP"; + if ($destIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid destination IPv6 address\n"; + } } else { die "Please enter a valid destination IPv6 address\n"; } diff --git a/scripts/vyatta-show-conntrack.pl b/scripts/vyatta-show-conntrack.pl index a55e1e7..17457b1 100755 --- a/scripts/vyatta-show-conntrack.pl +++ b/scripts/vyatta-show-conntrack.pl @@ -237,7 +237,9 @@ if ($family eq "ipv4") { $sourcePort = substr($address[1], 1); my( $success, $err ) = isValidPortNumber($sourcePort); if (validateType('ipv6', $sourceIP, 'quiet')) { - #Valid ipv6 address. + if ($sourceIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid source IPv6 address\n"; + } } else { if(!defined($success)) { die "Please enter a valid source IPv6 address and port \n"; @@ -251,7 +253,9 @@ if ($family eq "ipv4") { } else { #IPv6-address without port if (validateType('ipv6', $sourceIP, 'quiet')) { - #Valid ipv6 address. + if ($sourceIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid source IPv6 address\n"; + } } else { die "Please enter a valid source IPv6 address\n"; } @@ -269,7 +273,9 @@ if ($family eq "ipv4") { $destPort = substr($address[1], 1); my( $success, $err ) = isValidPortNumber($destPort); if (validateType('ipv6', $destIP, 'quiet')) { - #Valid ipv6 address. + if ($destIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid destination IPv6 address\n"; + } } else { if(!defined($success)) { die "Please enter a valid destination IPv6 address and port \n"; @@ -283,8 +289,9 @@ if ($family eq "ipv4") { } else { #IPv6-address without port if (validateType('ipv6', $destIP, 'quiet')) { - #Valid ipv6 address. - #$command .= " -d $destIP"; + if ($destIP =~ m/[^ABCDEFabcdef0123456789:\[\]]/) { + die "Please enter a valid destination IPv6 address\n"; + } } else { die "Please enter a valid destination IPv6 address\n"; } |