Skip to content

Commit 4bc34cc

Browse files
authored
Merge pull request #18889 from FRRouting/revert-18273-bgp-hidden-10.2
Revert "bgpd: fix default instance when leaving the hidden state. (backport #18119)"
2 parents f0613f2 + c19aba7 commit 4bc34cc

25 files changed

+30
-839
lines changed

bgpd/bgpd.c

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3438,28 +3438,12 @@ static struct bgp *bgp_create(as_t *as, const char *name,
34383438
afi_t afi;
34393439
safi_t safi;
34403440

3441-
if (hidden)
3441+
if (hidden) {
34423442
bgp = bgp_old;
3443-
else
3444-
bgp = XCALLOC(MTYPE_BGP, sizeof(struct bgp));
3445-
3446-
bgp->as = *as;
3447-
3448-
if (bgp->as_pretty)
3449-
XFREE(MTYPE_BGP_NAME, bgp->as_pretty);
3450-
if (as_pretty)
3451-
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, as_pretty);
3452-
else
3453-
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, asn_asn2asplain(*as));
3454-
3455-
if (asnotation != ASNOTATION_UNDEFINED) {
3456-
bgp->asnotation = asnotation;
3457-
SET_FLAG(bgp->config, BGP_CONFIG_ASNOTATION);
3458-
} else
3459-
asn_str2asn_notation(bgp->as_pretty, NULL, &bgp->asnotation);
3460-
3461-
if (hidden)
34623443
goto peer_init;
3444+
}
3445+
3446+
bgp = XCALLOC(MTYPE_BGP, sizeof(struct bgp));
34633447

34643448
if (BGP_DEBUG(zebra, ZEBRA)) {
34653449
if (inst_type == BGP_INSTANCE_TYPE_DEFAULT)
@@ -3503,6 +3487,18 @@ static struct bgp *bgp_create(as_t *as, const char *name,
35033487
bgp->peer = list_new();
35043488

35053489
peer_init:
3490+
bgp->as = *as;
3491+
if (as_pretty)
3492+
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, as_pretty);
3493+
else
3494+
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, asn_asn2asplain(*as));
3495+
3496+
if (asnotation != ASNOTATION_UNDEFINED) {
3497+
bgp->asnotation = asnotation;
3498+
SET_FLAG(bgp->config, BGP_CONFIG_ASNOTATION);
3499+
} else
3500+
asn_str2asn_notation(bgp->as_pretty, NULL, &bgp->asnotation);
3501+
35063502
bgp->peer->cmp = (int (*)(void *, void *))peer_cmp;
35073503
bgp->peerhash = hash_create(peer_hash_key_make, peer_hash_same,
35083504
"BGP Peer Hash");
@@ -3599,7 +3595,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
35993595
/* printable name we can use in debug messages */
36003596
if (inst_type == BGP_INSTANCE_TYPE_DEFAULT && !hidden) {
36013597
bgp->name_pretty = XSTRDUP(MTYPE_BGP_NAME, "VRF default");
3602-
} else if (!hidden) {
3598+
} else {
36033599
const char *n;
36043600
int len;
36053601

@@ -3802,7 +3798,7 @@ int bgp_lookup_by_as_name_type(struct bgp **bgp_val, as_t *as, const char *as_pr
38023798
/* Handle AS number change */
38033799
if (bgp->as != *as) {
38043800
if (hidden || CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) {
3805-
if (hidden) {
3801+
if (force_config == false && hidden) {
38063802
bgp_create(as, name, inst_type,
38073803
as_pretty, asnotation, bgp,
38083804
hidden);
@@ -4231,13 +4227,14 @@ int bgp_delete(struct bgp *bgp)
42314227
bgp_set_evpn(bgp_get_default());
42324228
}
42334229

4230+
if (bgp->process_queue)
4231+
work_queue_free_and_null(&bgp->process_queue);
4232+
42344233
event_master_free_unused(bm->master);
42354234

4236-
if (!IS_BGP_INSTANCE_HIDDEN(bgp)) {
4237-
if (bgp->process_queue)
4238-
work_queue_free_and_null(&bgp->process_queue);
4235+
if (!IS_BGP_INSTANCE_HIDDEN(bgp))
42394236
bgp_unlock(bgp); /* initial reference */
4240-
} else {
4237+
else {
42414238
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
42424239
enum vpn_policy_direction dir;
42434240

tests/topotests/bgp_l3vpn_hidden/__init__.py

Whitespace-only changes.

tests/topotests/bgp_l3vpn_hidden/ce1/frr.conf

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_ipv4_unicast.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_ipv4_unicast_step1.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_ipv4_vpn_step1.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_ipv6_unicast.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_ipv6_unicast_step1.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_ipv6_vpn_step1.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/topotests/bgp_l3vpn_hidden/ce1/show_bgp_summary.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)