Type: improvement
VPP pnat is internally holding mapping between interface and pnat rule.
This is used by vppctl to delete rules. However querying this is not
possible over API, which makes it impossible to delete a rule w/o
keeping external cache of such mappings.
Change-Id: I3662bfb2caddbac0e1755068bdf7cb965c8acedb
Signed-off-by: Bartlomiej Leszak <[email protected]>
vl_api_pnat_mask_t lookup_mask[2]; /* PNAT_ATTACHMENT_POINT_MAX */
};
+
+autoendian define pnat_flow_lookup
+{
+ u32 client_index;
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+ vl_api_pnat_attachment_point_t attachment;
+ vl_api_pnat_match_tuple_t match;
+};
+
+autoendian define pnat_flow_lookup_reply
+{
+ u32 context;
+ i32 retval;
+ u32 binding_index;
+};
+
counters pnat {
none {
severity info;
REPLY_MACRO_END(VL_API_PNAT_BINDING_DEL_REPLY);
}
+static void vl_api_pnat_flow_lookup_t_handler(vl_api_pnat_flow_lookup_t *mp) {
+ pnat_main_t *pm = &pnat_main;
+ vl_api_pnat_flow_lookup_reply_t *rmp;
+ u32 binding_index;
+ int rv = 0;
+ binding_index =
+ pnat_flow_lookup(mp->sw_if_index, mp->attachment, &mp->match);
+ if (binding_index == ~0) {
+ rv = -1;
+ }
+ REPLY_MACRO2_END(VL_API_PNAT_FLOW_LOOKUP_REPLY,
+ ({ rmp->binding_index = binding_index; }));
+}
+
/*
* Workaround for a bug in vppapigen that doesn't register the endian handler
* for _details messages. When that's fixed it should be possible to use