Commit f4c339ec authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Minor changes to Tunnel functions.

parent 261e469a
...@@ -319,18 +319,33 @@ sub IsLocalNode($) ...@@ -319,18 +319,33 @@ sub IsLocalNode($)
} }
sub IsTunnel($) sub IsTunnel($)
{
my ($link) = @_;
my $tunnel_type = TunnelType($link);
return 1
if (defined($tunnel_type) &&
$tunnel_type =~ /^(tunnel|gre-tunnel|egre-tunnel)$/);
return 0;
}
sub TunnelType($)
{ {
my ($link) = @_; my ($link) = @_;
my $result = 0; my $result = undef;
if (IsVersion0($link)) { if (IsVersion0($link)) {
my $link_type = GetText("link_type", $link); my $link_type = GetText("link_type", $link);
$result = (defined($link_type) && $link_type eq "tunnel"); if (defined($link_type)) {
$result = "tunnel";
}
} else { } else {
my @types = FindNodes("n:link_type", $link)->get_nodelist(); my @types = FindNodes("n:link_type", $link)->get_nodelist();
foreach my $current (@types) { foreach my $current (@types) {
my $name = GetText("name", $current); my $name = GetText("name", $current);
if (defined($name) && $name eq "gre-tunnel") { if (defined($name)) {
$result = 1; $result = $name;
last; last;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment