]> git.puffer.fish Git - matthieu/frr.git/commitdiff
disable cli commands & checksums
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 18 Nov 2019 21:12:19 +0000 (16:12 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 19:40:22 +0000 (14:40 -0500)
pimd/pim_main.c
pimd/pim_pim.c

index 544d47fc5e11ce32fb0e2449a650a84750418133..a000845af45e503e53e6c231255d6635c017aef8 100644 (file)
@@ -104,33 +104,14 @@ FRR_DAEMON_INFO(pimd, PIM, .vty_port = PIMD_VTY_PORT,
 int main(int argc, char **argv, char **envp)
 {
        frr_preinit(&pimd_di, argc, argv);
-       frr_opt_add("", longopts, "");
-
-       /* this while just reads the options */
-       while (1) {
-               int opt;
-
-               opt = frr_getopt(argc, argv, NULL);
-
-               if (opt == EOF)
-                       break;
-
-               switch (opt) {
-               case 0:
-                       break;
-               default:
-                       frr_help_exit(1);
-               }
-       }
 
 #ifdef FUZZING
-       pim_router_init();
-       pim_vrf_init();
-       pim_init();
-
 #ifdef __AFL_HAVE_MANUAL_CONTROL
        __AFL_INIT();
 #endif
+       pim_router_init();
+       pim_vrf_init();
+       //pim_init();
 
        fseek(stdin, 0, SEEK_END);
        long fsize = ftell(stdin);
@@ -145,11 +126,30 @@ int main(int argc, char **argv, char **envp)
        pim_if_new(ifp, true, true, false, false);
        int result = pim_pim_packet(ifp, packet, fsize);
 
-       /* printf is expensive, skip it for fuzzing */
-       //fprintf(stderr, "parse result: %d\n", result);
        return result;
 #endif
 
+       frr_opt_add("", longopts, "");
+
+       /* this while just reads the options */
+       while (1) {
+               int opt;
+
+               opt = frr_getopt(argc, argv, NULL);
+
+               if (opt == EOF)
+                       break;
+
+               switch (opt) {
+               case 0:
+                       break;
+               default:
+                       frr_help_exit(1);
+                       break;
+               }
+       }
+
+
        pim_router_init();
 
        /*
index 3df7dc41ce318845f89f674d4fb444e3a383e050..dc16d25dd68b45df2e526c5408e3e39081f97f1b 100644 (file)
@@ -219,7 +219,9 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
                                                ifp->name, pim_checksum,
                                                checksum);
 
+#ifndef FUZZING
                                return -1;
+#endif
                        }
                }
        } else {
@@ -230,7 +232,9 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
                                        "Ignoring PIM pkt from %s with invalid checksum: received=%x calculated=%x",
                                        ifp->name, pim_checksum, checksum);
 
+#ifndef FUZZING
                        return -1;
+#endif
                }
        }