summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhasso <hasso>2004-12-29 19:34:22 +0000
committerhasso <hasso>2004-12-29 19:34:22 +0000
commit4660687a38034d60296fbc9e82aae772011c407f (patch)
tree5a0d7caea1ba0958c8f9780da038654ce4f10fed
parent1d69fdf645d8434e8e1488f8bf0c73613df09da9 (diff)
Don't crash during interface up/down events.
-rw-r--r--isisd/ChangeLog6
-rw-r--r--isisd/isis_circuit.c13
-rw-r--r--isisd/isis_csm.c2
-rw-r--r--isisd/isis_zebra.c3
4 files changed, 21 insertions, 3 deletions
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 93a901b7..e883faa0 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-29 Hasso Tepper <hasso at quagga.net>
+
+ * isis_circuit.c, isis_csm.c, isis_zebra.c: Don't crash during
+ interface up/down events. I'm not sure whether logic is correct
+ though. Needs rethink anyway, seems.
+
2004-12-24 Hasso Tepper <hasso at quagga.net>
* *.c: zlog_* cleanup. Mostly changed level of debug messages to
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index c00e88f8..ca5befbd 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -191,8 +191,10 @@ isis_circuit_del (struct isis_circuit *circuit)
if (circuit->circ_type == CIRCUIT_T_BROADCAST)
{
/* destroy adjacency databases */
- list_delete (circuit->u.bc.adjdb[0]);
- list_delete (circuit->u.bc.adjdb[1]);
+ if (circuit->u.bc.adjdb[0])
+ list_delete (circuit->u.bc.adjdb[0]);
+ if (circuit->u.bc.adjdb[1])
+ list_delete (circuit->u.bc.adjdb[1]);
/* destroy neighbour lists */
if (circuit->u.bc.lan_neighs[0])
list_delete (circuit->u.bc.lan_neighs[0]);
@@ -428,7 +430,12 @@ void
isis_circuit_update_params (struct isis_circuit *circuit,
struct interface *ifp)
{
- assert (circuit);
+ /* HT: It can happen at the moment during interface up event because we
+ * actually delete circuit during interface down event. Should be really
+ * cleaned up. TODO */
+ /* assert (circuit); */
+ if (!circuit)
+ return;
if (circuit->circuit_id != ifp->ifindex)
{
diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c
index 8e57d398..58a0b295 100644
--- a/isisd/isis_csm.c
+++ b/isisd/isis_csm.c
@@ -125,6 +125,7 @@ isis_csm_state_change (int event, struct isis_circuit *circuit, void *arg)
isis_circuit_if_del (circuit);
listnode_delete (isis->init_circ_list, circuit);
isis_circuit_del (circuit);
+ circuit = NULL;
break;
}
break;
@@ -143,6 +144,7 @@ isis_csm_state_change (int event, struct isis_circuit *circuit, void *arg)
case ISIS_DISABLE:
isis_circuit_deconfigure (circuit, (struct isis_area *) arg);
isis_circuit_del (circuit);
+ circuit = NULL;
break;
case IF_DOWN_FROM_Z:
zlog_warn ("circuit already disconnected");
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index c7d05334..bcd00184 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -135,6 +135,9 @@ isis_zebra_if_state_up (int command, struct zclient *zclient,
if (if_is_up (ifp))
{
zebra_interface_if_set_value (zclient->ibuf, ifp);
+ /* HT: This is wrong actually. We can't assume that circuit exist
+ * if we delete circuit during if_state_down event. Needs rethink.
+ * TODO */
isis_circuit_update_params (circuit_scan_by_ifp (ifp), ifp);
return 0;
}