Commit d8bcb1c4 authored by Christopher Alfeld's avatar Christopher Alfeld
Browse files

Fixed bug involving LANs.

parent 6af03a3d
...@@ -221,16 +221,16 @@ foreach $lan (keys(%lans)) { ...@@ -221,16 +221,16 @@ foreach $lan (keys(%lans)) {
printdb " Setting up link\n"; printdb " Setting up link\n";
$extlink = $lanlinks[0]; $extlink = $lanlinks[0];
($src,$dst,$bw,$delay,$loss) = @{$links{$extlink}}; ($src,$dst,$bw,$delay,$loss) = @{$links{$extlink}};
delete $links{$extlink};
if ($src eq "$lan") { if ($src eq "$lan") {
$rdst = $dst; $rdst = $dst;
} else { } else {
$rdst = $src; $rdst = $src;
} }
$nodes{$ssnode} = ["ext-$ssnode"]; $nodes{$ssnode} = ["$extlink"];
printdb " nodes{$ssnode} = ext-$ssnode\n"; printdb " nodes{$ssnode} = $extlink\n";
$links{"ext-$ssnode"} = [$ssnode,$rdst,$bw,$delay,$loss]; $links{"$extlink"} = [$ssnode,$rdst,$bw,$delay,$loss];
printdb " links{ext-$ssnode} = [$ssnode,$rdst,$bw,$delay,$loss]\n"; printdb " links{$extlink} = [$ssnode,$rdst,$bw,$delay,$loss]\n";
delete $links{$extlink};
} else { } else {
$nodes{$ssnode} = []; $nodes{$ssnode} = [];
printdb " nodes{$ssnode} = []\n"; printdb " nodes{$ssnode} = []\n";
......
...@@ -103,6 +103,16 @@ foreach (split("\n",&ir_get("/topology/links"))) { ...@@ -103,6 +103,16 @@ foreach (split("\n",&ir_get("/topology/links"))) {
$links{$link} = [$src,$dst]; $links{$link} = [$src,$dst];
} }
# Get a list of delays
&ir_exists("/delay") || do {
print STDERR "IR does not contain delay section.\n";
exit(1);
};
foreach (split("\n",&ir_get("/delay"))) {
@t = split;
$delays{$t[0]} = 1;
}
# Pull the MAC table from the database. # Pull the MAC table from the database.
# MACTABLE is indexed by virtual node name and contains a reference # MACTABLE is indexed by virtual node name and contains a reference
# to a list of MACs. # to a list of MACs.
...@@ -304,11 +314,12 @@ sub get_macs { ...@@ -304,11 +314,12 @@ sub get_macs {
if (defined($vlanmap{"ddst_$_[0]"})) { if (defined($vlanmap{"ddst_$_[0]"})) {
push(@$macs,@{$vlanmap{"ddst_$_[0]"}}); push(@$macs,@{$vlanmap{"ddst_$_[0]"}});
} }
# XXX - Not sure if this is correct
if (defined($links{$_[0]})) { if (defined($links{$_[0]})) {
my($src,$dst) = @{$links{$_[0]}}; my($src,$dst) = @{$links{$_[0]}};
if (&islan($src)) { if (&islan($src) && defined($delays{$dst})) {
push(@$macs,@{$vlanmap{$src}}); push(@$macs,@{$vlanmap{$src}});
} elsif (&islan($dst)) { } elsif (&islan($dst) && defined($delays{$src})) {
push(@$macs,@{$vlanmap{$dst}}); push(@$macs,@{$vlanmap{$dst}});
} }
} }
...@@ -496,10 +507,13 @@ foreach $left (keys(%to_assign)) { ...@@ -496,10 +507,13 @@ foreach $left (keys(%to_assign)) {
$ipB = &find_free_ip($subnet); $ipB = &find_free_ip($subnet);
$ips_assigned{$ipB} = 1; $ips_assigned{$ipB} = 1;
$ip_section .= "$node $dst $ipA\n"; $ip_section .= "$node $dst $ipA\n";
printdb "ip_section .= $node $dst $ipA\n";
$macs = &get_macs($left); $macs = &get_macs($left);
push(@ip_mac_section,[&intersect($MACTABLE{$node},$macs),$ipA]); push(@ip_mac_section,[&intersect($MACTABLE{$node},$macs),$ipA]);
printdb "ip_mac_section .= ".&intersect($MACTABLE{$node},$macs).",$ipA\n";
$ip_section .= "$dst $node $ipB\n"; $ip_section .= "$dst $node $ipB\n";
push(@ip_mac_section,[&intersect($MACTABLE{$dst},$macs),$ipB]); push(@ip_mac_section,[&intersect($MACTABLE{$dst},$macs),$ipB]);
printdb "ip_mac_section .= ".&intersect($MACTABLE{$dst},$macs).",$ipB\n";
push(@{$ips_node{$node}},$ipA); push(@{$ips_node{$node}},$ipA);
push(@{$ips_node{$dst}},$ipB); push(@{$ips_node{$dst}},$ipB);
} else { } else {
......
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