diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index c9d29871ae..45ee976550 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -122,7 +122,6 @@ int isis_ldp_sync_announce_update(struct ldp_igp_sync_announce announce) /* LDP just started up: * set cost to LSInfinity * send request to LDP for LDP-SYNC state for each interface - * start hello timer */ vrf = vrf_lookup_by_id(VRF_DEFAULT); FOR_ALL_INTERFACES (vrf, ifp) { @@ -135,62 +134,6 @@ int isis_ldp_sync_announce_update(struct ldp_igp_sync_announce announce) } } - THREAD_OFF(isis->ldp_sync_cmd.t_hello); - - isis->ldp_sync_cmd.sequence = 0; - isis_ldp_sync_hello_timer_add(); - - return 0; -} - -int isis_ldp_sync_hello_update(struct ldp_igp_sync_hello hello) -{ - struct isis_area *area; - struct listnode *node; - struct vrf *vrf; - struct interface *ifp; - struct isis_circuit *circuit; - struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); - - /* if isis is not enabled or LDP-SYNC is not configured ignore */ - if (!isis || - !CHECK_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) - return 0; - - if (hello.proto != ZEBRA_ROUTE_LDP) - return 0; - - /* Received Hello from LDP: - * if current sequence number is greater than received hello - * sequence number then assume LDP restarted - * set cost to LSInfinity - * send request to LDP for LDP-SYNC state for each interface - * else all is fine just restart hello timer - */ - if (hello.sequence == 0) - /* rolled over */ - isis->ldp_sync_cmd.sequence = 0; - - if (isis->ldp_sync_cmd.sequence > hello.sequence) { - zlog_err("ldp_sync: LDP restarted"); - - vrf = vrf_lookup_by_id(VRF_DEFAULT); - FOR_ALL_INTERFACES (vrf, ifp) { - for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, - area)) { - circuit = circuit_lookup_by_ifp(ifp, - area->circuit_list); - if (circuit == NULL) - continue; - isis_ldp_sync_if_start(circuit, true); - } - } - } else { - THREAD_OFF(isis->ldp_sync_cmd.t_hello); - isis_ldp_sync_hello_timer_add(); - } - isis->ldp_sync_cmd.sequence = hello.sequence; - return 0; } @@ -559,58 +502,6 @@ void isis_ldp_sync_handle_client_close(struct zapi_client_close_info *info) } } -/* - * LDP-SYNC hello timer routines - */ -static int isis_ldp_sync_hello_timer(struct thread *thread) -{ - struct isis_area *area; - struct listnode *node; - struct isis_circuit *circuit; - struct interface *ifp; - struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); - struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); - - if (!isis) - return 0; - - /* hello timer expired: - * didn't receive hello msg from LDP - * set cost of all interfaces to LSInfinity - */ - FOR_ALL_INTERFACES (vrf, ifp) { - for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { - circuit = circuit_lookup_by_ifp(ifp, - area->circuit_list); - if (circuit == NULL) - continue; - - isis_ldp_sync_ldp_fail(circuit); - } - } - - zlog_debug("ldp_sync: hello timer expired, LDP down"); - - return 0; -} - -void isis_ldp_sync_hello_timer_add(void) -{ - struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); - - /* Start hello timer: - * this timer is used to make sure LDP is up - * if expires set interface cost to LSInfinity - */ - if (!isis || - !CHECK_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) - return; - - thread_add_timer(master, isis_ldp_sync_hello_timer, - NULL, LDP_IGP_SYNC_HELLO_TIMEOUT, - &isis->ldp_sync_cmd.t_hello); -} - /* * LDP-SYNC routes used by set commands. */ @@ -699,13 +590,11 @@ void isis_ldp_sync_gbl_exit(bool remove) LDP_IGP_SYNC_IF_STATE_UPDATE); zclient_unregister_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); - zclient_unregister_opaque(zclient, LDP_IGP_SYNC_HELLO_UPDATE); /* disable LDP-SYNC globally */ UNSET_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE); UNSET_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_HOLDDOWN); isis->ldp_sync_cmd.holddown = LDP_IGP_SYNC_HOLDDOWN_DEFAULT; - THREAD_OFF(isis->ldp_sync_cmd.t_hello); /* remove LDP-SYNC on all ISIS interfaces */ FOR_ALL_INTERFACES (vrf, ifp) { diff --git a/isisd/isis_ldp_sync.h b/isisd/isis_ldp_sync.h index 1b6058c5c9..977c5ba0de 100644 --- a/isisd/isis_ldp_sync.h +++ b/isisd/isis_ldp_sync.h @@ -40,11 +40,9 @@ extern void isis_ldp_sync_if_complete(struct isis_circuit *circuit); extern void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit); extern void isis_ldp_sync_handle_client_close(struct zapi_client_close_info *info); -extern void isis_ldp_sync_hello_timer_add(void); extern void isis_ldp_sync_ldp_fail(struct isis_circuit *circuit); extern int isis_ldp_sync_state_update(struct ldp_igp_sync_if_state state); extern int isis_ldp_sync_announce_update(struct ldp_igp_sync_announce announce); -extern int isis_ldp_sync_hello_update(struct ldp_igp_sync_hello hello); extern void isis_ldp_sync_state_req_msg(struct isis_circuit *circuit); extern void isis_ldp_sync_set_if_metric(struct isis_circuit *circuit, bool run_regen); diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index c12ee44a90..84ca801d2b 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2305,7 +2305,6 @@ int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args *args) /* register with opaque client to recv LDP-IGP Sync msgs */ zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE); zclient_register_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); - zclient_register_opaque(zclient, LDP_IGP_SYNC_HELLO_UPDATE); if (!CHECK_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) { diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index d51a4db939..f08737c2c1 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -670,7 +670,6 @@ static int isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) 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; @@ -686,10 +685,6 @@ static int isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) STREAM_GET(&announce, s, sizeof(announce)); ret = isis_ldp_sync_announce_update(announce); break; - case LDP_IGP_SYNC_HELLO_UPDATE: - STREAM_GET(&hello, s, sizeof(hello)); - ret = isis_ldp_sync_hello_update(hello); - break; default: break; } diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c index df9832a281..a53854fa56 100644 --- a/ldpd/ldp_zebra.c +++ b/ldpd/ldp_zebra.c @@ -51,8 +51,6 @@ static void ldp_zebra_opaque_register(void); static void ldp_zebra_opaque_unregister(void); static int ldp_sync_zebra_send_announce(void); static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); -static void ldp_sync_zebra_start_hello_timer(void); -static int ldp_sync_zebra_hello(struct thread *thread); static void ldp_sync_zebra_init(void); static struct zclient *zclient; @@ -175,40 +173,12 @@ stream_failure: return 0; } -static void -ldp_sync_zebra_start_hello_timer(void) -{ - thread_add_timer_msec(master, ldp_sync_zebra_hello, NULL, 250, NULL); -} - -static int -ldp_sync_zebra_hello(struct thread *thread) -{ - static unsigned int sequence = 0; - struct ldp_igp_sync_hello hello; - - sequence++; - - hello.proto = ZEBRA_ROUTE_LDP; - hello.sequence = sequence; - - zclient_send_opaque(zclient, LDP_IGP_SYNC_HELLO_UPDATE, - (const uint8_t *) &hello, sizeof(hello)); - - ldp_sync_zebra_start_hello_timer(); - - return (0); -} - static void ldp_sync_zebra_init(void) { ldp_sync_zebra_send_announce(); - - ldp_sync_zebra_start_hello_timer(); } - static int ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr) { diff --git a/lib/ldp_sync.h b/lib/ldp_sync.h index 73e3dac3d8..0429e17d5c 100644 --- a/lib/ldp_sync.h +++ b/lib/ldp_sync.h @@ -39,14 +39,10 @@ extern "C" { #define LDP_IGP_SYNC_HOLDDOWN_DEFAULT 0 -#define LDP_IGP_SYNC_HELLO_TIMEOUT 5 - /* LDP-IGP Sync structures */ struct ldp_sync_info_cmd { uint16_t flags; uint16_t holddown; /* timer value */ - uint32_t sequence; /* hello sequence number */ - struct thread *t_hello; /* hello timer for detecting LDP going down */ }; struct ldp_sync_info { @@ -79,11 +75,6 @@ struct ldp_igp_sync_if_state_req { char name[INTERFACE_NAMSIZ]; }; -struct ldp_igp_sync_hello { - int proto; - unsigned int sequence; -}; - #ifdef __cplusplus } #endif diff --git a/lib/zclient.h b/lib/zclient.h index 33c1e732ee..af4707289f 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -1085,8 +1085,6 @@ enum zapi_opaque_registry { LDP_IGP_SYNC_IF_STATE_UPDATE = 4, /* Announce that LDP is up */ LDP_IGP_SYNC_ANNOUNCE_UPDATE = 5, - /* Heartbeat indicating that LDP is running */ - LDP_IGP_SYNC_HELLO_UPDATE = 6, }; /* Send the hello message. diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index bca15304b1..521b808ecc 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -93,57 +93,11 @@ int ospf_ldp_sync_announce_update(struct ldp_igp_sync_announce announce) /* LDP just started up: * set cost to LSInfinity * send request to LDP for LDP-SYNC state for each interface - * start hello timer */ vrf = vrf_lookup_by_id(ospf->vrf_id); FOR_ALL_INTERFACES (vrf, ifp) ospf_ldp_sync_if_start(ifp, true); - THREAD_OFF(ospf->ldp_sync_cmd.t_hello); - ospf->ldp_sync_cmd.sequence = 0; - ospf_ldp_sync_hello_timer_add(ospf); - - return 0; -} - -int ospf_ldp_sync_hello_update(struct ldp_igp_sync_hello hello) -{ - struct ospf *ospf; - struct vrf *vrf; - struct interface *ifp; - - /* if ospf is not enabled or LDP-SYNC is not configured ignore */ - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); - if (ospf == NULL || - !CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) - return 0; - - if (hello.proto != ZEBRA_ROUTE_LDP) - return 0; - - /* Received Hello from LDP: - * if current sequence number is greater than received hello - * sequence number then assume LDP restarted - * set cost to LSInfinity - * send request to LDP for LDP-SYNC state for each interface - * else all is fine just restart hello timer - */ - if (hello.sequence == 0) - /* rolled over */ - ospf->ldp_sync_cmd.sequence = 0; - - if (ospf->ldp_sync_cmd.sequence > hello.sequence) { - zlog_err("ldp_sync: LDP restarted"); - - vrf = vrf_lookup_by_id(ospf->vrf_id); - FOR_ALL_INTERFACES (vrf, ifp) - ospf_ldp_sync_if_start(ifp, true); - } else { - THREAD_OFF(ospf->ldp_sync_cmd.t_hello); - ospf_ldp_sync_hello_timer_add(ospf); - } - ospf->ldp_sync_cmd.sequence = hello.sequence; - return 0; } @@ -447,46 +401,6 @@ void ospf_ldp_sync_holddown_timer_add(struct interface *ifp) &ldp_sync_info->t_holddown); } -/* - * LDP-SYNC hello timer routines - */ -static int ospf_ldp_sync_hello_timer(struct thread *thread) -{ - struct ospf *ospf; - struct vrf *vrf; - struct interface *ifp; - - /* hello timer expired: - * didn't receive hello msg from LDP - * set cost of all interfaces to LSInfinity - */ - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); - if (ospf) { - vrf = vrf_lookup_by_id(ospf->vrf_id); - - FOR_ALL_INTERFACES (vrf, ifp) - ospf_ldp_sync_ldp_fail(ifp); - - zlog_err("ldp_sync: hello timer expired, LDP down"); - } - return 0; -} - -void ospf_ldp_sync_hello_timer_add(struct ospf *ospf) -{ - - /* Start hello timer: - * this timer is used to make sure LDP is up - * if expires set interface cost to LSInfinity - */ - if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) - return; - - thread_add_timer(master, ospf_ldp_sync_hello_timer, - NULL, LDP_IGP_SYNC_HELLO_TIMEOUT, - &ospf->ldp_sync_cmd.t_hello); -} - /* * LDP-SYNC exit routes. */ @@ -496,7 +410,6 @@ void ospf_ldp_sync_gbl_exit(struct ospf *ospf, bool remove) struct vrf *vrf; /* ospf is being removed - * stop hello timer * stop any holddown timers */ if (CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) { @@ -505,15 +418,12 @@ void ospf_ldp_sync_gbl_exit(struct ospf *ospf, bool remove) LDP_IGP_SYNC_IF_STATE_UPDATE); zclient_unregister_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); - zclient_unregister_opaque(zclient, LDP_IGP_SYNC_HELLO_UPDATE); /* disable LDP globally */ UNSET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE); UNSET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_HOLDDOWN); ospf->ldp_sync_cmd.holddown = LDP_IGP_SYNC_HOLDDOWN_DEFAULT; - THREAD_OFF(ospf->ldp_sync_cmd.t_hello); - /* turn off LDP-IGP Sync on all OSPF interfaces */ vrf = vrf_lookup_by_id(ospf->vrf_id); FOR_ALL_INTERFACES (vrf, ifp) @@ -856,7 +766,6 @@ DEFPY (ospf_mpls_ldp_sync, /* register with opaque client to recv LDP-IGP Sync msgs */ zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE); zclient_register_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); - zclient_register_opaque(zclient, LDP_IGP_SYNC_HELLO_UPDATE); if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) { SET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE); diff --git a/ospfd/ospf_ldp_sync.h b/ospfd/ospf_ldp_sync.h index 418ca4e5b6..63f370724d 100644 --- a/ospfd/ospf_ldp_sync.h +++ b/ospfd/ospf_ldp_sync.h @@ -40,7 +40,6 @@ extern void ospf_ldp_sync_if_remove(struct interface *ifp, bool remove); extern void ospf_ldp_sync_if_down(struct interface *ifp); extern void ospf_ldp_sync_if_complete(struct interface *ifp); extern void ospf_ldp_sync_holddown_timer_add(struct interface *ifp); -extern void ospf_ldp_sync_hello_timer_add(struct ospf *ospf); extern void ospf_ldp_sync_ldp_fail(struct interface *ifp); extern void ospf_ldp_sync_show_info(struct vty *vty, struct ospf *ospf, json_object *json_vrf, bool use_json); @@ -49,7 +48,6 @@ extern void ospf_ldp_sync_if_write_config(struct vty *vty, struct ospf_if_params *params); extern int ospf_ldp_sync_state_update(struct ldp_igp_sync_if_state state); extern int ospf_ldp_sync_announce_update(struct ldp_igp_sync_announce announce); -extern int ospf_ldp_sync_hello_update(struct ldp_igp_sync_hello hello); extern void ospf_ldp_sync_handle_client_close(struct zapi_client_close_info *info); extern void ospf_ldp_sync_state_req_msg(struct interface *ifp); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 93d4ee0ec7..2d02619ae3 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -1956,7 +1956,6 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS) 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; @@ -1973,10 +1972,6 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS) 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; }