DHCP client - remove interface address when DHCP de-configured
[vpp.git] / src / vnet / dhcp / client.c
index 29749a3..8f033d2 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 */
@@ -781,8 +782,7 @@ int dhcp_client_add_del (dhcp_client_add_del_args_t * a)
                                      c->sw_if_index),
                                  &all_1s,
                                  FIB_SOURCE_DHCP,
-                                 FIB_ENTRY_FLAG_LOCAL,
-                                 ADJ_INDEX_INVALID);
+                                 FIB_ENTRY_FLAG_LOCAL);
 
      /*
        * enable the interface to RX IPv4 packets
@@ -821,6 +821,7 @@ int dhcp_client_add_del (dhcp_client_add_del_args_t * a)
                                      1,
                                      FIB_ROUTE_PATH_FLAG_NONE);
       }
+      dhcp_client_release_address (dcm, c);
       ip4_sw_interface_enable_disable (c->sw_if_index, 0);
 
       vec_free (c->option_55_data);