summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_aspath.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-10-21 19:51:05 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-10-21 19:51:05 +0200
commitaac9ef6cb0169ea96debe2872066021608631c16 (patch)
tree95254a50d8573ce5b5c9ca622a8d358a14974a96 /bgpd/bgp_aspath.c
parentbgpd: Fix rfapi qobj use. (diff)
downloadfrr-aac9ef6cb0169ea96debe2872066021608631c16.tar.xz
frr-aac9ef6cb0169ea96debe2872066021608631c16.zip
bgpd: add 'neighbor x.x.x.x allowas-in origin' knob
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-13207 normal table on spine-1....we do not see 6.0.0.10 (spine-2's loopback) spine-1 and spine-2 are in AS 65200 superm-redxp-05# show ip bgp BGP table version is 13, local router ID is 6.0.0.9 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 6.0.0.5/32 swp1 0 0 65101 ? *> 6.0.0.6/32 swp2 0 0 65101 ? *> 6.0.0.7/32 swp3 0 0 65104 ? *> 6.0.0.8/32 swp4 0 0 65104 ? *> 6.0.0.9/32 0.0.0.0 0 32768 ? *= 6.0.0.11/32 swp2 0 65101 65001 ? *> swp1 0 65101 65001 ? *= 6.0.0.12/32 swp2 0 65101 65002 ? *> swp1 0 65101 65002 ? *= 6.0.0.13/32 swp4 0 65104 65001 ? *> swp3 0 65104 65001 ? *= 6.0.0.14/32 swp4 0 65104 65002 ? *> swp3 0 65104 65002 ? Displayed 9 out of 13 total prefixes superm-redxp-05# spine-1 with "neighbor x.x.x.x allowas-in origin", we now see 6.0.0.10 superm-redxp-05# show ip bgp BGP table version is 14, local router ID is 6.0.0.9 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 6.0.0.5/32 swp1 0 0 65101 ? *> 6.0.0.6/32 swp2 0 0 65101 ? *> 6.0.0.7/32 swp3 0 0 65104 ? *> 6.0.0.8/32 swp4 0 0 65104 ? * 6.0.0.9/32 swp2 0 65101 65200 ? * swp1 0 65101 65200 ? * swp3 0 65104 65200 ? * swp4 0 65104 65200 ? *> 0.0.0.0 0 32768 ? *= 6.0.0.10/32 swp2 0 65101 65200 ? *> swp1 0 65101 65200 ? *= swp3 0 65104 65200 ? *= swp4 0 65104 65200 ? *= 6.0.0.11/32 swp2 0 65101 65001 ? *> swp1 0 65101 65001 ? *= 6.0.0.12/32 swp2 0 65101 65002 ? *> swp1 0 65101 65002 ? *= 6.0.0.13/32 swp4 0 65104 65001 ? *> swp3 0 65104 65001 ? *= 6.0.0.14/32 swp4 0 65104 65002 ? *> swp3 0 65104 65002 ? Displayed 10 out of 21 total prefixes superm-redxp-05# The only as-paths with 65200 that made it through were the ones that originated from 65200 superm-redxp-05# show ip bgp regexp _65200_ BGP table version is 14, local router ID is 6.0.0.9 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 6.0.0.9/32 swp2 0 65101 65200 ? * swp1 0 65101 65200 ? * swp3 0 65104 65200 ? * swp4 0 65104 65200 ? *= 6.0.0.10/32 swp2 0 65101 65200 ? *> swp1 0 65101 65200 ? *= swp3 0 65104 65200 ? *= swp4 0 65104 65200 ? Displayed 2 out of 21 total prefixes superm-redxp-05#
Diffstat (limited to 'bgpd/bgp_aspath.c')
-rw-r--r--bgpd/bgp_aspath.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 70d4f0493..bf1e92b26 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -1163,8 +1163,8 @@ aspath_firstas_check (struct aspath *aspath, as_t asno)
return 0;
}
-int
-aspath_get_firstas (struct aspath *aspath)
+unsigned int
+aspath_get_first_as (struct aspath *aspath)
{
if (aspath == NULL || aspath->segments == NULL)
return 0;
@@ -1172,6 +1172,29 @@ aspath_get_firstas (struct aspath *aspath)
return aspath->segments->as[0];
}
+unsigned int
+aspath_get_last_as (struct aspath *aspath)
+{
+ int i;
+ unsigned int last_as = 0;
+ const struct assegment *seg;
+
+ if (aspath == NULL || aspath->segments == NULL)
+ return last_as;
+
+ seg = aspath->segments;
+
+ while (seg)
+ {
+ if (seg->type == AS_SEQUENCE || seg->type == AS_CONFED_SEQUENCE)
+ for (i = 0; i < seg->length; i++)
+ last_as = seg->as[i];
+ seg = seg->next;
+ }
+
+ return last_as;
+}
+
/* AS path loop check. If aspath contains asno then return >= 1. */
int
aspath_loop_check (struct aspath *aspath, as_t asno)