DHCP client option 61 "client_id"

the existing seeting of client_id to a VPP version number was unused and so overridden

Change-Id: If9ebea936336f1fcca8d07e67186c95f8f8f0ccd
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c
index 8f033d2..25ab317 100644
--- a/src/vnet/dhcp/client.c
+++ b/src/vnet/dhcp/client.c
@@ -414,6 +414,16 @@
       o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
     }
 
+  /* send option 61, client_id */
+  if (vec_len (c->client_identifier))
+    {
+      o->option = 61;
+      o->length = vec_len (c->client_identifier);
+      clib_memcpy (o->data, c->client_identifier,
+                   vec_len (c->client_identifier));
+      o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
+    }
+
   /* $$ maybe send the client s/w version if anyone cares */
 
   /* 
@@ -838,6 +848,7 @@
 dhcp_client_config (vlib_main_t * vm,
                     u32 sw_if_index,
                     u8 * hostname,
+                    u8 * client_id,
                     u32 is_add,
                     u32 client_index,
                     void * event_callback,
@@ -854,7 +865,9 @@
   a->event_callback = event_callback;
   vec_validate(a->hostname, strlen((char *)hostname) - 1);
   strncpy((char *)a->hostname, (char *)hostname, vec_len(a->hostname));
-  a->client_identifier = format (0, "vpe 1.0%c", 0);
+  vec_validate(a->client_identifier, strlen((char *)client_id) - 1);
+  strncpy((char *)a->client_identifier, (char *)client_id, vec_len(a->client_identifier));
+
   /* 
    * Option 55 request list. These data precisely match
    * the Ubuntu dhcp client. YMMV.
diff --git a/src/vnet/dhcp/client.h b/src/vnet/dhcp/client.h
index 1f85d7c..509d5d4 100644
--- a/src/vnet/dhcp/client.h
+++ b/src/vnet/dhcp/client.h
@@ -113,6 +113,7 @@
 int dhcp_client_config (vlib_main_t * vm,
                         u32 sw_if_index,
                         u8 * hostname,
+                        u8 * client_id,
                         u32 is_add,
                         u32 client_index,
                         void *event_callback,
diff --git a/src/vnet/dhcp/dhcp.api b/src/vnet/dhcp/dhcp.api
index a280372..c632c08 100644
--- a/src/vnet/dhcp/dhcp.api
+++ b/src/vnet/dhcp/dhcp.api
@@ -61,6 +61,7 @@
     @param context - sender context, to match reply w/ request
     @param sw_if_index - index of the interface for DHCP client
     @param hostname - hostname
+    @param client_id - Client ID - option 61
     @param is_add - add the config if non-zero, else delete
     @param want_dhcp_event - DHCP event sent to the sender
            via dhcp_compl_event API message if non-zero
@@ -72,6 +73,7 @@
   u32 context;
   u32 sw_if_index;
   u8 hostname[64];
+  u8 client_id[64];
   u8 is_add;
   u8 want_dhcp_event;
   u32 pid;
diff --git a/src/vnet/dhcp/dhcp_api.c b/src/vnet/dhcp/dhcp_api.c
index 5ea9366..d6984f2 100644
--- a/src/vnet/dhcp/dhcp_api.c
+++ b/src/vnet/dhcp/dhcp_api.c
@@ -227,7 +227,8 @@
   VALIDATE_SW_IF_INDEX (mp);
 
   rv = dhcp_client_config (vm, ntohl (mp->sw_if_index),
-			   mp->hostname, mp->is_add, mp->client_index,
+			   mp->hostname, mp->client_id,
+			   mp->is_add, mp->client_index,
 			   mp->want_dhcp_event ? dhcp_compl_event_callback :
 			   NULL, mp->pid);