diff options
Diffstat (limited to 'ospfd/ospf_zebra.c')
| -rw-r--r-- | ospfd/ospf_zebra.c | 72 |
1 files changed, 62 insertions, 10 deletions
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 8cf8430247..dc8a8dccd2 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -51,6 +51,7 @@ #include "ospfd/ospf_zebra.h" #include "ospfd/ospf_te.h" #include "ospfd/ospf_sr.h" +#include "ospfd/ospf_ldp_sync.h" DEFINE_MTYPE_STATIC(OSPFD, OSPF_EXTERNAL, "OSPF External route table") DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute") @@ -1354,16 +1355,26 @@ static int ospf_distribute_list_update_timer(struct thread *thread) else if ( (lsa = ospf_external_info_find_lsa( ospf, &ei->p))) { - if (!CHECK_FLAG( - lsa->flags, - OSPF_LSA_IN_MAXAGE)) - ospf_external_lsa_refresh( - ospf, lsa, ei, - LSA_REFRESH_IF_CHANGED); - else - ospf_external_lsa_refresh( - ospf, lsa, ei, - LSA_REFRESH_FORCE); + int force = + LSA_REFRESH_IF_CHANGED; + /* If this is a MaxAge LSA, we + * need to force refresh it + * because distribute settings + * might have changed and now, + * this LSA needs to be + * originated, not be removed. + * If we don't force refresh it, + * it will remain a MaxAge LSA + * because it will look like it + * hasn't changed. Neighbors + * will not receive updates for + * this LSA. + */ + if (IS_LSA_MAXAGE(lsa)) + force = LSA_REFRESH_FORCE; + + ospf_external_lsa_refresh( + ospf, lsa, ei, force); } else ospf_external_lsa_originate( ospf, ei); @@ -1833,6 +1844,45 @@ static void ospf_zebra_connected(struct zclient *zclient) zclient_send_reg_requests(zclient, VRF_DEFAULT); } +/* + * opaque messages between processes + */ +static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS) +{ + struct stream *s; + struct zapi_opaque_msg info; + struct ldp_igp_sync_if_state state; + struct ldp_igp_sync_announce announce; + struct ldp_igp_sync_hello hello; + int ret = 0; + + s = zclient->ibuf; + + if (zclient_opaque_decode(s, &info) != 0) + return -1; + + switch (info.type) { + case LDP_IGP_SYNC_IF_STATE_UPDATE: + STREAM_GET(&state, s, sizeof(state)); + ret = ospf_ldp_sync_state_update(state); + break; + case LDP_IGP_SYNC_ANNOUNCE_UPDATE: + STREAM_GET(&announce, s, sizeof(announce)); + ret = ospf_ldp_sync_announce_update(announce); + break; + case LDP_IGP_SYNC_HELLO_UPDATE: + STREAM_GET(&hello, s, sizeof(hello)); + ret = ospf_ldp_sync_hello_update(hello); + break; + default: + break; + } + +stream_failure: + + return ret; +} + void ospf_zebra_init(struct thread_master *master, unsigned short instance) { /* Allocate zebra structure. */ @@ -1866,6 +1916,8 @@ void ospf_zebra_init(struct thread_master *master, unsigned short instance) access_list_delete_hook(ospf_filter_update); prefix_list_add_hook(ospf_prefix_list_update); prefix_list_delete_hook(ospf_prefix_list_update); + + zclient->opaque_msg_handler = ospf_opaque_msg_handler; } void ospf_zebra_send_arp(const struct interface *ifp, const struct prefix *p) |
