From 41b612c31be05409e69e7365db82b3d1aefc4ca3 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 20 Jul 2011 23:40:20 +0200 Subject: OSPF NSSA support, part one. --- proto/ospf/ospf.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'proto/ospf/ospf.h') diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 664bc48..a8b4a98 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -123,7 +123,10 @@ struct ospf_area_config { node n; u32 areaid; - u32 stub; + u32 stub_cost; /* Cost of default route for stub areas */ + u8 type; /* Area type (standard, stub, NSSA), represented + by option flags (OPT_E, OPT_N) */ + u8 summary; /* Import summaries to this stub/NSSA area, valid for ABR */ list patt_list; list net_list; /* List of aggregate networks for that area */ list stubnet_list; /* List of stub networks added to Router LSA */ @@ -137,12 +140,14 @@ struct ospf_area_config #define OPT_DC 0x20 #ifdef OSPFv2 +#define OPT_P 0x08 /* flags P and N share position, see NSSA RFC */ #define OPT_EA 0x10 /* VEB flags are are stored independently in 'u16 options' */ #define OPT_RT_B (0x01 << 8) #define OPT_RT_E (0x02 << 8) #define OPT_RT_V (0x04 << 8) +#define OPT_RT_NT (0x10 << 8) #endif #ifdef OSPFv3 @@ -363,6 +368,7 @@ struct ospf_lsa_header #define LSA_T_SUM_NET 3 #define LSA_T_SUM_RT 4 #define LSA_T_EXT 5 +#define LSA_T_NSSA 7 #define LSA_SCOPE_AREA 0x2000 #define LSA_SCOPE_AS 0x4000 @@ -377,6 +383,7 @@ struct ospf_lsa_header #define LSA_T_SUM_NET 0x2003 #define LSA_T_SUM_RT 0x2004 #define LSA_T_EXT 0x4005 +#define LSA_T_NSSA 0x2007 #define LSA_T_LINK 0x0008 #define LSA_T_PREFIX 0x2009 @@ -720,12 +727,11 @@ struct ospf_area { node n; u32 areaid; - struct ospf_area_config *ac; /* Related area config, might be NULL */ + struct ospf_area_config *ac; /* Related area config */ struct top_hash_entry *rt; /* My own router LSA */ struct top_hash_entry *pxr_lsa; /* Originated prefix LSA */ list cand; /* List of candidates for RT calc. */ struct fib net_fib; /* Networks to advertise or not */ - u32 stub; /* 0 or stub area cost */ u32 options; /* Optional features */ byte origrt; /* Rt lsa origination scheduled? */ byte trcap; /* Transit capability? */ @@ -796,7 +802,6 @@ struct ospf_iface_patt #endif }; - int ospf_import_control(struct proto *p, rte **new, ea_list **attrs, struct linpool *pool); struct ea_list *ospf_make_tmp_attrs(struct rte *rt, struct linpool *pool); @@ -806,6 +811,16 @@ void schedule_rtcalc(struct proto_ospf *po); void schedule_net_lsa(struct ospf_iface *ifa); struct ospf_area *ospf_find_area(struct proto_ospf *po, u32 aid); +static inline struct ospf_area *ospf_main_area(struct proto_ospf *po) +{ return (po->areano == 1) ? HEAD(po->area_list) : po->backbone; } + +static inline int oa_is_stub(struct ospf_area *oa) +{ return (oa->options & (OPT_E | OPT_N)) == 0; } +static inline int oa_is_ext(struct ospf_area *oa) +{ return oa->options & OPT_E; } +static inline int oa_is_nssa(struct ospf_area *oa) +{ return oa->options & OPT_N; } + #ifdef OSPFv3 void schedule_link_lsa(struct ospf_iface *ifa); -- cgit v1.2.3