]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: fix issue with the "no segment-routing prefix A.B.C.D/M" command 3209/head
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 19 Oct 2018 18:55:47 +0000 (15:55 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 20 Oct 2018 15:39:05 +0000 (12:39 -0300)
Add a missing check to bail out earlier when SR is not configured. The
same command without the "no" prefix has the same check as it prevents
unexpected things (i.e. crashes) from happening.

Fixes the following segfaults:
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "no segment-routing prefix 1.1.1.1/32"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "no segment-routing prefix 1.1.1.1/32 index 65535 no-php-flag"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ospfd/ospf_sr.c

index d793735003b25a72d1a336d30e41989754eff783..3a21b723d51cfe10bdf16f6631a5b340a468ec78 100644 (file)
@@ -2053,6 +2053,9 @@ DEFUN (no_sr_prefix_sid,
        bool found = false;
        int rc;
 
+       if (!ospf_sr_enabled(vty))
+               return CMD_WARNING_CONFIG_FAILED;
+
        /* Get network prefix */
        argv_find(argv, argc, "A.B.C.D/M", &idx);
        rc = str2prefix(argv[idx]->arg, &p);