]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd/eigrpd: fix crashes found by the CLI fuzzer
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 25 Jul 2017 16:55:48 +0000 (13:55 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 25 Jul 2017 16:58:23 +0000 (13:58 -0300)
Fixes the following crashes:
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1 json"
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1"
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1 json"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 2001:db8::1/128 json"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 2001:db8::1/128"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 2001:db8::1/128 json"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 2001:db8::1/128"
* bgpd aborted: vtysh  -c "show vnc responses 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show vnc responses 2001:db8::1/128"
* bgpd aborted: vtysh  -c "show vnc responses 11:11:11:11:11:11"
* bgpd aborted: vtysh  -c "show vnc responses"
* eigrpd aborted: vtysh -c "configure terminal" -c "no router eigrp 65535"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
bgpd/bgp_route.c
bgpd/rfapi/rfapi_rib.c
eigrpd/eigrp_vty.c

index 38ad7a6e0a239edff68e2853275764f5f6a2c211..7cdc839618aaed27fd1c497ab06274fceb6033ed 100644 (file)
@@ -8617,8 +8617,14 @@ static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str,
                          int prefix_check, enum bgp_path_type pathtype,
                          u_char use_json)
 {
-       if (!bgp)
+       if (!bgp) {
                bgp = bgp_get_default();
+               if (!bgp) {
+                       if (!use_json)
+                               vty_out(vty, "No BGP process is configured\n");
+                       return CMD_WARNING;
+               }
+       }
 
        /* labeled-unicast routes live in the unicast table */
        if (safi == SAFI_LABELED_UNICAST)
index a414df1ab4c89c3b17e8fedadfe81a398b976703..791eb4c916ed09f0c8678c056cdd5e382d0f8b51 100644 (file)
@@ -2236,9 +2236,12 @@ void rfapiRibShowResponsesSummary(void *stream)
        struct rfapi_descriptor *rfd;
        struct listnode *node;
 
-
        if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
                return;
+       if (!bgp) {
+               fp(out, "Unable to find default BGP instance\n");
+               return;
+       }
 
        fp(out, "%-24s ", "Responses: (Prefixes)");
        fp(out, "%-8s %-8u ", "Active:", bgp->rfapi->rib_prefix_count_total);
@@ -2388,6 +2391,11 @@ void rfapiRibShowResponses(void *stream, struct prefix *pfx_match,
 
        if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
                return;
+       if (!bgp) {
+               fp(out, "Unable to find default BGP instance\n");
+               return;
+       }
+
        /*
         * loop over NVEs
         */
index d416183f52a4223b02b137b1afa92edb6618f1b9..746db2abe992599edb8d8e3ea28f93b6e9d6e565 100644 (file)
@@ -237,6 +237,11 @@ DEFUN (no_router_eigrp,
        struct eigrp *eigrp;
 
        eigrp = eigrp_lookup();
+       if (eigrp == NULL) {
+               vty_out(vty, " EIGRP Routing Process not enabled\n");
+               return CMD_SUCCESS;
+       }
+
        if (eigrp->AS != atoi(argv[3]->arg)) {
                vty_out(vty, "%% Attempting to deconfigure non-existent AS\n");
                return CMD_WARNING_CONFIG_FAILED;