ospf6d: fix redistribute configuration

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>
This commit is contained in:
Igor Ryzhov 2021-06-22 16:12:41 +03:00
parent 2fdc4f8dea
commit bf84c96dae

View 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);