diff options
author | 2021-01-16 13:14:54 +0000 | |
---|---|---|
committer | 2021-01-16 13:14:54 +0000 | |
commit | a3d44d867efdaf2e45a02309e361ac18796a6bc8 (patch) | |
tree | cde4c12e5dcfb58a291cafe33c00206a547a5149 | |
parent | The sysctl variable net.inet.ip.forwarding is checked before (diff) | |
download | wireguard-openbsd-a3d44d867efdaf2e45a02309e361ac18796a6bc8.tar.xz wireguard-openbsd-a3d44d867efdaf2e45a02309e361ac18796a6bc8.zip |
aspath_neighbor() needs to return the local system AS for empty AS paths
but also for AS paths starting with an AS_SET segment. RFC4271 wants this
and it also makes sense for all the cases where aspath_neighbor() is used
in bgpd.
OK denis@ job@
-rw-r--r-- | usr.sbin/bgpd/rde_attr.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c index 3aaf51bbd1a..69d8ee0da1f 100644 --- a/usr.sbin/bgpd/rde_attr.c +++ b/usr.sbin/bgpd/rde_attr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_attr.c,v 1.123 2019/06/24 06:39:49 claudio Exp $ */ +/* $OpenBSD: rde_attr.c,v 1.124 2021/01/16 13:14:54 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -673,8 +673,13 @@ aspath_length(struct aspath *aspath) u_int32_t aspath_neighbor(struct aspath *aspath) { - /* Empty aspath is OK -- internal AS route. */ - if (aspath->len == 0) + /* + * Empty aspath is OK -- internal AS route. + * Additionally the RFC specifies that if the path starts with an + * AS_SET the neighbor AS is also the local AS. + */ + if (aspath->len == 0 || + aspath->data[0] != AS_SEQUENCE) return (rde_local_as()); return (aspath_extract(aspath->data, 0)); } |