]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: fix redistribute configuration
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 22 Jun 2021 13:12:41 +0000 (16:12 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 22 Jun 2021 22:05:07 +0000 (01:05 +0300)
ospf6_asbr_redistribute_unset must not be called if the redistribution
is not yet configured, because it decrements redistribution counter and
makes it negative in this case.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
ospf6d/ospf6_asbr.c

index c963976088833aa8e1f89acc6fdfbaba106527c2..ba355a347e3b1922bbef3029af72ac8f974ff352 100644 (file)
@@ -1577,11 +1577,12 @@ DEFUN (ospf6_redistribute,
        if (type < 0)
                return CMD_WARNING_CONFIG_FAILED;
 
-       red = ospf6_redist_add(ospf6, type, 0);
+       red = ospf6_redist_lookup(ospf6, type, 0);
        if (!red)
-               return CMD_SUCCESS;
+               ospf6_redist_add(ospf6, type, 0);
+       else
+               ospf6_asbr_redistribute_unset(ospf6, red, type);
 
-       ospf6_asbr_redistribute_unset(ospf6, red, type);
        ospf6_asbr_redistribute_set(ospf6, type);
 
        return CMD_SUCCESS;
@@ -1607,11 +1608,12 @@ DEFUN (ospf6_redistribute_routemap,
        if (type < 0)
                return CMD_WARNING_CONFIG_FAILED;
 
-       red = ospf6_redist_add(ospf6, type, 0);
+       red = ospf6_redist_lookup(ospf6, type, 0);
        if (!red)
-               return CMD_SUCCESS;
+               red = ospf6_redist_add(ospf6, type, 0);
+       else
+               ospf6_asbr_redistribute_unset(ospf6, red, type);
 
-       ospf6_asbr_redistribute_unset(ospf6, red, type);
        ospf6_asbr_routemap_set(red, argv[idx_word]->arg);
        ospf6_asbr_redistribute_set(ospf6, type);