1998-12-06 18:21:23 +00:00
|
|
|
/*
|
|
|
|
* BIRD -- Static Route Generator
|
|
|
|
*
|
2000-01-17 11:52:50 +00:00
|
|
|
* (c) 1998--2000 Martin Mares <mj@ucw.cz>
|
1998-12-06 18:21:23 +00:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BIRD_STATIC_H_
|
|
|
|
#define _BIRD_STATIC_H_
|
|
|
|
|
2015-07-24 16:02:07 +00:00
|
|
|
#include "nest/route.h"
|
|
|
|
#include "nest/bfd.h"
|
2017-03-07 17:42:41 +00:00
|
|
|
#include "lib/buffer.h"
|
2015-07-24 16:02:07 +00:00
|
|
|
|
1999-02-05 21:38:22 +00:00
|
|
|
struct static_config {
|
|
|
|
struct proto_config c;
|
2017-03-07 17:42:41 +00:00
|
|
|
list routes; /* List of static routes (struct static_route) */
|
2011-09-24 00:21:52 +00:00
|
|
|
int check_link; /* Whether iface link state is used */
|
2017-03-30 11:29:34 +00:00
|
|
|
struct rtable_config *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */
|
|
|
|
struct rtable_config *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */
|
1998-12-06 18:21:23 +00:00
|
|
|
};
|
|
|
|
|
2017-03-07 17:42:41 +00:00
|
|
|
struct static_proto {
|
|
|
|
struct proto p;
|
2010-11-11 11:24:27 +00:00
|
|
|
|
2017-03-07 17:42:41 +00:00
|
|
|
struct event *event; /* Event for announcing updated routes */
|
2017-12-10 12:16:31 +00:00
|
|
|
BUFFER_(struct static_route *) marked; /* Routes marked for reannouncement */
|
2017-03-30 11:29:34 +00:00
|
|
|
rtable *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */
|
|
|
|
rtable *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */
|
2017-03-07 17:42:41 +00:00
|
|
|
};
|
1998-12-06 18:21:23 +00:00
|
|
|
|
|
|
|
struct static_route {
|
|
|
|
node n;
|
2015-11-12 01:03:59 +00:00
|
|
|
net_addr *net; /* Network we route */
|
1998-12-06 23:13:31 +00:00
|
|
|
ip_addr via; /* Destination router */
|
2016-06-13 13:49:53 +00:00
|
|
|
struct iface *iface; /* Destination iface, for link-local vias or device routes */
|
2017-03-07 17:42:41 +00:00
|
|
|
struct neighbor *neigh; /* Associated neighbor entry */
|
|
|
|
struct static_route *chain; /* Next for the same neighbor */
|
2016-06-13 13:49:53 +00:00
|
|
|
struct static_route *mp_head; /* First nexthop of this route */
|
2017-03-07 17:42:41 +00:00
|
|
|
struct static_route *mp_next; /* Nexthops for multipath routes */
|
2015-07-20 09:12:02 +00:00
|
|
|
struct f_inst *cmds; /* List of commands for setting attributes */
|
2019-03-14 13:44:35 +00:00
|
|
|
u32 metric; /* Route metric */
|
2017-03-07 17:42:41 +00:00
|
|
|
byte dest; /* Destination type (RTD_*) */
|
|
|
|
byte state; /* State of route announcement (SRS_*) */
|
|
|
|
byte active; /* Next hop is active (nbr/iface/BFD available) */
|
2017-07-04 21:36:21 +00:00
|
|
|
byte onlink; /* Gateway is onlink regardless of IP ranges */
|
2017-03-07 17:42:41 +00:00
|
|
|
byte weight; /* Multipath next hop weight */
|
2016-06-13 13:49:53 +00:00
|
|
|
byte use_bfd; /* Configured to use BFD */
|
2015-07-24 16:02:07 +00:00
|
|
|
struct bfd_request *bfd_req; /* BFD request, if BFD is used */
|
2017-03-17 14:48:09 +00:00
|
|
|
mpls_label_stack *mls; /* MPLS label stack; may be NULL */
|
1998-12-06 18:21:23 +00:00
|
|
|
};
|
|
|
|
|
2017-03-07 17:42:41 +00:00
|
|
|
/*
|
|
|
|
* Note that data fields neigh, chain, state, active and bfd_req are runtime
|
|
|
|
* data, not real configuration data. Must be handled carefully.
|
|
|
|
*
|
|
|
|
* Regular (i.e. dest == RTD_UNICAST) routes use static_route structure for
|
|
|
|
* additional next hops (fields mp_head, mp_next). Note that 'state' is for
|
|
|
|
* whole route, while 'active' is for each next hop. Also note that fields
|
|
|
|
* mp_head, mp_next, active are zero for other kinds of routes.
|
|
|
|
*/
|
2011-09-24 00:21:52 +00:00
|
|
|
|
|
|
|
#define RTDX_RECURSIVE 0x7f /* Phony dest value for recursive routes */
|
|
|
|
|
2017-03-07 17:42:41 +00:00
|
|
|
#define SRS_DOWN 0 /* Route is not announced */
|
|
|
|
#define SRS_CLEAN 1 /* Route is active and announced */
|
|
|
|
#define SRS_DIRTY 2 /* Route changed since announcement */
|
|
|
|
|
1999-12-03 11:41:23 +00:00
|
|
|
void static_show(struct proto *);
|
|
|
|
|
1998-12-06 18:21:23 +00:00
|
|
|
#endif
|