Browse Source

isisd: fix a crash due to an lsp-mtu issue

isisd crashed on startup if it was enabled for an interface with
a too small MTU.

To fix this, we treat this case as an invalid configuration and
disable isis on that interface if that case happens, since it is
a configuration error.

Signed-off-by: Christian Franke <nobody@nowhere.ws>
Christian Franke 3 years ago
parent
commit
8ed8d0b5d1
2 changed files with 21 additions and 4 deletions
  1. 1 1
      isisd/isis_circuit.c
  2. 20 3
      isisd/isis_csm.c

+ 1 - 1
isisd/isis_circuit.c

@@ -640,7 +640,7 @@ isis_circuit_up (struct isis_circuit *circuit)
       zlog_err("Interface MTU %zu on %s is too low to support area lsp mtu %u!",
                isis_circuit_pdu_size(circuit), circuit->interface->name,
                circuit->area->lsp_mtu);
-      isis_circuit_down(circuit);
+      isis_circuit_update_all_srmflags(circuit, 0);
       return ISIS_ERROR;
     }
 

+ 20 - 3
isisd/isis_csm.c

@@ -147,10 +147,27 @@ isis_csm_state_change (int event, struct isis_circuit *circuit, void *arg)
 	case IF_UP_FROM_Z:
 	  isis_circuit_if_add (circuit, (struct interface *) arg);
 	  if (isis_circuit_up (circuit) != ISIS_OK)
-            {
-              isis_circuit_if_del (circuit, (struct interface *) arg);
+	    {
+	      zlog_err("Could not bring up %s because of invalid config.",
+	               circuit->interface->name);
+	      zlog_err("Clearing config for %s. Please re-examine it.",
+	               circuit->interface->name);
+	      if (circuit->ip_router)
+	        {
+	          circuit->ip_router = 0;
+	          circuit->area->ip_circuits--;
+	        }
+	      if (circuit->ipv6_router)
+	        {
+	          circuit->ipv6_router = 0;
+	          circuit->area->ipv6_circuits--;
+	        }
+	      circuit_update_nlpids(circuit);
+	      isis_circuit_deconfigure(circuit, circuit->area);
+	      listnode_add (isis->init_circ_list, circuit);
+	      circuit->state = C_STATE_INIT;
 	      break;
-            }
+	    }
 	  circuit->state = C_STATE_UP;
 	  isis_event_circuit_state_change (circuit, circuit->area, 1);
 	  break;