mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Minor cleanups
This commit is contained in:
parent
256cc8ee08
commit
f8aad5d5b7
@ -490,7 +490,7 @@ int
|
||||
channel_reconfigure(struct channel *c, struct channel_config *cf)
|
||||
{
|
||||
/* FIXME: better handle these changes, also handle in_keep_filtered */
|
||||
if ((c->table != cf->table->table) || (c->ra_mode != cf->ra_mode))
|
||||
if ((c->table != cf->table->table) || (cf->ra_mode && (c->ra_mode != cf->ra_mode)))
|
||||
return 0;
|
||||
|
||||
int import_changed = !filter_same(c->in_filter, cf->in_filter);
|
||||
|
@ -258,6 +258,7 @@ static inline int rte_is_filtered(rte *r) { return !!(r->flags & REF_FILTERED);
|
||||
|
||||
|
||||
/* Types of route announcement, also used as flags */
|
||||
#define RA_UNDEF 0 /* Undefined RA type */
|
||||
#define RA_OPTIMAL 1 /* Announcement of optimal route change */
|
||||
#define RA_ACCEPTED 2 /* Announcement of first accepted route */
|
||||
#define RA_ANY 3 /* Announcement of any route change */
|
||||
|
@ -524,9 +524,13 @@ bgp_conn_enter_established_state(struct bgp_conn *conn)
|
||||
c->add_path_rx = (loc->add_path & BGP_ADD_PATH_RX) && (rem->add_path & BGP_ADD_PATH_TX);
|
||||
c->add_path_tx = (loc->add_path & BGP_ADD_PATH_TX) && (rem->add_path & BGP_ADD_PATH_RX);
|
||||
|
||||
// XXXX reset back to non-ANY?
|
||||
/* Update RA mode */
|
||||
if (c->add_path_tx)
|
||||
c->c.ra_mode = RA_ANY;
|
||||
else if (c->cf->secondary)
|
||||
c->c.ra_mode = RA_ACCEPTED;
|
||||
else
|
||||
c->c.ra_mode = RA_OPTIMAL;
|
||||
}
|
||||
|
||||
p->afi_map = mb_alloc(p->p.pool, num * sizeof(u32));
|
||||
@ -1411,8 +1415,6 @@ bgp_channel_init(struct channel *C, struct channel_config *CF)
|
||||
struct bgp_channel *c = (void *) C;
|
||||
struct bgp_channel_config *cf = (void *) CF;
|
||||
|
||||
C->ra_mode = cf->secondary ? RA_ACCEPTED : RA_OPTIMAL;
|
||||
|
||||
c->cf = cf;
|
||||
c->afi = cf->afi;
|
||||
c->desc = bgp_get_af_desc(c->afi);
|
||||
|
@ -453,18 +453,6 @@ 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; }
|
||||
|
||||
|
||||
|
||||
|
||||
/* Hack: although BA_NEXT_HOP attribute has type EAF_TYPE_IP_ADDRESS, in IPv6
|
||||
* we store two addesses in it - a global address and a link local address.
|
||||
*/
|
||||
#ifdef XXX
|
||||
#define NEXT_HOP_LENGTH (2*sizeof(ip_addr))
|
||||
static inline void set_next_hop(byte *b, ip_addr addr) { ((ip_addr *) b)[0] = addr; ((ip_addr *) b)[1] = IPA_NONE; }
|
||||
#define NEXT_HOP_LENGTH sizeof(ip_addr)
|
||||
static inline void set_next_hop(byte *b, ip_addr addr) { ((ip_addr *) b)[0] = addr; }
|
||||
#endif
|
||||
|
||||
int bgp_encode_attrs(struct bgp_write_state *s, ea_list *attrs, byte *buf, byte *end);
|
||||
ea_list * bgp_decode_attrs(struct bgp_parse_state *s, byte *data, uint len);
|
||||
|
||||
|
@ -152,6 +152,7 @@ bgp_channel_start: bgp_afi
|
||||
|
||||
this_channel = channel_config_new(&channel_bgp, desc->net, this_proto);
|
||||
BGP_CC->c.name = desc->name;
|
||||
BGP_CC->c.ra_mode = RA_UNDEF;
|
||||
BGP_CC->afi = $1;
|
||||
BGP_CC->gr_able = 0xff; /* undefined */
|
||||
};
|
||||
|
@ -277,6 +277,12 @@ bgp_write_capabilities(struct bgp_conn *conn, byte *buf)
|
||||
|
||||
/* Create capability list in buffer */
|
||||
|
||||
/*
|
||||
* Note that max length is ~ 20+14*af_count. With max 6 channels that is
|
||||
* 104. Option limit is 253 and buffer size is 4096, so we cannot overflow
|
||||
* unless we add new capabilities or more AFs.
|
||||
*/
|
||||
|
||||
WALK_AF_CAPS(caps, ac)
|
||||
if (ac->ready)
|
||||
{
|
||||
@ -350,8 +356,6 @@ bgp_write_capabilities(struct bgp_conn *conn, byte *buf)
|
||||
*buf++ = 0; /* Capability data length */
|
||||
}
|
||||
|
||||
/* FIXME: Should not XXXX 255 */
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user