Statistics
| Branch: | Revision:

iof-bird-daemon / nest / route.h @ cf98be7b

History | View | Annotate | Download (19.6 KB)

1
/*
2
 *        BIRD Internet Routing Daemon -- Routing Table
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_ROUTE_H_
10
#define _BIRD_ROUTE_H_
11

    
12
#include "lib/lists.h"
13
#include "lib/resource.h"
14
#include "lib/timer.h"
15
#include "nest/protocol.h"
16

    
17
struct protocol;
18
struct proto;
19
struct symbol;
20
struct filter;
21
struct cli;
22

    
23
/*
24
 *        Generic data structure for storing network prefixes. Also used
25
 *        for the master routing table. Currently implemented as a hash
26
 *        table.
27
 *
28
 *        Available operations:
29
 *                - insertion of new entry
30
 *                - deletion of entry
31
 *                - searching for entry by network prefix
32
 *                - asynchronous retrieval of fib contents
33
 */
34

    
35
struct fib_node {
36
  struct fib_node *next;                /* Next in hash chain */
37
  struct fib_iterator *readers;                /* List of readers of this node */
38
  byte pxlen;
39
  byte flags;                                /* User-defined */
40
  byte x0, x1;                                /* User-defined */
41
  u32 uid;                                /* Unique ID based on hash */
42
  ip_addr prefix;                        /* In host order */
43
};
44

    
45
struct fib_iterator {                        /* See lib/slists.h for an explanation */
46
  struct fib_iterator *prev, *next;        /* Must be synced with struct fib_node! */
47
  byte efef;                                /* 0xff to distinguish between iterator and node */
48
  byte pad[3];
49
  struct fib_node *node;                /* Or NULL if freshly merged */
50
  unsigned int hash;
51
};
52

    
53
typedef void (*fib_init_func)(struct fib_node *);
54

    
55
struct fib {
56
  pool *fib_pool;                        /* Pool holding all our data */
57
  slab *fib_slab;                        /* Slab holding all fib nodes */
58
  struct fib_node **hash_table;                /* Node hash table */
59
  unsigned int hash_size;                /* Number of hash table entries (a power of two) */
60
  unsigned int hash_order;                /* Binary logarithm of hash_size */
61
  unsigned int hash_shift;                /* 16 - hash_log */
62
  unsigned int entries;                        /* Number of entries */
63
  unsigned int entries_min, entries_max;/* Entry count limits (else start rehashing) */
64
  fib_init_func init;                        /* Constructor */
65
};
66

    
67
void fib_init(struct fib *, pool *, unsigned node_size, unsigned hash_order, fib_init_func init);
68
void *fib_find(struct fib *, ip_addr *, int);        /* Find or return NULL if doesn't exist */
69
void *fib_get(struct fib *, ip_addr *, int);         /* Find or create new if nonexistent */
70
void *fib_route(struct fib *, ip_addr, int);        /* Longest-match routing lookup */
71
void fib_delete(struct fib *, void *);        /* Remove fib entry */
72
void fib_free(struct fib *);                /* Destroy the fib */
73
void fib_check(struct fib *);                /* Consistency check for debugging */
74

    
75
void fit_init(struct fib_iterator *, struct fib *); /* Internal functions, don't call */
76
struct fib_node *fit_get(struct fib *, struct fib_iterator *);
77
void fit_put(struct fib_iterator *, struct fib_node *);
78

    
79
#define FIB_WALK(fib, z) do {                                        \
80
        struct fib_node *z, **ff = (fib)->hash_table;                \
81
        unsigned int count = (fib)->hash_size;                        \
82
        while (count--)                                                \
83
          for(z = *ff++; z; z=z->next)
84

    
85
#define FIB_WALK_END } while (0)
86

    
87
#define FIB_ITERATE_INIT(it, fib) fit_init(it, fib)
88

    
89
#define FIB_ITERATE_START(fib, it, z) do {                        \
90
        struct fib_node *z = fit_get(fib, it);                        \
91
        unsigned int count = (fib)->hash_size;                        \
92
        unsigned int hpos = (it)->hash;                                \
93
        for(;;) {                                                \
94
          if (!z)                                                \
95
            {                                                        \
96
               if (++hpos >= count)                                \
97
                 break;                                                \
98
               z = (fib)->hash_table[hpos];                        \
99
               continue;                                        \
100
            }
101

    
102
#define FIB_ITERATE_END(z) z = z->next; } } while(0)
103

    
104
#define FIB_ITERATE_PUT(it, z) fit_put(it, z)
105

    
106
/*
107
 *        Master Routing Tables. Generally speaking, each of them contains a FIB
108
 *        with each entry pointing to a list of route entries representing routes
109
 *        to given network (with the selected one at the head).
110
 *
111
 *        Each of the RTE's contains variable data (the preference and protocol-dependent
112
 *        metrics) and a pointer to a route attribute block common for many routes).
113
 *
114
 *        It's guaranteed that there is at most one RTE for every (prefix,proto) pair.
115
 */
116

    
117
struct rtable_config {
118
  node n;
119
  char *name;
120
  struct rtable *table;
121
  struct proto_config *krt_attached;        /* Kernel syncer attached to this table */
122
  int gc_max_ops;                        /* Maximum number of operations before GC is run */
123
  int gc_min_time;                        /* Minimum time between two consecutive GC runs */
124
  byte sorted;                                /* Routes of network are sorted according to rte_better() */
125
};
126

    
127
typedef struct rtable {
128
  node n;                                /* Node in list of all tables */
129
  struct fib fib;
130
  char *name;                                /* Name of this table */
131
  list hooks;                                /* List of announcement hooks */
132
  int pipe_busy;                        /* Pipe loop detection */
133
  int use_count;                        /* Number of protocols using this table */
134
  struct hostcache *hostcache;
135
  struct rtable_config *config;                /* Configuration of this table */
136
  struct config *deleted;                /* Table doesn't exist in current configuration,
137
                                         * delete as soon as use_count becomes 0 and remove
138
                                         * obstacle from this routing table.
139
                                         */
140
  struct event *rt_event;                /* Routing table event */
141
  int gc_counter;                        /* Number of operations since last GC */
142
  bird_clock_t gc_time;                        /* Time of last GC */
143
  byte gc_scheduled;                        /* GC is scheduled */
144
  byte prune_state;                        /* Table prune state, 1 -> prune is running */
145
  byte hcu_scheduled;                        /* Hostcache update is scheduled */
146
  byte nhu_state;                        /* Next Hop Update state */
147
  struct fib_iterator prune_fit;        /* Rtable prune FIB iterator */
148
  struct fib_iterator nhu_fit;                /* Next Hop Update FIB iterator */
149
} rtable;
150

    
151
typedef struct network {
152
  struct fib_node n;                        /* FIB flags reserved for kernel syncer */
153
  struct rte *routes;                        /* Available routes for this network */
154
} net;
155

    
156
struct hostcache {
157
  slab *slab;                                /* Slab holding all hostentries */
158
  struct hostentry **hash_table;        /* Hash table for hostentries */
159
  unsigned hash_order, hash_shift;
160
  unsigned hash_max, hash_min;
161
  unsigned hash_items;
162
  linpool *lp;                                /* Linpool for trie */
163
  struct f_trie *trie;                        /* Trie of prefixes that might affect hostentries */
164
  list hostentries;                        /* List of all hostentries */
165
  byte update_hostcache;
166
};
167

    
168
struct hostentry {
169
  node ln;
170
  ip_addr addr;                                /* IP address of host, part of key */
171
  ip_addr link;                                /* (link-local) IP address of host, used as gw
172
                                           if host is directly attached */
173
  struct rtable *tab;                        /* Dependent table, part of key*/
174
  struct hostentry *next;                /* Next in hash chain */
175
  unsigned hash_key;                        /* Hash key */
176
  unsigned uc;                                /* Use count */
177
  struct rta *src;                        /* Source rta entry */
178
  ip_addr gw;                                /* Chosen next hop */
179
  byte dest;                                /* Chosen route destination type (RTD_...) */
180
  u32 igp_metric;                        /* Chosen route IGP metric */
181
};
182

    
183
typedef struct rte {
184
  struct rte *next;
185
  net *net;                                /* Network this RTE belongs to */
186
  struct announce_hook *sender;                /* Announce hook used to send the route to the routing table */
187
  struct rta *attrs;                        /* Attributes of this route */
188
  byte flags;                                /* Flags (REF_...) */
189
  byte pflags;                                /* Protocol-specific flags */
190
  word pref;                                /* Route preference */
191
  bird_clock_t lastmod;                        /* Last modified */
192
  union {                                /* Protocol-dependent data (metrics etc.) */
193
#ifdef CONFIG_RIP
194
    struct {
195
      node garbage;                        /* List for garbage collection */
196
      byte metric;                        /* RIP metric */
197
      u16 tag;                                /* External route tag */
198
      struct rip_entry *entry;
199
    } rip;
200
#endif
201
#ifdef CONFIG_OSPF
202
    struct {
203
      u32 metric1, metric2;                /* OSPF Type 1 and Type 2 metrics */
204
      u32 tag;                                /* External route tag */
205
      u32 router_id;                        /* Router that originated this route */
206
    } ospf;
207
#endif
208
#ifdef CONFIG_BGP
209
    struct {
210
      u8 suppressed;                        /* Used for deterministic MED comparison */
211
    } bgp;
212
#endif
213
    struct {                                /* Routes generated by krt sync (both temporary and inherited ones) */
214
      s8 src;                                /* Alleged route source (see krt.h) */
215
      u8 proto;                                /* Kernel source protocol ID */
216
      u8 type;                                /* Kernel route type */
217
      u8 seen;                                /* Seen during last scan */
218
      u32 metric;                        /* Kernel metric */
219
    } krt;
220
  } u;
221
} rte;
222

    
223
#define REF_COW                1                /* Copy this rte on write */
224
#define REF_REJECTED        2                /* Route is rejected by import filter */
225

    
226
/* Route is valid for propagation (may depend on other flags in the future), accepts NULL */
227
static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_REJECTED); }
228

    
229
/* Route just has REF_REJECTED flag */
230
static inline int rte_is_rejected(rte *r) { return !!(r->flags & REF_REJECTED); }
231

    
232

    
233
/* Types of route announcement, also used as flags */
234
#define RA_OPTIMAL        1                /* Announcement of optimal route change */
235
#define RA_ACCEPTED        2                /* Announcement of first accepted route */
236
#define RA_ANY                3                /* Announcement of any route change */
237

    
238
struct config;
239

    
240
void rt_init(void);
241
void rt_preconfig(struct config *);
242
void rt_commit(struct config *new, struct config *old);
243
void rt_lock_table(rtable *);
244
void rt_unlock_table(rtable *);
245
void rt_setup(pool *, rtable *, char *, struct rtable_config *);
246
static inline net *net_find(rtable *tab, ip_addr addr, unsigned len) { return (net *) fib_find(&tab->fib, &addr, len); }
247
static inline net *net_get(rtable *tab, ip_addr addr, unsigned len) { return (net *) fib_get(&tab->fib, &addr, len); }
248
rte *rte_find(net *net, struct proto *p);
249
rte *rte_get_temp(struct rta *);
250
void rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src);
251
static inline void rte_update(rtable *tab, net *net, struct proto *p, struct proto *src, rte *new) { rte_update2(p->main_ahook, net, new, src); }
252
void rte_discard(rtable *tab, rte *old);
253
void rte_dump(rte *);
254
void rte_free(rte *);
255
rte *rte_do_cow(rte *);
256
static inline rte * rte_cow(rte *r) { return (r->flags & REF_COW) ? rte_do_cow(r) : r; }
257
void rt_dump(rtable *);
258
void rt_dump_all(void);
259
int rt_feed_baby(struct proto *p);
260
void rt_feed_baby_abort(struct proto *p);
261
void rt_schedule_prune_all(void);
262
int rt_prune_loop(void);
263
struct rtable_config *rt_new_table(struct symbol *s);
264

    
265
struct rt_show_data {
266
  ip_addr prefix;
267
  unsigned pxlen;
268
  rtable *table;
269
  struct filter *filter;
270
  int verbose;
271
  struct fib_iterator fit;
272
  struct proto *show_protocol;
273
  struct proto *export_protocol;
274
  int export_mode, primary_only, rejected;
275
  struct config *running_on_config;
276
  int net_counter, rt_counter, show_counter;
277
  int stats, show_for;
278
};
279
void rt_show(struct rt_show_data *);
280

    
281
/*
282
 *        Route Attributes
283
 *
284
 *        Beware: All standard BGP attributes must be represented here instead
285
 *        of making them local to the route. This is needed to ensure proper
286
 *        construction of BGP route attribute lists.
287
 */
288

    
289
/* Multipath next-hop */
290
struct mpnh {
291
  ip_addr gw;                                /* Next hop */
292
  struct iface *iface;                        /* Outgoing interface */
293
  struct mpnh *next;
294
  unsigned char weight;
295
};
296

    
297
typedef struct rta {
298
  struct rta *next, **pprev;                /* Hash chain */
299
  struct proto *proto;                        /* Protocol instance that originally created the route */
300
  unsigned uc;                                /* Use count */
301
  byte source;                                /* Route source (RTS_...) */
302
  byte scope;                                /* Route scope (SCOPE_... -- see ip.h) */
303
  byte cast;                                /* Casting type (RTC_...) */
304
  byte dest;                                /* Route destination type (RTD_...) */
305
  byte flags;                                /* Route flags (RTF_...), now unused */
306
  byte aflags;                                /* Attribute cache flags (RTAF_...) */
307
  u16 hash_key;                                /* Hash over important fields */
308
  u32 igp_metric;                        /* IGP metric to next hop (for iBGP routes) */
309
  ip_addr gw;                                /* Next hop */
310
  ip_addr from;                                /* Advertising router */
311
  struct hostentry *hostentry;                /* Hostentry for recursive next-hops */
312
  struct iface *iface;                        /* Outgoing interface */
313
  struct mpnh *nexthops;                /* Next-hops for multipath routes */
314
  struct ea_list *eattrs;                /* Extended Attribute chain */
315
} rta;
316

    
317
#define RTS_DUMMY 0                        /* Dummy route to be removed soon */
318
#define RTS_STATIC 1                        /* Normal static route */
319
#define RTS_INHERIT 2                        /* Route inherited from kernel */
320
#define RTS_DEVICE 3                        /* Device route */
321
#define RTS_STATIC_DEVICE 4                /* Static device route */
322
#define RTS_REDIRECT 5                        /* Learned via redirect */
323
#define RTS_RIP 6                        /* RIP route */
324
#define RTS_OSPF 7                        /* OSPF route */
325
#define RTS_OSPF_IA 8                        /* OSPF inter-area route */
326
#define RTS_OSPF_EXT1 9                        /* OSPF external route type 1 */
327
#define RTS_OSPF_EXT2 10                /* OSPF external route type 2 */
328
#define RTS_BGP 11                        /* BGP route */
329
#define RTS_PIPE 12                        /* Inter-table wormhole */
330

    
331
#define RTC_UNICAST 0
332
#define RTC_BROADCAST 1
333
#define RTC_MULTICAST 2
334
#define RTC_ANYCAST 3                        /* IPv6 Anycast */
335

    
336
#define RTD_ROUTER 0                        /* Next hop is neighbor router */
337
#define RTD_DEVICE 1                        /* Points to device */
338
#define RTD_BLACKHOLE 2                        /* Silently drop packets */
339
#define RTD_UNREACHABLE 3                /* Reject as unreachable */
340
#define RTD_PROHIBIT 4                        /* Administratively prohibited */
341
#define RTD_MULTIPATH 5                        /* Multipath route (nexthops != NULL) */
342
#define RTD_NONE 6                        /* Invalid RTD */
343

    
344
                                        /* Flags for net->n.flags, used by kernel syncer */
345
#define KRF_INSTALLED 0x80                /* This route should be installed in the kernel */
346
#define KRF_SYNC_ERROR 0x40                /* Error during kernel table synchronization */
347

    
348
#define RTAF_CACHED 1                        /* This is a cached rta */
349

    
350
#define IGP_METRIC_UNKNOWN 0x80000000        /* Default igp_metric used when no other
351
                                           protocol-specific metric is availabe */
352

    
353
/*
354
 *        Extended Route Attributes
355
 */
356

    
357
typedef struct eattr {
358
  word id;                                /* EA_CODE(EAP_..., protocol-dependent ID) */
359
  byte flags;                                /* Protocol-dependent flags */
360
  byte type;                                /* Attribute type and several flags (EAF_...) */
361
  union {
362
    u32 data;
363
    struct adata *ptr;                        /* Attribute data elsewhere */
364
  } u;
365
} eattr;
366

    
367
#define EAP_GENERIC 0                        /* Generic attributes */
368
#define EAP_BGP 1                        /* BGP attributes */
369
#define EAP_RIP 2                        /* RIP */
370
#define EAP_OSPF 3                        /* OSPF */
371
#define EAP_KRT 4                        /* Kernel route attributes */
372
#define EAP_MAX 5
373

    
374
#define EA_CODE(proto,id) (((proto) << 8) | (id))
375
#define EA_PROTO(ea) ((ea) >> 8)
376
#define EA_ID(ea) ((ea) & 0xff)
377

    
378
#define EA_GEN_IGP_METRIC EA_CODE(EAP_GENERIC, 0)
379

    
380
#define EA_CODE_MASK 0xffff
381
#define EA_ALLOW_UNDEF 0x10000                /* ea_find: allow EAF_TYPE_UNDEF */
382

    
383
#define EAF_TYPE_MASK 0x0f                /* Mask with this to get type */
384
#define EAF_TYPE_INT 0x01                /* 32-bit signed integer number */
385
#define EAF_TYPE_OPAQUE 0x02                /* Opaque byte string (not filterable) */
386
#define EAF_TYPE_IP_ADDRESS 0x04        /* IP address */
387
#define EAF_TYPE_ROUTER_ID 0x05                /* Router ID (IPv4 address) */
388
#define EAF_TYPE_AS_PATH 0x06                /* BGP AS path (encoding per RFC 1771:4.3) */
389
#define EAF_TYPE_INT_SET 0x0a                /* Set of u32's (e.g., a community list) */
390
#define EAF_TYPE_EC_SET 0x0e                /* Set of pairs of u32's - ext. community list */
391
#define EAF_TYPE_UNDEF 0x0f                /* `force undefined' entry */
392
#define EAF_EMBEDDED 0x01                /* Data stored in eattr.u.data (part of type spec) */
393
#define EAF_VAR_LENGTH 0x02                /* Attribute length is variable (part of type spec) */
394
#define EAF_ORIGINATED 0x40                /* The attribute has originated locally */
395
#define EAF_TEMP 0x80                        /* A temporary attribute (the one stored in the tmp attr list) */
396

    
397
struct adata {
398
  unsigned int length;                        /* Length of data */
399
  byte data[0];
400
};
401

    
402
typedef struct ea_list {
403
  struct ea_list *next;                        /* In case we have an override list */
404
  byte flags;                                /* Flags: EALF_... */
405
  byte rfu;
406
  word count;                                /* Number of attributes */
407
  eattr attrs[0];                        /* Attribute definitions themselves */
408
} ea_list;
409

    
410
#define EALF_SORTED 1                        /* Attributes are sorted by code */
411
#define EALF_BISECT 2                        /* Use interval bisection for searching */
412
#define EALF_CACHED 4                        /* Attributes belonging to cached rta */
413

    
414
eattr *ea_find(ea_list *, unsigned ea);
415
int ea_get_int(ea_list *, unsigned ea, int def);
416
void ea_dump(ea_list *);
417
void ea_sort(ea_list *);                /* Sort entries in all sub-lists */
418
unsigned ea_scan(ea_list *);                /* How many bytes do we need for merged ea_list */
419
void ea_merge(ea_list *from, ea_list *to); /* Merge sub-lists to allocated buffer */
420
int ea_same(ea_list *x, ea_list *y);        /* Test whether two ea_lists are identical */
421
unsigned int ea_hash(ea_list *e);        /* Calculate 16-bit hash value */
422
ea_list *ea_append(ea_list *to, ea_list *what);
423

    
424
int mpnh__same(struct mpnh *x, struct mpnh *y); /* Compare multipath nexthops */
425
static inline int mpnh_same(struct mpnh *x, struct mpnh *y)
426
{ return (x == y) || mpnh__same(x, y); }
427

    
428
void rta_init(void);
429
rta *rta_lookup(rta *);                        /* Get rta equivalent to this one, uc++ */
430
static inline rta *rta_clone(rta *r) { r->uc++; return r; }
431
void rta__free(rta *r);
432
static inline void rta_free(rta *r) { if (r && !--r->uc) rta__free(r); }
433
void rta_dump(rta *);
434
void rta_dump_all(void);
435
void rta_show(struct cli *, rta *, ea_list *);
436
void rta_set_recursive_next_hop(rtable *dep, rta *a, rtable *tab, ip_addr *gw, ip_addr *ll);
437

    
438
/*
439
 * rta_set_recursive_next_hop() acquires hostentry from hostcache and
440
 * fills rta->hostentry field.  New hostentry has zero use
441
 * count. Cached rta locks its hostentry (increases its use count),
442
 * uncached rta does not lock it. Hostentry with zero use count is
443
 * removed asynchronously during host cache update, therefore it is
444
 * safe to hold such hostentry temorarily. Hostentry holds a lock for
445
 * a 'source' rta, mainly to share multipath nexthops. There is no
446
 * need to hold a lock for hostentry->dep table, because that table
447
 * contains routes responsible for that hostentry, and therefore is
448
 * non-empty if given hostentry has non-zero use count. The protocol
449
 * responsible for routes with recursive next hops should also hold a
450
 * lock for a table governing that routes (argument tab to
451
 * rta_set_recursive_next_hop()).
452
 */
453

    
454
static inline void rt_lock_hostentry(struct hostentry *he) { if (he) he->uc++; }
455
static inline void rt_unlock_hostentry(struct hostentry *he) { if (he) he->uc--; }
456

    
457

    
458
extern struct protocol *attr_class_to_protocol[EAP_MAX];
459

    
460
/*
461
 *        Default protocol preferences
462
 */
463

    
464
#define DEF_PREF_DIRECT                    240        /* Directly connected */
465
#define DEF_PREF_STATIC                200        /* Static route */
466
#define DEF_PREF_OSPF                150        /* OSPF intra-area, inter-area and type 1 external routes */
467
#define DEF_PREF_RIP                120        /* RIP */
468
#define DEF_PREF_BGP                100        /* BGP */
469
#define DEF_PREF_PIPE                70        /* Routes piped from other tables */
470
#define DEF_PREF_INHERITED        10        /* Routes inherited from other routing daemons */
471

    
472

    
473
/*
474
 *        Route Origin Authorization
475
 */
476

    
477
struct roa_item {
478
  u32 asn;
479
  byte maxlen;
480
  byte src;
481
  struct roa_item *next;
482
};
483

    
484
struct roa_node {
485
  struct fib_node n;
486
  struct roa_item *items;
487
  // u32 cached_asn;
488
};
489

    
490
struct roa_table {
491
  node n;                                /* Node in roa_table_list */
492
  struct fib fib;
493
  char *name;                                /* Name of this ROA table */
494
  struct roa_table_config *cf;                /* Configuration of this ROA table */
495
};
496

    
497
struct roa_item_config {
498
  ip_addr prefix;
499
  byte pxlen, maxlen;
500
  u32 asn;
501
  struct roa_item_config *next;
502
};
503

    
504
struct roa_table_config {
505
  node n;                                /* Node in config->rpa_tables */
506
  char *name;                                /* Name of this ROA table */
507
  struct roa_table *table;
508

    
509
  struct roa_item_config *roa_items;        /* Preconfigured ROA items */
510

    
511
  // char *filename;
512
  // int gc_max_ops;                        /* Maximum number of operations before GC is run */
513
  // int gc_min_time;                        /* Minimum time between two consecutive GC runs */
514
};
515

    
516
struct roa_show_data {
517
  struct fib_iterator fit;
518
  struct roa_table *table;
519
  ip_addr prefix;
520
  byte pxlen;
521
  byte mode;                                /* ROA_SHOW_* values */
522
  u32 asn;                                /* Filter ASN, 0 -> all */
523
};
524

    
525
#define ROA_UNKNOWN        0
526
#define ROA_VALID        1
527
#define ROA_INVALID        2
528

    
529
#define ROA_SRC_ANY        0
530
#define ROA_SRC_CONFIG        1
531
#define ROA_SRC_DYNAMIC        2
532

    
533
#define ROA_SHOW_ALL        0
534
#define ROA_SHOW_PX        1
535
#define ROA_SHOW_IN        2
536
#define ROA_SHOW_FOR        3
537

    
538
extern struct roa_table *roa_table_default;
539

    
540
void roa_add_item(struct roa_table *t, ip_addr prefix, byte pxlen, byte maxlen, u32 asn, byte src);
541
void roa_delete_item(struct roa_table *t, ip_addr prefix, byte pxlen, byte maxlen, u32 asn, byte src);
542
void roa_flush(struct roa_table *t, byte src);
543
byte roa_check(struct roa_table *t, ip_addr prefix, byte pxlen, u32 asn);
544
struct roa_table_config * roa_new_table_config(struct symbol *s);
545
void roa_add_item_config(struct roa_table_config *rtc, ip_addr prefix, byte pxlen, byte maxlen, u32 asn);
546
void roa_init(void);
547
void roa_preconfig(struct config *c);
548
void roa_commit(struct config *new, struct config *old);
549
void roa_show(struct roa_show_data *d);
550

    
551

    
552
#endif