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: Allow overriding ORIGIN for aggregate-address #5802

Merged
merged 3 commits into from
Feb 19, 2020
Merged

bgpd: Allow overriding ORIGIN for aggregate-address #5802

merged 3 commits into from
Feb 19, 2020

Conversation

ton31337
Copy link
Member

Override ORIGIN attribute if defined.
E.g.: Cisco and Juniper set ORIGIN for aggregated address
to IGP which is not what rfc4271 says.

This enables the same behavior, optionally.

Closes #5796

@polychaeta polychaeta added bgp documentation tests Topotests, make check, etc labels Feb 12, 2020
Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution to FRR!

Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/48ded0315d68801e11d8fef688628836/raw/88371cc9a827718b28672c6c3e65b597175069e6/cr_5802_1581541008.diff | git apply

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f7cecb115..6862bb033 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6867,21 +6867,20 @@ static int bgp_aggregate_set(struct vty *vty, const char *prefix_str, afi_t afi,
 	return CMD_SUCCESS;
 }
 
-DEFUN (aggregate_address,
-       aggregate_address_cmd,
-       "aggregate-address A.B.C.D/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
-       "Configure BGP aggregate entries\n"
-       "Aggregate prefix\n"
-       "Generate AS set path information\n"
-       "Filter more specific routes from updates\n"
-       "Filter more specific routes from updates\n"
-       "Generate AS set path information\n"
-       "Apply route map to aggregate network\n"
-       "Name of route map\n"
-       "BGP origin code\n"
-       "Remote EGP\n"
-       "Local IGP\n"
-       "Unknown heritage\n")
+DEFUN(aggregate_address, aggregate_address_cmd,
+      "aggregate-address A.B.C.D/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
+      "Configure BGP aggregate entries\n"
+      "Aggregate prefix\n"
+      "Generate AS set path information\n"
+      "Filter more specific routes from updates\n"
+      "Filter more specific routes from updates\n"
+      "Generate AS set path information\n"
+      "Apply route map to aggregate network\n"
+      "Name of route map\n"
+      "BGP origin code\n"
+      "Remote EGP\n"
+      "Local IGP\n"
+      "Unknown heritage\n")
 {
 	int idx = 0;
 	argv_find(argv, argc, "A.B.C.D/M", &idx);
@@ -6914,22 +6913,21 @@ DEFUN (aggregate_address,
 				 summary_only, as_set, origin);
 }
 
-DEFUN (aggregate_address_mask,
-       aggregate_address_mask_cmd,
-       "aggregate-address A.B.C.D A.B.C.D [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
-       "Configure BGP aggregate entries\n"
-       "Aggregate address\n"
-       "Aggregate mask\n"
-       "Generate AS set path information\n"
-       "Filter more specific routes from updates\n"
-       "Filter more specific routes from updates\n"
-       "Generate AS set path information\n"
-       "Apply route map to aggregate network\n"
-       "Name of route map\n"
-       "BGP origin code\n"
-       "Remote EGP\n"
-       "Local IGP\n"
-       "Unknown heritage\n")
+DEFUN(aggregate_address_mask, aggregate_address_mask_cmd,
+      "aggregate-address A.B.C.D A.B.C.D [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
+      "Configure BGP aggregate entries\n"
+      "Aggregate address\n"
+      "Aggregate mask\n"
+      "Generate AS set path information\n"
+      "Filter more specific routes from updates\n"
+      "Filter more specific routes from updates\n"
+      "Generate AS set path information\n"
+      "Apply route map to aggregate network\n"
+      "Name of route map\n"
+      "BGP origin code\n"
+      "Remote EGP\n"
+      "Local IGP\n"
+      "Unknown heritage\n")
 {
 	int idx = 0;
 	argv_find(argv, argc, "A.B.C.D", &idx);
@@ -6971,22 +6969,21 @@ DEFUN (aggregate_address_mask,
 				 rmap, summary_only, as_set, origin);
 }
 
-DEFUN (no_aggregate_address,
-       no_aggregate_address_cmd,
-       "no aggregate-address A.B.C.D/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
-       NO_STR
-       "Configure BGP aggregate entries\n"
-       "Aggregate prefix\n"
-       "Generate AS set path information\n"
-       "Filter more specific routes from updates\n"
-       "Filter more specific routes from updates\n"
-       "Generate AS set path information\n"
-       "Apply route map to aggregate network\n"
-       "Name of route map\n"
-       "BGP origin code\n"
-       "Remote EGP\n"
-       "Local IGP\n"
-       "Unknown heritage\n")
+DEFUN(no_aggregate_address, no_aggregate_address_cmd,
+      "no aggregate-address A.B.C.D/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
+      NO_STR
+      "Configure BGP aggregate entries\n"
+      "Aggregate prefix\n"
+      "Generate AS set path information\n"
+      "Filter more specific routes from updates\n"
+      "Filter more specific routes from updates\n"
+      "Generate AS set path information\n"
+      "Apply route map to aggregate network\n"
+      "Name of route map\n"
+      "BGP origin code\n"
+      "Remote EGP\n"
+      "Local IGP\n"
+      "Unknown heritage\n")
 {
 	int idx = 0;
 	argv_find(argv, argc, "A.B.C.D/M", &idx);
@@ -6994,23 +6991,22 @@ DEFUN (no_aggregate_address,
 	return bgp_aggregate_unset(vty, prefix, AFI_IP, bgp_node_safi(vty));
 }
 
-DEFUN (no_aggregate_address_mask,
-       no_aggregate_address_mask_cmd,
-       "no aggregate-address A.B.C.D A.B.C.D [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
-       NO_STR
-       "Configure BGP aggregate entries\n"
-       "Aggregate address\n"
-       "Aggregate mask\n"
-       "Generate AS set path information\n"
-       "Filter more specific routes from updates\n"
-       "Filter more specific routes from updates\n"
-       "Generate AS set path information\n"
-       "Apply route map to aggregate network\n"
-       "Name of route map\n"
-       "BGP origin code\n"
-       "Remote EGP\n"
-       "Local IGP\n"
-       "Unknown heritage\n")
+DEFUN(no_aggregate_address_mask, no_aggregate_address_mask_cmd,
+      "no aggregate-address A.B.C.D A.B.C.D [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
+      NO_STR
+      "Configure BGP aggregate entries\n"
+      "Aggregate address\n"
+      "Aggregate mask\n"
+      "Generate AS set path information\n"
+      "Filter more specific routes from updates\n"
+      "Filter more specific routes from updates\n"
+      "Generate AS set path information\n"
+      "Apply route map to aggregate network\n"
+      "Name of route map\n"
+      "BGP origin code\n"
+      "Remote EGP\n"
+      "Local IGP\n"
+      "Unknown heritage\n")
 {
 	int idx = 0;
 	argv_find(argv, argc, "A.B.C.D", &idx);
@@ -7028,21 +7024,20 @@ DEFUN (no_aggregate_address_mask,
 	return bgp_aggregate_unset(vty, prefix_str, AFI_IP, bgp_node_safi(vty));
 }
 
-DEFUN (ipv6_aggregate_address,
-       ipv6_aggregate_address_cmd,
-       "aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
-       "Configure BGP aggregate entries\n"
-       "Aggregate prefix\n"
-       "Generate AS set path information\n"
-       "Filter more specific routes from updates\n"
-       "Filter more specific routes from updates\n"
-       "Generate AS set path information\n"
-       "Apply route map to aggregate network\n"
-       "Name of route map\n"
-       "BGP origin code\n"
-       "Remote EGP\n"
-       "Local IGP\n"
-       "Unknown heritage\n")
+DEFUN(ipv6_aggregate_address, ipv6_aggregate_address_cmd,
+      "aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
+      "Configure BGP aggregate entries\n"
+      "Aggregate prefix\n"
+      "Generate AS set path information\n"
+      "Filter more specific routes from updates\n"
+      "Filter more specific routes from updates\n"
+      "Generate AS set path information\n"
+      "Apply route map to aggregate network\n"
+      "Name of route map\n"
+      "BGP origin code\n"
+      "Remote EGP\n"
+      "Local IGP\n"
+      "Unknown heritage\n")
 {
 	int idx = 0;
 	argv_find(argv, argc, "X:X::X:X/M", &idx);
@@ -7076,22 +7071,21 @@ DEFUN (ipv6_aggregate_address,
 				 sum_only, as_set, origin);
 }
 
-DEFUN (no_ipv6_aggregate_address,
-       no_ipv6_aggregate_address_cmd,
-       "no aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
-       NO_STR
-       "Configure BGP aggregate entries\n"
-       "Aggregate prefix\n"
-       "Generate AS set path information\n"
-       "Filter more specific routes from updates\n"
-       "Filter more specific routes from updates\n"
-       "Generate AS set path information\n"
-       "Apply route map to aggregate network\n"
-       "Name of route map\n"
-       "BGP origin code\n"
-       "Remote EGP\n"
-       "Local IGP\n"
-       "Unknown heritage\n")
+DEFUN(no_ipv6_aggregate_address, no_ipv6_aggregate_address_cmd,
+      "no aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>] [route-map WORD] [origin <egp|igp|incomplete>]",
+      NO_STR
+      "Configure BGP aggregate entries\n"
+      "Aggregate prefix\n"
+      "Generate AS set path information\n"
+      "Filter more specific routes from updates\n"
+      "Filter more specific routes from updates\n"
+      "Generate AS set path information\n"
+      "Apply route map to aggregate network\n"
+      "Name of route map\n"
+      "BGP origin code\n"
+      "Remote EGP\n"
+      "Local IGP\n"
+      "Unknown heritage\n")
 {
 	int idx = 0;
 	argv_find(argv, argc, "X:X::X:X/M", &idx);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 5f0a2d370..5d42f6b1b 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1489,7 +1489,7 @@ struct bgp_nlri {
 #define BGP_ORIGIN_IGP                           0
 #define BGP_ORIGIN_EGP                           1
 #define BGP_ORIGIN_INCOMPLETE                    2
-#define BGP_ORIGIN_UNSPECIFIED                 255
+#define BGP_ORIGIN_UNSPECIFIED 255
 
 /* BGP notify message codes.  */
 #define BGP_NOTIFY_HEADER_ERR                    1

If you are a new contributor to FRR, please see our contributing guidelines.

@LabN-CI

This comment has been minimized.

@NetDEF-CI

This comment has been minimized.

Override ORIGIN attribute if defined.
E.g.: Cisco and Juniper set ORIGIN for aggregated address
to IGP which is not what rfc4271 says.

This enables the same behavior, optionally.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
@LabN-CI

This comment has been minimized.

@NetDEF-CI

This comment has been minimized.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
@LabN-CI
Copy link
Collaborator

LabN-CI commented Feb 13, 2020

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/5802 a87d2ef
Date 02/13/2020
Start 09:30:45
Finish 09:56:28
Run-Time 25:43
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-02-13-09:30:45.txt
Log autoscript-2020-02-13-09:31:41.log.bz2
Memory 458 461 418

For details, please contact louberger

@NetDEF-CI

This comment has been minimized.

@NetDEF-CI

This comment has been minimized.

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-10724/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-10724/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: pkg-js-tools-test-is-missing
W: frr source: pkg-js-tools-test-is-missing
W: frr-snmp: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200213-05-g25df253b8-0 (missing) -> 7.4-dev-20200213-05-g25df253b8-0~deb10u1
W: frr-doc: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200213-05-g25df253b8-0 (missing) -> 7.4-dev-20200213-05-g25df253b8-0~deb10u1
W: frr-pythontools: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200213-05-g25df253b8-0 (missing) -> 7.4-dev-20200213-05-g25df253b8-0~deb10u1
W: frr-rpki-rtrlib: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200213-05-g25df253b8-0 (missing) -> 7.4-dev-20200213-05-g25df253b8-0~deb10u1
W: frr: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200213-05-g25df253b8-0 (missing) -> 7.4-dev-20200213-05-g25df253b8-0~deb10u1
<TITLE>clang_check</TITLE>

clang_check

@donaldsharp donaldsharp self-requested a review February 18, 2020 16:24
@donaldsharp donaldsharp merged commit 1a21da6 into FRRouting:master Feb 19, 2020
@ton31337 ton31337 deleted the feature/aggregate-address_origin_override branch February 22, 2020 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bgp documentation feature tests Topotests, make check, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add modify flag for aggregate-address to set default origin value
5 participants