Jon,

No, you are not missing anything, there is a ping missing there indeed... :-)

At the time I could not figure out how to get the CONTROL_PING to be
sent from within the VAT, and since the main use case was
programmatic-API driven (I had used VAT primarily during the initial
debugging/sanity checks), it fell through the cracks. Appears the
solution is not trivial though - the SNAT plugin seems to define its
own CONTROL_PING flavour ping, with its own reply code which is
exactly the same as the "real" CONTROL_PING handler...

That seems a bit wasteful....

I've tried out the quick below, which looks like it makes the acl_dump
work correctly (of course the "extern" is merely a "TBD" for a proper
place into a public include)...

Maybe someone with a good view on the API infra (Dave B?) could
comment whether this is the approach below is in the right direction,
rather than define FOO_CONTROL_PING per plugin and copy paste code...

diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 6154a23..b2df35f 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -758,6 +758,7 @@ static int api_acl_interface_list_dump (vat_main_t * vam)
     return ret;
 }

+extern void api_send_control_ping (vat_main_t * vam);
 static int api_acl_dump (vat_main_t * vam)
 {
     unformat_input_t * i = vam->input;
@@ -780,6 +781,9 @@ static int api_acl_dump (vat_main_t * vam)
     /* send it... */
     S(mp);

+    /* Synchronize with control ping */
+    api_send_control_ping(vam);
+
     /* Wait for a reply... */
     W (ret);
     return ret;
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index efb71ef..39dcc27 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -5182,6 +5182,14 @@ api_want_interface_events (vat_main_t * vam)
   return ret;
 }

+void
+api_send_control_ping (vat_main_t * vam)
+{
+  vl_api_control_ping_t *mp_ping;
+
+  M (CONTROL_PING, mp_ping);
+  S (mp_ping);
+}

 /* Note: non-static, called once to set up the initial intfc table */

--a

On 5/17/17, Jon Loeliger <j...@netgate.com> wrote:
> Folks,
>
> I have two questions about the ACL plugin's API.
>
> First, when there are no ACLs configured and an ACL_DUMP is requested,
> there is no way for the API to reply except to not send a message and let
> the "wait for message" time-out and indicate failure.  The same problem
> exists if one requests ACL_INTERFACE_LIST_DUMP and there are no
> interfaces with an ACL on them.
>
> This seems like a very fragile interaction to me.  It also induces a delay
> in the messaging which is quite noticeable in an interactive session.
>
> Second, as there is no notion of CONTROL_PING in the ACL API it seems
> like we can get into synchronization problems with the DUMP messages.
>
> Am I missing something again? :-)
>
> Thanks,
> jdl
>
_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to