mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 15:41:54 +00:00
bgpsec-mbaer: simple after merge fixes
This commit is contained in:
parent
f857f67485
commit
8e24b2bd92
@ -30,7 +30,9 @@
|
|||||||
#define MAX(a,b) MAX_(a,b)
|
#define MAX(a,b) MAX_(a,b)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef U64
|
||||||
#define U64(c) UINT64_C(c)
|
#define U64(c) UINT64_C(c)
|
||||||
|
#endif
|
||||||
#define ABS(a) ((a)>=0 ? (a) : -(a))
|
#define ABS(a) ((a)>=0 ? (a) : -(a))
|
||||||
#define DELTA(a,b) (((a)>=(b))?(a)-(b):(b)-(a))
|
#define DELTA(a,b) (((a)>=(b))?(a)-(b):(b)-(a))
|
||||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
|
||||||
|
@ -400,7 +400,7 @@ decode_bgpsec_attr(struct bgp_proto *bgp,
|
|||||||
p, err, path_id, prefix, pxlen and goto 'done:' */
|
p, err, path_id, prefix, pxlen and goto 'done:' */
|
||||||
int err = 0;
|
int err = 0;
|
||||||
u32 path_id = 0;
|
u32 path_id = 0;
|
||||||
ip_addr prefix = 0;
|
ip_addr prefix = IPA_NONE;
|
||||||
int pxlen = 0;
|
int pxlen = 0;
|
||||||
|
|
||||||
/* Is it long enough to have a minimal valid bgpseg_path_attr */
|
/* Is it long enough to have a minimal valid bgpseg_path_attr */
|
||||||
@ -2433,14 +2433,16 @@ bgp_remove_as4_attrs(struct bgp_proto *p, rta *a)
|
|||||||
* @len: length of attribute block
|
* @len: length of attribute block
|
||||||
* @pool: linear pool to make all the allocations in
|
* @pool: linear pool to make all the allocations in
|
||||||
* @mandatory: 1 iff presence of mandatory attributes has to be checked
|
* @mandatory: 1 iff presence of mandatory attributes has to be checked
|
||||||
|
* @nlri: FIXME
|
||||||
|
* @nlri_len: FIXME
|
||||||
*
|
*
|
||||||
* This function takes a BGP attribute block (a part of an Update message), checks
|
* This function takes a BGP attribute block (a part of an Update message), checks
|
||||||
* its consistency and converts it to a list of BIRD route attributes represented
|
* its consistency and converts it to a list of BIRD route attributes represented
|
||||||
* by a &rta.
|
* by a &rta.
|
||||||
*/
|
*/
|
||||||
struct rta *
|
struct rta *
|
||||||
bgp_decode_attrs(struct bgp_conn *conn, byte *attr, uint len, struct linpool *pool, int mandatory,
|
bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len,
|
||||||
byte *nlri, int nlri_len)
|
struct linpool *pool, int mandatory, byte *nlri, int nlri_len)
|
||||||
{
|
{
|
||||||
struct bgp_proto *bgp = conn->bgp;
|
struct bgp_proto *bgp = conn->bgp;
|
||||||
rta *a = lp_alloc(pool, sizeof(struct rta));
|
rta *a = lp_alloc(pool, sizeof(struct rta));
|
||||||
@ -2754,3 +2756,6 @@ bgp_get_route_info(rte *e, byte *buf, ea_list *attrs)
|
|||||||
buf += bsprintf(buf, "%c", "ie?"[o->u.data]);
|
buf += bsprintf(buf, "%c", "ie?"[o->u.data]);
|
||||||
strcpy(buf, "]");
|
strcpy(buf, "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1371,7 +1371,7 @@ bgp_check_config(struct bgp_config *c)
|
|||||||
#ifdef CONFIG_BGPSEC
|
#ifdef CONFIG_BGPSEC
|
||||||
/* create a binary SKI from config */
|
/* create a binary SKI from config */
|
||||||
if ( c->enable_bgpsec ) {
|
if ( c->enable_bgpsec ) {
|
||||||
if ( strnlen(c->bgpsec_ski, (2 * BGPSEC_SKI_LENGTH))
|
if ( c->bgpsec_ski == NULL || strnlen(c->bgpsec_ski, (2 * BGPSEC_SKI_LENGTH))
|
||||||
!= (BGPSEC_SKI_LENGTH * 2) ) {
|
!= (BGPSEC_SKI_LENGTH * 2) ) {
|
||||||
cf_error("BGPSEC: bad length of the configured SKI value");
|
cf_error("BGPSEC: bad length of the configured SKI value");
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ static inline void set_next_hop(byte *b, ip_addr addr) { ((ip_addr *) b)[0] = ad
|
|||||||
|
|
||||||
void bgp_attach_attr(struct ea_list **to, struct linpool *pool, unsigned attr, uintptr_t val);
|
void bgp_attach_attr(struct ea_list **to, struct linpool *pool, unsigned attr, uintptr_t val);
|
||||||
byte *bgp_attach_attr_wa(struct ea_list **to, struct linpool *pool, unsigned attr, unsigned len);
|
byte *bgp_attach_attr_wa(struct ea_list **to, struct linpool *pool, unsigned attr, unsigned len);
|
||||||
struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *a, uint len, struct linpool *pool, int mandatory, byte * nlri, int nlri_len);
|
struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct linpool *pool, int mandatory, byte * nlri, int nlri_len);
|
||||||
int bgp_get_attr(struct eattr *e, byte *buf, int buflen);
|
int bgp_get_attr(struct eattr *e, byte *buf, int buflen);
|
||||||
int bgp_rte_better(struct rte *, struct rte *);
|
int bgp_rte_better(struct rte *, struct rte *);
|
||||||
int bgp_rte_mergable(rte *pri, rte *sec);
|
int bgp_rte_mergable(rte *pri, rte *sec);
|
||||||
@ -317,6 +317,11 @@ void bgp_get_route_info(struct rte *, byte *buf, struct ea_list *attrs);
|
|||||||
inline static void bgp_attach_attr_ip(struct ea_list **to, struct linpool *pool, unsigned attr, ip_addr a)
|
inline static void bgp_attach_attr_ip(struct ea_list **to, struct linpool *pool, unsigned attr, ip_addr a)
|
||||||
{ *(ip_addr *) bgp_attach_attr_wa(to, pool, attr, sizeof(ip_addr)) = a; }
|
{ *(ip_addr *) bgp_attach_attr_wa(to, pool, attr, sizeof(ip_addr)) = a; }
|
||||||
|
|
||||||
|
#ifdef CONFIG_BGPSEC
|
||||||
|
unsigned int encode_bgpsec_attr(struct bgp_conn *conn, ea_list *attr_list, byte *w, int remains, byte *nlri);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* packets.c */
|
/* packets.c */
|
||||||
|
|
||||||
void mrt_dump_bgp_state_change(struct bgp_conn *conn, unsigned old, unsigned new);
|
void mrt_dump_bgp_state_change(struct bgp_conn *conn, unsigned old, unsigned new);
|
||||||
|
@ -9,3 +9,4 @@ validate_tmp.o: ../../../../proto/bgp/bgpsec/validate.c
|
|||||||
|
|
||||||
tests: tests.o validate_tmp.o
|
tests: tests.o validate_tmp.o
|
||||||
gcc -o $@ $^ bgpsec.o $(LDFLAGS) $(LIBS)
|
gcc -o $@ $^ bgpsec.o $(LDFLAGS) $(LIBS)
|
||||||
|
|
||||||
|
@ -1370,7 +1370,7 @@ bgp_do_rx_update(struct bgp_conn *conn,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Note: bgp_linpool, nlri, nlri_len needed for bgpsec decoding */
|
/* Note: bgp_linpool, nlri, nlri_len needed for bgpsec decoding */
|
||||||
a0 = bgp_decode_attrs(conn, attrs, attr_len, bgp_linpool, nlri, nlri_len);
|
a0 = bgp_decode_attrs(conn, attrs, attr_len, bgp_linpool, nlri_len, nlri, nlri_len); /* XXX */
|
||||||
|
|
||||||
if (conn->state != BS_ESTABLISHED) /* fatal error during decoding */
|
if (conn->state != BS_ESTABLISHED) /* fatal error during decoding */
|
||||||
return;
|
return;
|
||||||
@ -1464,7 +1464,7 @@ bgp_do_rx_update(struct bgp_conn *conn,
|
|||||||
|
|
||||||
p->mp_reach_len = 0;
|
p->mp_reach_len = 0;
|
||||||
p->mp_unreach_len = 0;
|
p->mp_unreach_len = 0;
|
||||||
a0 = bgp_decode_attrs(conn, attrs, attr_len, bgp_linpool, nlri, nlri_len);
|
a0 = bgp_decode_attrs(conn, attrs, attr_len, bgp_linpool, 0, nlri, nlri_len);
|
||||||
|
|
||||||
if (conn->state != BS_ESTABLISHED) /* fatal error during decoding */
|
if (conn->state != BS_ESTABLISHED) /* fatal error during decoding */
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user