1998-12-07 02:21:23 +08:00
|
|
|
/*
|
|
|
|
* BIRD -- Static Route Generator
|
|
|
|
*
|
2000-01-17 19:52:50 +08:00
|
|
|
* (c) 1998--2000 Martin Mares <mj@ucw.cz>
|
1998-12-07 02:21:23 +08:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BIRD_STATIC_H_
|
|
|
|
#define _BIRD_STATIC_H_
|
|
|
|
|
2015-07-25 00:02:07 +08:00
|
|
|
#include "nest/route.h"
|
|
|
|
#include "nest/bfd.h"
|
2017-03-08 01:42:41 +08:00
|
|
|
#include "lib/buffer.h"
|
2015-07-25 00:02:07 +08:00
|
|
|
|
1999-02-06 05:38:22 +08:00
|
|
|
struct static_config {
|
|
|
|
struct proto_config c;
|
2017-03-08 01:42:41 +08:00
|
|
|
list routes; /* List of static routes (struct static_route) */
|
2011-09-24 08:21:52 +08:00
|
|
|
int check_link; /* Whether iface link state is used */
|
2017-03-30 19:29:34 +08: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-07 02:21:23 +08:00
|
|
|
};
|
|
|
|
|
2017-03-08 01:42:41 +08:00
|
|
|
struct static_proto {
|
|
|
|
struct proto p;
|
2010-11-11 19:24:27 +08:00
|
|
|
|
2017-03-08 01:42:41 +08:00
|
|
|
struct event *event; /* Event for announcing updated routes */
|
|
|
|
BUFFER(struct static_route *) marked; /* Routes marked for reannouncement */
|
2017-03-30 19:29:34 +08: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-08 01:42:41 +08:00
|
|
|
};
|
1998-12-07 02:21:23 +08:00
|
|
|
|
|
|
|
struct static_route {
|
|
|
|
node n;
|
2015-11-12 09:03:59 +08:00
|
|
|
net_addr *net; /* Network we route */
|
1998-12-07 07:13:31 +08:00
|
|
|
ip_addr via; /* Destination router */
|
2016-06-13 21:49:53 +08:00
|
|
|
struct iface *iface; /* Destination iface, for link-local vias or device routes */
|
2017-03-08 01:42:41 +08:00
|
|
|
struct neighbor *neigh; /* Associated neighbor entry */
|
|
|
|
struct static_route *chain; /* Next for the same neighbor */
|
2016-06-13 21:49:53 +08:00
|
|
|
struct static_route *mp_head; /* First nexthop of this route */
|
2017-03-08 01:42:41 +08:00
|
|
|
struct static_route *mp_next; /* Nexthops for multipath routes */
|
2015-07-20 17:12:02 +08:00
|
|
|
struct f_inst *cmds; /* List of commands for setting attributes */
|
2017-03-08 01:42:41 +08:00
|
|
|
byte dest; /* Destination type (RTD_*) */
|
|
|
|
byte state; /* State of route announcement (SRS_*) */
|
|
|
|
byte active; /* Next hop is active (nbr/iface/BFD available) */
|
|
|
|
byte weight; /* Multipath next hop weight */
|
2016-06-13 21:49:53 +08:00
|
|
|
byte use_bfd; /* Configured to use BFD */
|
2015-07-25 00:02:07 +08:00
|
|
|
struct bfd_request *bfd_req; /* BFD request, if BFD is used */
|
2017-03-17 22:48:09 +08:00
|
|
|
mpls_label_stack *mls; /* MPLS label stack; may be NULL */
|
1998-12-07 02:21:23 +08:00
|
|
|
};
|
|
|
|
|
2017-03-08 01:42:41 +08: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 08:21:52 +08:00
|
|
|
|
|
|
|
#define RTDX_RECURSIVE 0x7f /* Phony dest value for recursive routes */
|
|
|
|
|
2017-03-08 01:42:41 +08: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 19:41:23 +08:00
|
|
|
void static_show(struct proto *);
|
|
|
|
|
1998-12-07 02:21:23 +08:00
|
|
|
#endif
|