From 5764264382d1487ad0d992dcf090acd15dc3be33 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 18 Nov 2019 16:12:19 -0500 Subject: [PATCH] disable cli commands & checksums --- pimd/pim_main.c | 48 ++++++++++++++++++++++++------------------------ pimd/pim_pim.c | 4 ++++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 544d47fc5e..a000845af4 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -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(); /* diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 3df7dc41ce..dc16d25dd6 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -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 } } -- 2.39.5