mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-21 17:21:53 +00:00
Backport some minor changes from int-new
This commit is contained in:
parent
9f4908fe78
commit
f2dd602fef
@ -37,6 +37,9 @@ struct align_probe { char x; long int y; };
|
||||
#define ABS(a) ((a)>=0 ? (a) : -(a))
|
||||
#define DELTA(a,b) (((a)>=(b))?(a)-(b):(b)-(a))
|
||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
|
||||
#define BYTES(n) ((((uint) (n)) + 7) / 8)
|
||||
#define CALL(fn, args...) ({ if (fn) fn(args); })
|
||||
#define ADVANCE(w, r, l) ({ r -= l; w += l; })
|
||||
|
||||
|
||||
/* Bitfield macros */
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "lib/lists.h"
|
||||
#include "lib/resource.h"
|
||||
#include "lib/timer.h"
|
||||
#include "nest/route.h"
|
||||
#include "conf/conf.h"
|
||||
|
||||
struct iface;
|
||||
@ -287,6 +288,17 @@ proto_get_router_id(struct proto_config *pc)
|
||||
return pc->router_id ? pc->router_id : pc->global->router_id;
|
||||
}
|
||||
|
||||
static inline struct ea_list *
|
||||
rte_make_tmp_attrs(struct rte *rt, struct linpool *pool)
|
||||
{
|
||||
struct ea_list *(*mta)(struct rte *rt, struct linpool *pool);
|
||||
mta = rt->attrs->src->proto->make_tmp_attrs;
|
||||
return mta ? mta(rt, pool) : NULL;
|
||||
}
|
||||
|
||||
/* Moved from route.h to avoid dependency conflicts */
|
||||
static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
|
||||
|
||||
extern list active_proto_list;
|
||||
|
||||
/*
|
||||
|
@ -12,10 +12,11 @@
|
||||
#include "lib/lists.h"
|
||||
#include "lib/resource.h"
|
||||
#include "lib/timer.h"
|
||||
#include "nest/protocol.h"
|
||||
|
||||
struct ea_list;
|
||||
struct protocol;
|
||||
struct proto;
|
||||
struct rte_src;
|
||||
struct symbol;
|
||||
struct filter;
|
||||
struct cli;
|
||||
@ -273,7 +274,7 @@ static inline net *net_get(rtable *tab, ip_addr addr, unsigned len) { return (ne
|
||||
rte *rte_find(net *net, struct rte_src *src);
|
||||
rte *rte_get_temp(struct rta *);
|
||||
void rte_update2(struct announce_hook *ah, net *net, rte *new, struct rte_src *src);
|
||||
static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
|
||||
/* rte_update() moved to protocol.h to avoid dependency conflicts */
|
||||
int rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter *filter);
|
||||
rte *rt_export_merged(struct announce_hook *ah, net *net, rte **rt_free, struct ea_list **tmpa, linpool *pool, int silent);
|
||||
void rt_refresh_begin(rtable *t, struct announce_hook *ah);
|
||||
|
@ -60,14 +60,6 @@ static inline void rt_schedule_gc(rtable *tab);
|
||||
static inline void rt_schedule_prune(rtable *tab);
|
||||
|
||||
|
||||
static inline struct ea_list *
|
||||
make_tmp_attrs(struct rte *rt, struct linpool *pool)
|
||||
{
|
||||
struct ea_list *(*mta)(struct rte *rt, struct linpool *pool);
|
||||
mta = rt->attrs->src->proto->make_tmp_attrs;
|
||||
return mta ? mta(rt, pool) : NULL;
|
||||
}
|
||||
|
||||
/* Like fib_route(), but skips empty net entries */
|
||||
static net *
|
||||
net_route(rtable *tab, ip_addr a, int len)
|
||||
@ -260,7 +252,7 @@ export_filter_(struct announce_hook *ah, rte *rt0, rte **rt_free, ea_list **tmpa
|
||||
if (!tmpa)
|
||||
tmpa = &tmpb;
|
||||
|
||||
*tmpa = make_tmp_attrs(rt, pool);
|
||||
*tmpa = rte_make_tmp_attrs(rt, pool);
|
||||
|
||||
v = p->import_control ? p->import_control(p, &rt, tmpa, pool) : 0;
|
||||
if (v < 0)
|
||||
@ -1223,7 +1215,7 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct rte_src *src)
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpa = make_tmp_attrs(new, rte_update_pool);
|
||||
tmpa = rte_make_tmp_attrs(new, rte_update_pool);
|
||||
if (filter && (filter != FILTER_REJECT))
|
||||
{
|
||||
ea_list *old_tmpa = tmpa;
|
||||
@ -1303,7 +1295,7 @@ rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter
|
||||
rte_update_lock();
|
||||
|
||||
/* Rest is stripped down export_filter() */
|
||||
ea_list *tmpa = make_tmp_attrs(rt, rte_update_pool);
|
||||
ea_list *tmpa = rte_make_tmp_attrs(rt, rte_update_pool);
|
||||
int v = p->import_control ? p->import_control(p, &rt, &tmpa, rte_update_pool) : 0;
|
||||
if (v == RIC_PROCESS)
|
||||
v = (f_run(filter, &rt, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
|
||||
@ -2470,7 +2462,7 @@ rt_show_net(struct cli *c, net *n, struct rt_show_data *d)
|
||||
|
||||
ee = e;
|
||||
rte_update_lock(); /* We use the update buffer for filtering */
|
||||
tmpa = make_tmp_attrs(e, rte_update_pool);
|
||||
tmpa = rte_make_tmp_attrs(e, rte_update_pool);
|
||||
|
||||
/* Special case for merged export */
|
||||
if ((d->export_mode == RSEM_EXPORT) && (d->export_protocol->accept_ra_types == RA_MERGED))
|
||||
|
@ -469,8 +469,6 @@ bgp_get_attr_len(eattr *a)
|
||||
return len;
|
||||
}
|
||||
|
||||
#define ADVANCE(w, r, l) do { r -= l; w += l; } while (0)
|
||||
|
||||
/**
|
||||
* bgp_encode_attrs - encode BGP attributes
|
||||
* @p: BGP instance
|
||||
|
Loading…
Reference in New Issue
Block a user