aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-05-26 11:19:28 -0400
committerFlorin Coras <florin.coras@gmail.com>2020-05-27 20:53:57 +0000
commit7f475bf4b77ae2e74d65c62a22dc550329bb59c1 (patch)
treec93fe64b721ff42cedc10bab9335c7776b7f65a3 /src
parentec3a3f16e4cd3b33e2a409fb01b8d8826e05f9fa (diff)
dhcp: vat support for the dhcp_client_dump API
Also: permanently solve ordering issues with the vpp builtin vat plugin loader, by explicitly loading vat plugins once we're sure that all data plane plugins have registered their APIs / API message handlers. Fix compilation / link errors when the vpp builtin vat plugin loader is disbled by cmake configuration. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Id553c63ae860ebfc196c5ad4b55c19e08fec2c9e Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dhcp/dhcp_api.c2
-rw-r--r--src/plugins/dhcp/dhcp_test.c35
-rw-r--r--src/vlibmemory/CMakeLists.txt1
-rw-r--r--src/vlibmemory/vlib_api.c11
-rw-r--r--src/vpp/api/api_main.c8
-rw-r--r--src/vpp/vnet/main.c4
6 files changed, 53 insertions, 8 deletions
diff --git a/src/plugins/dhcp/dhcp_api.c b/src/plugins/dhcp/dhcp_api.c
index d2e423572fb..c5c7a82f3c3 100644
--- a/src/plugins/dhcp/dhcp_api.c
+++ b/src/plugins/dhcp/dhcp_api.c
@@ -262,7 +262,7 @@ dhcp_client_lease_encode (vl_api_dhcp_lease_t * lease,
size_t len;
u8 i;
- lease->is_ipv6 = 0; // only support IPv6 clients
+ lease->is_ipv6 = 0; // only support IPv4 clients
lease->sw_if_index = ntohl (client->sw_if_index);
lease->state = ntohl (client->state);
len = clib_min (sizeof (lease->hostname) - 1, vec_len (client->hostname));
diff --git a/src/plugins/dhcp/dhcp_test.c b/src/plugins/dhcp/dhcp_test.c
index a0d6f416e6b..0eb87ab3257 100644
--- a/src/plugins/dhcp/dhcp_test.c
+++ b/src/plugins/dhcp/dhcp_test.c
@@ -366,10 +366,41 @@ api_dhcp6_pd_send_client_message (vat_main_t * vam)
return -1;
}
+static void
+vl_api_dhcp_client_details_t_handler (vl_api_dhcp_client_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vl_api_dhcp_client_t *cp;
+ vl_api_dhcp_lease_t *lp;
+
+ cp = &mp->client;
+ lp = &mp->lease;
+
+ print (vam->ofp, "sw_if_index %d, id '%s'", ntohl (cp->sw_if_index),
+ cp->id);
+
+ print (vam->ofp, "leased address %U, router address %U",
+ format_ip4_address, &lp->host_address.un,
+ format_ip4_address, &lp->router_address.un);
+}
+
static int
api_dhcp_client_dump (vat_main_t * vam)
{
- return -1;
+ vl_api_dhcp_plugin_control_ping_t *mp_ping;
+ vl_api_dhcp_client_dump_t *mp;
+ int ret;
+
+ M (DHCP_CLIENT_DUMP, mp);
+
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ MPING (DHCP_PLUGIN_CONTROL_PING, mp_ping);
+ S (mp_ping);
+
+ W (ret);
+ return ret;
}
static int
@@ -396,8 +427,6 @@ api_dhcp_plugin_get_version (vat_main_t * vam)
return -1;
}
-#define vl_api_dhcp_client_details_t_handler vl_noop_handler
-
static void
vl_api_dhcp_plugin_get_version_reply_t_handler
(vl_api_dhcp_plugin_get_version_reply_t * mp)
diff --git a/src/vlibmemory/CMakeLists.txt b/src/vlibmemory/CMakeLists.txt
index 64fcb2d58fb..b48ff7b5766 100644
--- a/src/vlibmemory/CMakeLists.txt
+++ b/src/vlibmemory/CMakeLists.txt
@@ -16,6 +16,7 @@ add_vpp_library (vlibmemory
memory_api.c
memory_shared.c
memory_client.c
+ socket_client.c
socket_api.c
vlib_api.c
vlib_api_cli.c
diff --git a/src/vlibmemory/vlib_api.c b/src/vlibmemory/vlib_api.c
index 582016852a7..51378a5675e 100644
--- a/src/vlibmemory/vlib_api.c
+++ b/src/vlibmemory/vlib_api.c
@@ -248,6 +248,13 @@ vl_api_save_msg_table (void)
vec_free (serialized_message_table);
}
+clib_error_t *vat_builtin_main_init (vlib_main_t * vm) __attribute__ ((weak));
+clib_error_t *
+vat_builtin_main_init (vlib_main_t * vm)
+{
+ return 0;
+}
+
static uword
vl_api_clnt_process (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * f)
@@ -287,6 +294,10 @@ vl_api_clnt_process (vlib_main_t * vm, vlib_node_runtime_t * node,
if (e)
clib_error_report (e);
+ e = vat_builtin_main_init (vm);
+ if (e)
+ clib_error_report (e);
+
sleep_time = 10.0;
dead_client_scan_time = vlib_time_now (vm) + 10.0;
diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c
index 1d16f78ea88..e2223a402b9 100644
--- a/src/vpp/api/api_main.c
+++ b/src/vpp/api/api_main.c
@@ -38,8 +38,9 @@ init_error_string_table (vat_main_t * vam)
hash_set (vam->error_string_by_error_number, 99, "Misc");
}
-static clib_error_t *
-api_main_init (vlib_main_t * vm)
+#if VPP_API_TEST_BUILTIN > 0
+clib_error_t *
+vat_builtin_main_init (vlib_main_t * vm)
{
vat_main_t *vam = &vat_main;
int rv;
@@ -58,8 +59,7 @@ api_main_init (vlib_main_t * vm)
return 0;
}
-
-VLIB_MAIN_LOOP_ENTER_FUNCTION (api_main_init);
+#endif
void
vat_plugin_hash_create (void)
diff --git a/src/vpp/vnet/main.c b/src/vpp/vnet/main.c
index f4cc5042d45..b8a6f2b5ae2 100644
--- a/src/vpp/vnet/main.c
+++ b/src/vpp/vnet/main.c
@@ -74,7 +74,9 @@ vpp_find_plugin_path ()
static void
vpe_main_init (vlib_main_t * vm)
{
+#if VPP_API_TEST_BUILTIN > 0
void vat_plugin_hash_create (void);
+#endif
if (CLIB_DEBUG > 0)
vlib_unix_cli_set_prompt ("DBGvpp# ");
@@ -87,7 +89,9 @@ vpe_main_init (vlib_main_t * vm)
/*
* Create the binary api plugin hashes before loading plugins
*/
+#if VPP_API_TEST_BUILTIN > 0
vat_plugin_hash_create ();
+#endif
if (!vlib_plugin_path)
vpp_find_plugin_path ();