summaryrefslogtreecommitdiffstats
path: root/isisd/isis_circuit.c
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2018-03-05 18:45:02 +0100
committerChristian Franke <chris@opensourcerouting.org>2018-03-10 18:38:03 +0100
commit0849c75e5d75d25b0d330545451295edfe8d23be (patch)
tree2f7a1eb48037585a8f5e5686b87a42fb640e84ce /isisd/isis_circuit.c
parentisisd: cleanup usage of circuit_id (diff)
downloadfrr-0849c75e5d75d25b0d330545451295edfe8d23be.tar.xz
frr-0849c75e5d75d25b0d330545451295edfe8d23be.zip
isisd: allocate circuit_id only for broadcast circuits
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_circuit.c')
-rw-r--r--isisd/isis_circuit.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 4341584a2..c8642b623 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -377,7 +377,7 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
return;
}
-static uint8_t isis_circuit_id_gen(struct interface *ifp)
+static uint8_t isis_circuit_id_gen(struct isis *isis, struct interface *ifp)
{
/* Circuit ids MUST be unique for any broadcast circuits. Otherwise,
* Pseudo-Node LSPs cannot be generated correctly.
@@ -403,6 +403,7 @@ static uint8_t isis_circuit_id_gen(struct interface *ifp)
return 0;
}
+ _ISIS_SET_FLAG(isis->circuit_ids_used, id);
return id;
}
@@ -411,11 +412,7 @@ void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp)
struct listnode *node, *nnode;
struct connected *conn;
- circuit->circuit_id = isis_circuit_id_gen(ifp);
- _ISIS_SET_FLAG(isis->circuit_ids_used, circuit->circuit_id);
-
isis_circuit_if_bind(circuit, ifp);
- /* isis_circuit_update_addrs (circuit, ifp); */
if (if_is_broadcast(ifp)) {
if (circuit->circ_type_config == CIRCUIT_T_P2P)
@@ -440,8 +437,6 @@ void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp)
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, conn))
isis_circuit_add_addr(circuit, conn);
-
- return;
}
void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp)
@@ -471,10 +466,6 @@ void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp)
}
circuit->circ_type = CIRCUIT_T_UNKNOWN;
- _ISIS_CLEAR_FLAG(isis->circuit_ids_used, circuit->circuit_id);
- circuit->circuit_id = 0;
-
- return;
}
void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp)
@@ -588,6 +579,12 @@ int isis_circuit_up(struct isis_circuit *circuit)
}
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
+ circuit->circuit_id = isis_circuit_id_gen(isis, circuit->interface);
+ if (!circuit->circuit_id) {
+ zlog_err("There are already 255 broadcast circuits active!");
+ return ISIS_ERROR;
+ }
+
/*
* Get the Hardware Address
*/
@@ -732,6 +729,9 @@ void isis_circuit_down(struct isis_circuit *circuit)
THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]);
circuit->lsp_regenerate_pending[0] = 0;
circuit->lsp_regenerate_pending[1] = 0;
+
+ _ISIS_CLEAR_FLAG(isis->circuit_ids_used, circuit->circuit_id);
+ circuit->circuit_id = 0;
} else if (circuit->circ_type == CIRCUIT_T_P2P) {
isis_delete_adj(circuit->u.p2p.neighbor);
circuit->u.p2p.neighbor = NULL;