Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/frrouting/frr into return…
Browse files Browse the repository at this point in the history
…_nothing_for_zapi
  • Loading branch information
donaldsharp committed Feb 8, 2024
2 parents 7ada350 + 04d0834 commit de9f6f1
Show file tree
Hide file tree
Showing 117 changed files with 1,845 additions and 1,541 deletions.
1 change: 0 additions & 1 deletion babeld/babeld.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
#endif


#define BABEL_VTY_PORT 2609
#define BABEL_DEFAULT_CONFIG "babeld.conf"

/* Values in milliseconds */
Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static const struct frr_yang_module_info *const bfdd_yang_modules[] = {

/* clang-format off */
FRR_DAEMON_INFO(bfdd, BFD,
.vty_port = 2617,
.vty_port = BFDD_VTY_PORT,
.proghelp = "Implementation of the BFD protocol.",

.signals = bfd_signals,
Expand Down
14 changes: 7 additions & 7 deletions bgpd/bgp_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ struct attr {
/* Distance as applied by Route map */
uint8_t distance;

/* EVPN DF preference for DF election on local ESs */
uint8_t df_alg;
uint16_t df_pref;

/* PMSI tunnel type (RFC 6514). */
enum pta_type pmsi_tnl_type;

Expand All @@ -215,6 +219,9 @@ struct attr {
/* ifIndex corresponding to mp_nexthop_local. */
ifindex_t nh_lla_ifindex;

/* MPLS label */
mpls_label_t label;

/* Extended Communities attribute. */
struct ecommunity *ecommunity;

Expand Down Expand Up @@ -262,13 +269,6 @@ struct attr {
/* Label index */
uint32_t label_index;

/* MPLS label */
mpls_label_t label;

/* EVPN DF preference for DF election on local ESs */
uint16_t df_pref;
uint8_t df_alg;

/* SRv6 VPN SID */
struct bgp_attr_srv6_vpn *srv6_vpn;

Expand Down
5 changes: 0 additions & 5 deletions bgpd/bgp_evpn_mh.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,6 @@ static inline bool bgp_evpn_attr_is_local_es(struct attr *attr)
return attr ? !!(attr->es_flags & ATTR_ES_IS_LOCAL) : false;
}

static inline uint32_t bgp_evpn_attr_get_df_pref(struct attr *attr)
{
return (attr) ? attr->df_pref : 0;
}

static inline bool bgp_evpn_local_es_is_active(struct bgp_evpn_es *es)
{
return (es->flags & BGP_EVPNES_OPER_UP)
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA, "BGP ancillary route info");
DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_EVPN, "BGP extra info for EVPN");
DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_FS, "BGP extra info for flowspec");
DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_VRFLEAK, "BGP extra info for vrf leaking");
DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_VNC, "BGP extra info for vnc");
DEFINE_MTYPE(BGPD, BGP_CONN, "BGP connected");
DEFINE_MTYPE(BGPD, BGP_STATIC, "BGP static");
DEFINE_MTYPE(BGPD, BGP_ADVERTISE_ATTR, "BGP adv attr");
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DECLARE_MTYPE(BGP_ROUTE_EXTRA);
DECLARE_MTYPE(BGP_ROUTE_EXTRA_EVPN);
DECLARE_MTYPE(BGP_ROUTE_EXTRA_FS);
DECLARE_MTYPE(BGP_ROUTE_EXTRA_VRFLEAK);
DECLARE_MTYPE(BGP_ROUTE_EXTRA_VNC);
DECLARE_MTYPE(BGP_CONN);
DECLARE_MTYPE(BGP_STATIC);
DECLARE_MTYPE(BGP_ADVERTISE_ATTR);
Expand Down
5 changes: 3 additions & 2 deletions bgpd/bgp_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -1897,8 +1897,9 @@ uint16_t bgp_open_capability(struct stream *s, struct peer *peer,
stream_putc(s, CAPABILITY_CODE_DYNAMIC_LEN);
}

/* Hostname capability */
if (cmd_hostname_get()) {
/* FQDN capability */
if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN)
&& cmd_hostname_get()) {
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_ADV);
stream_putc(s, BGP_OPEN_OPT_CAP);
rcapp = stream_get_endp(s); /* Ptr to length placeholder */
Expand Down
3 changes: 2 additions & 1 deletion bgpd/bgp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,8 @@ void bgp_capability_send(struct peer *peer, afi_t afi, safi_t safi,
iana_safi2str(pkt_safi));
break;
case CAPABILITY_CODE_FQDN:
if (hostname) {
if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN) &&
hostname) {
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_ADV);
stream_putc(s, action);
stream_putc(s, CAPABILITY_CODE_FQDN);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_rd.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct rd_as {

struct rd_ip {
uint16_t type;
struct in_addr ip;
uint16_t val;
struct in_addr ip;
};

#ifdef ENABLE_BGP_VNC
Expand Down
31 changes: 17 additions & 14 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
XFREE(MTYPE_BGP_ROUTE_EXTRA_FS, e->flowspec);
if (e->vrfleak)
XFREE(MTYPE_BGP_ROUTE_EXTRA_VRFLEAK, e->vrfleak);
#ifdef ENABLE_BGP_VNC
if (e->vnc)
XFREE(MTYPE_BGP_ROUTE_EXTRA_VNC, e->vnc);
#endif

XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra);
}
Expand Down Expand Up @@ -3516,7 +3520,8 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
*/
if (old_select &&
is_route_parent_evpn(old_select))
bgp_zebra_withdraw(p, old_select, bgp, safi);
bgp_zebra_withdraw(p, old_select, bgp, afi,
safi);

bgp_zebra_announce(dest, p, new_select, bgp, afi, safi);
} else {
Expand All @@ -3526,7 +3531,8 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
|| old_select->sub_type == BGP_ROUTE_AGGREGATE
|| old_select->sub_type == BGP_ROUTE_IMPORTED))

bgp_zebra_withdraw(p, old_select, bgp, safi);
bgp_zebra_withdraw(p, old_select, bgp, afi,
safi);
}
}

Expand Down Expand Up @@ -4181,7 +4187,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
int aspath_loop_count = 0;
struct bgp_dest *dest;
struct bgp *bgp;
struct attr new_attr;
struct attr new_attr = {};
struct attr *attr_new;
struct bgp_path_info *pi;
struct bgp_path_info *new = NULL;
Expand Down Expand Up @@ -4214,10 +4220,6 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (orig_safi == SAFI_LABELED_UNICAST)
safi = SAFI_UNICAST;

memset(&new_attr, 0, sizeof(new_attr));
new_attr.label_index = BGP_INVALID_LABEL_INDEX;
new_attr.label = MPLS_INVALID_LABEL;

bgp = peer->bgp;
dest = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
/* TODO: Check to see if we can get rid of "is_valid_label" */
Expand Down Expand Up @@ -4427,7 +4429,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (pi && pi->attr->rmap_table_id != new_attr.rmap_table_id) {
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
/* remove from RIB previous entry */
bgp_zebra_withdraw(p, pi, bgp, safi);
bgp_zebra_withdraw(p, pi, bgp, afi, safi);
}

if (peer->sort == BGP_PEER_EBGP) {
Expand Down Expand Up @@ -6029,7 +6031,7 @@ bool bgp_inbound_policy_exists(struct peer *peer, struct bgp_filter *filter)
}

static void bgp_cleanup_table(struct bgp *bgp, struct bgp_table *table,
safi_t safi)
afi_t afi, safi_t safi)
{
struct bgp_dest *dest;
struct bgp_path_info *pi;
Expand All @@ -6053,7 +6055,8 @@ static void bgp_cleanup_table(struct bgp *bgp, struct bgp_table *table,
|| pi->sub_type == BGP_ROUTE_IMPORTED)) {

if (bgp_fibupd_safi(safi))
bgp_zebra_withdraw(p, pi, bgp, safi);
bgp_zebra_withdraw(p, pi, bgp, afi,
safi);
}

dest = bgp_path_info_reap(dest, pi);
Expand All @@ -6071,7 +6074,7 @@ void bgp_cleanup_routes(struct bgp *bgp)
for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
if (afi == AFI_L2VPN)
continue;
bgp_cleanup_table(bgp, bgp->rib[afi][SAFI_UNICAST],
bgp_cleanup_table(bgp, bgp->rib[afi][SAFI_UNICAST], afi,
SAFI_UNICAST);
/*
* VPN and ENCAP and EVPN tables are two-level (RD is top level)
Expand All @@ -6083,7 +6086,7 @@ void bgp_cleanup_routes(struct bgp *bgp)
dest = bgp_route_next(dest)) {
table = bgp_dest_get_bgp_table_info(dest);
if (table != NULL) {
bgp_cleanup_table(bgp, table, safi);
bgp_cleanup_table(bgp, table, afi, safi);
bgp_table_finish(&table);
bgp_dest_set_bgp_table_info(dest, NULL);
dest = bgp_dest_unlock_node(dest);
Expand All @@ -6096,7 +6099,7 @@ void bgp_cleanup_routes(struct bgp *bgp)
dest = bgp_route_next(dest)) {
table = bgp_dest_get_bgp_table_info(dest);
if (table != NULL) {
bgp_cleanup_table(bgp, table, safi);
bgp_cleanup_table(bgp, table, afi, safi);
bgp_table_finish(&table);
bgp_dest_set_bgp_table_info(dest, NULL);
dest = bgp_dest_unlock_node(dest);
Expand All @@ -6110,7 +6113,7 @@ void bgp_cleanup_routes(struct bgp *bgp)
dest = bgp_route_next(dest)) {
table = bgp_dest_get_bgp_table_info(dest);
if (table != NULL) {
bgp_cleanup_table(bgp, table, SAFI_EVPN);
bgp_cleanup_table(bgp, table, afi, SAFI_EVPN);
bgp_table_finish(&table);
bgp_dest_set_bgp_table_info(dest, NULL);
dest = bgp_dest_unlock_node(dest);
Expand Down
56 changes: 30 additions & 26 deletions bgpd/bgp_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,33 +193,9 @@ struct bgp_path_info_extra_vrfleak {
struct prefix nexthop_orig;
};

/* Ancillary information to struct bgp_path_info,
* used for uncommonly used data (aggregation, MPLS, etc.)
* and lazily allocated to save memory.
*/
struct bgp_path_info_extra {
/* Pointer to dampening structure. */
struct bgp_damp_info *damp_info;

/** List of aggregations that suppress this path. */
struct list *aggr_suppressors;

/* Nexthop reachability check. */
uint32_t igpmetric;

/* MPLS label(s) - VNI(s) for EVPN-VxLAN */
mpls_label_t label[BGP_MAX_LABELS];
uint32_t num_labels;

/* timestamp of the rib installation */
time_t bgp_rib_uptime;

/*For EVPN*/
struct bgp_path_info_extra_evpn *evpn;

#ifdef ENABLE_BGP_VNC
struct bgp_path_info_extra_vnc {
union {

struct {
void *rfapi_handle; /* export: NVE advertising this
route */
Expand All @@ -242,8 +218,36 @@ struct bgp_path_info_extra {
struct prefix aux_prefix; /* AFI_L2VPN: the IP addr,
if family set */
} import;

} vnc;
};
#endif

/* Ancillary information to struct bgp_path_info,
* used for uncommonly used data (aggregation, MPLS, etc.)
* and lazily allocated to save memory.
*/
struct bgp_path_info_extra {
/* Pointer to dampening structure. */
struct bgp_damp_info *damp_info;

/** List of aggregations that suppress this path. */
struct list *aggr_suppressors;

/* Nexthop reachability check. */
uint32_t igpmetric;

/* MPLS label(s) - VNI(s) for EVPN-VxLAN */
mpls_label_t label[BGP_MAX_LABELS];
uint32_t num_labels;

/* timestamp of the rib installation */
time_t bgp_rib_uptime;

/*For EVPN*/
struct bgp_path_info_extra_evpn *evpn;

#ifdef ENABLE_BGP_VNC
struct bgp_path_info_extra_vnc *vnc;
#endif

/* For flowspec*/
Expand Down
33 changes: 33 additions & 0 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ struct rpki_vrf {
QOBJ_FIELDS;
};

static pthread_key_t rpki_pthread;

static struct rpki_vrf *find_rpki_vrf(const char *vrfname);
static int bgp_rpki_vrf_update(struct vrf *vrf, bool enabled);
static int bgp_rpki_write_vrf(struct vty *vty, struct vrf *vrf);
Expand Down Expand Up @@ -887,6 +889,8 @@ static int bgp_rpki_fini(void)

static int bgp_rpki_module_init(void)
{
pthread_key_create(&rpki_pthread, NULL);

lrtr_set_alloc_functions(malloc_wrapper, realloc_wrapper, free_wrapper);

hook_register(bgp_rpki_prefix_status, rpki_validate_prefix);
Expand Down Expand Up @@ -1297,6 +1301,35 @@ static int rpki_create_socket(void *_cache)

rpki_vrf = cache->rpki_vrf;

/*
* the rpki infrastructure can call this function
* multiple times per pthread. Why? I have absolutely
* no idea, and I am not sure I care a whole bunch.
* Why does this matter? Well when we attempt to
* hook this pthread into the rcu structure multiple
* times the rcu code asserts on shutdown. Clearly
* upset that you have rcu data associated with a pthread
* that has not been cleaned up. And frankly this is rightly so.
*
* At this point we know that this function is not
* called a million bajillion times so let's just
* add a bit of insurance by looking to see if
* some thread specific code has been set for this
* pthread. If not, hook into the rcu code and
* make things happy.
*
* IF YOU PUT A ZLOG_XXXX prior to the call into
* frr_pthread_non_controlled_startup in this function
* BGP WILL CRASH. You have been warned.
*/
if (!pthread_getspecific(rpki_pthread) &&
frr_pthread_non_controlled_startup(cache->rtr_socket->thread_id,
"RPKI RTRLIB socket",
"rpki_create_socket") < 0)
return -1;

pthread_setspecific(rpki_pthread, &rpki_pthread);

if (rpki_vrf->vrfname == NULL)
vrf = vrf_lookup_by_id(VRF_DEFAULT);
else
Expand Down
Loading

0 comments on commit de9f6f1

Please sign in to comment.