[racktables-users] Patch: allow multiple routers on one IP

  • From: "Tyler J. Wagner" <tyler@xxxxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Mon, 28 Mar 2011 16:09:35 +0100

Attached is a patch to allow multiple routers on one IP. Valid from
0.18.x to current (0.19.2). IE, when one IP has multiple "Router"-type
assignments, it does not appear with red background colour. Good for
those of us with VRRP-speaking devices sharing common IPs.

Regards,
Tyler

-- 
"Religion is the opiate of the masses, so long as the masses are straight. 
However, amass a bunch of lesbians and you're going to need actual drugs."
   -- OKCupid Blog, with apologies to Karl Marx
      http://blog.okcupid.com/index.php/gay-sex-vs-straight-sex/
--- functions.php_orig  2011-03-24 12:44:33.000000000 +0000
+++ functions.php       2011-03-28 15:04:43.000000000 +0000
@@ -1728,9 +1728,10 @@
                );
                foreach ($addrlist[$ip_bin]['allocs'] as $a)
                        $refc[$a['type']]++;
-               $nvirtloopback = ($refc['shared'] + $refc['virtual'] > 0) ? 1 : 
0; // modulus of virtual + shared
+               // 2010-10-08 tyler - routers may have multiple allocations on 
one IP
+               $nvirtloopback = ($refc['shared'] + $refc['virtual'] + 
$refc['router'] > 0) ? 1 : 0; // modulus of virtual + shared + router
                $nreserved = ($addrlist[$ip_bin]['reserved'] == 'yes') ? 1 : 0; 
// only one reservation is possible ever
-               $nrealms = $nreserved + $nvirtloopback + $refc['regular'] + 
$refc['router']; // latter two are connected and router allocations
+               $nrealms = $nreserved + $nvirtloopback + $refc['regular']; // 
last is connected allocation
                
                if ($nrealms == 1)
                        $addrlist[$ip_bin]['class'] = 'trbusy';

Other related posts: