summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-09-21 22:57:28 +0200
committerGitHub <noreply@github.com>2018-09-21 22:57:28 +0200
commitfc81954dd17c4231cf5abed80ac673f668035a2c (patch)
treef615070416bf3a7f041ea53bc57bd092d48f94ba
parent6ea2d6e15f226fb9a946e94c593de3404d4e1582 (diff)
parent766b826f1621276f2529a1e9c5696d25b8f2eddd (diff)
Merge pull request #2978 from ton31337/fix/default_originate_after_second_enter
osfpd: Install default route after second try instantly
-rw-r--r--ospfd/ospf_vty.c6
-rw-r--r--ospfd/ospf_zebra.c20
2 files changed, 9 insertions, 17 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index aa877903fc..e25d1a31de 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -8201,6 +8201,8 @@ DEFUN (no_ospf_redistribute_source,
return CMD_SUCCESS;
ospf_routemap_unset(red);
+ ospf_redist_del(ospf, source, 0);
+
return ospf_redistribute_unset(ospf, source, 0);
}
@@ -8315,6 +8317,8 @@ DEFUN (no_ospf_redistribute_instance_source,
return CMD_SUCCESS;
ospf_routemap_unset(red);
+ ospf_redist_del(ospf, source, instance);
+
return ospf_redistribute_unset(ospf, source, instance);
}
@@ -8447,6 +8451,8 @@ DEFUN (no_ospf_default_information_originate,
return CMD_SUCCESS;
ospf_routemap_unset(red);
+ ospf_redist_del(ospf, DEFAULT_ROUTE, 0);
+
return ospf_redistribute_default_unset(ospf);
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 912142b78f..8a7f38b743 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -740,8 +740,6 @@ int ospf_redistribute_unset(struct ospf *ospf, int type,
zlog_debug("Redistribute[%s][%d] vrf id %u: Stop",
ospf_redist_string(type), instance, ospf->vrf_id);
- ospf_redist_del(ospf, type, instance);
-
/* Remove the routes from OSPF table. */
ospf_redistribute_withdraw(ospf, type, instance);
@@ -755,30 +753,17 @@ int ospf_redistribute_unset(struct ospf *ospf, int type,
int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
int mvalue)
{
- struct ospf_redist *red;
-
ospf->default_originate = originate;
- red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0);
- red->dmetric.type = mtype;
- red->dmetric.value = mvalue;
-
ospf_external_add(ospf, DEFAULT_ROUTE, 0);
- if (ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0)) {
- /* if ospf->default_originate changes value, is calling
- ospf_external_lsa_refresh_default sufficient to implement
- the change? */
- ospf_external_lsa_refresh_default(ospf);
-
+ if (ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0))
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug(
"Redistribute[%s]: Refresh Type[%d], Metric[%d]",
ospf_redist_string(DEFAULT_ROUTE),
metric_type(ospf, DEFAULT_ROUTE, 0),
metric_value(ospf, DEFAULT_ROUTE, 0));
- return CMD_SUCCESS;
- }
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient,
ospf->vrf_id);
@@ -788,6 +773,8 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
metric_type(ospf, DEFAULT_ROUTE, 0),
metric_value(ospf, DEFAULT_ROUTE, 0));
+ ospf_external_lsa_refresh_default(ospf);
+
if (ospf->router_id.s_addr == 0)
ospf->external_origin |= (1 << DEFAULT_ROUTE);
else
@@ -805,7 +792,6 @@ int ospf_redistribute_default_unset(struct ospf *ospf)
return CMD_SUCCESS;
ospf->default_originate = DEFAULT_ORIGINATE_NONE;
- ospf_redist_del(ospf, DEFAULT_ROUTE, 0);
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient,
ospf->vrf_id);