[ofw] patch: allow dhcp to work also when the guids are not matched by the GUID to Mac algorithm

Tzachi Dar tzachid at mellanox.co.il
Mon Mar 2 06:02:40 PST 2009


This patch allows DHCP to also work with an arbitrary GUID.
 
Please note that this patch doesn't change the client identifier that is
being transferred on the wire.
 
What it does is change the client identifier that is being passed to
windows. Instead of passing the Mac address that we have been able to
create from the GUID, it passes the GUID itself (which is always
unique). Please note that for guids that didn't pass our algorithm we
used to pass a number that could change from time to time. Now we pass
the GUID itself which remains after reboots.
 
Patch was tested on 2003 and 2008.
 
One thing that I have found out was that in the function
__send_mgr_filter_dhcp there was one case in which windows was sending
us a client id which is not in the format that we have expected. I'm not
sure if our handling of this is correct, and I have marked this with an
assert to see if it ever happens.
 
Thanks
Tzachi
 
Index: ipoib_port.c
===================================================================
--- ipoib_port.c (revision 4004)
+++ ipoib_port.c (working copy)
@@ -2219,7 +2219,6 @@
  dhcp_pkt_t   *p_dhcp;
  uint8_t    *p_option;
  uint8_t    *p_cid = NULL;
- ib_gid_t   gid;
  uint8_t    msg = 0;
 
  IPOIB_ENTER( IPOIB_DBG_RECV );
@@ -2340,18 +2339,14 @@
    * accesses to the contents.
    * Recover CID to standard type.
    */
-  cl_memcpy( &gid, &p_cid[7], sizeof(ib_gid_t) );
-  p_cid[1] =  HW_ADDR_LEN +1;// CID length 
-  p_cid[2] =  DHCP_HW_TYPE_ETH;// CID type 
-  status = ipoib_mac_from_guid( gid.unicast.interface_id,
p_port->p_adapter->params.guid_mask, (mac_addr_t*)&p_cid[3] );
-  if (status == IB_INVALID_GUID_MASK)
-  {
-   IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,
-    ("Invalid GUID mask received, rejecting it") );
-   ipoib_create_log(p_port->p_adapter->h_adapter, GUID_MASK_LOG_INDEX,
EVENT_IPOIB_WRONG_PARAMETER_WRN);
-   status = IB_SUCCESS;
-  }
-  p_cid[HW_ADDR_LEN + 3] = DHCP_OPT_END; //terminate tag
+
+  CL_ASSERT(sizeof(ib_net64_t) == 8);
+
+  p_cid[1] =  sizeof (ib_net64_t) + 1;// CID length 
+  p_cid[2] =  DHCP_HW_TYPE_ETH;// CID type
+  RtlMoveMemory( &p_cid[3], &p_cid[15], sizeof (ib_net64_t) );
+  RtlFillMemory(&p_cid[11], 12, 0);
+  p_cid[sizeof (ib_net64_t) + 3] = DHCP_OPT_END; //terminate tag 
  }
  IPOIB_EXIT( IPOIB_DBG_RECV );
  return status;
@@ -3613,6 +3608,7 @@
    }
    else
    {
+    ASSERT(FALSE); // Do we ever reach here? does it work correct?
     p_cid[2] = DHCP_HW_TYPE_IB;
    }
   }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090302/4e95cb4d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhcp.diff
Type: application/octet-stream
Size: 1598 bytes
Desc: dhcp.diff
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090302/4e95cb4d/attachment.obj>


More information about the ofw mailing list