Commit 8a0c87bc authored by Leigh B Stoller's avatar Leigh B Stoller

Little hack for elabinelab when boss,ops are XEN VMs with unroutable

IPs; if there is an ipalias defined in the interfaces table, and that
ip is routable, then we can create an entry in the routable map *and*
the unroutable map.
parent e579e339
...@@ -102,7 +102,7 @@ if ((my $locked = TBScriptLock("named", 1)) != TBSCRIPTLOCK_OKAY()) { ...@@ -102,7 +102,7 @@ if ((my $locked = TBScriptLock("named", 1)) != TBSCRIPTLOCK_OKAY()) {
# #
my $db_result = my $db_result =
DBQueryFatal("select n.node_id, n.role, null, i.IP, i.role, ". DBQueryFatal("select n.node_id, n.role, null, i.IP, i.role, ".
" r.inner_elab_role ". " r.inner_elab_role, i.IPaliases ".
" from nodes as n join interfaces as i ". " from nodes as n join interfaces as i ".
"left join reserved as r on r.node_id=n.node_id ". "left join reserved as r on r.node_id=n.node_id ".
"where (n.node_id=i.node_id and ". "where (n.node_id=i.node_id and ".
...@@ -123,7 +123,7 @@ process_nodes($db_result); ...@@ -123,7 +123,7 @@ process_nodes($db_result);
# #
$db_result = $db_result =
DBQueryFatal("select n.node_id, n.role, n.jailip, i.IP, i.role, ". DBQueryFatal("select n.node_id, n.role, n.jailip, i.IP, i.role, ".
" r.inner_elab_role ". " r.inner_elab_role, null ".
" from nodes as n ". " from nodes as n ".
"left join interfaces as i on i.node_id=n.phys_nodeid ". "left join interfaces as i on i.node_id=n.phys_nodeid ".
"left join interfaces as i2 on i2.node_id=n.node_id ". "left join interfaces as i2 on i2.node_id=n.node_id ".
...@@ -138,7 +138,7 @@ process_nodes($db_result); ...@@ -138,7 +138,7 @@ process_nodes($db_result);
# For IXPs we also need their gateway addresses as well # For IXPs we also need their gateway addresses as well
# #
$db_result = $db_result =
DBQueryFatal("select n.node_id, n.role, n.jailip, i.IP, i.role, null ". DBQueryFatal("select n.node_id, n.role, n.jailip, i.IP, i.role, null,null ".
" from nodes as n ". " from nodes as n ".
"left join interfaces as i ". "left join interfaces as i ".
"on n.phys_nodeid=i.node_id and n.node_id!=i.node_id ". "on n.phys_nodeid=i.node_id and n.node_id!=i.node_id ".
...@@ -311,6 +311,7 @@ sub process_nodes($) { ...@@ -311,6 +311,7 @@ sub process_nodes($) {
my $IP = $row[3]; my $IP = $row[3];
my $irole = $row[4]; my $irole = $row[4];
my $inner_elab_role = $row[5]; my $inner_elab_role = $row[5];
my $IPaliases = $row[6];
# #
# For most nodes, we get the IP address from the interfaces table; # For most nodes, we get the IP address from the interfaces table;
...@@ -324,7 +325,7 @@ sub process_nodes($) { ...@@ -324,7 +325,7 @@ sub process_nodes($) {
next; next;
} }
# #
# Special treatment for gateway interfaces - we give act as if they # Special treatment for gateway interfaces - we give act as if they
# are a separate node # are a separate node
# #
...@@ -351,6 +352,26 @@ sub process_nodes($) { ...@@ -351,6 +352,26 @@ sub process_nodes($) {
$unroutable{$node_id} = $node_rec; $unroutable{$node_id} = $node_rec;
} }
#
# Special treatment for virtnodes with private IP addresses;
# If there is an IPaliases defined, add a entry for that too,
# but only to the other map. In other words, if the IP is
# unroutable and the ipalias is routable, then we can have
# two entries, one of which is routable.
#
if (defined($IPaliases) && $IPaliases ne "") {
my @ipaliases = split(',', $IPaliases);
my $ipalias = $ipaliases[0];
if (!isroutable($IP) && isroutable($ipalias)) {
$routable{$node_id} = {
IP => $ipalias,
role => $nrole,
inner_elab_role => $inner_elab_role
};
}
}
# #
# Put it into a map so we can generate the reverse zone file later # Put it into a map so we can generate the reverse zone file later
# #
......
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