r1940 + align allocations table according to the current style
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 3 Jun 2008 15:08:08 +0000 (15:08 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 3 Jun 2008 15:08:08 +0000 (15:08 +0000)
+ give IPv4 address allocation handlers an overhaul
+ handle reservation release (new UI option)
+ cleanups here and there

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

index 7b66046..e9e1d84 100644 (file)
@@ -839,7 +839,6 @@ function getObjectAddressesAndNames ()
        return $ret;
 }
 
        return $ret;
 }
 
-
 function getEmptyPortsOfType ($type_id)
 {
        $query =
 function getEmptyPortsOfType ($type_id)
 {
        $query =
@@ -1047,13 +1046,12 @@ function updateRange ($id=0, $name='')
                "update IPRanges set name='$name' where id='$id'";
        $result = $dbxlink->exec ($query);
        return '';
                "update IPRanges set name='$name' where id='$id'";
        $result = $dbxlink->exec ($query);
        return '';
-       
 }
 
 // This function is actually used not only to update, but also to create records,
 // that's why ON DUPLICATE KEY UPDATE was replaced by DELETE-INSERT pair
 // (MySQL 4.0 workaround).
 }
 
 // This function is actually used not only to update, but also to create records,
 // that's why ON DUPLICATE KEY UPDATE was replaced by DELETE-INSERT pair
 // (MySQL 4.0 workaround).
-function updateAddress ($ip=0, $name='', $reserved='no')
+function updateAddress ($ip = 0, $name = '', $reserved = 'no')
 {
        // DELETE may safely fail.
        $r = useDeleteBlade ('IPAddress', 'ip', "INET_ATON('${ip}')", FALSE);
 {
        // DELETE may safely fail.
        $r = useDeleteBlade ('IPAddress', 'ip', "INET_ATON('${ip}')", FALSE);
@@ -1063,7 +1061,7 @@ function updateAddress ($ip=0, $name='', $reserved='no')
        if (useInsertBlade ('IPAddress', array ('name' => "'${name}'", 'reserved' => "'${reserved}'", 'ip' => "INET_ATON('${ip}')")))
                return '';
        else
        if (useInsertBlade ('IPAddress', array ('name' => "'${name}'", 'reserved' => "'${reserved}'", 'ip' => "INET_ATON('${ip}')")))
                return '';
        else
-               return 'useInsertBlade() failed in updateAddress()';
+               return __FUNCTION__ . '(): useInsertBlade() failed';
 }
 
 // FIXME: This function doesn't wipe relevant records from IPAddress table.
 }
 
 // FIXME: This function doesn't wipe relevant records from IPAddress table.
index 16e83ba..dc70bc5 100644 (file)
@@ -635,7 +635,7 @@ function getIPRange ($id = 0)
 // Don't require any records in IPAddress, but if there is one,
 // merge the data between getting allocation list. Collect enough data
 // to call displayedName() ourselves.
 // Don't require any records in IPAddress, but if there is one,
 // merge the data between getting allocation list. Collect enough data
 // to call displayedName() ourselves.
-function getIPAddress ($ip=0)
+function getIPAddress ($ip = 0)
 {
        $ret = array();
        $ret['bonds'] = array();
 {
        $ret = array();
        $ret['bonds'] = array();
@@ -647,18 +647,12 @@ function getIPAddress ($ip=0)
        $ret['exists'] = 0;
        $ret['name'] = '';
        $ret['reserved'] = 'no';
        $ret['exists'] = 0;
        $ret['name'] = '';
        $ret['reserved'] = 'no';
-       global $dbxlink;
        $query =
                "select ".
                "name, reserved ".
                "from IPAddress ".
                "where ip = INET_ATON('$ip') and (reserved = 'yes' or name != '')";
        $query =
                "select ".
                "name, reserved ".
                "from IPAddress ".
                "where ip = INET_ATON('$ip') and (reserved = 'yes' or name != '')";
-       $result = $dbxlink->query ($query);
-       if ($result == NULL)
-       {
-               showError ('Query #1 failed', __FUNCTION__);
-               return NULL;
-       }
+       $result = useSelectBlade ($query);
        if ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
                $ret['exists'] = 1;
        if ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
                $ret['exists'] = 1;
@@ -680,7 +674,7 @@ function getIPAddress ($ip=0)
                "where IPBonds.ip=INET_ATON('$ip') ".
                "and chapter_name = 'RackObjectType' " .
                "order by RackObject.id, IPBonds.name";
                "where IPBonds.ip=INET_ATON('$ip') ".
                "and chapter_name = 'RackObjectType' " .
                "order by RackObject.id, IPBonds.name";
-       $result = $dbxlink->query ($query);
+       $result = useSelectBlade ($query);
        $count=0;
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
        $count=0;
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
@@ -699,7 +693,7 @@ function getIPAddress ($ip=0)
        unset ($result);
 
        $query = "select id, vport, proto, name from IPVirtualService where vip = inet_aton('${ip}')";
        unset ($result);
 
        $query = "select id, vport, proto, name from IPVirtualService where vip = inet_aton('${ip}')";
-       $result = $dbxlink->query ($query);
+       $result = useSelectBlade ($query);
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
                $new = $row;
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
                $new = $row;
@@ -712,7 +706,7 @@ function getIPAddress ($ip=0)
        $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}')";
        $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 = $dbxlink->query ($query);
+       $result = useSelectBlade ($query);
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
                $new = $row;
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
        {
                $new = $row;
@@ -725,11 +719,11 @@ function getIPAddress ($ip=0)
        return $ret;
 }
        
        return $ret;
 }
        
-function bindIpToObject ($ip='', $object_id=0, $name='', $type='')
+function bindIpToObject ($ip = '', $object_id = 0, $name = '', $type = '')
 {
        global $dbxlink;
 
 {
        global $dbxlink;
 
-       $range = getRangeByIp($ip);
+       $range = getRangeByIp ($ip);
        if (!$range)
                return 'Non-existant ip address. Try adding IP range first';
 
        if (!$range)
                return 'Non-existant ip address. Try adding IP range first';
 
@@ -744,7 +738,7 @@ function bindIpToObject ($ip='', $object_id=0, $name='', $type='')
                        'type' => "'${type}'"
                )
        );
                        'type' => "'${type}'"
                )
        );
-       return $result ? '' : 'useInsertBlade() failed in bindIpToObject()';
+       return $result ? '' : (__FUNCTION__ . '(): useInsertBlade() failed');
 }
 
 // This function looks up 'has_problems' flag for 'T' atoms
 }
 
 // This function looks up 'has_problems' flag for 'T' atoms
index 64df4ac..21b2ed0 100644 (file)
@@ -1169,10 +1169,10 @@ function renderNetworkForObject ($object_id=0)
                echo "<form action='process.php'>";
                echo "<input type=hidden name=page value='${pageno}'>\n";
                echo "<input type=hidden name=tab value='${tabno}'>\n";
                echo "<form action='process.php'>";
                echo "<input type=hidden name=page value='${pageno}'>\n";
                echo "<input type=hidden name=tab value='${tabno}'>\n";
-               echo "<input type=hidden name=op value=editAddressFromObject>";
+               echo "<input type=hidden name=op value=updIPv4Allocation>";
                echo "<input type=hidden name=object_id value='$object_id'>";
                echo "<input type=hidden name=ip value='${addr['ip']}'>";
                echo "<input type=hidden name=object_id value='$object_id'>";
                echo "<input type=hidden name=ip value='${addr['ip']}'>";
-               echo "<tr class='$class'><td><a href='process.php?op=delAddrFObj&page=${pageno}&tab=${tabno}&ip=${addr['ip']}&object_id=$object_id'>";
+               echo "<tr class='$class'><td><a href='process.php?op=delIPv4Allocation&page=${pageno}&tab=${tabno}&ip=${addr['ip']}&object_id=$object_id'>";
                printImageHREF ('delete', 'Delete this IPv4 address');
                echo "</a></td>";
                echo "<td class=tdleft><input type='text' name='bond_name' value='${addr['name']}' size=10></td>";
                printImageHREF ('delete', 'Delete this IPv4 address');
                echo "</a></td>";
                echo "<td class=tdleft><input type='text' name='bond_name' value='${addr['name']}' size=10></td>";
@@ -1243,13 +1243,13 @@ function renderNetworkForObject ($object_id=0)
        echo "<form action='${root}process.php'><tr><td>";
        printImageHREF ('add', 'Allocate new address', TRUE, 99);
        echo "</td><td class=tdleft>";
        echo "<form action='${root}process.php'><tr><td>";
        printImageHREF ('add', 'Allocate new address', TRUE, 99);
        echo "</td><td class=tdleft>";
-       echo "<input type='text' size='10' name='name' tabindex=100></td>\n";
+       echo "<input type='text' size='10' name='bond_name' tabindex=100></td>\n";
        echo "<input type=hidden name=page value='${pageno}'>\n";
        echo "<input type=hidden name=tab value='${tabno}'>\n";
        echo "<input type=hidden name=page value='${pageno}'>\n";
        echo "<input type=hidden name=tab value='${tabno}'>\n";
-       echo "<input type=hidden name=op value=addAddrFObj>\n";
+       echo "<input type=hidden name=op value=addIPv4Allocation>\n";
        echo "<input type=hidden name=object_id value='$object_id'>\n";
        echo "<td class=tdleft><input type=text name='ip' tabindex=101>\n";
        echo "<input type=hidden name=object_id value='$object_id'>\n";
        echo "<td class=tdleft><input type=text name='ip' tabindex=101>\n";
-       echo "</td><td>&nbsp;</td><td><select name='type' tabindex=102>";
+       echo "</td><td>&nbsp;</td><td><select name='bond_type' tabindex=102>";
        echo "<option value='regular'>Regular</option>";
        echo "<option value='virtual'>Virtual</option>";
        echo "<option value='shared'>Shared</option>";
        echo "<option value='regular'>Regular</option>";
        echo "<option value='virtual'>Virtual</option>";
        echo "<option value='shared'>Shared</option>";
@@ -2279,7 +2279,7 @@ function renderIPAddressAssignment ()
 
 
        echo "<table class='widetable' cesspadding=5 cellspacing=0 border=0 align='center'>\n";
 
 
        echo "<table class='widetable' cesspadding=5 cellspacing=0 border=0 align='center'>\n";
-       echo "<tr><th>&nbsp;</th><th>Object name</th><th>Interface name</th><th>Interface type</th><th>&nbsp;</th></tr>\n";
+       echo "<tr><th>&nbsp;</th><th>object name</th><th>object interface</th><th>allocation type</th><th>&nbsp;</th></tr>\n";
 
        $numshared = countRefsOfType($address['bonds'], 'shared', 'eq');
        $numreg = countRefsOfType($address['bonds'], 'regular', 'eq');
 
        $numshared = countRefsOfType($address['bonds'], 'shared', 'eq');
        $numreg = countRefsOfType($address['bonds'], 'regular', 'eq');
@@ -2300,12 +2300,12 @@ function renderIPAddressAssignment ()
        foreach ($address['bonds'] as $bond)
        {
                echo "<tr class='$class'><form action='process.php'>";
        foreach ($address['bonds'] as $bond)
        {
                echo "<tr class='$class'><form action='process.php'>";
-               echo "<input type=hidden name=op value='editBondForAddress'>";
+               echo "<input type=hidden name=op value='updIPv4Allocation'>";
                echo "<input type=hidden name=page value='${pageno}'>";
                echo "<input type=hidden name=tab value='${tabno}'>";
                echo "<input type=hidden name=ip value='$ip'>";
                echo "<input type=hidden name=object_id value='${bond['object_id']}'>";
                echo "<input type=hidden name=page value='${pageno}'>";
                echo "<input type=hidden name=tab value='${tabno}'>";
                echo "<input type=hidden name=ip value='$ip'>";
                echo "<input type=hidden name=object_id value='${bond['object_id']}'>";
-               echo "<td><a href='process.php?op=delIpAssignment&page=${pageno}&tab=${tabno}&ip=$ip&object_id=${bond['object_id']}'>";
+               echo "<td><a href='process.php?op=delIPv4Allocation&page=${pageno}&tab=${tabno}&ip=$ip&object_id=${bond['object_id']}'>";
                printImageHREF ('delete', 'Unallocate address');
                echo "</a></td>";
                echo "<td><a href='${root}?page=object&object_id=${bond['object_id']}'>${bond['object_name']}</td>";
                printImageHREF ('delete', 'Unallocate address');
                echo "</a></td>";
                echo "<td><a href='${root}?page=object&object_id=${bond['object_id']}'>${bond['object_name']}</td>";
@@ -2329,13 +2329,17 @@ function renderIPAddressAssignment ()
                                echo "<option value='shared'>Shared</option>";
                                break;
                }
                                echo "<option value='shared'>Shared</option>";
                                break;
                }
-               echo "</select></td><td><input type='submit' value='OK'></td></form></tr>\n";
+               echo "</select></td><td>";
+               printImageHREF ('save', 'Save changes', TRUE);
+               echo "</td></form></tr>\n";
        }
        }
-       echo "<form action='process.php'><input type='hidden' name='op' value='bindObjectToIp'>";
+       echo "<form action='process.php'><input type='hidden' name='op' value='addIPv4Allocation'>";
        echo "<input type=hidden name=page value='${pageno}'>\n";
        echo "<input type=hidden name=tab value='${tabno}'>\n";
        echo "<input type='hidden' name='ip' value='$ip'>";
        echo "<input type=hidden name=page value='${pageno}'>\n";
        echo "<input type=hidden name=tab value='${tabno}'>\n";
        echo "<input type='hidden' name='ip' value='$ip'>";
-       echo "<td colspan=2><select name='object_id'>";
+       echo "<td>";
+       printImageHREF ('add', 'new allocation', TRUE);
+       echo "</td><td><select name='object_id'>";
 
        foreach (explode (',', getConfigVar ('IPV4_PERFORMERS')) as $type) 
                foreach (getObjectList ($type) as $object)
 
        foreach (explode (',', getConfigVar ('IPV4_PERFORMERS')) as $type) 
                foreach (getObjectList ($type) as $object)
@@ -2343,7 +2347,7 @@ function renderIPAddressAssignment ()
 
        echo "</select></td><td><input type='text' name='bond_name' value='' size=10></td>";
        echo "<td><select name='bond_type'><option value='regular'>Regular</option><option value='virtual'>Virtual</option><option value='shared'>Shared</option></select></td>";
 
        echo "</select></td><td><input type='text' name='bond_name' value='' size=10></td>";
        echo "<td><select name='bond_type'><option value='regular'>Regular</option><option value='virtual'>Virtual</option><option value='shared'>Shared</option></select></td>";
-       echo "<td><input type='submit' value='Assign address'></td></form></tr>";
+       echo "<td>&nbsp;</td></form></tr>";
        echo "</table><br><br>";
 
 }
        echo "</table><br><br>";
 
 }
index 763e81d..34de28f 100644 (file)
@@ -115,9 +115,9 @@ $ophandler['object']['ports']['linkPort'] = 'linkPortForObject';
 $ophandler['object']['ports']['unlinkPort'] = 'unlinkPortForObject';
 $ophandler['object']['ports']['addMultiPorts'] = 'addMultiPorts';
 $ophandler['object']['ports']['useup'] = 'useupPort';
 $ophandler['object']['ports']['unlinkPort'] = 'unlinkPortForObject';
 $ophandler['object']['ports']['addMultiPorts'] = 'addMultiPorts';
 $ophandler['object']['ports']['useup'] = 'useupPort';
-$ophandler['object']['network']['editAddressFromObject'] = 'editAddressFromObject';
-$ophandler['object']['network']['addAddrFObj'] = 'addAddressToObject';
-$ophandler['object']['network']['delAddrFObj'] = 'delAddressFromObject';
+$ophandler['object']['network']['updIPv4Allocation'] = 'updIPv4Allocation';
+$ophandler['object']['network']['addIPv4Allocation'] = 'addIPv4Allocation';
+$ophandler['object']['network']['delIPv4Allocation'] = 'delIPv4Allocation';
 $ophandler['object']['edit']['del'] = 'resetAttrValue';
 $ophandler['object']['edit']['upd'] = 'updateAttrValues';
 $ophandler['object']['portfwrd']['forwardPorts'] = 'addPortForwarding';
 $ophandler['object']['edit']['del'] = 'resetAttrValue';
 $ophandler['object']['edit']['upd'] = 'updateAttrValues';
 $ophandler['object']['portfwrd']['forwardPorts'] = 'addPortForwarding';
@@ -166,9 +166,9 @@ $tabhandler['ipaddress']['default'] = 'renderIPAddress';
 $tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
 $tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
 $tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
 $tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
-$ophandler['ipaddress']['assignment']['delIpAssignment'] = 'delIpAssignment';
-$ophandler['ipaddress']['assignment']['editBondForAddress'] = 'editIpAssignment';
-$ophandler['ipaddress']['assignment']['bindObjectToIp'] = 'addIpAssignment';
+$ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
+$ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
+$ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
 
 $page['ipv4slb']['title'] = 'IPv4 SLB';
 $page['ipv4slb']['parent'] = 'index';
 
 $page['ipv4slb']['title'] = 'IPv4 SLB';
 $page['ipv4slb']['parent'] = 'index';
index a11b4ac..5c90aa0 100644 (file)
@@ -406,96 +406,65 @@ http://www.cisco.com/en/US/products/hw/routers/ps274/products_tech_note09186a008
                urlencode("Added ${added_count} ports, updated ${updated_count} ports, encountered ${error_count} errors.");
 }
 
                urlencode("Added ${added_count} ports, updated ${updated_count} ports, encountered ${error_count} errors.");
 }
 
-function editAddressFromObject ()
+function updIPv4Allocation ()
 {
 {
-       global $root;
-
-       $ip = $_REQUEST['ip'];
-       $object_id = $_REQUEST['object_id'];
-       $name = $_REQUEST['bond_name'];
-       $type = $_REQUEST['bond_type'];
-       $error = updateBond($ip, $object_id, $name, $type);
-       if ($error != '')
-       {
-               return "${root}?page=object&tab=network&object_id=$object_id&error=".urlencode($error);
-       }
-       else
-       {
-               return "${root}?page=object&tab=network&object_id=$object_id&message=".urlencode("Interface successfully updated");
-       }
-}
-
-function delAddressFromObject ()
-{
-       global $root;
+       global $root, $pageno, $tabno, $page;
+       assertIPv4Arg ('ip', __FUNCTION__);
+       assertUIntArg ('object_id', __FUNCTION__);
+       assertStringArg ('bond_name', __FUNCTION__, TRUE);
+       assertStringArg ('bond_type', __FUNCTION__);
 
 
-       $ip = $_REQUEST['ip'];
-       $object_id = $_REQUEST['object_id'];
-       $error = unbindIpFromObject($ip, $object_id);
+       $error = updateBond ($_REQUEST['ip'], $_REQUEST['object_id'], $_REQUEST['bond_name'], $_REQUEST['bond_type']);
+       $bpname = $page[$pageno]['bypass'];
+       $baseurl = "${root}?page=${pageno}&tab=${tabno}&${bpname}=" . $_REQUEST[$bpname];
        if ($error != '')
        if ($error != '')
-       {
-               return "${root}?page=object&tab=network&object_id=$object_id&error=".urlencode($error);
-       }
+               return "${baseurl}&error=" . urlencode ($error);
        else
        else
-       {
-               return "${root}?page=object&tab=network&object_id=$object_id&message=".urlencode("Interface successfully deleted");
-       }
+               return "${baseurl}&message=" . urlencode ("allocation updated");
 }
 
 }
 
-function delIpAssignment ()
+function delIPv4Allocation ()
 {
 {
-       global $root;
+       global $root, $pageno, $tabno, $page;
+       assertIPv4Arg ('ip', __FUNCTION__);
+       assertUIntArg ('object_id', __FUNCTION__);
 
 
-       $ip = $_REQUEST['ip'];
-       $object_id = $_REQUEST['object_id'];
-       $error = unbindIpFromObject($ip, $object_id);
+       $error = unbindIpFromObject ($_REQUEST['ip'], $_REQUEST['object_id']);
+       $bpname = $page[$pageno]['bypass'];
+       $baseurl = "${root}?page=${pageno}&tab=${tabno}&${bpname}=" . $_REQUEST[$bpname];
        if ($error != '')
        if ($error != '')
-       {
-               return "${root}?page=ipaddress&tab=assignment&ip=$ip&error=".urlencode($error);
-       }
+               return "${baseurl}&error=" . urlencode ($error);
        else
        else
-       {
-               return "${root}?page=ipaddress&tab=assignment&ip=$ip&message=".urlencode("Interface successfully deleted");
-       }
+               return "${baseurl}&message=" . urlencode ("deallocated");
 }
 
 }
 
-function editIpAssignment ()
+function addIPv4Allocation ()
 {
 {
-       global $root;
+       global $root, $pageno, $tabno, $page;
 
 
-       $ip = $_REQUEST['ip'];
-       $object_id = $_REQUEST['object_id'];
-       $name = $_REQUEST['bond_name'];
-       $type = $_REQUEST['bond_type'];
-       $error = updateBond($ip, $object_id, $name, $type);
-
-       if ($error != '')
-       {
-               return "${root}?page=ipaddress&tab=assignment&ip=$ip&error=".urlencode($error);
-       }
-       else
+       assertIPv4Arg ('ip', __FUNCTION__);
+       assertUIntArg ('object_id', __FUNCTION__);
+       assertStringArg ('bond_name', __FUNCTION__, TRUE);
+       assertStringArg ('bond_type', __FUNCTION__);
+       // Strip masklen.
+       $ip = ereg_replace ('/[[:digit:]]+$', '', $_REQUEST['ip']);
+       $error = bindIpToObject ($ip, $_REQUEST['object_id'], $_REQUEST['bond_name'], $_REQUEST['bond_type']);
+       $address = getIPAddress ($ip);
+       if ($address['exists'] and ($address['reserved'] == 'yes' or strlen ($address['name']) > 0))
        {
        {
-               return "${root}?page=ipaddress&tab=assignment&ip=$ip&message=".urlencode("Interface successfully updated");
+               $release = getConfigVar ('IPV4_AUTO_RELEASE');
+               if ($release >= 1)
+                       $address['reserved'] = 'no';
+               if ($release >= 2)
+                       $address['name'] = '';
+               updateAddress ($ip, $address['name'], $address['reserved']);
        }
        }
-}
-
-function addIpAssignment ()
-{
-       global $root;
-
-       $ip = $_REQUEST['ip'];
-       $object_id = $_REQUEST['object_id'];
-       $name = $_REQUEST['bond_name'];
-       $type = $_REQUEST['bond_type'];
-       $error = bindIpToObject($ip, $object_id, $name, $type);
+       $bpname = $page[$pageno]['bypass'];
+       $baseurl = "${root}?page=${pageno}&tab=${tabno}&${bpname}=" . $_REQUEST[$bpname];
        if ($error != '')
        if ($error != '')
-       {
-               return "${root}?page=ipaddress&tab=assignment&ip=$ip&error=".urlencode($error);
-       }
+               return "${baseurl}&error=" . urlencode ($error);
        else
        else
-       {
-               return "${root}?page=ipaddress&tab=assignment&ip=$ip&message=".urlencode("Interface successfully added");
-       }
+               return "${baseurl}&message=" . urlencode ("allocated");
 }
 
 function addNewRange ()
 }
 
 function addNewRange ()
@@ -576,25 +545,6 @@ function editAddress ()
 
 }
 
 
 }
 
-function addAddressToObject ()
-{
-       global $root, $pageno, $tabno;
-
-       assertStringArg ('ip', __FUNCTION__);
-       assertUIntArg ('object_id', __FUNCTION__);
-       assertStringArg ('name', __FUNCTION__, TRUE);
-       assertStringArg ('type', __FUNCTION__);
-       // Strip masklen.
-       $ip = ereg_replace ('/[[:digit:]]+$', '', $_REQUEST['ip']);
-       $object_id = $_REQUEST['object_id'];
-       $error = bindIpToObject($ip, $object_id, $_REQUEST['name'], $_REQUEST['type']);
-       if ($error != '')
-               return "${root}?page=${pageno}&tab=${tabno}&object_id=${object_id}&error=".urlencode($error);
-       else
-               return "${root}?page=$pageno&tab=${tabno}&object_id=${object_id}&message=".
-                       urlencode("Address ${ip} was added successfully.");
-}
-
 function createUserAccount ()
 {
        global $root, $pageno, $tabno;
 function createUserAccount ()
 {
        global $root, $pageno, $tabno;