summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-07-07 15:03:07 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2023-07-07 23:01:13 +0300
commitc1ccfa977aa26895b7c8203ca8a751e321997a00 (patch)
treed018e0b673789f96f8359787003a6042618e5181 /bgpd/bgp_attr.c
parent700ef0dd20edcf97123b29eb65980f6d84b9ceba (diff)
bgpd: Check if originator-id attribute is not received via eBGP session
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 34422bf514..b5cdcfd2df 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2138,6 +2138,15 @@ bgp_attr_originator_id(struct bgp_attr_parser_args *args)
struct attr *const attr = args->attr;
const bgp_size_t length = args->length;
+ /* if the ORIGINATOR_ID attribute is received from an external
+ * neighbor, it SHALL be discarded using the approach of "attribute
+ * discard".
+ */
+ if (peer->sort == BGP_PEER_EBGP) {
+ stream_forward_getp(peer->curr, length);
+ return BGP_ATTR_PARSE_PROCEED;
+ }
+
/* if received from an internal neighbor, it SHALL be considered
* malformed if its length is not equal to 4. If malformed, the
* UPDATE message SHALL be handled using the approach of "treat-as-