mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 01:31:55 +00:00
Merge commit 'c70b3198' into thread-next [lots of conflicts]
There were more conflicts that I'd like to see, most notably in route export. If a bisect identifies this commit with something related, it may be simply true that this commit introduces that bug. Let's hope it doesn't happen.
This commit is contained in:
commit
05673b16a8
@ -44,7 +44,7 @@ struct config {
|
||||
|
||||
int cli_debug; /* Tracing of CLI connections and commands */
|
||||
int latency_debug; /* I/O loop tracks duration of each event */
|
||||
int pipe_debug; /* Track route propagation through pipes */
|
||||
int table_debug; /* Track route propagation through tables */
|
||||
u32 latency_limit; /* Events with longer duration are logged (us) */
|
||||
u32 watchdog_warning; /* I/O loop watchdog limit for warning (us) */
|
||||
u32 watchdog_timeout; /* Watchdog timeout (in seconds, 0 = disabled) */
|
||||
|
@ -178,8 +178,13 @@ void debug(const char *msg, ...); /* Printf to debug output */
|
||||
|
||||
#if defined(LOCAL_DEBUG) || defined(GLOBAL_DEBUG)
|
||||
#define DBG(x, y...) debug(x, ##y)
|
||||
#define DBGL(x, y...) debug(x "\n", ##y)
|
||||
#elif defined(DEBUG_TO_LOG)
|
||||
#define DBG(...) do { } while (0)
|
||||
#define DBGL(...) log(L_DEBUG __VA_ARGS__)
|
||||
#else
|
||||
#define DBG(x, y...) do { } while(0)
|
||||
#define DBG(...) do { } while(0)
|
||||
#define DBGL(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define ASSERT_DIE(x) do { if (!(x)) bug("Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0)
|
||||
|
@ -115,6 +115,7 @@ void sl_free(void *);
|
||||
void buffer_realloc(void **buf, unsigned *size, unsigned need, unsigned item_size);
|
||||
|
||||
/* Allocator of whole pages; for use in slabs and other high-level allocators. */
|
||||
#define PAGE_HEAD(x) ((void *) (((uintptr_t) (x)) & ~(page_size-1)))
|
||||
extern long page_size;
|
||||
void *alloc_page(void);
|
||||
void free_page(void *);
|
||||
|
@ -197,7 +197,7 @@ static struct resclass sl_class = {
|
||||
slab_memsize
|
||||
};
|
||||
|
||||
#define SL_GET_HEAD(x) ((struct sl_head *) (((uintptr_t) (x)) & ~(page_size-1)))
|
||||
#define SL_GET_HEAD(x) PAGE_HEAD(x)
|
||||
|
||||
#define SL_HEAD_CHANGE_STATE(_s, _h, _from, _to) ({ \
|
||||
ASSERT_DIE(_h->state == slh_##_from); \
|
||||
|
@ -386,7 +386,7 @@ debug_default:
|
||||
DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
|
||||
| DEBUG CHANNELS debug_mask { new_config->channel_default_debug = $3; }
|
||||
| DEBUG COMMANDS expr { new_config->cli_debug = $3; }
|
||||
| DEBUG PIPE bool { new_config->pipe_debug = $3; }
|
||||
| DEBUG TABLES bool { new_config->table_debug = $3; }
|
||||
;
|
||||
|
||||
/* MRTDUMP PROTOCOLS is in systep/unix/config.Y */
|
||||
|
@ -697,8 +697,6 @@ channel_do_stop(struct channel *c)
|
||||
|
||||
CALL(c->channel->shutdown, c);
|
||||
|
||||
/* This have to be done in here, as channel pool is freed before channel_do_down() */
|
||||
c->out_table = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -79,8 +79,8 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
|
||||
if (d->verbose)
|
||||
{
|
||||
ea_show_list(c, a);
|
||||
cli_printf(c, -1008, "\tInternal route handling values: %uL %uG %uS",
|
||||
e->src->private_id, e->src->global_id, e->stale_cycle);
|
||||
cli_printf(c, -1008, "\tInternal route handling values: %uL %uG %uS id %u",
|
||||
e->src->private_id, e->src->global_id, e->stale_cycle, e->id);
|
||||
}
|
||||
else if (dest == RTD_UNICAST)
|
||||
ea_show_nexthop_list(c, nhad);
|
||||
|
815
nest/rt-table.c
815
nest/rt-table.c
File diff suppressed because it is too large
Load Diff
35
nest/rt.h
35
nest/rt.h
@ -18,6 +18,8 @@
|
||||
#include "lib/fib.h"
|
||||
#include "lib/route.h"
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
struct ea_list;
|
||||
struct protocol;
|
||||
struct proto;
|
||||
@ -53,6 +55,7 @@ struct rtable_config {
|
||||
byte trie_used; /* Rtable has attached trie */
|
||||
btime min_settle_time; /* Minimum settle time for notifications */
|
||||
btime max_settle_time; /* Maximum settle time for notifications */
|
||||
btime export_settle_time; /* Delay before exports are announced */
|
||||
};
|
||||
|
||||
struct rt_export_hook;
|
||||
@ -61,9 +64,17 @@ struct rt_export_request;
|
||||
struct rt_exporter {
|
||||
list hooks; /* Registered route export hooks */
|
||||
uint addr_type; /* Type of address data exported (NET_*) */
|
||||
|
||||
struct rt_export_hook *(*start)(struct rt_exporter *, struct rt_export_request *);
|
||||
void (*stop)(struct rt_export_hook *);
|
||||
void (*done)(struct rt_export_hook *);
|
||||
void (*used)(struct rt_exporter *);
|
||||
|
||||
list pending; /* List of packed struct rt_pending_export */
|
||||
struct timer *export_timer;
|
||||
|
||||
struct rt_pending_export *first; /* First export to announce */
|
||||
u64 next_seq; /* The next export will have this ID */
|
||||
};
|
||||
|
||||
typedef struct rtable {
|
||||
@ -98,6 +109,7 @@ typedef struct rtable {
|
||||
byte prune_trie; /* Prune prefix trie during next table prune */
|
||||
byte hcu_scheduled; /* Hostcache update is scheduled */
|
||||
byte nhu_state; /* Next Hop Update state */
|
||||
byte export_used; /* Pending Export pruning is scheduled */
|
||||
struct fib_iterator prune_fit; /* Rtable prune FIB iterator */
|
||||
struct fib_iterator nhu_fit; /* Next Hop Update FIB iterator */
|
||||
struct f_trie *trie_new; /* New prefix trie defined during pruning */
|
||||
@ -132,7 +144,8 @@ struct rt_flowspec_link {
|
||||
#define NHU_DIRTY 3
|
||||
|
||||
typedef struct network {
|
||||
struct rte_storage *routes; /* Available routes for this network */
|
||||
struct rte_storage *routes; /* Available routes for this network */
|
||||
struct rt_pending_export *first, *last;
|
||||
struct fib_node n; /* FIB flags reserved for kernel syncer */
|
||||
} net;
|
||||
|
||||
@ -200,6 +213,7 @@ struct rt_import_hook {
|
||||
u32 withdraws_accepted; /* Number of route withdraws accepted and processed */
|
||||
} stats;
|
||||
|
||||
u64 flush_seq; /* Table export seq when the channel announced flushing */
|
||||
btime last_state_change; /* Time of last state transition */
|
||||
|
||||
u8 import_state; /* IS_* */
|
||||
@ -212,7 +226,9 @@ struct rt_import_hook {
|
||||
};
|
||||
|
||||
struct rt_pending_export {
|
||||
struct rt_pending_export * _Atomic next; /* Next export for the same destination */
|
||||
struct rte_storage *new, *new_best, *old, *old_best;
|
||||
u64 seq; /* Sequential ID (table-local) of the pending export */
|
||||
};
|
||||
|
||||
struct rt_export_request {
|
||||
@ -241,7 +257,6 @@ struct rt_export_hook {
|
||||
struct rt_exporter *table; /* The connected table */
|
||||
|
||||
pool *pool;
|
||||
linpool *lp;
|
||||
|
||||
struct rt_export_request *req; /* The requestor */
|
||||
|
||||
@ -260,10 +275,15 @@ struct rt_export_hook {
|
||||
u32 hash_iter; /* Iterator over hash */
|
||||
};
|
||||
|
||||
struct bmap seq_map; /* Keep track which exports were already procesed */
|
||||
|
||||
struct rt_pending_export * _Atomic last_export;/* Last export processed */
|
||||
struct rt_pending_export *rpe_next; /* Next pending export to process */
|
||||
|
||||
btime last_state_change; /* Time of last state transition */
|
||||
|
||||
u8 refeed_pending; /* Refeeding and another refeed is scheduled */
|
||||
u8 export_state; /* Route export state (TES_*, see below) */
|
||||
_Atomic u8 export_state; /* Route export state (TES_*, see below) */
|
||||
u8 feed_type; /* Which feeding method is used (TFT_*, see below) */
|
||||
|
||||
struct event *event; /* Event running all the export operations */
|
||||
@ -314,6 +334,15 @@ void rt_set_export_state(struct rt_export_hook *hook, u8 state);
|
||||
|
||||
void rte_import(struct rt_import_request *req, const net_addr *net, rte *new, struct rte_src *src);
|
||||
|
||||
/* Get next rpe. If src is given, it must match. */
|
||||
struct rt_pending_export *rpe_next(struct rt_pending_export *rpe, struct rte_src *src);
|
||||
|
||||
/* Mark the pending export processed */
|
||||
void rpe_mark_seen(struct rt_export_hook *hook, struct rt_pending_export *rpe);
|
||||
|
||||
/* Get pending export seen status */
|
||||
int rpe_get_seen(struct rt_export_hook *hook, struct rt_pending_export *rpe);
|
||||
|
||||
/* Types of route announcement, also used as flags */
|
||||
#define RA_UNDEF 0 /* Undefined RA type */
|
||||
#define RA_OPTIMAL 1 /* Announcement of optimal route change */
|
||||
|
@ -1901,7 +1901,6 @@ bgp_out_table_export_start(struct rt_exporter *re, struct rt_export_request *req
|
||||
pool *p = rp_new(c->c.proto->pool, "Export hook");
|
||||
struct rt_export_hook *hook = mb_allocz(p, sizeof(struct rt_export_hook));
|
||||
hook->pool = p;
|
||||
hook->lp = lp_new_default(p);
|
||||
hook->event = ev_new_init(p, bgp_out_table_feed, hook);
|
||||
hook->feed_type = TFT_HASH;
|
||||
|
||||
@ -1919,6 +1918,7 @@ bgp_setup_out_table(struct bgp_channel *c)
|
||||
};
|
||||
|
||||
init_list(&c->prefix_exporter.hooks);
|
||||
init_list(&c->prefix_exporter.pending);
|
||||
|
||||
c->c.out_table = &c->prefix_exporter;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user