isisd: fix crash on changing the circuit type of a passive interface
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index 3887b7c..96d5762 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -280,26 +280,29 @@
return;
}
- switch (circuit->is_type)
+ if (! circuit->is_passive)
{
- case IS_LEVEL_1:
- if (newtype == IS_LEVEL_2)
- circuit_resign_level (circuit, 1);
- circuit_commence_level (circuit, 2);
- break;
- case IS_LEVEL_1_AND_2:
- if (newtype == IS_LEVEL_1)
- circuit_resign_level (circuit, 2);
- else
- circuit_resign_level (circuit, 1);
- break;
- case IS_LEVEL_2:
- if (newtype == IS_LEVEL_1)
- circuit_resign_level (circuit, 2);
- circuit_commence_level (circuit, 1);
- break;
- default:
- break;
+ switch (circuit->is_type)
+ {
+ case IS_LEVEL_1:
+ if (newtype == IS_LEVEL_2)
+ circuit_resign_level (circuit, 1);
+ circuit_commence_level (circuit, 2);
+ break;
+ case IS_LEVEL_1_AND_2:
+ if (newtype == IS_LEVEL_1)
+ circuit_resign_level (circuit, 2);
+ else
+ circuit_resign_level (circuit, 1);
+ break;
+ case IS_LEVEL_2:
+ if (newtype == IS_LEVEL_1)
+ circuit_resign_level (circuit, 2);
+ circuit_commence_level (circuit, 1);
+ break;
+ default:
+ break;
+ }
}
circuit->is_type = newtype;