Skip to content

Commit

Permalink
Merge pull request #14283 from opensourcerouting/fix/dynamic_capabili…
Browse files Browse the repository at this point in the history
…ty_role_unset

bgpd: Handle Role capability via dynamic capabilities for SET/UNSET properly
  • Loading branch information
riw777 authored Aug 29, 2023
2 parents 2c2b16f + 5ad080d commit 3bd869f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bgpd/bgp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,6 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
case CAPABILITY_CODE_EXT_MESSAGE:
break;
case CAPABILITY_CODE_ROLE:
SET_FLAG(peer->cap, PEER_CAP_ROLE_RCV);
if (hdr->length != CAPABILITY_CODE_ROLE_LEN) {
flog_warn(EC_BGP_CAPABILITY_INVALID_LENGTH,
"Role: Received invalid length %d",
Expand All @@ -2908,11 +2907,17 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}

uint8_t role;

memcpy(&role, pnt + 3, sizeof(role));
if (action == CAPABILITY_ACTION_SET) {
SET_FLAG(peer->cap, PEER_CAP_ROLE_RCV);
memcpy(&role, pnt + 3, sizeof(role));

peer->remote_role = role;
peer->remote_role = role;
} else {
UNSET_FLAG(peer->cap, PEER_CAP_ROLE_RCV);
}
break;
default:
flog_warn(
Expand Down

0 comments on commit 3bd869f

Please sign in to comment.