DHCP complete event sends mask length 72/7472/1
authorNeale Ranns <nranns@cisco.com>
Thu, 6 Jul 2017 08:39:05 +0000 (01:39 -0700)
committerNeale Ranns <nranns@cisco.com>
Thu, 6 Jul 2017 20:52:58 +0000 (20:52 +0000)
Change-Id: I4a529dfab5d0ce6b0bbc0ccbbd89c6b109dbf917
Signed-off-by: Neale Ranns <nranns@cisco.com>
src/vnet/dhcp/client.c
src/vnet/dhcp/dhcp.api
src/vnet/dhcp/dhcp_api.c

index 7c3f7f6..014f17a 100644 (file)
@@ -194,7 +194,7 @@ int dhcp_client_for_us (u32 bi, vlib_buffer_t * b,
       /* OK, we own the address (etc), add to the routing table(s) */
       if (c->state == DHCP_REQUEST)
         {
-          void (*fp)(u32, u32, u8 *, u8, u8 *, u8 *, u8 *) = c->event_callback;
+          void (*fp)(u32, u32, u8 *, u8, u8, u8 *, u8 *, u8 *) = c->event_callback;
 
           dhcp_client_acquire_address (dcm, c);
 
@@ -236,6 +236,7 @@ int dhcp_client_for_us (u32 bi, vlib_buffer_t * b,
             (*fp) (c->client_index,  /* clinet index */
                    c->pid,
                    c->hostname,
+                   c->subnet_mask_width,
                    0, /* is_ipv6 */
                    (u8 *)&c->leased_address,  /* host IP address */
                    (u8 *)&c->router_address,  /* router IP address */
index eb0b070..a280372 100644 (file)
@@ -81,6 +81,7 @@ autoreply define dhcp_client_config
     @param client_index - opaque cookie to identify the sender
     @param pid - client pid registered to receive notification
     @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+    @param mask_width - The length of the subnet mask assigned
     @param host_address - Host IP address
     @param router_address - Router IP address
     @param host_mac - Host MAC address
@@ -91,6 +92,7 @@ define dhcp_compl_event
   u32 pid;
   u8 hostname[64];
   u8 is_ipv6;
+  u8 mask_width;
   u8 host_address[16];
   u8 router_address[16];
   u8 host_mac[6];
index 2c0dd77..5ea9366 100644 (file)
@@ -187,8 +187,8 @@ dhcp_send_details (fib_protocol_t proto,
 
 void
 dhcp_compl_event_callback (u32 client_index, u32 pid, u8 * hostname,
-                          u8 is_ipv6, u8 * host_address, u8 * router_address,
-                          u8 * host_mac)
+                          u8 mask_width, u8 is_ipv6, u8 * host_address,
+                          u8 * router_address, u8 * host_mac)
 {
   unix_shared_memory_queue_t *q;
   vl_api_dhcp_compl_event_t *mp;
@@ -205,6 +205,7 @@ dhcp_compl_event_callback (u32 client_index, u32 pid, u8 * hostname,
   len = (vec_len (hostname) < 63) ? vec_len (hostname) : 63;
   clib_memcpy (&mp->hostname, hostname, len);
   mp->hostname[len] = 0;
+  mp->mask_width = mask_width;
   clib_memcpy (&mp->host_address[0], host_address, 16);
   clib_memcpy (&mp->router_address[0], router_address, 16);