1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Temporary integrated OSPF commit.

This commit is contained in:
Ondrej Zajicek
2014-07-18 18:24:12 +02:00
parent 70945cb645
commit a7a7372aa7
15 changed files with 779 additions and 691 deletions

View File

@@ -2,9 +2,10 @@
* BIRD -- OSPF
*
* (c) 2000--2004 Ondrej Filip <feela@network.cz>
* (c) 2009--2014 Ondrej Zajicek <santiago@crfreenet.org>
* (c) 2009--2014 CZ.NIC z.s.p.o.
*
* Can be freely distributed and used under the terms of the GNU GPL.
*
*/
#ifndef _BIRD_OSPF_RT_H_
@@ -28,12 +29,17 @@ typedef struct orta
#define ORTA_ASBR OPT_RT_E
#define ORTA_ABR OPT_RT_B
/*
* For ORT_NET routes, the field is almost unused with one
* exception: ORTA_PREF for external routes means that the route is
* preferred in AS external route selection according to 16.4.1. -
* it is intra-area path using non-backbone area. In other words,
* the forwarding address (or ASBR if forwarding address is zero) is
* intra-area (type == RTS_OSPF) and its area is not a backbone.
* For ORT_NET routes, there are just several flags for external routes:
*
* ORTA_PREF for external routes means that the route is preferred in AS
* external route selection according to 16.4.1. - it is intra-area path using
* non-backbone area. In other words, the forwarding address (or ASBR if
* forwarding address is zero) is intra-area (type == RTS_OSPF) and its area
* is not a backbone.
*
* ORTA_NSSA means that the entry represents an NSSA route, and ORTA_PROP
* means that the NSSA route has propagate-bit set. These flags are used in
* NSSA translation.
*/
#define ORTA_PREF 0x80000000
#define ORTA_NSSA 0x40000000
@@ -51,41 +57,38 @@ typedef struct orta
}
orta;
/* Values for fn.flags in struct ort */
#define OSPF_RT_PERSISTENT 0x01
typedef struct ort
{
/*
* We use OSPF_RT_PERSISTENT to mark persistent rt entries, that are
* needed for summary LSAs that don't have 'proper' rt entry (area
* networks + default to stubs) to keep uid stable (used for LSA ID
* in OSPFv3 - see fibnode_to_lsaid()).
* Most OSPF routing table entries are for computed OSPF routes, these have
* defined n.type. There are also few other cases: entries for configured area
* networks (these have area_net field set) and entries for external routes
* exported to OSPF (these have external_rte field set). These entries are
* kept even if they do not contain 'proper' rt entry. That is needed to keep
* allocated stable UID numbers (fn.uid), which are used as LSA IDs in OSPFv3
* (see fibnode_to_lsaid()) for related LSAs (network summary LSAs in the
* first case, external or NSSA LSAs in the second case). Entries for external
* routes also have a second purpose - to prevent NSSA translation of received
* NSSA routes if regular external routes were already originated for the same
* network (see check_nssa_lsa()).
*
* We use ORT_RT_EXPORT and ORT_RT_NSSA to note whether the
* external/NSSA route was originated from the route export (in
* ospf_rt_notify()) or from the NSSA route translation (in
* check_nssa_lsa()).
*
* old_* values are here to represent the last route update. old_rta
* is cached (we keep reference), mainly for multipath nexthops.
* old_rta == NULL means route was not in the last update, in that
* case other old_* values are not valid.
* old_* values are here to represent the last route update. old_rta is cached
* (we keep reference), mainly for multipath nexthops. old_rta == NULL means
* route was not in the last update, in that case other old_* values are not
* valid.
*/
struct fib_node fn;
orta n;
u32 old_metric1, old_metric2, old_tag, old_rid;
rta *old_rta;
u8 external_rte;
u8 area_net;
}
ort;
static inline int rt_is_nssa(ort *nf)
{ return nf->n.options & ORTA_NSSA; }
#define EXT_EXPORT 1
#define EXT_NSSA 2
/*
* Invariants for structs top_hash_entry (nodes of LSA db)
@@ -97,7 +100,7 @@ static inline int rt_is_nssa(ort *nf)
* - beware, nhs is not valid after SPF calculation
*
* Invariants for structs orta nodes of fib tables po->rtf, oa->rtr:
* - nodes may be invalid (fn.type == 0), in that case other invariants don't hold
* - nodes may be invalid (n.type == 0), in that case other invariants don't hold
* - n.metric1 may be at most a small multiple of LSINFINITY,
* therefore sums do not overflow
* - n.oa is always non-NULL