diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2020-10-08 19:23:08 +0300 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2020-10-08 23:14:54 +0300 | 
| commit | 0bcdb96bb183bed8d9145a3586a2193b4b1364b4 (patch) | |
| tree | 8111d059f77f0bcf93c4da1de29ba306e338ec98 /isisd/isis_csm.c | |
| parent | 733c4db58726a54ac0fe46b1a18def9dbe133cbc (diff) | |
isisd: fix incorrect vrf lookups
Lookup in C_STATE_NA must be made before the new circuit creation, or it
will be leaked if the isis instance is not found. All other lookups are
unnecessary - we just need to remember the previously used instance.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'isisd/isis_csm.c')
| -rw-r--r-- | isisd/isis_csm.c | 31 | 
1 files changed, 9 insertions, 22 deletions
diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c index c848ed2638..f5ad0aff48 100644 --- a/isisd/isis_csm.c +++ b/isisd/isis_csm.c @@ -83,16 +83,17 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)  			circuit->state = C_STATE_CONF;  			break;  		case IF_UP_FROM_Z: -			circuit = isis_circuit_new(); -			isis_circuit_if_add(circuit, (struct interface *)arg); -			isis = isis_lookup_by_vrfid(circuit->interface->vrf_id); +			isis = isis_lookup_by_vrfid(((struct interface *)arg)->vrf_id);  			if (isis == NULL) {  				zlog_warn(  					" %s : ISIS routing instance not found",  					__func__);  				break;  			} +			circuit = isis_circuit_new(); +			isis_circuit_if_add(circuit, (struct interface *)arg);  			listnode_add(isis->init_circ_list, circuit); +			circuit->isis = isis;  			circuit->state = C_STATE_INIT;  			break;  		case ISIS_DISABLE: @@ -117,7 +118,7 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)  			circuit->state = C_STATE_UP;  			isis_event_circuit_state_change(circuit, circuit->area,  							1); -			listnode_delete(circuit->area->isis->init_circ_list, +			listnode_delete(circuit->isis->init_circ_list,  					circuit);  			break;  		case IF_UP_FROM_Z: @@ -129,15 +130,8 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)  			break;  		case IF_DOWN_FROM_Z:  			isis_circuit_if_del(circuit, (struct interface *)arg); -			isis = isis_lookup_by_vrfid(circuit->interface->vrf_id); -			if (isis == NULL) { -				zlog_warn( -					"%s : ISIS routing instance not found", -					__func__); -				break; -			} - -			listnode_delete(isis->init_circ_list, circuit); +			listnode_delete(circuit->isis->init_circ_list, +					circuit);  			isis_circuit_del(circuit);  			circuit = NULL;  			break; @@ -184,22 +178,15 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)  			zlog_warn("circuit already connected");  			break;  		case ISIS_DISABLE: +			isis = circuit->area->isis;  			isis_circuit_down(circuit);  			isis_circuit_deconfigure(circuit,  						 (struct isis_area *)arg);  			circuit->state = C_STATE_INIT;  			isis_event_circuit_state_change(  				circuit, (struct isis_area *)arg, 0); - -			isis = isis_lookup_by_vrfid(circuit->interface->vrf_id); -			if (isis == NULL) { -				zlog_warn( -					"%s : ISIS routing instance not found", -					__func__); -				break; -			} -  			listnode_add(isis->init_circ_list, circuit); +			circuit->isis = isis;  			break;  		case IF_DOWN_FROM_Z:  			isis_circuit_down(circuit);  | 
