summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-02-24 14:54:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-02-24 14:54:04 +0000
commitf7a7dae42c2431846ad8b9590474e76d24697247 (patch)
tree070c3570b88cf2e3c2c936c12689a4f1f17f008e
parent55004d75955b808550c2a0ffc2c3e8a619d86489 (diff)
struct prefix holds path_id_tx for the path id sent to peers when
add-path send is enabled. Start using this instead of 0. Currently nothing sets path_id_tx to any value != 0 so this is the same but a bit more correct. OK tb@
-rw-r--r--usr.sbin/bgpd/rde.c20
-rw-r--r--usr.sbin/bgpd/rde_update.c5
2 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index eca6f44ab29..6d2e9a44059 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.534 2022/02/06 09:51:19 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.535 2022/02/24 14:54:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2422,7 +2422,7 @@ rde_dump_rib_as(struct prefix *p, struct rde_aspath *asp, pid_t pid, int flags,
}
} else {
if (peer_has_add_path(peer, p->pt->aid, CAPA_AP_SEND)) {
- rib.path_id = 0; /* XXX add-path send */
+ rib.path_id = p->path_id_tx;
rib.flags |= F_PREF_PATH_ID;
}
}
@@ -2507,12 +2507,16 @@ rde_dump_filter(struct prefix *p, struct ctl_show_rib_request *req, int adjout)
if ((req->flags & F_CTL_INVALID) &&
(asp->flags & F_ATTR_PARSE_ERR) == 0)
return;
- /*
- * XXX handle out specially since then we want to match against our
- * path ids.
- */
- if ((req->flags & F_CTL_HAS_PATHID) && req->path_id != p->path_id)
- return;
+ if ((req->flags & F_CTL_HAS_PATHID)) {
+ /* Match against the transmit path id if adjout is used. */
+ if (adjout) {
+ if (req->path_id != p->path_id_tx)
+ return;
+ } else {
+ if (req->path_id != p->path_id)
+ return;
+ }
+ }
if (req->as.type != AS_UNDEF &&
!aspath_match(asp->aspath, &req->as, 0))
return;
diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c
index 60985bd7c92..15d5b052260 100644
--- a/usr.sbin/bgpd/rde_update.c
+++ b/usr.sbin/bgpd/rde_update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_update.c,v 1.132 2022/02/06 09:51:19 claudio Exp $ */
+/* $OpenBSD: rde_update.c,v 1.133 2022/02/24 14:54:03 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -632,8 +632,7 @@ up_dump_prefix(u_char *buf, int len, struct prefix_tree *prefix_head,
if (peer_has_add_path(peer, p->pt->aid, CAPA_AP_SEND)) {
if (len <= wpos + (int)sizeof(pathid))
break;
- /* XXX add-path send side */
- pathid = 0;
+ pathid = htonl(p->path_id_tx);
memcpy(buf + wpos, &pathid, sizeof(pathid));
wpos += sizeof(pathid);
}