From 4660687a38034d60296fbc9e82aae772011c407f Mon Sep 17 00:00:00 2001 From: hasso Date: Wed, 29 Dec 2004 19:34:22 +0000 Subject: Don't crash during interface up/down events. --- isisd/ChangeLog | 6 ++++++ isisd/isis_circuit.c | 13 ++++++++++--- isisd/isis_csm.c | 2 ++ isisd/isis_zebra.c | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) (limited to 'isisd') 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 + + * 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 * *.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; } -- cgit v1.2.1