#include <dhcp/dhcp6_ia_na_client_dp.h>
#include <vnet/ip/ip.h>
#include <vnet/ip/ip6.h>
+#include <vnet/ip/ip6_link.h>
#include <float.h>
#include <math.h>
static void interrupt_process (void);
-static u32
-ip6_enable (u32 sw_if_index)
-{
- dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
- clib_error_t *rv;
-
- rv = enable_ip6_interface (rm->vlib_main, sw_if_index);
-
- return rv != 0;
-}
-
static u8
ip6_addresses_equal (ip6_address_t * address1, ip6_address_t * address2)
{
clib_warning ("Failed to delete interface address");
pool_put (rm->address_pool, address_info);
/* make sure ip6 stays enabled */
- ip6_enable (sw_if_index);
+ ip6_link_enable (sw_if_index);
client_state = &rm->client_state_by_sw_if_index[sw_if_index];
if (--client_state->address_count == 0)
{
clib_error_t *error = 0;
client_state_t *cs;
f64 current_time = vlib_time_now (vm);
- char buf1[256];
- char buf2[256];
+ u8 *buf1 = 0;
+ u8 *buf2 = 0;
const char *rebinding;
u32 i;
cs = &rm->client_state_by_sw_if_index[i];
if (cs->enabled)
{
+ vec_reset_length (buf1);
+ vec_reset_length (buf2);
if (cs->T1_due_time != DBL_MAX && cs->T1_due_time > current_time)
{
- sprintf (buf1, "%u remaining",
- (u32) round (cs->T1_due_time - current_time));
+ buf1 = format (buf1, "%u remaining",
+ (u32) round (cs->T1_due_time - current_time));
}
else
- sprintf (buf1, "timeout");
+ buf1 = format (buf1, "timeout");
if (cs->T2_due_time != DBL_MAX && cs->T2_due_time > current_time)
- sprintf (buf2, "%u remaining",
- (u32) round (cs->T2_due_time - current_time));
+ buf2 = format (buf2, "%u remaining",
+ (u32) round (cs->T2_due_time - current_time));
else
- sprintf (buf2, "timeout");
+ buf2 = format (buf2, "timeout");
if (cs->rebinding)
rebinding = ", REBINDING";
else
rebinding = "";
if (cs->T1)
vlib_cli_output (vm,
- "sw_if_index: %u, T1: %u (%s), "
- "T2: %u (%s), server index: %d%s", i,
+ "sw_if_index: %u, T1: %u (%v), "
+ "T2: %u (%v), server index: %d%s", i,
cs->T1, buf1, cs->T2, buf2,
cs->server_index, rebinding);
else
}
}
+ vec_free (buf1);
+ vec_free (buf2);
+
return error;
}
dhcp6_clients_enable_disable (1);
}
- ip6_enable (sw_if_index);
+ ip6_link_enable (sw_if_index);
send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT,
0, 1);
}
rm->vlib_main = vm;
rm->vnet_main = vnet_get_main ();
- rm->api_main = &api_main;
+ rm->api_main = vlibapi_get_main ();
rm->node_index = dhcp6_client_cp_process_node.index;
return NULL;