]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd ultra fast wagyu mode
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 21 Nov 2019 00:37:46 +0000 (19:37 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 19:42:31 +0000 (14:42 -0500)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_fsm.c
bgpd/bgp_main.c
bgpd/bgp_packet.c
bgpd/bgpd.c
lib/command.c
lib/zebra.h

index 91265ed358533ee991beb854e1d3595f6ffd7761..6ccbb1e276796255d4c06173bdcd19add9709120 100644 (file)
@@ -18,6 +18,7 @@
  * with this program; see the file COPYING; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
+#define FUZZING 1
 
 #include <zebra.h>
 
@@ -352,6 +353,9 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
    structure. */
 void bgp_timer_set(struct peer *peer)
 {
+#ifdef FUZZING
+       return;
+#endif
        switch (peer->status) {
        case Idle:
                /* First entry point of peer's finite state machine.  In Idle
index 3f4f3231decd5a83b46175369edbf10816bfc450..c4f5af192e3fdcd0905ff47f85896bbd0a63a7e0 100644 (file)
@@ -423,7 +423,7 @@ int main(int argc, char **argv)
        frr_preinit(&bgpd_di, argc, argv);
 
 #ifdef FUZZING
-       bgp_master_init(frr_init(), buffer_size);
+       bgp_master_init(frr_init_fast(), buffer_size);
        bm->port = bgp_port;
        if (bgp_port == 0)
                bgp_option_set(BGP_OPT_NO_LISTEN);
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
                bgp_option_set(BGP_OPT_NO_ZEBRA);
        bgp_error_init();
        /* Initializations. */
-       bgp_vrf_init();
+       //bgp_vrf_init();
 
        /* BGP related initialization.  */
        bgp_init((unsigned short)instance);
@@ -445,13 +445,19 @@ int main(int argc, char **argv)
 
        union sockunion su;
        sockunion_init(&su);
-       inet_pton(AF_INET, "192.168.0.1", &su.sin.sin_addr);
+       inet_pton(AF_INET, "10.1.1.1", &su.sin.sin_addr);
        su.sin.sin_family = AF_INET;
        su.sin.sin_port = 2001;
        struct peer *p = peer_create(&su, NULL, bgp_get_default(), 65000, 65001, 0, AFI_IP,
                        SAFI_UNICAST, NULL);
        p->bgp->rpkt_quanta = 1;
        p->status = Established;
+       p->as_type = AS_EXTERNAL;
+       SET_FLAG(p->cap, PEER_CAP_AS4_RCV);
+       SET_FLAG(p->cap, PEER_CAP_ADDPATH_AF_RX_RCV);
+       SET_FLAG(p->cap, PEER_CAP_ADDPATH_AF_TX_RCV);
+       SET_FLAG(p->cap, PEER_CAP_REFRESH_OLD_RCV);
+       SET_FLAG(p->cap, PEER_CAP_REFRESH_NEW_RCV);
        struct thread t = {};
        t.arg = p;
 
index 852791d3ae91f598f421b27be2b1e33775ace5df..2a864d759508ef69afc52f74356d044ab298d4a8 100644 (file)
@@ -1345,12 +1345,14 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
                return BGP_Stop;
 
        /* Get sockname. */
+#ifndef FUZZING
        if (bgp_getsockname(peer) < 0) {
                flog_err_sys(EC_LIB_SOCKET,
                             "%s: bgp_getsockname() failed for peer: %s",
                             __func__, peer->host);
                return BGP_Stop;
        }
+#endif
 
        /* Set remote router-id */
        peer->remote_id = remote_id;
@@ -1471,7 +1473,9 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
 #endif
                }
        }
+#ifndef FUZZING
        peer->rtt = sockopt_tcp_rtt(peer->fd);
+#endif
 
        return Receive_OPEN_message;
 }
index 9316d71baffd55e18c0e07a13e6a5dec0b787f63..df91d50a2c7fb84db6d1866340f2f0efe489bd67 100644 (file)
@@ -7793,33 +7793,43 @@ void bgp_init(unsigned short instance)
        /* allocates some vital data structures used by peer commands in
         * vty_init */
 
+#ifndef FUZZING
        /* pre-init pthreads */
        bgp_pthreads_init();
 
        /* Init zebra. */
        bgp_zebra_init(bm->master, instance);
+#endif
 
 #ifdef ENABLE_BGP_VNC
        vnc_zebra_init(bm->master);
 #endif
 
        /* BGP VTY commands installation.  */
+#ifndef FUZZING
        bgp_vty_init();
+#endif
 
        /* BGP inits. */
        bgp_attr_init();
+#ifndef FUZZING
        bgp_debug_init();
        bgp_community_alias_init();
        bgp_dump_init();
+#endif
        bgp_route_init();
        bgp_route_map_init();
+#ifndef FUZZING
        bgp_scan_vty_init();
+#endif
        bgp_mplsvpn_init();
+#ifndef FUZZING
 #ifdef ENABLE_BGP_VNC
        rfapi_init();
 #endif
        bgp_ethernetvpn_init();
        bgp_flowspec_vty_init();
+#endif
 
        /* Access list initialize. */
        access_list_init();
@@ -7839,12 +7849,14 @@ void bgp_init(unsigned short instance)
        /* Community list initialize. */
        bgp_clist = community_list_init();
 
+#ifndef FUZZING
        /* BFD init */
        bgp_bfd_init(bm->master);
 
        bgp_lp_vty_init();
 
        cmd_variable_handler_register(bgp_viewvrf_var_handlers);
+#endif
 }
 
 void bgp_terminate(void)
index ea66a17bb07c258648d4b06944e3302245c6e175..256e0a70744cad3cb4942f9c4f1950e47dbbdb97 100644 (file)
@@ -23,6 +23,7 @@
  * with this program; see the file COPYING; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
+#define FUZZING 1
 
 #include <zebra.h>
 #include <lib/version.h>
@@ -296,6 +297,9 @@ void cmd_defer_tree(bool val)
 /* Install a command into a node. */
 void _install_element(enum node_type ntype, const struct cmd_element *cmd)
 {
+#ifdef FUZZING
+       return;
+#endif
        struct cmd_node *cnode;
 
        /* cmd_init hasn't been called */
index c9794352c784a34bff0b4aea1080931647457c83..0a5e652bb15f3ab66aa76a83e336f1f91e84376f 100644 (file)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#define FUZZING 1
 #ifndef _ZEBRA_H
 #define _ZEBRA_H