r2107 + display router refs in network views
authorDenis Ovsienko <infrastation@yandex.ru>
Mon, 4 Aug 2008 11:47:15 +0000 (11:47 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Mon, 4 Aug 2008 11:47:15 +0000 (11:47 +0000)
+ toss IPv4 code even more

inc/database.php
inc/functions.php
inc/interface.php
inc/navigation.php
inc/ophandlers.php

index 505f083..4034d70 100644 (file)
@@ -959,111 +959,6 @@ function getObjectAddresses ($object_id = 0)
        return $ret;
 }
 
-// FIXME: unused function
-function getIPAddress ($ip = 0)
-{
-       $ret = array
-       (
-               'bonds' => array(),
-               'outpf' => array(),
-               'inpf' => array(),
-               'vslist' => array(),
-               'rslist' => array(),
-               'exists' => 0,
-               'name' => '',
-               'reserved' => 'no'
-       );
-       $query = "select name, reserved from IPAddress ".
-               "where ip = INET_ATON('$ip') and (reserved = 'yes' or name != '')";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       if ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $ret['exists'] = 1;
-               $ret['name'] = $row['name'];
-               $ret['reserved'] = $row['reserved'];
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query =
-               "select ".
-               "IPBonds.object_id as object_id, ".
-               "IPBonds.name as name, ".
-               "IPBonds.type as type, ".
-               "objtype_id, dict_value as objtype_name, " .
-               "RackObject.name as object_name ".
-               "from IPBonds join RackObject on IPBonds.object_id=RackObject.id ".
-               "left join Dictionary on objtype_id=dict_key natural join Chapter " .
-               "where IPBonds.ip=INET_ATON('$ip') ".
-               "and chapter_name = 'RackObjectType' " .
-               "order by RackObject.id, IPBonds.name";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       $count = 0;
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $ret['bonds'][$count]['object_id'] = $row['object_id'];
-               $ret['bonds'][$count]['name'] = $row['name'];
-               $ret['bonds'][$count]['type'] = $row['type'];
-               $qo = array();
-               $qo['name'] = $row['object_name'];
-               $qo['objtype_id'] = $row['objtype_id'];
-               $qo['objtype_name'] = $row['objtype_name'];
-               $ret['bonds'][$count]['object_name'] = displayedName ($qo);
-               $count++;
-               $ret['exists'] = 1;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query = "select id, vport, proto, name from IPVirtualService where vip = inet_aton('${ip}')";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $new = $row;
-               $new['vip'] = $ip;
-               $ret['vslist'][] = $new;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query = "select inservice, rsport, IPRSPool.id as pool_id, IPRSPool.name as poolname from " .
-               "IPRealServer inner join IPRSPool on rspool_id = IPRSPool.id " .
-               "where rsip = inet_aton('${ip}')";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $new = $row;
-               $new['rsip'] = $ip;
-               $ret['rslist'][] = $new;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query =
-               "select " .
-               "proto, " .
-               "INET_NTOA(localip) as localip, " .
-               "localport, " .
-               "INET_NTOA(remoteip) as remoteip, " .
-               "remoteport, " .
-               "description " .
-               "from PortForwarding " .
-               "where remoteip = inet_aton('${ip}') or localip = inet_aton('${ip}') " .
-               "order by localip, localport, remoteip, remoteport, proto";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               if ($row['remoteip'] == $ip)
-                       $ret['inpf'][] = $row;
-               if ($row['localip'] == $ip)
-                       $ret['outpf'][] = $row;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       return $ret;
-}
-
 // Check the range requested for meaningful IPv4 records, build them
 // into a list and return. Return an empty list if nothing matched.
 // Both arguments are expected in signed int32 form. The resulting list
@@ -1075,10 +970,8 @@ function scanIPv4Space ($i32_first, $i32_last)
        (
                'name' => '',
                'reserved' => 'no',
-               'bonds' => array(),
                'outpf' => array(),
                'inpf' => array(),
-               'vslist' => array(),
                'rslist' => array(),
                'allocs' => array(),
                'lblist' => array()
@@ -1333,157 +1226,6 @@ function getAddressspaceList ($tagfilter = array(), $tfmode = 'any')
 
 }
 
-// FIXME: unused function
-function getIPRange ($id = 0)
-{
-       global $dbxlink;
-       $query =
-               "select ".
-               "id as IPRanges_id, ".
-               "INET_NTOA(ip) as IPRanges_ip, ".
-               "mask as IPRanges_mask, ".
-               "name as IPRanges_name ".
-               "from IPRanges ".
-               "where id = '$id'";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       $ret = array();
-       $row = $result->fetch (PDO::FETCH_ASSOC);
-       if ($row == NULL)
-               return $ret;
-       $ret['id'] = $row['IPRanges_id'];
-       $ret['ip'] = $row['IPRanges_ip'];
-       $ret['ip_bin'] = ip2long ($row['IPRanges_ip']);
-       $ret['mask_bin'] = binMaskFromDec($row['IPRanges_mask']);
-       $ret['mask_bin_inv'] = binInvMaskFromDec($row['IPRanges_mask']);
-       $ret['name'] = $row['IPRanges_name'];
-       $ret['mask'] = $row['IPRanges_mask'];
-       $ret['addrlist'] = array();
-       $result->closeCursor();
-       unset ($result);
-       // We risk losing some significant bits in an unsigned 32bit integer,
-       // unless it is converted to a string.
-       $db_first = "'" . sprintf ('%u', 0x00000000 + $ret['ip_bin'] & $ret['mask_bin']) . "'";
-       $db_last  = "'" . sprintf ('%u', 0x00000000 + $ret['ip_bin'] | ($ret['mask_bin_inv'])) . "'";
-
-       // Don't try to build up the whole structure in a single pass. Request
-       // the list of user comments and reservations and merge allocations in
-       // at a latter point.
-       $query =
-               "select INET_NTOA(ip) as ip, name, reserved from IPAddress " .
-               "where ip between ${db_first} and ${db_last} " .
-               "and (reserved = 'yes' or name != '')";
-       $result = $dbxlink->query ($query);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $ip_bin = ip2long ($row['ip']);
-               $ret['addrlist'][$ip_bin] = $row;
-               $tmp = array();
-               foreach (array ('ip', 'name', 'reserved') as $cname)
-                       $tmp[$cname] = $row[$cname];
-               $tmp['references'] = array();
-               $tmp['lbrefs'] = array();
-               $tmp['rsrefs'] = array();
-               $ret['addrlist'][$ip_bin] = $tmp;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query =
-               "select INET_NTOA(ipb.ip) as ip, ro.id as object_id, " .
-               "ro.name as object_name, ipb.name, ipb.type, objtype_id, " .
-               "dict_value as objtype_name from " .
-               "IPBonds as ipb inner join RackObject as ro on ipb.object_id = ro.id " .
-               "left join Dictionary on objtype_id=dict_key natural join Chapter " .
-               "where ip between ${db_first} and ${db_last} " .
-               "and chapter_name = 'RackObjectType'" .
-               "order by ipb.type, object_name";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $ip_bin = ip2long ($row['ip']);
-               if (!isset ($ret['addrlist'][$ip_bin]))
-               {
-                       $ret['addrlist'][$ip_bin] = array();
-                       $ret['addrlist'][$ip_bin]['ip'] = $row['ip'];
-                       $ret['addrlist'][$ip_bin]['name'] = '';
-                       $ret['addrlist'][$ip_bin]['reserved'] = 'no';
-                       $ret['addrlist'][$ip_bin]['references'] = array();
-                       $ret['addrlist'][$ip_bin]['lbrefs'] = array();
-                       $ret['addrlist'][$ip_bin]['rsrefs'] = array();
-               }
-               $tmp = array();
-               foreach (array ('object_id', 'type', 'name') as $cname)
-                       $tmp[$cname] = $row[$cname];
-               $quasiobject['name'] = $row['object_name'];
-               $quasiobject['objtype_id'] = $row['objtype_id'];
-               $quasiobject['objtype_name'] = $row['objtype_name'];
-               $tmp['object_name'] = displayedName ($quasiobject);
-               $ret['addrlist'][$ip_bin]['references'][] = $tmp;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query = "select vs_id, inet_ntoa(vip) as ip, vport, proto, " .
-               "object_id, objtype_id, ro.name, dict_value as objtype_name from " .
-               "IPVirtualService as vs inner join IPLoadBalancer as lb on vs.id = lb.vs_id " .
-               "inner join RackObject as ro on lb.object_id = ro.id " .
-               "left join Dictionary on objtype_id=dict_key " .
-               "natural join Chapter " .
-               "where vip between ${db_first} and ${db_last} " .
-               "and chapter_name = 'RackObjectType'" .
-               "order by vport, proto, ro.name, object_id";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $ip_bin = ip2long ($row['ip']);
-               if (!isset ($ret['addrlist'][$ip_bin]))
-               {
-                       $ret['addrlist'][$ip_bin] = array();
-                       $ret['addrlist'][$ip_bin]['ip'] = $row['ip'];
-                       $ret['addrlist'][$ip_bin]['name'] = '';
-                       $ret['addrlist'][$ip_bin]['reserved'] = 'no';
-                       $ret['addrlist'][$ip_bin]['references'] = array();
-                       $ret['addrlist'][$ip_bin]['lbrefs'] = array();
-                       $ret['addrlist'][$ip_bin]['rsrefs'] = array();
-               }
-               $tmp = $qbject = array();
-               foreach (array ('object_id', 'vport', 'proto', 'vs_id') as $cname)
-                       $tmp[$cname] = $row[$cname];
-               foreach (array ('name', 'objtype_id', 'objtype_name') as $cname)
-                       $qobject[$cname] = $row[$cname];
-               $tmp['object_name'] = displayedName ($qobject);
-               $ret['addrlist'][$ip_bin]['lbrefs'][] = $tmp;
-       }
-       $result->closeCursor();
-       unset ($result);
-
-       $query = "select inet_ntoa(rsip) as ip, rsport, rspool_id, rsp.name as rspool_name from " .
-               "IPRealServer as rs inner join IPRSPool as rsp on rs.rspool_id = rsp.id " .
-               "where rsip between ${db_first} and ${db_last} " .
-               "order by ip, rsport, rspool_id";
-       $result = useSelectBlade ($query, __FUNCTION__);
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
-       {
-               $ip_bin = ip2long ($row['ip']);
-               if (!isset ($ret['addrlist'][$ip_bin]))
-               {
-                       $ret['addrlist'][$ip_bin] = array();
-                       $ret['addrlist'][$ip_bin]['ip'] = $row['ip'];
-                       $ret['addrlist'][$ip_bin]['name'] = '';
-                       $ret['addrlist'][$ip_bin]['reserved'] = 'no';
-                       $ret['addrlist'][$ip_bin]['references'] = array();
-                       $ret['addrlist'][$ip_bin]['lbrefs'] = array();
-                       $ret['addrlist'][$ip_bin]['rsrefs'] = array();
-               }
-               $tmp = array();
-               foreach (array ('rspool_id', 'rsport', 'rspool_name') as $cname)
-                       $tmp[$cname] = $row[$cname];
-               $ret['addrlist'][$ip_bin]['rsrefs'][] = $tmp;
-       }
-
-       return $ret;
-}
-
 // Return the id of the smallest IPv4 network containing the given IPv4 address
 // or NULL, if nothing was found.
 function getIPv4AddressNetworkId ($dottedquad)
index 165dc4e..ef58768 100644 (file)
@@ -1493,11 +1493,10 @@ function buildRouterConfig ($object_id = 0)
                        $netinfo = getIPv4Network (getIPv4AddressNetworkId ($alloc['ip']));
                        $newconfig .= sprintf
                        (
-                               "%s %s /%u 0x%08x\n",
+                               "%s %s/%u\n",
                                $alloc['name'],
                                $alloc['ip'],
-                               $netinfo['mask'],
-                               $netinfo['mask_bin']
+                               $netinfo['mask']
                        );
                }
        return $newconfig;
@@ -1526,4 +1525,21 @@ function markupIPv4AddrList (&$addrlist)
        }
 }
 
+// Scan the given address list (returned by scanIPv4Space) and return a list of all routers found.
+function findRouters ($addrlist)
+{
+       $ret = array();
+       foreach ($addrlist as $addr)
+               foreach ($addr['allocs'] as $alloc)
+                       if ($alloc['type'] == 'router')
+                               $ret[] = array
+                               (
+                                       'id' => $alloc['object_id'],
+                                       'iface' => $alloc['name'],
+                                       'dname' => $alloc['object_name'],
+                                       'addr' => $addr['ip']
+                               );
+       return $ret;
+}
+
 ?>
index 028ec8e..0ab4191 100644 (file)
@@ -140,7 +140,7 @@ function renderRow ($row_id = 0)
        echo "<table border=0 cellspacing=0 cellpadding=3 width='100%'>\n";
        echo "<tr><th width='50%' class=tdright>Racks:</th><td class=tdleft>${rowInfo['count']}</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>Units:</th><td class=tdleft>${rowInfo['sum']}</td></tr>\n";
-       echo "<tr><th width='50%' class=tdright>Utilization:</th><td class=tdleft>";
+       echo "<tr><th width='50%' class=tdright>%% used:</th><td class=tdleft>";
        renderProgressBar (getRSUforRackRow ($rackList));
        echo "</td></tr>\n";
        echo "</table><br>\n";
@@ -589,7 +589,7 @@ function renderRackInfoPortlet ($rackData)
        echo "<tr><th width='50%' class=tdright>Rack row:</th><td class=tdleft>${rackData['row_name']}</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>Name:</th><td class=tdleft>${rackData['name']}</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>Height:</th><td class=tdleft>${rackData['height']}</td></tr>\n";
-       echo "<tr><th width='50%' class=tdright>Utilization:</th><td class=tdleft>";
+       echo "<tr><th width='50%' class=tdright>%% used:</th><td class=tdleft>";
        renderProgressBar (getRSUforRack ($rackData));
        echo "</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>Objects:</th><td class=tdleft>";
@@ -1997,18 +1997,18 @@ function renderRackspaceHistory ()
        
 }
 
-function renderAddressspace ()
+function renderIPv4Space ()
 {
        global $root, $pageno;
 
        echo "<table border=0 class=objectview>\n";
        echo "<tr><td class=pcleft>";
 
-       startPortlet ('Networks');
-       echo "<table class='widetable' border=0 cellpadding=5 cellspacing=0 align='center'>\n";
        $tagfilter = getTagFilter();
        $addrspaceList = getAddressspaceList ($tagfilter, getTFMode());
-       echo "<tr><th>prefix</th><th>name/tags</th><th>utilization</th></tr>\n";
+       startPortlet ('networks (' . count ($addrspaceList) . ')');
+       echo "<table class='widetable' border=0 cellpadding=5 cellspacing=0 align='center'>\n";
+       echo "<tr><th>prefix</th><th>name/tags</th><th>%% used</th><th>routed by</th></tr>\n";
        foreach ($addrspaceList as $iprange)
        {
                $netdata = getIPv4Network ($iprange['id']);
@@ -2024,7 +2024,15 @@ function renderAddressspace ()
                }
                echo "</td><td class=tdcenter>";
                renderProgressBar ($used/$total);
-               echo "<br><small>${used}/${total}</small></td></tr>";
+               echo "<br><small>${used}/${total}</small></td><td>";
+               $newline = '';
+               foreach (findRouters ($netdata['addrlist']) as $router)
+               {
+                       echo $newline . "<a href='${root}?page=object&object_id=${router['id']}&hl_ipv4_addr=${router['addr']}'>";
+                       echo (empty ($router['iface']) ? '' : $router['iface'] . '@') . $router['dname'] . '</a>';
+                       $newline = '<br>';
+               }
+               echo "</td></tr>";
        }
        echo "</table>\n";
        finishPortlet();
@@ -2098,55 +2106,61 @@ function renderIPv4SLB ()
        finishPortlet ();
 }
 
-function renderAddNewRange ()
+function renderIPv4SpaceEditor ()
 {
        global $root, $pageno, $tabno;
        showMessageOrError();
 
        startPortlet ("Add new");
-       echo "<table class='widetable' border=0 cellpadding=10 align='center'>\n";
-       echo "<tr><th>prefix</th><th>name</th><th>connected network</th><th>assign tags</th><th>&nbsp;</th></tr>\n";
-       echo "<form name='add_new_range' action='${root}process.php'>\n";
+       echo '<table border=0 cellpadding=10 align=center>';
+       echo "<form method=post name='add_new_range' action='${root}process.php'>\n";
        echo "<input type=hidden name=op value=addIPv4Prefix>\n";
        echo "<input type=hidden name=page value='${pageno}'>\n";
        echo "<input type=hidden name=tab value='${tabno}'>\n";
-       echo "<tr valign=top><td class='tdcenter'><input type=text name='range' size=18 class='live-validate' tabindex=1></td>\n";
-       echo "<td class='tdcenter'><input type=text name='name' size='20' tabindex=2></td>\n";
-       echo "<td class='tdcenter'><input type=checkbox name='is_bcast' tabindex=3 checked></td>\n";
-       echo "<td>\n";
+       // tags column
+       echo '<tr><td rowspan=4><h3>assign tags</h3>';
        renderTagSelect();
-       echo "</td><td class=tdcenter>";
+       echo '</td>';
+       // inputs column
+       echo "<th class=tdright>prefix</th><td class=tdleft><input type=text name='range' size=18 class='live-validate' tabindex=1></td>";
+       echo "<tr><th class=tdright>name</th><td class=tdleft><input type=text name='name' size='20' tabindex=2></td></tr>";
+       echo "<tr><th class=tdright>connected network</th><td class=tdleft><input type=checkbox name='is_bcast' tabindex=3 checked></td></tr>";
+       echo "<tr><td colspan=2>";
        printImageHREF ('CREATE', 'Add a new network', TRUE, 4);
-       echo "</td></tr>\n";
+       echo '</td></tr>';
        echo "</form></table><br><br>\n";
        finishPortlet();
 
-       startPortlet ("Manage existing");
-       echo "<table class='widetable' border=0 cellpadding=5 cellspacing=0 align='center'>\n";
        $addrspaceList = getAddressspaceList();
-       echo "<tr><th>&nbsp;</th><th>prefix</th><th>name</th><th>utilization</th></tr>";
-       foreach ($addrspaceList as $iprange)
+       if (count ($addrspaceList))
        {
-               $netdata = getIPv4Network ($iprange['id']);
-               $usedips = count ($netdata['addrlist']);
-               $totalips = ($netdata['ip_bin'] | $netdata['mask_bin_inv']) - ($netdata['ip_bin'] & $netdata['mask_bin']) + 1;
-               echo "<tr valign=top><td>";
-               if ($usedips == 0)
+               startPortlet ('Manage existing (' . count ($addrspaceList) . ')');
+               echo "<table class='widetable' border=0 cellpadding=5 cellspacing=0 align='center'>\n";
+               echo "<tr><th>&nbsp;</th><th>prefix</th><th>name</th><th>&nbsp;</th></tr>";
+               foreach ($addrspaceList as $iprange)
                {
-                       echo "<a href='${root}process.php?op=delIPv4Prefix&page=${pageno}&tab=${tabno}&id=${iprange['id']}'>";
-                       printImageHREF ('delete', 'Delete this IP range');
-                       echo "</a>";
+                       $netdata = getIPv4Network ($iprange['id']);
+                       $usedips = count ($netdata['addrlist']);
+                       $totalips = ($netdata['ip_bin'] | $netdata['mask_bin_inv']) - ($netdata['ip_bin'] & $netdata['mask_bin']) + 1;
+                       echo "<form method=post action='${root}process.php?page=${pageno}&tab=${tabno}&op=updIPv4Prefix&id=${iprange['id']}'>";
+                       echo '<tr valign=top><td>';
+                       if ($usedips == 0)
+                       {
+                               echo "<a href='${root}process.php?op=delIPv4Prefix&page=${pageno}&tab=${tabno}&id=${iprange['id']}'>";
+                               printImageHREF ('delete', 'Delete this IP range');
+                               echo "</a>";
+                       }
+                       else
+                               printImageHREF ('nodelete', 'There are IP addresses allocated or reserved');
+                       echo "</td>\n<td class=tdleft>${netdata['ip']}/${netdata['mask']}</td>";
+                       echo "<td><input type=text name=name size=40 value='${netdata['name']}'>";
+                       echo "</td><td>";
+                       printImageHREF ('save', 'Save changes', TRUE);
+                       echo "</td></tr></form>\n";
                }
-               else
-                       printImageHREF ('nodelete', 'There are IP addresses allocated or reserved');
-               echo "</td>\n<td class=tdleft><a href='${root}?page=iprange&id=${iprange['id']}'>";
-               echo "${netdata['ip']}/${netdata['mask']}</a></td><td class=tdleft>${netdata['name']}";
-               echo "</td><td class=tdcenter>";
-               renderProgressBar ($usedips / $totalips);
-               echo "<br><small>${usedips}/${totalips}</small></td></tr>\n";
+               echo "</table>";
+               finishPortlet();
        }
-       echo "</table>";
-       finishPortlet();
 }
 
 function renderIPv4Network ($id)
@@ -2237,15 +2251,36 @@ function renderIPv4Network ($id)
        $total = ($range['ip_bin'] | $range['mask_bin_inv']) - ($range['ip_bin'] & $range['mask_bin']) + 1;
        $used = count ($range['addrlist']);
        echo "<table border=0 cellspacing=0 cellpadding=3 width='100%'>\n";
-       echo "<tr><th width='50%' class=tdright>Utilization:</th><td class=tdleft>";
+
+       echo "<tr><th width='50%' class=tdright>%% used:</th><td class=tdleft>";
        renderProgressBar ($used/$total);
        echo "&nbsp;${used}/${total}</td></tr>\n";
+
        echo "<tr><th width='50%' class=tdright>Netmask:</th><td class=tdleft>";
        echo $netmaskbylen[$range['mask']];
        echo "</td></tr>\n";
+
        echo "<tr><th width='50%' class=tdright>Wildcard bits:</th><td class=tdleft>";
        echo $wildcardbylen[$range['mask']];
        echo "</td></tr>\n";
+
+       $rtrs = findRouters ($range['addrlist']);
+       if (count ($rtrs))
+       {
+               $rtrclass = 'tdleft';
+               foreach ($rtrs as $rtr)
+                       if ($range['addrlist'][ip2long ($rtr['addr'])]['class'] == 'trerror')
+                               $rtrclass = 'tdleft trerror';
+               echo "<tr><th width='50%' class=tdright>Routed by:</th><td class='${rtrclass}'>";
+               $comma = '';
+               foreach ($rtrs as $rtr)
+               {
+                       echo $comma . $rtr['addr'];
+                       $comma = ', ';
+               }
+               echo "</td></tr>\n";
+       }
+
        printTagTRs ("${root}?page=ipv4space&");
        echo "</table><br>\n";
        finishPortlet();
@@ -2378,10 +2413,10 @@ function renderIPv4Address ($dottedquad)
        echo "<tr><td class=pcleft>";
        startPortlet ('summary');
        echo "<table border=0 cellspacing=0 cellpadding=3 width='100%'>\n";
-       echo "<tr><th width='50%' class=tdright>Allocations:</th><td class=tdleft>" . count ($address['bonds']) . "</td></tr>\n";
+       echo "<tr><th width='50%' class=tdright>Allocations:</th><td class=tdleft>" . count ($address['allocs']) . "</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>Originated NAT connections:</th><td class=tdleft>" . count ($address['outpf']) . "</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>Arriving NAT connections:</th><td class=tdleft>" . count ($address['inpf']) . "</td></tr>\n";
-       echo "<tr><th width='50%' class=tdright>SLB virtual services:</th><td class=tdleft>" . count ($address['vslist']) . "</td></tr>\n";
+       echo "<tr><th width='50%' class=tdright>SLB virtual services:</th><td class=tdleft>" . count ($address['lblist']) . "</td></tr>\n";
        echo "<tr><th width='50%' class=tdright>SLB real servers:</th><td class=tdleft>" . count ($address['rslist']) . "</td></tr>\n";
        printTagTRs();
        echo "</table><br>\n";
index 6a5e6c5..0f9aa90 100644 (file)
@@ -201,10 +201,11 @@ $page['ipv4space']['title'] = 'IPv4 space';
 $page['ipv4space']['parent'] = 'index';
 $tab['ipv4space']['default'] = 'Browse';
 $tab['ipv4space']['newrange'] = 'Manage';
-$tabhandler['ipv4space']['default'] = 'renderAddressspace';
-$tabhandler['ipv4space']['newrange'] = 'renderAddNewRange';
+$tabhandler['ipv4space']['default'] = 'renderIPv4Space';
+$tabhandler['ipv4space']['newrange'] = 'renderIPv4SpaceEditor';
 $ophandler['ipv4space']['newrange']['addIPv4Prefix'] = 'addIPv4Prefix';
 $ophandler['ipv4space']['newrange']['delIPv4Prefix'] = 'delIPv4Prefix';
+$ophandler['ipv4space']['newrange']['updIPv4Prefix'] = 'updIPv4Prefix';
 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['OK'] = 23;
 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR'] = 100;
 $msgcode['ipv4space']['newrange']['delIPv4Prefix']['OK'] = 24;
@@ -225,13 +226,14 @@ $tabhandler['iprange']['properties'] = 'renderIPv4NetworkProperties';
 $tabhandler['iprange']['liveptr'] = 'renderLivePTR';
 $tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
 $trigger['iprange']['tags'] = 'trigger_tags';
-$ophandler['iprange']['properties']['editRange'] = 'editRange';
+$ophandler['iprange']['properties']['editRange'] = 'updIPv4Prefix';
 $ophandler['iprange']['liveptr']['importPTRData'] = 'importPTRData';
 $ophandler['iprange']['tags']['saveTags'] = 'saveIPv4PrefixTags';
 $msgcode['iprange']['properties']['editRange']['OK'] = 25;
 $msgcode['iprange']['properties']['editRange']['ERR'] = 100;
 $msgcode['iprange']['liveptr']['importPTRData']['OK'] = 26;
 $msgcode['iprange']['liveptr']['importPTRData']['ERR'] = 141;
+$msgcode['ipv4space']['newrange']['updIPv4Prefix'] = $msgcode['iprange']['properties']['editRange'];
 
 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
 $page['ipaddress']['parent'] = 'iprange';
index 1b6c1c7..2cf9378 100644 (file)
@@ -421,7 +421,7 @@ function delIPv4Prefix ()
                return buildRedirectURL ('OK');
 }
 
-function editRange ()
+function updIPv4Prefix ()
 {
        assertUIntArg ('id', __FUNCTION__);
        assertStringArg ('name', __FUNCTION__);