0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Merge commit '4a23ede2b056a41456790cc20a0c3d92a7137693' into haugesund

This commit is contained in:
Maria Matejka 2022-05-30 15:31:19 +02:00
commit d7b077f5d6
39 changed files with 257 additions and 169 deletions

View File

@ -82,6 +82,9 @@ conf-lex-targets := $(addprefix $(objdir)/conf/,cf-lex.o)
conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
cf-local = $(conf-y-targets): $(s)config.Y
# nest/Makefile declarations needed for all other modules
proto-build-c := $(addprefix $(objdir)/nest/,proto-build.c)
src-o-files = $(patsubst %.c,$(o)%.o,$(src))
tests-target-files = $(patsubst %.c,$(o)%,$(tests_src))
@ -95,6 +98,13 @@ else
o = $(patsubst $(srcdir)%,$(objdir)%,$(s))
endif
define proto-build_in =
PROTO_BUILD += $(1)
$(proto-build-c): $(lastword $(MAKEFILE_LIST))
endef
proto-build = $(eval $(call proto-build_in,$(1)))
define clean_in =
clean::
rm -f $(addprefix $(o),$(1))

View File

@ -714,9 +714,6 @@
case EAF_TYPE_LC_SET:
RESULT_(T_LCLIST, ad, e->u.ptr);
break;
case EAF_TYPE_UNDEF:
RESULT_VOID;
break;
default:
bug("Unknown dynamic attribute type");
}
@ -737,7 +734,9 @@
l->count = 1;
l->attrs[0].id = da.ea_code;
l->attrs[0].flags = 0;
l->attrs[0].type = da.type | EAF_ORIGINATED | EAF_FRESH;
l->attrs[0].type = da.type;
l->attrs[0].originated = 1;
l->attrs[0].fresh = 1;
switch (da.type) {
case EAF_TYPE_INT:
@ -792,21 +791,8 @@
ACCESS_RTE;
ACCESS_EATTRS;
{
struct ea_list *l = lp_alloc(fs->pool, sizeof(struct ea_list) + sizeof(eattr));
l->next = NULL;
l->flags = EALF_SORTED;
l->count = 1;
l->attrs[0].id = da.ea_code;
l->attrs[0].flags = 0;
l->attrs[0].type = EAF_TYPE_UNDEF | EAF_ORIGINATED | EAF_FRESH;
l->attrs[0].u.data = 0;
f_rta_cow(fs);
l->next = *fs->eattrs;
*fs->eattrs = l;
}
f_rta_cow(fs);
ea_unset_attr(fs->eattrs, fs->pool, 1, da.ea_code);
}
INST(FI_LENGTH, 1, 1) { /* Get length of */

View File

@ -32,6 +32,7 @@
#include "nest/bird.h"
#include "lib/resource.h"
#include "lib/string.h"
#include "lib/tlists.h"
#undef FAKE_SLAB /* Turn on if you want to debug memory allocations */
@ -153,11 +154,38 @@ slab_memsize(resource *r)
#define MAX_EMPTY_HEADS 1
enum sl_head_state {
slh_empty = 2,
slh_partial = 0,
slh_full = 1,
} PACKED;
struct sl_head {
struct slab *slab;
TLIST_NODE(sl_head, struct sl_head) n;
u16 num_full;
enum sl_head_state state;
u32 used_bits[0];
};
struct sl_alignment { /* Magic structure for testing of alignment */
byte data;
int x[0];
};
#define TLIST_PREFIX sl_head
#define TLIST_TYPE struct sl_head
#define TLIST_ITEM n
#define TLIST_WANT_WALK
#define TLIST_WANT_ADD_HEAD
#include "lib/tlists.h"
struct slab {
resource r;
uint obj_size, head_size, head_bitfield_len;
uint objs_per_slab, num_empty_heads, data_size;
list empty_heads, partial_heads, full_heads;
struct sl_head_list empty_heads, partial_heads, full_heads;
};
static struct resclass sl_class = {
@ -169,20 +197,16 @@ static struct resclass sl_class = {
slab_memsize
};
struct sl_head {
struct slab *slab;
node n;
u32 num_full;
u32 used_bits[0];
};
struct sl_alignment { /* Magic structure for testing of alignment */
byte data;
int x[0];
};
#define SL_GET_HEAD(x) ((struct sl_head *) (((uintptr_t) (x)) & ~(page_size-1)))
#define SL_HEAD_CHANGE_STATE(_s, _h, _from, _to) ({ \
ASSERT_DIE(_h->state == slh_##_from); \
sl_head_rem_node(&_s->_from##_heads, _h); \
sl_head_add_head(&_s->_to##_heads, _h); \
_h->state = slh_##_to; \
})
/**
* sl_new - create a new Slab
* @p: resource pool
@ -218,9 +242,6 @@ sl_new(pool *p, uint size)
bug("Slab: object too large");
s->num_empty_heads = 0;
init_list(&s->empty_heads);
init_list(&s->partial_heads);
init_list(&s->full_heads);
return s;
}
@ -237,8 +258,7 @@ sl_alloc(slab *s)
struct sl_head *h;
redo:
h = SKIP_BACK(struct sl_head, n, HEAD(s->partial_heads));
if (!h->n.next)
if (!(h = s->partial_heads.first))
goto no_partial;
okay:
for (uint i=0; i<s->head_bitfield_len; i++)
@ -258,16 +278,13 @@ okay:
return out;
}
rem_node(&h->n);
add_tail(&s->full_heads, &h->n);
SL_HEAD_CHANGE_STATE(s, h, partial, full);
goto redo;
no_partial:
h = SKIP_BACK(struct sl_head, n, HEAD(s->empty_heads));
if (h->n.next)
if (h = s->empty_heads.first)
{
rem_node(&h->n);
add_head(&s->partial_heads, &h->n);
SL_HEAD_CHANGE_STATE(s, h, empty, partial);
s->num_empty_heads--;
goto okay;
}
@ -281,7 +298,7 @@ no_partial:
memset(h, 0, s->head_size);
h->slab = s;
add_head(&s->partial_heads, &h->n);
sl_head_add_head(&s->partial_heads, h);
goto okay;
}
@ -326,14 +343,11 @@ sl_free(void *oo)
h->used_bits[pos / 32] &= ~(1 << (pos % 32));
if (h->num_full-- == s->objs_per_slab)
{
rem_node(&h->n);
add_head(&s->partial_heads, &h->n);
}
if ((h->num_full-- == s->objs_per_slab) && (h->state == slh_full))
SL_HEAD_CHANGE_STATE(s, h, full, partial);
else if (!h->num_full)
{
rem_node(&h->n);
sl_head_rem_node(&s->partial_heads, h);
if (s->num_empty_heads >= MAX_EMPTY_HEADS)
{
#ifdef POISON
@ -343,7 +357,8 @@ sl_free(void *oo)
}
else
{
add_head(&s->empty_heads, &h->n);
sl_head_add_head(&s->empty_heads, h);
h->state = slh_empty;
s->num_empty_heads++;
}
}
@ -353,14 +368,12 @@ static void
slab_free(resource *r)
{
slab *s = (slab *) r;
struct sl_head *h;
node *nn, *nxt;
WALK_LIST2_DELSAFE(h, nn, nxt, s->empty_heads, n)
WALK_TLIST_DELSAFE(sl_head, h, &s->empty_heads)
free_page(h);
WALK_LIST2_DELSAFE(h, nn, nxt, s->partial_heads, n)
WALK_TLIST_DELSAFE(sl_head, h, &s->partial_heads)
free_page(h);
WALK_LIST2_DELSAFE(h, nn, nxt, s->full_heads, n)
WALK_TLIST_DELSAFE(sl_head, h, &s->full_heads)
free_page(h);
}
@ -369,14 +382,12 @@ slab_dump(resource *r)
{
slab *s = (slab *) r;
int ec=0, pc=0, fc=0;
struct sl_head *h;
node *nn;
WALK_LIST2(h, nn, s->empty_heads, n)
WALK_TLIST(sl_head, h, &s->empty_heads)
ec++;
WALK_LIST2(h, nn, s->partial_heads, n)
WALK_TLIST(sl_head, h, &s->partial_heads)
pc++;
WALK_LIST2(h, nn, s->full_heads, n)
WALK_TLIST(sl_head, h, &s->full_heads)
fc++;
debug("(%de+%dp+%df blocks per %d objs per %d bytes)\n", ec, pc, fc, s->objs_per_slab, s->obj_size);
}
@ -386,21 +397,19 @@ slab_memsize(resource *r)
{
slab *s = (slab *) r;
size_t heads = 0;
struct sl_head *h;
node *nn;
WALK_LIST2(h, nn, s->full_heads, n)
WALK_TLIST(sl_head, h, &s->full_heads)
heads++;
size_t items = heads * s->objs_per_slab;
WALK_LIST2(h, nn, s->partial_heads, n)
WALK_TLIST(sl_head, h, &s->partial_heads)
{
heads++;
items += h->num_full;
}
WALK_LIST2(h, nn, s->empty_heads, n)
WALK_TLIST(sl_head, h, &s->empty_heads)
heads++;
size_t eff = items * s->data_size;
@ -415,13 +424,11 @@ static resource *
slab_lookup(resource *r, unsigned long a)
{
slab *s = (slab *) r;
struct sl_head *h;
node *nn;
WALK_LIST2(h, nn, s->partial_heads, n)
WALK_TLIST(sl_head, h, &s->partial_heads)
if ((unsigned long) h < a && (unsigned long) h + page_size < a)
return r;
WALK_LIST2(h, nn, s->full_heads, n)
WALK_TLIST(sl_head, h, &s->full_heads)
if ((unsigned long) h < a && (unsigned long) h + page_size < a)
return r;
return NULL;

View File

@ -1,7 +1,12 @@
src := a-path.c a-set.c cli.c cmds.c iface.c locks.c neighbor.c password.c proto.c rt-attr.c rt-dev.c rt-fib.c rt-show.c rt-table.c
src := a-path.c a-set.c cli.c cmds.c iface.c locks.c neighbor.c password.c proto.c proto-build.c rt-attr.c rt-dev.c rt-fib.c rt-show.c rt-table.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,dev_build)
$(proto-build-c): $(lastword $(MAKEFILE_LIST))
$(E)echo GEN $@
$(Q)echo "$(patsubst %,void %(void); ,$(PROTO_BUILD)) void protos_build_gen(void) { $(patsubst %, %(); ,$(PROTO_BUILD))}" > $@
tests_src := a-set_test.c a-path_test.c
tests_targets := $(tests_targets) $(tests-target-files)

View File

@ -591,7 +591,7 @@ as_path_match_set(const struct adata *path, const struct f_tree *set)
p += 2;
for (i=0; i<n; i++)
{
struct f_val v = {T_INT, .val.i = get_as(p)};
struct f_val v = { .type = T_INT, .val.i = get_as(p)};
if (find_tree(set, &v))
return 1;
p += BS;
@ -631,7 +631,7 @@ as_path_filter(struct linpool *pool, const struct adata *path, const struct f_tr
if (set)
{
struct f_val v = {T_INT, .val.i = as};
struct f_val v = { .type = T_INT, .val.i = as};
match = !!find_tree(set, &v);
}
else

View File

@ -23,9 +23,9 @@
#include "filter/f-inst.h"
pool *proto_pool;
list proto_list;
list STATIC_LIST_INIT(proto_list);
static list protocol_list;
static list STATIC_LIST_INIT(protocol_list);
struct protocol *class_to_protocol[PROTOCOL__MAX];
#define CD(c, msg, args...) ({ if (c->debug & D_STATES) log(L_TRACE "%s.%s: " msg, c->proto->name, c->name ?: "?", ## args); })
@ -1757,6 +1757,8 @@ proto_build(struct protocol *p)
/* FIXME: convert this call to some protocol hook */
extern void bfd_init_all(void);
void protos_build_gen(void);
/**
* protos_build - build a protocol list
*
@ -1769,44 +1771,7 @@ extern void bfd_init_all(void);
void
protos_build(void)
{
init_list(&proto_list);
init_list(&protocol_list);
proto_build(&proto_device);
#ifdef CONFIG_RADV
proto_build(&proto_radv);
#endif
#ifdef CONFIG_RIP
proto_build(&proto_rip);
#endif
#ifdef CONFIG_STATIC
proto_build(&proto_static);
#endif
#ifdef CONFIG_MRT
proto_build(&proto_mrt);
#endif
#ifdef CONFIG_OSPF
proto_build(&proto_ospf);
#endif
#ifdef CONFIG_PIPE
proto_build(&proto_pipe);
#endif
#ifdef CONFIG_BGP
proto_build(&proto_bgp);
#endif
#ifdef CONFIG_BFD
proto_build(&proto_bfd);
bfd_init_all();
#endif
#ifdef CONFIG_BABEL
proto_build(&proto_babel);
#endif
#ifdef CONFIG_RPKI
proto_build(&proto_rpki);
#endif
#ifdef CONFIG_PERF
proto_build(&proto_perf);
#endif
protos_build_gen();
proto_pool = rp_new(&root_pool, "Protocols");
proto_shutdown_timer = tm_new(proto_pool);

View File

@ -84,8 +84,8 @@ struct protocol {
void (*copy_config)(struct proto_config *, struct proto_config *); /* Copy config from given protocol instance */
};
void protos_build(void);
void proto_build(struct protocol *);
void protos_build(void); /* Called from sysdep to initialize protocols */
void proto_build(struct protocol *); /* Called from protocol to register itself */
void protos_preconfig(struct config *);
void protos_commit(struct config *new, struct config *old, int force_restart, int type);
struct proto * proto_spawn(struct proto_config *cf, uint disabled);

View File

@ -664,7 +664,10 @@ static inline int rte_is_reachable(rte *r)
typedef struct eattr {
word id; /* EA_CODE(PROTOCOL_..., protocol-dependent ID) */
byte flags; /* Protocol-dependent flags */
byte type; /* Attribute type and several flags (EAF_...) */
byte type:5; /* Attribute type */
byte originated:1; /* The attribute has originated locally */
byte fresh:1; /* An uncached attribute (e.g. modified in export filter) */
byte undef:1; /* Explicitly undefined */
union {
uintptr_t data;
const struct adata *ptr; /* Attribute data elsewhere */
@ -700,11 +703,8 @@ const char *ea_custom_name(uint ea);
#define EAF_TYPE_PTR 0x0d /* Pointer to an object */
#define EAF_TYPE_EC_SET 0x0e /* Set of pairs of u32's - ext. community list */
#define EAF_TYPE_LC_SET 0x12 /* Set of triplets of u32's - large community list */
#define EAF_TYPE_UNDEF 0x1f /* `force undefined' entry */
#define EAF_EMBEDDED 0x01 /* Data stored in eattr.u.data (part of type spec) */
#define EAF_VAR_LENGTH 0x02 /* Attribute length is variable (part of type spec) */
#define EAF_ORIGINATED 0x20 /* The attribute has originated locally */
#define EAF_FRESH 0x40 /* An uncached attribute (e.g. modified in export filter) */
typedef struct adata {
uint length; /* Length of data */
@ -772,27 +772,50 @@ void ea_format_bitfield(const struct eattr *a, byte *buf, int bufsize, const cha
ea = NULL; \
} while(0) \
struct ea_one_attr_list {
ea_list l;
eattr a;
};
static inline eattr *
ea_set_attr(ea_list **to, struct linpool *pool, uint id, uint flags, uint type, uintptr_t val)
{
ea_list *a = lp_alloc(pool, sizeof(ea_list) + sizeof(eattr));
eattr *e = &a->attrs[0];
struct ea_one_attr_list *ea = lp_alloc(pool, sizeof(*ea));
*ea = (struct ea_one_attr_list) {
.l.flags = EALF_SORTED,
.l.count = 1,
.l.next = *to,
a->flags = EALF_SORTED;
a->count = 1;
a->next = *to;
*to = a;
e->id = id;
e->type = type;
e->flags = flags;
.a.id = id,
.a.type = type,
.a.flags = flags,
};
if (type & EAF_EMBEDDED)
e->u.data = (u32) val;
ea->a.u.data = val;
else
e->u.ptr = (struct adata *) val;
ea->a.u.ptr = (struct adata *) val;
return e;
*to = &ea->l;
return &ea->a;
}
static inline void
ea_unset_attr(ea_list **to, struct linpool *pool, _Bool local, uint code)
{
struct ea_one_attr_list *ea = lp_alloc(pool, sizeof(*ea));
*ea = (struct ea_one_attr_list) {
.l.flags = EALF_SORTED,
.l.count = 1,
.l.next = *to,
.a.id = code,
.a.fresh = local,
.a.originated = local,
.a.undef = 1,
};
*to = &ea->l;
}
static inline void

View File

@ -448,8 +448,7 @@ ea_find(ea_list *e, unsigned id)
{
eattr *a = ea__find(e, id & EA_CODE_MASK);
if (a && (a->type & EAF_TYPE_MASK) == EAF_TYPE_UNDEF &&
!(id & EA_ALLOW_UNDEF))
if (a && a->undef && !(id & EA_ALLOW_UNDEF))
return NULL;
return a;
}
@ -516,7 +515,7 @@ ea_walk(struct ea_walk_state *s, uint id, uint max)
BIT32_SET(s->visited, n);
if ((a->type & EAF_TYPE_MASK) == EAF_TYPE_UNDEF)
if (a->undef)
continue;
s->eattrs = e;
@ -616,14 +615,17 @@ ea_do_prune(ea_list *e)
/* Now s0 is the most recent version, s[-1] the oldest one */
/* Drop undefs */
if ((s0->type & EAF_TYPE_MASK) == EAF_TYPE_UNDEF)
if (s0->undef)
continue;
/* Copy the newest version to destination */
*d = *s0;
/* Preserve info whether it originated locally */
d->type = (d->type & ~(EAF_ORIGINATED|EAF_FRESH)) | (s[-1].type & EAF_ORIGINATED);
d->originated = s[-1].originated;
/* Not fresh any more, we prefer surstroemming */
d->fresh = 0;
/* Next destination */
d++;
@ -737,6 +739,9 @@ ea_same(ea_list *x, ea_list *y)
if (a->id != b->id ||
a->flags != b->flags ||
a->type != b->type ||
a->originated != b->originated ||
a->fresh != b->fresh ||
a->undef != b->undef ||
((a->type & EAF_EMBEDDED) ? a->u.data != b->u.data : !adata_same(a->u.ptr, b->u.ptr)))
return 0;
}
@ -939,6 +944,10 @@ ea_show(struct cli *c, const eattr *e)
{
*pos++ = ':';
*pos++ = ' ';
if (e->undef)
bsprintf(pos, "undefined");
else
switch (e->type & EAF_TYPE_MASK)
{
case EAF_TYPE_INT:
@ -968,7 +977,6 @@ ea_show(struct cli *c, const eattr *e)
case EAF_TYPE_LC_SET:
ea_show_lc_set(c, ad, pos, buf, end);
return;
case EAF_TYPE_UNDEF:
default:
bsprintf(pos, "<type %02x>", e->type);
}
@ -1004,7 +1012,7 @@ ea_dump(ea_list *e)
eattr *a = &e->attrs[i];
debug(" %02x:%02x.%02x", EA_PROTO(a->id), EA_ID(a->id), a->flags);
debug("=%c", "?iO?I?P???S?????" [a->type & EAF_TYPE_MASK]);
if (a->type & EAF_ORIGINATED)
if (a->originated)
debug("o");
if (a->type & EAF_EMBEDDED)
debug(":%08x", a->u.data);

View File

@ -194,3 +194,9 @@ struct protocol proto_device = {
.reconfigure = dev_reconfigure,
.copy_config = dev_copy_config
};
void
dev_build(void)
{
proto_build(&proto_device);
}

View File

@ -2,5 +2,6 @@ src := babel.c packets.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,babel_build)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -2497,3 +2497,9 @@ struct protocol proto_babel = {
.get_route_info = babel_get_route_info,
.get_attr = babel_get_attr
};
void
babel_build(void)
{
proto_build(&proto_babel);
}

View File

@ -2,5 +2,6 @@ src := bfd.c io.c packets.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,bfd_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -113,8 +113,8 @@
#define HASH_IP_EQ(a1,n1,a2,n2) ipa_equal(a1, a2) && n1 == n2
#define HASH_IP_FN(a,n) ipa_hash(a) ^ u32_hash(n)
static list bfd_proto_list;
static list bfd_wait_list;
static list STATIC_LIST_INIT(bfd_proto_list);
static list STATIC_LIST_INIT(bfd_wait_list);
const char *bfd_state_names[] = { "AdminDown", "Down", "Init", "Up" };
@ -998,13 +998,6 @@ bfd_notify_init(struct bfd_proto *p)
* BFD protocol glue
*/
void
bfd_init_all(void)
{
init_list(&bfd_proto_list);
init_list(&bfd_wait_list);
}
static struct proto *
bfd_init(struct proto_config *c)
{
@ -1186,3 +1179,9 @@ struct protocol proto_bfd = {
.reconfigure = bfd_reconfigure,
.copy_config = bfd_copy_config,
};
void
bfd_build(void)
{
proto_build(&proto_bfd);
}

View File

@ -2,5 +2,6 @@ src := attrs.c bgp.c packets.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,bgp_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -106,7 +106,7 @@ bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintp
({ REPORT(msg, ## args); s->err_withdraw = 1; return; })
#define UNSET(a) \
({ a->type = EAF_TYPE_UNDEF; return; })
({ a->undef = 1; return; })
#define REJECT(msg, args...) \
({ log(L_ERR "%s: " msg, s->proto->p.name, ## args); s->err_reject = 1; return; })
@ -1153,7 +1153,7 @@ bgp_export_attr(struct bgp_export_state *s, eattr *a, ea_list *to)
a->flags = (a->flags & BAF_PARTIAL) | desc->flags;
/* Set partial bit if new opt-trans attribute is attached to non-local route */
if ((s->src != NULL) && (a->type & EAF_ORIGINATED) &&
if ((s->src != NULL) && (a->originated) &&
(a->flags & BAF_OPTIONAL) && (a->flags & BAF_TRANSITIVE))
a->flags |= BAF_PARTIAL;
@ -1161,7 +1161,7 @@ bgp_export_attr(struct bgp_export_state *s, eattr *a, ea_list *to)
CALL(desc->export, s, a);
/* Attribute might become undefined in hook */
if ((a->type & EAF_TYPE_MASK) == EAF_TYPE_UNDEF)
if (a->undef)
return;
}
else
@ -1776,7 +1776,7 @@ bgp_update_attrs(struct bgp_proto *p, struct bgp_channel *c, rte *e, ea_list *at
/* MULTI_EXIT_DESC attribute - accept only if set in export filter */
a = bgp_find_attr(attrs0, BA_MULTI_EXIT_DISC);
if (a && !(a->type & EAF_FRESH))
if (a && !(a->fresh))
bgp_unset_attr(&attrs, pool, BA_MULTI_EXIT_DISC);
}

View File

@ -2592,3 +2592,8 @@ struct protocol proto_bgp = {
.get_route_info = bgp_get_route_info,
.show_proto_info = bgp_show_proto_info
};
void bgp_build(void)
{
proto_build(&proto_bgp);
}

View File

@ -563,9 +563,7 @@ bgp_set_attr_data(ea_list **to, struct linpool *pool, uint code, uint flags, voi
bgp_set_attr(to, pool, code, flags, (uintptr_t) a);
}
static inline void
bgp_unset_attr(ea_list **to, struct linpool *pool, uint code)
{ eattr *e = bgp_set_attr(to, pool, code, 0, 0); e->type = EAF_TYPE_UNDEF; }
#define bgp_unset_attr(to, pool, code) ea_unset_attr(to, pool, 0, code)
int bgp_encode_mp_reach_mrt(struct bgp_write_state *s, eattr *a, byte *buf, uint size);

View File

@ -1062,7 +1062,7 @@ bgp_use_next_hop(struct bgp_export_state *s, eattr *a)
return 1;
/* Keep it when explicitly set in export filter */
if (a->type & EAF_FRESH)
if (a->fresh)
return 1;
/* Check for non-matching AF */

View File

@ -2,5 +2,6 @@ src := mrt.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,mrt_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -913,3 +913,9 @@ struct protocol proto_mrt = {
.reconfigure = mrt_reconfigure,
.copy_config = mrt_copy_config,
};
void
mrt_build(void)
{
proto_build(&proto_mrt);
}

View File

@ -2,5 +2,6 @@ src := dbdes.c hello.c iface.c lsack.c lsalib.c lsreq.c lsupd.c neighbor.c ospf.
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,ospf_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -1534,3 +1534,9 @@ struct protocol proto_ospf = {
.get_attr = ospf_get_attr,
.get_route_info = ospf_get_route_info
};
void
ospf_build(void)
{
proto_build(&proto_ospf);
}

View File

@ -2,5 +2,6 @@ src := perf.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,perf_build)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -314,3 +314,9 @@ struct protocol proto_perf = {
.reconfigure = perf_reconfigure,
.copy_config = perf_copy_config,
};
void
perf_build(void)
{
proto_build(&proto_perf);
}

View File

@ -2,5 +2,6 @@ src := pipe.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,pipe_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -309,3 +309,9 @@ struct protocol proto_pipe = {
.get_status = pipe_get_status,
.show_proto_info = pipe_show_proto_info
};
void
pipe_build(void)
{
proto_build(&proto_pipe);
}

View File

@ -2,5 +2,6 @@ src := packets.c radv.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,radv_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -771,3 +771,9 @@ struct protocol proto_radv = {
.get_status = radv_get_status,
.get_attr = radv_get_attr
};
void
radv_build(void)
{
proto_build(&proto_radv);
}

View File

@ -2,5 +2,6 @@ src := packets.c rip.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,rip_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -1341,3 +1341,9 @@ struct protocol proto_rip = {
.get_route_info = rip_get_route_info,
.get_attr = rip_get_attr
};
void
rip_build(void)
{
proto_build(&proto_rip);
}

View File

@ -2,5 +2,6 @@ src := rpki.c packets.c tcp_transport.c ssh_transport.c transport.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,rpki_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -955,3 +955,9 @@ struct protocol proto_rpki = {
.reconfigure = rpki_reconfigure,
.get_status = rpki_get_status,
};
void
rpki_build(void)
{
proto_build(&proto_rpki);
}

View File

@ -2,5 +2,6 @@ src := static.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,static_build)
tests_objs := $(tests_objs) $(src-o-files)
tests_objs := $(tests_objs) $(src-o-files)

View File

@ -775,3 +775,9 @@ struct protocol proto_static = {
.copy_config = static_copy_config,
.get_route_info = static_get_route_info,
};
void
static_build(void)
{
proto_build(&proto_static);
}

View File

@ -2,6 +2,8 @@ src := alloc.c io.c krt.c log.c main.c random.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
$(call proto-build,kif_build)
$(call proto-build,krt_build)
$(conf-y-targets): $(s)krt.Y
src := $(filter-out main.c, $(src))

View File

@ -243,6 +243,13 @@ struct protocol proto_unix_iface = {
.copy_config = kif_copy_config
};
void
kif_build(void)
{
proto_build(&proto_unix_iface);
}
/*
* Tracing of routes
*/
@ -1186,3 +1193,9 @@ struct protocol proto_unix_kernel = {
.dump = krt_dump,
#endif
};
void
krt_build(void)
{
proto_build(&proto_unix_kernel);
}

View File

@ -906,8 +906,6 @@ main(int argc, char **argv)
open_pid_file();
protos_build();
proto_build(&proto_unix_kernel);
proto_build(&proto_unix_iface);
struct config *conf = read_config();

View File

@ -68,8 +68,6 @@ bt_bird_init(void)
config_init();
protos_build();
proto_build(&proto_unix_kernel);
proto_build(&proto_unix_iface);
}
void bt_bird_cleanup(void)