isisd: fix isis_circuit_create()
Between the awkwardly managed CSM and the tacked-on IPv6 support, the
simplified logic to setup a circuit wasn't quite right.
Note that the API essentially allows creating a circuit without enabling
either IPv4 or IPv6. This wasn't possible before and probably breaks
isisd in 'interesting' ways. The CLI won't do this, so it's only an
issue when adding on other configuration mechanisms.
Reported-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index aa30fcd..b830794 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -1225,8 +1225,10 @@
struct isis_circuit *
isis_circuit_create (struct isis_area *area, struct interface *ifp)
{
- struct isis_circuit *circuit;
- circuit = isis_csm_state_change (ISIS_ENABLE, NULL, area);
+ struct isis_circuit *circuit = circuit_scan_by_ifp (ifp);
+ if (circuit && circuit->area)
+ return NULL;
+ circuit = isis_csm_state_change (ISIS_ENABLE, circuit, area);
assert (circuit->state == C_STATE_CONF || circuit->state == C_STATE_UP);
isis_circuit_if_bind (circuit, ifp);
return circuit;