diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-03-10 07:35:35 +0200 | 
|---|---|---|
| committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-03-17 13:31:23 +0200 | 
| commit | 33d022bcf6a9cb3f323b75feedfb9d80b99e7228 (patch) | |
| tree | 35b88ab6c1e483b98fc1c62f95900c6d8f9d480d /bgpd/bgp_aspath.c | |
| parent | 9b5082174cc50abfc6a34059d53bd24964d4c41f (diff) | |
bgpd: Proscribe the use of AS 0 (zero)
Implements https://tools.ietf.org/html/rfc7607
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'bgpd/bgp_aspath.c')
| -rw-r--r-- | bgpd/bgp_aspath.c | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index f73d6e3009..cf75e69e29 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -429,6 +429,22 @@ bool aspath_check_as_sets(struct aspath *aspath)  	return false;  } +/* Check if aspath has BGP_AS_ZERO */ +bool aspath_check_as_zero(struct aspath *aspath) +{ +	struct assegment *seg = aspath->segments; +	unsigned int i; + +	while (seg) { +		for (i = 0; i < seg->length; i++) +			if (seg->as[i] == BGP_AS_ZERO) +				return true; +		seg = seg->next; +	} + +	return false; +} +  /* Estimate size aspath /might/ take if encoded into an   * ASPATH attribute.   *  | 
