Statistics
| Branch: | Revision:

iof-bird / bird-2.0.1 / proto / static / static.h @ 6b3f1a54

History | View | Annotate | Download (2.64 KB)

1
/*
2
 *        BIRD -- Static Route Generator
3
 *
4
 *        (c) 1998--2000 Martin Mares <mj@ucw.cz>
5
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8

    
9
#ifndef _BIRD_STATIC_H_
10
#define _BIRD_STATIC_H_
11

    
12
#include "nest/route.h"
13
#include "nest/bfd.h"
14
#include "lib/buffer.h"
15

    
16
struct static_config {
17
  struct proto_config c;
18
  list routes;                                /* List of static routes (struct static_route) */
19
  int check_link;                        /* Whether iface link state is used */
20
  struct rtable_config *igp_table_ip4;        /* Table for recursive IPv4 next hop lookups */
21
  struct rtable_config *igp_table_ip6;        /* Table for recursive IPv6 next hop lookups */
22
};
23

    
24
struct static_proto {
25
  struct proto p;
26

    
27
  struct event *event;                        /* Event for announcing updated routes */
28
  BUFFER_(struct static_route *) marked; /* Routes marked for reannouncement */
29
  rtable *igp_table_ip4;                /* Table for recursive IPv4 next hop lookups */
30
  rtable *igp_table_ip6;                /* Table for recursive IPv6 next hop lookups */
31
};
32

    
33
struct static_route {
34
  node n;
35
  net_addr *net;                        /* Network we route */
36
  ip_addr via;                                /* Destination router */
37
  struct iface *iface;                        /* Destination iface, for link-local vias or device routes */
38
  struct neighbor *neigh;                /* Associated neighbor entry */
39
  struct static_route *chain;                /* Next for the same neighbor */
40
  struct static_route *mp_head;                /* First nexthop of this route */
41
  struct static_route *mp_next;                /* Nexthops for multipath routes */
42
  struct f_inst *cmds;                        /* List of commands for setting attributes */
43
  byte dest;                                /* Destination type (RTD_*) */
44
  byte state;                                /* State of route announcement (SRS_*) */
45
  byte active;                                /* Next hop is active (nbr/iface/BFD available) */
46
  byte onlink;                                /* Gateway is onlink regardless of IP ranges */
47
  byte weight;                                /* Multipath next hop weight */
48
  byte use_bfd;                                /* Configured to use BFD */
49
  struct bfd_request *bfd_req;                /* BFD request, if BFD is used */
50
  mpls_label_stack *mls;                /* MPLS label stack; may be NULL */
51
};
52

    
53
/*
54
 * Note that data fields neigh, chain, state, active and bfd_req are runtime
55
 * data, not real configuration data. Must be handled carefully.
56
 *
57
 * Regular (i.e. dest == RTD_UNICAST) routes use static_route structure for
58
 * additional next hops (fields mp_head, mp_next). Note that 'state' is for
59
 * whole route, while 'active' is for each next hop. Also note that fields
60
 * mp_head, mp_next, active are zero for other kinds of routes.
61
 */
62

    
63
#define RTDX_RECURSIVE 0x7f                /* Phony dest value for recursive routes */
64

    
65
#define SRS_DOWN        0                /* Route is not announced */
66
#define SRS_CLEAN        1                /* Route is active and announced */
67
#define SRS_DIRTY        2                /* Route changed since announcement */
68

    
69
void static_show(struct proto *);
70

    
71
#endif