]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Check if originator-id attribute is not received via eBGP session
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 7 Jul 2023 12:03:07 +0000 (15:03 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 7 Jul 2023 20:01:13 +0000 (23:01 +0300)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_attr.c
tests/topotests/bgp_path_attribute_discard/test_bgp_path_attribute_discard.py

index 34422bf514ca4054ec1f2c0765eb74336721351b..b5cdcfd2df4d2d1ad911ce326c707709899a89fa 100644 (file)
@@ -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-
index ebaab603412a10f7d2ff75c8aca28c45f90f8049..c97cd0bddabddbed4d83607b98cfd982e36df4b7 100644 (file)
@@ -83,7 +83,7 @@ def test_bgp_path_attribute_discard():
                     "paths": [
                         {
                             "valid": True,
-                            "originatorId": "10.0.0.2",
+                            "originatorId": None,
                             "community": {
                                 "string": "65001:102",
                             },
@@ -98,12 +98,12 @@ def test_bgp_path_attribute_discard():
     _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
     assert result is None, "Failed bgp convergence"
 
-    step("Discard atomic-aggregate, community, and originator-id attributes from peer1")
+    step("Discard atomic-aggregate, and community attributes from peer1")
     r1.vtysh_cmd(
         """
     configure terminal
         router bgp
-            neighbor 10.0.0.2 path-attribute discard 6 8 9
+            neighbor 10.0.0.2 path-attribute discard 6 8
     """
     )
 
@@ -137,7 +137,7 @@ def test_bgp_path_attribute_discard():
     _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
     assert (
         result is None
-    ), "Failed to discard path attributes (atomic-aggregate, community, and originator-id)"
+    ), "Failed to discard path attributes (atomic-aggregate, community)"
 
 
 def test_memory_leak():