]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: fix crash when entering "no ip[v6] router isis" twice
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 20 Feb 2019 18:36:50 +0000 (15:36 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Thu, 21 Feb 2019 02:04:12 +0000 (23:04 -0300)
isisd CLI has some housekeeping code that removes the
"frr-isisd:isis" container from the interface configuration when
IS-IS is disabled for both IPv4 and IPv6 in the corresponding
interface.

The problem is that the code was checking the values of the
"ipv4-routing" and "ipv6-routing" leafs without checking if the
parent "frr-isisd:isis" container was present. So, entering "no
ip[v6] router isis" twice would cause isisd to crash since the
"frr-isisd:isis" container wouldn't be present the second time the
command is processed. Fix this.

isisd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "no ip router isis WORD"
isisd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "no ipv6 router isis"

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

index bd8b58e8f0bd91dff4fa493b98950e5e50d8d096..ab5faf76b6c11afb5c10e8d131365cae7fb0b0c0 100644 (file)
@@ -279,25 +279,26 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
       "IS-IS routing protocol\n"
       "Routing process tag\n")
 {
-       const struct lyd_node *dnode =
-               yang_dnode_get(running_config->dnode, VTY_CURR_XPATH);
+       const struct lyd_node *dnode;
 
-       /* if both ipv4 and ipv6 are off delete the interface isis container too
+       dnode = yang_dnode_get(vty->candidate_config->dnode,
+                              "%s/frr-isisd:isis", VTY_CURR_XPATH);
+       if (!dnode)
+               return CMD_SUCCESS;
+
+       /*
+        * If both ipv4 and ipv6 are off delete the interface isis container.
         */
-       if (!strncmp(ip, "ipv6", strlen("ipv6"))) {
-               if (dnode
-                   && !yang_dnode_get_bool(dnode,
-                                           "./frr-isisd:isis/ipv4-routing"))
+       if (strmatch(ip, "ipv6")) {
+               if (!yang_dnode_get_bool(dnode, "./ipv4-routing"))
                        nb_cli_enqueue_change(vty, "./frr-isisd:isis",
                                              NB_OP_DESTROY, NULL);
                else
                        nb_cli_enqueue_change(vty,
                                              "./frr-isisd:isis/ipv6-routing",
                                              NB_OP_MODIFY, "false");
-       } else { /* no ipv4  */
-               if (dnode
-                   && !yang_dnode_get_bool(dnode,
-                                           "./frr-isisd:isis/ipv6-routing"))
+       } else {
+               if (!yang_dnode_get_bool(dnode, "./ipv6-routing"))
                        nb_cli_enqueue_change(vty, "./frr-isisd:isis",
                                              NB_OP_DESTROY, NULL);
                else