]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_intra.h
Merge pull request #478 from opensourcerouting/test-extension
[mirror_frr.git] / ospf6d / ospf6_intra.h
index db92f7e726fb94e209588baa29d5b77f77fa43e9..c9660b6a5c5551ed212894d5f2330e44899684d6 100644 (file)
 #ifndef OSPF6_INTRA_H
 #define OSPF6_INTRA_H
 
+/* Debug option */
+extern unsigned char conf_debug_ospf6_brouter;
+extern u_int32_t conf_debug_ospf6_brouter_specific_router_id;
+extern u_int32_t conf_debug_ospf6_brouter_specific_area_id;
+#define OSPF6_DEBUG_BROUTER_SUMMARY         0x01
+#define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER 0x02
+#define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA   0x04
+#define OSPF6_DEBUG_BROUTER_ON() \
+  (conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SUMMARY)
+#define OSPF6_DEBUG_BROUTER_OFF() \
+  (conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SUMMARY)
+#define IS_OSPF6_DEBUG_BROUTER \
+  (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SUMMARY)
+
+#define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id)             \
+  do {                                                                \
+    conf_debug_ospf6_brouter_specific_router_id = (router_id);        \
+    conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER;  \
+  } while (0)
+#define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF()                     \
+  do {                                                                \
+    conf_debug_ospf6_brouter_specific_router_id = 0;                  \
+    conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
+  } while (0)
+#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER                        \
+  (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER)
+#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(router_id)          \
+  (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER &&                          \
+   conf_debug_ospf6_brouter_specific_router_id == (router_id))
+
+#define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id)                 \
+  do {                                                                \
+    conf_debug_ospf6_brouter_specific_area_id = (area_id);            \
+    conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_AREA;    \
+  } while (0)
+#define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF()                       \
+  do {                                                                \
+    conf_debug_ospf6_brouter_specific_area_id = 0;                    \
+    conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_AREA;   \
+  } while (0)
+#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA                          \
+  (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_AREA)
+#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(area_id)              \
+  (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA &&                            \
+   conf_debug_ospf6_brouter_specific_area_id == (area_id))
+
 /* Router-LSA */
+#define OSPF6_ROUTER_LSA_MIN_SIZE              4U
 struct ospf6_router_lsa
 {
   u_char bits;
@@ -31,6 +78,7 @@ struct ospf6_router_lsa
 };
 
 /* Link State Description in Router-LSA */
+#define OSPF6_ROUTER_LSDESC_FIX_SIZE          16U
 struct ospf6_router_lsdesc
 {
   u_char    type;
@@ -46,6 +94,13 @@ struct ospf6_router_lsdesc
 #define OSPF6_ROUTER_LSDESC_STUB_NETWORK       3
 #define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK       4
 
+enum stub_router_mode
+  {
+    OSPF6_NOT_STUB_ROUTER,
+    OSPF6_IS_STUB_ROUTER,
+    OSPF6_IS_STUB_ROUTER_V6,
+  };
+
 #define ROUTER_LSDESC_IS_TYPE(t,x)                         \
   ((((struct ospf6_router_lsdesc *)(x))->type ==           \
    OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0)
@@ -59,6 +114,7 @@ struct ospf6_router_lsdesc
   (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
 
 /* Network-LSA */
+#define OSPF6_NETWORK_LSA_MIN_SIZE             4U
 struct ospf6_network_lsa
 {
   u_char reserved;
@@ -67,6 +123,7 @@ struct ospf6_network_lsa
 };
 
 /* Link State Description in Router-LSA */
+#define OSPF6_NETWORK_LSDESC_FIX_SIZE          4U
 struct ospf6_network_lsdesc
 {
   u_int32_t router_id;
@@ -75,6 +132,7 @@ struct ospf6_network_lsdesc
   (((struct ospf6_network_lsdesc *)(x))->router_id)
 
 /* Link-LSA */
+#define OSPF6_LINK_LSA_MIN_SIZE               24U /* w/o 1st IPv6 prefix */
 struct ospf6_link_lsa
 {
   u_char          priority;
@@ -85,6 +143,7 @@ struct ospf6_link_lsa
 };
 
 /* Intra-Area-Prefix-LSA */
+#define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE       12U /* w/o 1st IPv6 prefix */
 struct ospf6_intra_prefix_lsa
 {
   u_int16_t prefix_num;
@@ -94,35 +153,40 @@ struct ospf6_intra_prefix_lsa
   /* followed by ospf6 prefix(es) */
 };
 
-\f
+
 #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
   do { \
-    if (! (oa)->thread_router_lsa) \
+    if (! (oa)->thread_router_lsa \
+        && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
       (oa)->thread_router_lsa = \
         thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \
   } while (0)
 #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
   do { \
-    if (! (oi)->thread_network_lsa) \
+    if (! (oi)->thread_network_lsa \
+        && ! CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
       (oi)->thread_network_lsa = \
         thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \
   } while (0)
 #define OSPF6_LINK_LSA_SCHEDULE(oi) \
   do { \
-    if (! (oi)->thread_link_lsa) \
+    if (! (oi)->thread_link_lsa \
+        && ! CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
       (oi)->thread_link_lsa = \
         thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \
   } while (0)
 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
   do { \
-    if (! (oa)->thread_intra_prefix_lsa) \
+    if (! (oa)->thread_intra_prefix_lsa \
+        && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
       (oa)->thread_intra_prefix_lsa = \
         thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \
                           oa, 0); \
   } while (0)
 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
   do { \
-    if (! (oi)->thread_intra_prefix_lsa) \
+    if (! (oi)->thread_intra_prefix_lsa \
+        && ! CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
       (oi)->thread_intra_prefix_lsa = \
         thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \
                           oi, 0); \
@@ -141,25 +205,29 @@ struct ospf6_intra_prefix_lsa
 
 
 /* Function Prototypes */
-char *ospf6_router_lsdesc_lookup (u_char type, u_int32_t interface_id,
-                            u_int32_t neighbor_interface_id,
-                            u_int32_t neighbor_router_id,
-                            struct ospf6_lsa *lsa);
-char *ospf6_network_lsdesc_lookup (u_int32_t router_id,
-                                   struct ospf6_lsa *lsa);
-
-int ospf6_router_lsa_originate (struct thread *);
-int ospf6_network_lsa_originate (struct thread *);
-int ospf6_link_lsa_originate (struct thread *);
-int ospf6_intra_prefix_lsa_originate_transit (struct thread *);
-int ospf6_intra_prefix_lsa_originate_stub (struct thread *);
-void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa);
-void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa);
-
-void ospf6_intra_route_calculation (struct ospf6_area *oa);
-void ospf6_intra_brouter_calculation (struct ospf6_area *oa);
-
-void ospf6_intra_init ();
+extern char *ospf6_router_lsdesc_lookup (u_char type, u_int32_t interface_id,
+                                         u_int32_t neighbor_interface_id,
+                                         u_int32_t neighbor_router_id,
+                                         struct ospf6_lsa *lsa);
+extern char *ospf6_network_lsdesc_lookup (u_int32_t router_id,
+                                          struct ospf6_lsa *lsa);
+
+extern int ospf6_router_is_stub_router (struct ospf6_lsa *lsa);
+extern int ospf6_router_lsa_originate (struct thread *);
+extern int ospf6_network_lsa_originate (struct thread *);
+extern int ospf6_link_lsa_originate (struct thread *);
+extern int ospf6_intra_prefix_lsa_originate_transit (struct thread *);
+extern int ospf6_intra_prefix_lsa_originate_stub (struct thread *);
+extern void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa);
+extern void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa);
+
+extern void ospf6_intra_route_calculation (struct ospf6_area *oa);
+extern void ospf6_intra_brouter_calculation (struct ospf6_area *oa);
+
+extern void ospf6_intra_init (void);
+
+extern int config_write_ospf6_debug_brouter (struct vty *vty);
+extern void install_element_ospf6_debug_brouter (void);
 
 #endif /* OSPF6_LSA_H */