diff options
Diffstat (limited to 'zebra/rib.h')
-rw-r--r-- | zebra/rib.h | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/zebra/rib.h b/zebra/rib.h index 887ed3c2..c374df37 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -38,10 +38,6 @@ union g_addr { struct rib { - /* Status Flags for the *route_node*, but kept in the head RIB.. */ - u_char rn_status; -#define RIB_ROUTE_QUEUED(x) (1 << (x)) - /* Link list. */ struct rib *next; struct rib *prev; @@ -49,20 +45,30 @@ struct rib /* Nexthop structure */ struct nexthop *nexthop; - /* Refrence count. */ + /* Reference count. */ unsigned long refcnt; /* Uptime. */ time_t uptime; - /* Type fo this route. */ - int type; + /* Metric */ + u_int32_t metric; /* Which routing table */ - int table; + u_int32_t table; - /* Metric */ - u_int32_t metric; + /* Type for this route. < ZEBRA_ROUTE_MAX */ + u_int8_t type; + + /* Scope for this route: RTM_UNIVERSE .. RTM_NOWHERE */ + u_int8_t scope; + + /* Routing protocol: RTPROT_UNSPEC .. */ + u_int8_t protocol; + + /* Status Flags for the *route_node*, but kept in the head RIB.. */ + u_char rn_status; +#define RIB_ROUTE_QUEUED(x) (1 << (x)) /* Distance. */ u_char distance; @@ -104,6 +110,13 @@ struct static_ipv4 struct static_ipv4 *prev; struct static_ipv4 *next; + /* Nexthop value. */ + union + { + struct in_addr ipv4; + char *ifname; + } gate; + /* Administrative distance. */ u_char distance; @@ -113,13 +126,6 @@ struct static_ipv4 #define STATIC_IPV4_IFNAME 2 #define STATIC_IPV4_BLACKHOLE 3 - /* Nexthop value. */ - union - { - struct in_addr ipv4; - char *ifname; - } gate; - /* bit flags */ u_char flags; /* @@ -136,6 +142,10 @@ struct static_ipv6 struct static_ipv6 *prev; struct static_ipv6 *next; + /* Nexthop value. */ + struct in6_addr ipv6; + char *ifname; + /* Administrative distance. */ u_char distance; @@ -144,11 +154,6 @@ struct static_ipv6 #define STATIC_IPV6_GATEWAY 1 #define STATIC_IPV6_GATEWAY_IFNAME 2 #define STATIC_IPV6_IFNAME 3 - - /* Nexthop value. */ - struct in6_addr ipv6; - char *ifname; - /* bit flags */ u_char flags; /* @@ -180,22 +185,24 @@ struct nexthop /* Interface index. */ char *ifname; unsigned int ifindex; + + /* Nexthop address or interface name. */ + union g_addr gate; + + unsigned int rifindex; + union g_addr rgate; + union g_addr src; - enum nexthop_types_t type; +/* Really enum nexthop_types_t but safe space */ + u_char type; u_char flags; #define NEXTHOP_FLAG_ACTIVE (1 << 0) /* This nexthop is alive. */ #define NEXTHOP_FLAG_FIB (1 << 1) /* FIB nexthop. */ #define NEXTHOP_FLAG_RECURSIVE (1 << 2) /* Recursive nexthop. */ - /* Nexthop address or interface name. */ - union g_addr gate; - /* Recursive lookup nexthop. */ u_char rtype; - unsigned int rifindex; - union g_addr rgate; - union g_addr src; }; /* Routing table instance. */ @@ -220,7 +227,8 @@ struct vrf struct route_table *stable[AFI_MAX][SAFI_MAX]; }; -extern struct nexthop *nexthop_ifindex_add (struct rib *, unsigned int); +extern struct nexthop *nexthop_ifindex_add (struct rib *, unsigned int, + struct in_addr *); extern struct nexthop *nexthop_ifname_add (struct rib *, char *); extern struct nexthop *nexthop_blackhole_add (struct rib *); extern struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *, @@ -249,7 +257,8 @@ extern struct route_table *vrf_static_table (afi_t afi, safi_t safi, u_int32_t i extern int rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p, struct in_addr *gate, struct in_addr *src, unsigned int ifindex, u_int32_t vrf_id, - u_int32_t, u_char); + u_int32_t metric, u_int8_t distance, + u_int8_t scope, u_int8_t protocol); extern int rib_add_ipv4_multipath (struct prefix_ipv4 *, struct rib *); @@ -264,6 +273,8 @@ extern struct rib *rib_lookup_ipv4 (struct prefix_ipv4 *); extern void rib_update (void); extern void rib_weed_tables (void); extern void rib_sweep_route (void); +struct interface; +extern void rib_flush_interface (afi_t afi, struct interface *ifp); extern void rib_close (void); extern void rib_init (void); |