Commit 4cb10094 authored by Leigh Stoller's avatar Leigh Stoller

Minor changes for Shashi; add "src" slot to virt_routes table so that

routes can be listed for each interface on a node, and so that the
route list can be converted into an ipfw chain on the client for nse.
parent 84a2cd9b
......@@ -303,6 +303,12 @@ foreach my $result (@results) {
$routes{"$src:$dst"} = $hop;
}
#
# Clean the routes.
#
DBQueryFatal("delete from virt_routes where ".
"pid='$pid' and eid='$eid'");
#
# Now it gets fun. We have to go through each src:dst pair in the route
# list. The problem is that the dst could be multihomed and multiple hops
......@@ -448,8 +454,8 @@ foreach my $route (keys(%routes)) {
}
else {
DBQueryFatal("insert into virt_routes ".
" (pid,eid,vname,dst,nexthop,dst_type) ".
" values ('$pid', '$eid', '$src', '$dstip', ".
" (pid,eid,vname,src,dst,nexthop,dst_type) ".
" values ('$pid', '$eid', '$src', '$srcip', '$dstip', ".
" '$hopip', '$type')");
}
}
......
......@@ -57,7 +57,7 @@ my %p2type;
my %p2osid;
my %vv2pmap;
getopts('hnmdlevb',\%opt);
getopts('hnmdlevbr',\%opt);
if ($opt{h}) {
exit &usage;
......@@ -386,25 +386,25 @@ if ($showdelays &&
#
if ($showroutes) {
my $result =
DBQueryFatal("select vname,dst,dst_type,dst_mask,nexthop,cost ".
DBQueryFatal("select vname,src,dst,dst_type,dst_mask,nexthop,cost ".
" from virt_routes where ".
"pid='$pid' and eid='$eid' order by vname");
if ($result->numrows) {
print "Route List:\n";
printf "%-15s %-15s %-15s %-15s %-8s \n",
"Node", "Dest", "Type/Mask", "Nexthop", "Cost";
printf "%-15s %-15s %-15s %-15s %-5s %-4s \n",
"Node", "Interface", "Dest", "Nexthop", "Type", "Cost";
print "--------------- --------------- --------------- ".
"--------------- --------\n";
"--------------- ----- ----\n";
while (($vname,$dst,$dst_type,$dst_mask,$nexthop,$cost) =
while (($vname,$src,$dst,$dst_type,$dst_mask,$nexthop,$cost) =
$result->fetchrow_array()) {
if ($dst_type eq "host") {
$dst_mask = "host";
}
printf "%-15s %-15s %-15s %-15s %-10s \n",
$vname, $dst, $dst_mask, $nexthop, $cost;
printf "%-15s %-15s %-15s %-15s %-5s %-4s \n",
$vname, $src, $dst, $nexthop, $dst_type, $cost;
}
print "\n";
}
......
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