Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: update AS value of a hidden bgp instance #17861

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3401,18 +3401,20 @@ static struct bgp *bgp_create(as_t *as, const char *name,
afi_t afi;
safi_t safi;

if (hidden) {
if (hidden)
bgp = bgp_old;
goto peer_init;
}
else
bgp = XCALLOC(MTYPE_BGP, sizeof(struct bgp));

bgp = XCALLOC(MTYPE_BGP, sizeof(struct bgp));
bgp->as = *as;
if (as_pretty)
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, as_pretty);
else
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, asn_asn2asplain(*as));

if (hidden)
goto peer_init;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we don't have bgp->peer allocated, and bgp->peer->cmp = (int (*)(void *, void *))peer_cmp; will segfault after goto peer_init;.

Also, we should respect AS notation...


if (asnotation != ASNOTATION_UNDEFINED) {
bgp->asnotation = asnotation;
SET_FLAG(bgp->config, BGP_CONFIG_ASNOTATION);
Expand Down
Loading