summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
authorPascal Mathis <mail@pascalmathis.com>2018-05-17 22:51:35 +0200
committerPascal Mathis <mail@pascalmathis.com>2018-05-19 14:43:42 +0200
commit47cbc09b639026bcda9d03bc7fb5e48d87aee6c8 (patch)
treefb8748894bfb5afd2666646be0642ab0275c68a0 /bgpd/bgp_attr.c
parentMerge pull request #2198 from LabNConsulting/working/master/bgpd-nht-crash (diff)
downloadfrr-47cbc09b639026bcda9d03bc7fb5e48d87aee6c8.tar.xz
frr-47cbc09b639026bcda9d03bc7fb5e48d87aee6c8.zip
bgpd: Move 'enforce-first-as' from global to peer
This commit moves the command 'bgp enforce-first-as' from global BGP instance configuration to peer/neighbor configuration, which can now be changed by executing '[no] neighbor <neighbor> enforce-first-as'. End users can now enforce sane first-AS checking on regular sessions while e.g. disabling the checks on routeserver sessions, which usually strip away their own AS number from the path. To ensure backwards-compatibility, a migration routine was added which automatically sets the 'enforce-first-as' flag on all configured neighbors if the old global setting was activated. The old global command immediately disappears after running the migration routine once. Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 276a7054e..9fc819b96 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1177,7 +1177,6 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer,
* not right.
* So do the checks later, i.e. here
*/
- struct bgp *bgp = peer->bgp;
struct aspath *aspath;
/* Confederation sanity check. */
@@ -1192,7 +1191,7 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer,
}
/* First AS check for EBGP. */
- if (bgp != NULL && bgp_flag_check(bgp, BGP_FLAG_ENFORCE_FIRST_AS)) {
+ if (CHECK_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS)) {
if (peer->sort == BGP_PEER_EBGP
&& !aspath_firstas_check(attr->aspath, peer->as)) {
zlog_err("%s incorrect first AS (must be %u)",