]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: enable deferred fork server mode
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 3 Jan 2020 04:02:54 +0000 (23:02 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 19:52:41 +0000 (14:52 -0500)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
ospfd/ospf_main.c

index 5d4014b24e9a83088ab0e7f5731148e79a03bbae..e0cf5a565a0be6924bb6045ccfd6fd6965681ce4 100644 (file)
@@ -164,29 +164,45 @@ int main(int argc, char **argv)
 
        frr_preinit(&ospfd_di, argc, argv);
 
-
 #ifdef FUZZING
-       ospf_master_init(frr_init_fast());
-       ospf_debug_init();
-       ospf_vrf_init();
+       /* INIT */
+       {
+               ospf_master_init(frr_init_fast());
+               ospf_debug_init();
+               ospf_vrf_init();
+               access_list_init();
+               prefix_list_init();
+               ospf_if_init();
+               ospf_zebra_init(master, instance);
+               ospf_bfd_init();
+               ospf_route_map_init();
+               ospf_opaque_init();
+               ospf_error_init();
+       }
 
-       access_list_init();
-       prefix_list_init();
+       struct prefix p;
+       struct interface *ifp = if_create_ifindex(69, 0);
+       ifp->mtu = 68;
+       str2prefix("11.0.2.0/24", &p);
 
-       ospf_if_init();
+       bool created;
+       struct ospf *o = ospf_get_instance(instance, &created);
 
-       ospf_vty_init();
-       ospf_vty_show_init();
-       ospf_vty_clear_init();
+       struct in_addr in;
+       inet_pton(AF_INET, "0.0.0.0", &in);
+       struct ospf_area *a = ospf_area_new(o, in);
 
-       ospf_route_map_init();
-       ospf_opaque_init();
+       struct connected *c = connected_add_by_prefix(ifp, &p, NULL);
+       add_ospf_interface(c, a);
 
-       ospf_error_init();
+       struct ospf_interface *oi = listhead(a->oiflist)->data;
+       if (!oi)
+               goto done;
+       oi->state = 7; // ISM_DR
 
-       /* Fuzz here */
-       bool created;
-       struct ospf *o = ospf_get_instance(instance, &created);
+#ifdef __AFL_HAVE_MANUAL_CONTROL
+       __AFL_INIT();
+#endif
 
        uint8_t *input;
        int r = frrfuzz_read_input(&input);
@@ -211,25 +227,6 @@ int main(int argc, char **argv)
                        goto done;
        }
 
-       struct prefix p;
-       struct interface *ifp = if_create_ifindex(69, 0);
-       ifp->mtu = 68;
-       str2prefix("11.0.2.0/24", &p);
-
-       struct in_addr in;
-       inet_pton(AF_INET, "0.0.0.0", &in);
-       struct ospf_area *a = ospf_area_new(o, in);
-
-       struct connected *c = connected_add_by_prefix(ifp, &p, NULL);
-       add_ospf_interface(c, a);
-
-       struct ospf_interface *oi = listhead(a->oiflist)->data;
-       if (!oi)
-               goto done;
-       oi->state = 7; // ISM_DR
-
-       // struct ospf_interface *oi = ospf_if_new(o, ifp, &p);
-       // oi->connected = c;
 
        o->fuzzing_packet_ifp = ifp;