]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vrrpd: add fuzz target for zapi
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 1 Mar 2020 22:26:55 +0000 (17:26 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 22:12:33 +0000 (17:12 -0500)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vrrpd/vrrp_main.c
vrrpd/vrrp_zebra.c
vrrpd/vrrp_zebra.h

index b51b0d1c8489aa589c9c9587d08ffc589159bd8d..d608e8019882f23f19214ed44dd3cad634ae2a1c 100644 (file)
@@ -190,7 +190,10 @@ int LLVMFuzzerTestOneInput(uint8_t *data, size_t size)
 #else
        vr = FuzzingVr;
 #endif
-       
+
+#define FUZZING_ZAPI 1
+
+#ifndef FUZZING_ZAPI
        /* set input size */
        vr->v4->fuzzing_input_size = size;
        /* some info to fake msghdr with */
@@ -201,6 +204,9 @@ int LLVMFuzzerTestOneInput(uint8_t *data, size_t size)
        t.arg = vr->v4;
 
        vrrp_read(&t);
+#else
+       zclient_read_fuzz(zclient, data, size);
+#endif
 
        return 0;
 }
index b585287c81891ffa42a81454e00faf1416d3cf35..11625c4d2b84f934a4000d6a5f3c083e7e4781cc 100644 (file)
 
 #define VRRP_LOGPFX "[ZEBRA] "
 
+#ifndef FUZZING
 static struct zclient *zclient;
+#else
+struct zclient *zclient;
+#endif
 
 static void vrrp_zebra_debug_if_state(struct interface *ifp, vrf_id_t vrf_id,
                                      const char *func)
index c09943dcef9d32cc277a75eb8fe03a5a62203c85..b6ac1edb3910f13ab6030153280dc8a3b1a02388 100644 (file)
 
 #include "lib/if.h"
 
+#ifdef FUZZING
+#include "lib/zclient.h"
+extern struct zclient *zclient;
+#endif
+
 extern void vrrp_zebra_init(void);
 extern void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable);
 extern void vrrp_zclient_send_interface_protodown(struct interface *ifp,