diff -rupN RackTables-0.17.8/inc/database.php /var/www/html/racktables/inc/database.php
--- RackTables-0.17.8/inc/database.php  2009-11-23 03:48:44.000000000 -0200
+++ /var/www/html/racktables/inc/database.php   2010-01-18 17:20:53.000000000 -0200
@@ -550,14 +550,16 @@ function getObjectPortsAndLinks ($object
        {
                $portid = $ret[$tmpkey]['id'];
                $remote_id = NULL;
-               $query = "select porta, portb from Link where porta = {$portid} or portb = ${portid}";
+               $query = "select porta, portb, cable from Link where porta = {$portid} or portb = ${portid}";
                $result = useSelectBlade ($query, __FUNCTION__);
+               $cable = "CableID n/a";
                if ($row = $result->fetch (PDO::FETCH_ASSOC))
                {
                        if ($portid != $row['porta'])
                                $remote_id = $row['porta'];
                        elseif ($portid != $row['portb'])
                                $remote_id = $row['portb'];
+                       $cable = $row['cable'];
                }
                unset ($result);
                if ($remote_id) // there's a remote end here
@@ -568,6 +570,7 @@ function getObjectPortsAndLinks ($object
                        {
                                $ret[$tmpkey]['remote_name'] = $row['name'];
                                $ret[$tmpkey]['remote_object_id'] = $row['object_id'];
+                               $ret[$tmpkey]['cableid'] = $cable;
                        }
                        $ret[$tmpkey]['remote_id'] = $remote_id;
                        unset ($result);
@@ -1089,7 +1092,7 @@ function getAllIPv4Allocations ()
        return $ret;
 }

-function linkPorts ($porta, $portb)
+function linkPorts ($porta, $portb, $cable="")
 {
        if ($porta == $portb)
                return "Ports can't be the same";
@@ -1100,7 +1103,7 @@ function linkPorts ($porta, $portb)
                $portb = $tmp;
        }
        global $dbxlink;
-       $query1 = "insert into Link set porta='${porta}', portb='{$portb}'";
+       $query1 = "insert into Link set porta='${porta}', portb='{$portb}', cable='{$cable}'";
        $query2 = "update Port set reservation_comment = NULL where id = ${porta} or id = ${portb} limit 2";
        // FIXME: who cares about the return value?
        $result = $dbxlink->exec ($query1);
diff -rupN RackTables-0.17.8/inc/interface.php /var/www/html/racktables/inc/interface.php
--- RackTables-0.17.8/inc/interface.php 2009-12-07 09:34:36.000000000 -0200
+++ /var/www/html/racktables/inc/interface.php  2010-01-18 17:30:32.000000000 -0200
@@ -860,7 +860,8 @@ function renderRackObject ($object_id)
                echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>";
                echo '<tr><th class=tdleft>Local name</th><th class=tdleft>Visible label</th>';
                echo '<th class=tdleft>Interface</th><th class=tdleft>L2 address</th>';
-               echo '<th class=tdcenter colspan=2>Remote object and port</th></tr>';
+               echo '<th class=tdcenter colspan=2>Remote object and port</th>';
+               echo '<th class=tdleft>Cable ID</th></tr>';
                foreach ($info['ports'] as $port)
                {
                        echo '<tr';
@@ -875,6 +876,7 @@ function renderRackObject ($object_id)
                                $remote_object = spotEntity ('object', $port['remote_object_id']);
                                echo "<td class=tdleft><a href='".makeHref(array('page'=>'object', 'object_id'=>$port['remote_object_id'], 'hl_port_id'=>$port['remote_id']))."'>${remote_object['dname']}</a></td>";
                                echo "<td class=tdleft>${port['remote_name']}</td>";
+                               echo "<td class=tdleft>${port['cableid']}</td>";
                        }
                        elseif (strlen ($port['reservation_comment']))
                        {
@@ -1109,7 +1111,7 @@ function renderPortsForObject ($object_i
        amplifyCell ($object);
        echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>\n";
        echo "<tr><th>&nbsp;</th><th class=tdleft>Local name</th><th class=tdleft>Visible label</th><th class=tdleft>Interface</th><th class=tdleft>L2 address</th>";
-       echo "<th class=tdcenter colspan=2>Remote object and port</th><th class=tdcenter>(Un)link or (un)reserve</th><th>&nbsp;</th></tr>\n";
+       echo "<th class=tdcenter colspan=2>Cable, Remote object and port</th><th class=tdcenter>(Un)link or (un)reserve</th><th>&nbsp;</th></tr>\n";
        if (getConfigVar ('ADDNEW_AT_TOP') == 'yes')
                printNewItemTR ($prefs);
        foreach ($object['ports'] as $port)
@@ -1143,7 +1145,7 @@ function renderPortsForObject ($object_i
                if ($port['remote_object_id'])
                {
                        $remote_object = spotEntity ('object', $port['remote_object_id']);
-                       echo "<td><a href='".makeHref(array('page'=>'object', 'object_id'=>$port['remote_object_id']))."'>${remote_object['dname']}</a></td>";
+                       echo "<td>${port['cableid']}&nbsp;<a href='".makeHref(array('page'=>'object', 'object_id'=>$port['remote_object_id']))."'>${remote_object['dname']}</a></td>";
                        echo "<td>${port['remote_name']}</td>";
                        echo "<td class=tdcenter><a href='".
                                makeHrefProcess(array(
diff -rupN RackTables-0.17.8/inc/ophandlers.php /var/www/html/racktables/inc/ophandlers.php
--- RackTables-0.17.8/inc/ophandlers.php        2009-11-23 03:48:44.000000000 -0200
+++ /var/www/html/racktables/inc/ophandlers.php 2010-01-18 17:49:36.000000000 -0200
@@ -192,9 +192,11 @@ function linkPortForObject ()
 {
        assertUIntArg ('port_id', __FUNCTION__);
        assertUIntArg ('remote_port_id', __FUNCTION__);
+       assertStringArg ('cable', __FUNCTION__, TRUE);
+

        // FIXME: ensure, that at least one of these ports belongs to the current object
-       $error = linkPorts ($_REQUEST['port_id'], $_REQUEST['remote_port_id']);
+       $error = linkPorts ($_REQUEST['port_id'], $_REQUEST['remote_port_id'], $_REQUEST['cable']);
        if ($error != '')
                return buildRedirectURL (__FUNCTION__, 'ERR', array ($error));
        $local_port_info = getPortInfo ($_REQUEST['port_id']);
@@ -2006,3 +2008,4 @@ function delPortOIFCompat ()
 }

 ?>
+
diff -rupN RackTables-0.17.8/popup.php /var/www/html/racktables/popup.php
--- RackTables-0.17.8/popup.php 2009-11-09 06:59:26.000000000 -0200
+++ /var/www/html/racktables/popup.php  2010-01-18 17:34:34.000000000 -0200
@@ -92,10 +92,12 @@ function findSparePorts ($port_id, $only
                        }
                        $spare_ports = findSparePorts ($port_id, $only_racks);
                        printSelect ($spare_ports, array ('name' => 'ports', 'id' => 'ports', 'size' => getConfigVar ('MAXSELSIZE')));
-                       echo '<br><br>';
+                       echo '<br>';
+                       echo "Cable ID: <input type=text id=cable>";
+                       echo '<br>';
                        echo "<input type='submit' value='Link' onclick='".
                        "if (getElementById(\"ports\").value != \"\") {".
-                       "       opener.location=\"process.php?page=object&tab=ports&op=linkPort&object_id=${port_info['object_id']}&port_id=$port_id&remote_port_id=\"+getElementById(\"ports\").value; ".
+                       "       opener.location=\"process.php?page=object&tab=ports&op=linkPort&object_id=${port_info['object_id']}&port_id=$port_id&remote_port_id=\"+getElementById(\"ports\").value+\"&cable=\"+getElementById(\"cable\").value; ".
                        "       window.close();}'>";
                        echo '</form></div>';
                        break;
