summaryrefslogtreecommitdiff
path: root/isisd/isis_ldp_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'isisd/isis_ldp_sync.c')
-rw-r--r--isisd/isis_ldp_sync.c109
1 files changed, 18 insertions, 91 deletions
diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c
index 3b1faffe53..00bef5c782 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;
}
@@ -293,7 +236,7 @@ void isis_ldp_sync_ldp_fail(struct isis_circuit *circuit)
ldp_sync_info = circuit->ldp_sync_info;
- /* LDP failed to send hello:
+ /* LDP client close detected:
* stop holddown timer
* set cost of interface to LSInfinity so traffic will use different
* interface until LDP restarts and has learned all labels from peer
@@ -522,9 +465,9 @@ void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit)
}
/*
- * LDP-SYNC hello timer routines
+ * LDP-SYNC handle client close routine
*/
-static int isis_ldp_sync_hello_timer(struct thread *thread)
+void isis_ldp_sync_handle_client_close(struct zapi_client_close_info *info)
{
struct isis_area *area;
struct listnode *node;
@@ -533,44 +476,30 @@ static int isis_ldp_sync_hello_timer(struct thread *thread)
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT);
- if (!isis)
- return 0;
+ /* 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;
+
+ /* Check if the LDP main client session closed */
+ if (info->proto != ZEBRA_ROUTE_LDP || info->session_id == 0)
+ return;
- /* hello timer expired:
- * didn't receive hello msg from LDP
- * set cost of all interfaces to LSInfinity
+ /* Handle the zebra notification that the LDP client session closed.
+ * set cost to LSInfinity
+ * send request to LDP for LDP-SYNC state for each interface
*/
+ zlog_err("ldp_sync: LDP down");
+
FOR_ALL_INTERFACES (vrf, ifp) {
for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
- circuit = circuit_lookup_by_ifp(ifp,
- area->circuit_list);
+ 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);
}
/*
@@ -661,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) {