]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra, ospfd, vrrpd: update fuzzin' shims
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 1 Jul 2020 21:58:38 +0000 (17:58 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 22:12:33 +0000 (17:12 -0500)
some function sigs changed, zebra got some new message types and a
refactor.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
ospfd/ospf_main.c
vrrpd/vrrp_main.c
zebra/main.c
zebra/zapi_msg.c

index 03df0a9ad1105a272b3a5f5acbf4e0e9c7fdc2ed..fecbd8cad0e1e4f00a2727bec4c17489f1763241 100644 (file)
@@ -187,7 +187,7 @@ static bool FuzzingInit(void)
 static struct ospf *FuzzingCreateOspf(void)
 {
        struct prefix p;
-       struct interface *ifp = if_create_ifindex(69, 0);
+       struct interface *ifp = if_create_ifindex(69, 0, NULL);
        ifp->mtu = 68;
        str2prefix("11.0.2.0/24", &p);
 
index d608e8019882f23f19214ed44dd3cad634ae2a1c..ad8a624500235621d582d02e58835405426cd866 100644 (file)
@@ -157,7 +157,7 @@ static struct vrrp_vrouter *FuzzingCreateVr(void)
        struct interface *ifp;
        struct prefix p;
 
-       ifp = if_create_ifindex(69, 0);
+       ifp = if_create_ifindex(69, 0, NULL);
        ifp->mtu = 68;
        str2prefix("11.0.2.1/24", &p);
        connected_add_by_prefix(ifp, &p, NULL);
index ce1c27912a015384bc332ec911a5d6125049ddb4..e9192aa6b1eaffa4df2edf213eaedb2fc2c13623 100644 (file)
@@ -323,6 +323,8 @@ static bool FuzzingInit(void)
 static struct zserv *FuzzingZc;
 #endif /* FUZZING_LIBFUZZER */
 
+static struct stream_fifo *fifo;
+
 static bool FuzzingInitialized;
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
@@ -330,6 +332,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
        if (!FuzzingInitialized) {
                FuzzingInit();
                FuzzingInitialized = true;
+               fifo = stream_fifo_new();
        }
 
        /*
@@ -351,10 +354,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 
        struct stream *s = stream_new(size + 1);
        stream_put(s, data, size);
+       stream_fifo_push(fifo, s);
 
-       zserv_handle_commands(zc, s);
-
-       stream_free(s);
+       zserv_handle_commands(zc, fifo);
 
 done:
        zserv_close_client(zc);
index d1cd92eb07d33ee8f996c5521aba52d0ff1ad6b9..f205c9bedcb8f77adf11af0962bc7f5785c1fef4 100644 (file)
@@ -2792,7 +2792,9 @@ static void zread_get_label_chunk(struct zserv *client, struct stream *msg,
        STREAM_GETL(s, size);
        STREAM_GETL(s, base);
 
+#ifndef FUZZING
        assert(proto == client->proto && instance == client->instance);
+#endif
 
        /* call hook to get a chunk using wrapper */
        lm_get_chunk_call(&lmc, client, keep, size, base, vrf_id);
@@ -2817,7 +2819,9 @@ static void zread_release_label_chunk(struct zserv *client, struct stream *msg)
        STREAM_GETL(s, start);
        STREAM_GETL(s, end);
 
+#ifndef FUZZING
        assert(proto == client->proto && instance == client->instance);
+#endif
 
        /* call hook to release a chunk using wrapper */
        lm_release_chunk_call(client, start, end);