Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
misc: binary api fuzz test fixes
[vpp.git]
/
src
/
vnet
/
ip
/
punt_api.c
diff --git
a/src/vnet/ip/punt_api.c
b/src/vnet/ip/punt_api.c
index
946a001
..
3a964b4
100644
(file)
--- a/
src/vnet/ip/punt_api.c
+++ b/
src/vnet/ip/punt_api.c
@@
-21,7
+21,6
@@
#include <vlibmemory/api.h>
#include <vnet/ip/punt.h>
#include <vnet/ip/ip_types_api.h>
#include <vlibmemory/api.h>
#include <vnet/ip/punt.h>
#include <vnet/ip/ip_types_api.h>
-#include <vlibapi/api_types_inlines.h>
#include <vnet/vnet_msg_enum.h>
#include <vnet/vnet_msg_enum.h>
@@
-90,7
+89,11
@@
vl_api_punt_l4_decode (const vl_api_punt_l4_t * in, punt_l4_t * out)
int rv;
rv = ip_address_family_decode (in->af, &out->af);
int rv;
rv = ip_address_family_decode (in->af, &out->af);
- rv += ip_proto_decode (in->protocol, &out->protocol);
+ if (rv < 0)
+ return (rv);
+ rv = ip_proto_decode (in->protocol, &out->protocol);
+ if (rv < 0)
+ return (rv);
out->port = clib_net_to_host_u16 (in->port);
return (rv);
out->port = clib_net_to_host_u16 (in->port);
return (rv);
@@
-103,7
+106,9
@@
vl_api_punt_ip_proto_decode (const vl_api_punt_ip_proto_t * in,
int rv;
rv = ip_address_family_decode (in->af, &out->af);
int rv;
rv = ip_address_family_decode (in->af, &out->af);
- rv += ip_proto_decode (in->protocol, &out->protocol);
+ if (rv < 0)
+ return (rv);
+ rv = ip_proto_decode (in->protocol, &out->protocol);
return (rv);
}
return (rv);
}
@@
-322,6
+327,7
@@
typedef struct punt_reason_dump_walk_ctx_t_
{
vl_api_registration_t *reg;
u32 context;
{
vl_api_registration_t *reg;
u32 context;
+ u8 *name;
} punt_reason_dump_walk_ctx_t;
static int
} punt_reason_dump_walk_ctx_t;
static int
@@
-330,6
+336,14
@@
punt_reason_dump_walk_cb (vlib_punt_reason_t id, const u8 * name, void *args)
punt_reason_dump_walk_ctx_t *ctx = args;
vl_api_punt_reason_details_t *mp;
punt_reason_dump_walk_ctx_t *ctx = args;
vl_api_punt_reason_details_t *mp;
+ if (ctx->name)
+ {
+ /* user requested a specific punt-reason */
+ if (vec_cmp (name, ctx->name))
+ /* not the reasonn we're lookgin for */
+ return 1;
+ }
+
mp = vl_msg_api_alloc (sizeof (*mp) + vec_len (name));
if (!mp)
return (0);
mp = vl_msg_api_alloc (sizeof (*mp) + vec_len (name));
if (!mp)
return (0);
@@
-339,7
+353,7
@@
punt_reason_dump_walk_cb (vlib_punt_reason_t id, const u8 * name, void *args)
mp->context = ctx->context;
mp->reason.id = clib_host_to_net_u32 (id);
mp->context = ctx->context;
mp->reason.id = clib_host_to_net_u32 (id);
- vl_api_
to_api_string (vec_len (name), (char *)
name, &mp->reason.name);
+ vl_api_
vec_to_api_string (
name, &mp->reason.name);
vl_api_send_msg (ctx->reg, (u8 *) mp);
vl_api_send_msg (ctx->reg, (u8 *) mp);
@@
-358,9
+372,12
@@
vl_api_punt_reason_dump_t_handler (vl_api_punt_reason_dump_t * mp)
punt_reason_dump_walk_ctx_t ctx = {
.reg = reg,
.context = mp->context,
punt_reason_dump_walk_ctx_t ctx = {
.reg = reg,
.context = mp->context,
+ .name = vl_api_from_api_to_new_vec (mp, &mp->reason.name),
};
punt_reason_walk (punt_reason_dump_walk_cb, &ctx);
};
punt_reason_walk (punt_reason_dump_walk_cb, &ctx);
+
+ vec_free (ctx.name);
}
#define vl_msg_name_crc_list
}
#define vl_msg_name_crc_list
@@
-378,7
+395,7
@@
setup_message_id_table (api_main_t * am)
static clib_error_t *
punt_api_hookup (vlib_main_t * vm)
{
static clib_error_t *
punt_api_hookup (vlib_main_t * vm)
{
- api_main_t *am =
&api_main
;
+ api_main_t *am =
vlibapi_get_main ()
;
#define _(N,n) \
vl_msg_api_set_handlers(VL_API_##N, #n, \
#define _(N,n) \
vl_msg_api_set_handlers(VL_API_##N, #n, \