Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into fix/re…
Browse files Browse the repository at this point in the history
…vert_ipv4_mapped_ipv6_stuff_10.1

# Conflicts:
#	bgpd/bgp_nht.c
#	bgpd/bgp_updgrp_packet.c
#	bgpd/bgp_vty.c
#	configure.ac
#	tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json
#	tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json
#	tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py
  • Loading branch information
RodrigoMNardi committed Aug 15, 2024
2 parents 9e3aa8c + 28df446 commit db12dcc
Show file tree
Hide file tree
Showing 691 changed files with 20,937 additions and 9,999 deletions.
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,8 @@ WhitespaceSensitiveMacros:
- "DEFUN_YANG_NOSH"
- "DEFUNSH"
- "DEFUNSH_HIDDEN"
- "ALIAS"
- "ALIAS_HIDDEN"
- "ALIAS_YANG"
- "ALIAS_DEPRECATED"
...
2 changes: 2 additions & 0 deletions alpine/APKBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ _libdir=/usr/lib
_user=frr

build() {
export ABUILD_APK_INDEX_OPTS="--allow-untrusted"

cd "$builddir"

./configure \
Expand Down
21 changes: 18 additions & 3 deletions babeld/babel_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ babel_interface_address_add (ZAPI_CALLBACK_ARGS)
if (prefix->family == AF_INET) {
flush_interface_routes(ifc->ifp, 0);
babel_ifp = babel_get_if_nfo(ifc->ifp);
assert (babel_ifp != NULL);
if (babel_ifp->ipv4 == NULL) {
babel_ifp->ipv4 = malloc(4);
if (babel_ifp->ipv4 == NULL) {
Expand Down Expand Up @@ -144,6 +145,7 @@ babel_interface_address_delete (ZAPI_CALLBACK_ARGS)
if (prefix->family == AF_INET) {
flush_interface_routes(ifc->ifp, 0);
babel_ifp = babel_get_if_nfo(ifc->ifp);
assert (babel_ifp != NULL);
if (babel_ifp->ipv4 != NULL
&& memcmp(babel_ifp->ipv4, &prefix->u.prefix4, IPV4_MAX_BYTELEN)
== 0) {
Expand Down Expand Up @@ -542,7 +544,10 @@ DEFPY (babel_set_channel,
unsigned
jitter(babel_interface_nfo *babel_ifp, int urgent)
{
unsigned interval = babel_ifp->hello_interval;
unsigned interval;

assert (babel_ifp != NULL);
interval = babel_ifp->hello_interval;
if(urgent)
interval = MIN(interval, 100);
else
Expand All @@ -553,7 +558,10 @@ jitter(babel_interface_nfo *babel_ifp, int urgent)
unsigned
update_jitter(babel_interface_nfo *babel_ifp, int urgent)
{
unsigned interval = babel_ifp->hello_interval;
unsigned interval;

assert (babel_ifp != NULL);
interval = babel_ifp->hello_interval;
if(urgent)
interval = MIN(interval, 100);
else
Expand All @@ -566,10 +574,11 @@ update_jitter(babel_interface_nfo *babel_ifp, int urgent)
static int
interface_recalculate(struct interface *ifp)
{
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
unsigned char *tmp = NULL;
int mtu, rc;
struct ipv6_mreq mreq;
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);

if (!IS_ENABLE(ifp))
return -1;
Expand Down Expand Up @@ -656,6 +665,7 @@ interface_reset(struct interface *ifp)
int rc;
struct ipv6_mreq mreq;
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);

if (!CHECK_FLAG(babel_ifp->flags, BABEL_IF_IS_UP))
return 0;
Expand Down Expand Up @@ -777,6 +787,7 @@ show_babel_interface_sub (struct vty *vty, struct interface *ifp)
return;
}
babel_ifp = babel_get_if_nfo (ifp);
assert (babel_ifp != NULL);
vty_out (vty, " Babel protocol is running on this interface\n");
vty_out (vty, " Operating mode is \"%s\"\n",
CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless");
Expand Down Expand Up @@ -1228,6 +1239,7 @@ interface_config_write (struct vty *vty)
if (ifp->desc)
vty_out (vty, " description %s\n",ifp->desc);
babel_interface_nfo *babel_ifp = babel_get_if_nfo (ifp);
assert (babel_ifp != NULL);
/* wireless is the default*/
if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED))
{
Expand Down Expand Up @@ -1330,6 +1342,7 @@ babel_interface_allocate (void)
{
babel_interface_nfo *babel_ifp;
babel_ifp = XCALLOC(MTYPE_BABEL_IF, sizeof(babel_interface_nfo));
assert (babel_ifp != NULL);
/* All flags are unset */
babel_ifp->bucket_time = babel_now.tv_sec;
babel_ifp->bucket = BUCKET_TOKENS_MAX;
Expand All @@ -1349,6 +1362,8 @@ babel_interface_allocate (void)
static void
babel_interface_free (babel_interface_nfo *babel_ifp)
{
assert (babel_ifp != NULL);

if (babel_ifp->ipv4){
free(babel_ifp->ipv4);
babel_ifp->ipv4 = NULL;
Expand Down
82 changes: 10 additions & 72 deletions bfdd/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,19 +256,8 @@ void gen_bfd_key(struct bfd_key *key, struct sockaddr_any *peer,

struct bfd_session *bs_peer_find(struct bfd_peer_cfg *bpc)
{
struct bfd_session *bs;
struct peer_label *pl;
struct bfd_key key;

/* Try to find label first. */
if (bpc->bpc_has_label) {
pl = pl_find(bpc->bpc_label);
if (pl != NULL) {
bs = pl->pl_bs;
return bs;
}
}

/* Otherwise fallback to peer/local hash lookup. */
gen_bfd_key(&key, &bpc->bpc_peer, &bpc->bpc_local, bpc->bpc_mhop,
bpc->bpc_localif, bpc->bpc_vrfname);
Expand Down Expand Up @@ -327,10 +316,8 @@ int bfd_session_enable(struct bfd_session *bs)
bs->ifp = ifp;

/* Attempt to use data plane. */
if (bglobal.bg_use_dplane && bfd_dplane_add_session(bs) == 0) {
control_notify_config(BCM_NOTIFY_CONFIG_ADD, bs);
if (bglobal.bg_use_dplane && bfd_dplane_add_session(bs) == 0)
return 0;
}

/* Sanity check: don't leak open sockets. */
if (bs->sock != -1) {
Expand Down Expand Up @@ -410,8 +397,8 @@ static uint32_t ptm_bfd_gen_ID(void)
* random session identification numbers.
*/
do {
session_id = ((frr_weak_random() << 16) & 0xFFFF0000)
| (frr_weak_random() & 0x0000FFFF);
session_id = CHECK_FLAG((frr_weak_random() << 16), 0xFFFF0000) |
CHECK_FLAG(frr_weak_random(), 0x0000FFFF);
} while (session_id == 0 || bfd_id_lookup(session_id) != NULL);

return session_id;
Expand Down Expand Up @@ -502,7 +489,7 @@ void ptm_bfd_sess_up(struct bfd_session *bfd)
/* Start sending control packets with poll bit immediately. */
ptm_bfd_snd(bfd, 0);

control_notify(bfd, bfd->ses_state);
ptm_bfd_notify(bfd, bfd->ses_state);

if (old_state != bfd->ses_state) {
bfd->stats.session_up++;
Expand Down Expand Up @@ -538,7 +525,7 @@ void ptm_bfd_sess_dn(struct bfd_session *bfd, uint8_t diag)

/* only signal clients when going from up->down state */
if (old_state == PTM_BFD_UP)
control_notify(bfd, PTM_BFD_DOWN);
ptm_bfd_notify(bfd, PTM_BFD_DOWN);

/* Stop echo packet transmission if they are active */
if (CHECK_FLAG(bfd->flags, BFD_SESS_FLAG_ECHO_ACTIVE))
Expand Down Expand Up @@ -690,38 +677,6 @@ struct bfd_session *bfd_session_new(void)
return bs;
}

int bfd_session_update_label(struct bfd_session *bs, const char *nlabel)
{
/* New label treatment:
* - Check if the label is taken;
* - Try to allocate the memory for it and register;
*/
if (bs->pl == NULL) {
if (pl_find(nlabel) != NULL) {
/* Someone is already using it. */
return -1;
}

pl_new(nlabel, bs);

return 0;
}

/*
* Test label change consistency:
* - Do nothing if it's the same label;
* - Check if the future label is already taken;
* - Change label;
*/
if (strcmp(nlabel, bs->pl->pl_label) == 0)
return -1;
if (pl_find(nlabel) != NULL)
return -1;

strlcpy(bs->pl->pl_label, nlabel, sizeof(bs->pl->pl_label));
return 0;
}

static void _bfd_session_update(struct bfd_session *bs,
struct bfd_peer_cfg *bpc)
{
Expand Down Expand Up @@ -750,9 +705,6 @@ static void _bfd_session_update(struct bfd_session *bs,
bs->peer_profile.min_echo_tx = bs->timers.desired_min_echo_tx;
}

if (bpc->bpc_has_label)
bfd_session_update_label(bs, bpc->bpc_label);

if (bpc->bpc_cbit)
SET_FLAG(bs->flags, BFD_SESS_FLAG_CBIT);
else
Expand Down Expand Up @@ -792,8 +744,6 @@ static int bfd_session_update(struct bfd_session *bs, struct bfd_peer_cfg *bpc)

_bfd_session_update(bs, bpc);

control_notify_config(BCM_NOTIFY_CONFIG_UPDATE, bs);

return 0;
}

Expand All @@ -819,8 +769,6 @@ void bfd_session_free(struct bfd_session *bs)
if (bso != NULL)
bs_observer_del(bso);

pl_free(bs->pl);

XFREE(MTYPE_BFDD_PROFILE, bs->profile_name);
XFREE(MTYPE_BFDD_CONFIG, bs);
}
Expand Down Expand Up @@ -917,8 +865,6 @@ struct bfd_session *bs_registrate(struct bfd_session *bfd)
if (bglobal.debug_peer_event)
zlog_debug("session-new: %s", bs_to_string(bfd));

control_notify_config(BCM_NOTIFY_CONFIG_ADD, bfd);

return bfd;
}

Expand All @@ -941,8 +887,6 @@ int ptm_bfd_sess_del(struct bfd_peer_cfg *bpc)
if (bglobal.debug_peer_event)
zlog_debug("%s: %s", __func__, bs_to_string(bs));

control_notify_config(BCM_NOTIFY_CONFIG_DELETE, bs);

bfd_session_free(bs);

return 0;
Expand Down Expand Up @@ -1166,11 +1110,8 @@ void bs_final_handler(struct bfd_session *bs)
* When using demand mode we must disable the detection timer
* for lost control packets.
*/
if (bs->demand_mode) {
/* Notify watchers about changed timers. */
control_notify_config(BCM_NOTIFY_CONFIG_UPDATE, bs);
if (bs->demand_mode)
return;
}

/*
* Calculate transmission time based on new timers.
Expand All @@ -1189,9 +1130,6 @@ void bs_final_handler(struct bfd_session *bs)

/* Apply new transmission timer immediately. */
ptm_bfd_start_xmt_timer(bs, false);

/* Notify watchers about changed timers. */
control_notify_config(BCM_NOTIFY_CONFIG_UPDATE, bs);
}

void bs_set_slow_timers(struct bfd_session *bs)
Expand Down Expand Up @@ -1261,7 +1199,7 @@ void bfd_set_shutdown(struct bfd_session *bs, bool shutdown)
if (bs->bdc) {
bs->ses_state = PTM_BFD_ADM_DOWN;
bfd_dplane_update_session(bs);
control_notify(bs, bs->ses_state);
ptm_bfd_notify(bs, bs->ses_state);
return;
}

Expand All @@ -1273,7 +1211,7 @@ void bfd_set_shutdown(struct bfd_session *bs, bool shutdown)

/* Change and notify state change. */
bs->ses_state = PTM_BFD_ADM_DOWN;
control_notify(bs, bs->ses_state);
ptm_bfd_notify(bs, bs->ses_state);

/* Don't try to send packets with a disabled session. */
if (bs->sock != -1)
Expand All @@ -1289,13 +1227,13 @@ void bfd_set_shutdown(struct bfd_session *bs, bool shutdown)
if (bs->bdc) {
bs->ses_state = PTM_BFD_DOWN;
bfd_dplane_update_session(bs);
control_notify(bs, bs->ses_state);
ptm_bfd_notify(bs, bs->ses_state);
return;
}

/* Change and notify state change. */
bs->ses_state = PTM_BFD_DOWN;
control_notify(bs, bs->ses_state);
ptm_bfd_notify(bs, bs->ses_state);

/* Enable timers if non passive, otherwise stop them. */
if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_PASSIVE)) {
Expand Down
Loading

0 comments on commit db12dcc

Please sign in to comment.