diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-12-17 14:13:57 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-12-17 20:25:51 +0100 |
commit | 0f05e56bedb5ae3cdf57c8fc71eb38cd2aeef17c (patch) | |
tree | 88fe9f4f51f301d2871cebef0353d235d4d66637 /bgpd/bgp_open.c | |
parent | Merge pull request #15015 from donaldsharp/test_ospf_suppress_fa_cleanup (diff) | |
download | frr-0f05e56bedb5ae3cdf57c8fc71eb38cd2aeef17c.tar.xz frr-0f05e56bedb5ae3cdf57c8fc71eb38cd2aeef17c.zip |
bgpd: Validate Addpath capability flags per AF
Send/Receive:
This field indicates whether the sender is (a) able to receive
multiple paths from its peer (value 1), (b) able to send
multiple paths to its peer (value 2), or (c) both (value 3) for
the <AFI, SAFI>.
If any other value is received, then the capability SHOULD be
treated as not understood and ignored [RFC5492].
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r-- | bgpd/bgp_open.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 44cf8343c..0aa9838a7 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -680,6 +680,17 @@ static int bgp_capability_addpath(struct peer *peer, iana_safi_t pkt_safi = stream_getc(s); uint8_t send_receive = stream_getc(s); + /* If any other value (other than 1-3) is received, then + * the capability SHOULD be treated as not understood + * and ignored. + */ + if (!send_receive || send_receive > 3) { + flog_warn(EC_BGP_CAPABILITY_INVALID_DATA, + "Add Path: Received invalid send/receive value %u in Add Path capability", + send_receive); + continue; + } + if (bgp_debug_neighbor_events(peer)) zlog_debug("%s OPEN has %s capability for afi/safi: %s/%s%s%s", peer->host, |