isisd: initialize circuit to match area is_type

New circuits should be initialized to match the is_type
of their area. Also add an additional check to make sure
that no IIHs are sent for levels which are not enabled.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index d63a8a6..26efe4d 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -2446,6 +2446,13 @@
   assert (circuit);
   circuit->u.bc.t_send_lan_hello[0] = NULL;
 
+  if (!(circuit->area->is_type & IS_LEVEL_1))
+    {
+      zlog_warn ("ISIS-Hello (%s): Trying to send L1 IIH in L2-only area",
+		 circuit->area->area_tag);
+      return 1;
+    }
+
   if (circuit->u.bc.run_dr_elect[0])
     retval = isis_dr_elect (circuit, 1);
 
@@ -2469,6 +2476,13 @@
   assert (circuit);
   circuit->u.bc.t_send_lan_hello[1] = NULL;
 
+  if (!(circuit->area->is_type & IS_LEVEL_2))
+    {
+      zlog_warn ("ISIS-Hello (%s): Trying to send L2 IIH in L1 area",
+		 circuit->area->area_tag);
+      return 1;
+    }
+
   if (circuit->u.bc.run_dr_elect[1])
     retval = isis_dr_elect (circuit, 2);