and ineligible paths.
While there rename F_PREF_OTC_LOOP to F_PREF_OTC_LEAK since this indicates
that a route leak was detected.
OK tb@
-/* $OpenBSD: bgpd.h,v 1.464 2023/03/10 07:57:15 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.465 2023/03/13 16:52:41 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
#define F_MPLS 0x0080
#define F_LONGER 0x0200
#define F_SHORTER 0x0400
-#define F_CTL_DETAIL 0x1000 /* only set on requests */
-#define F_CTL_ADJ_IN 0x2000 /* only set on requests */
-#define F_CTL_ADJ_OUT 0x4000 /* only set on requests */
+#define F_CTL_DETAIL 0x1000 /* only set on requests */
+#define F_CTL_ADJ_IN 0x2000 /* only set on requests */
+#define F_CTL_ADJ_OUT 0x4000 /* only set on requests */
#define F_CTL_BEST 0x8000
-#define F_CTL_SSV 0x20000 /* only used by bgpctl */
-#define F_CTL_INVALID 0x40000 /* only set on requests */
+#define F_CTL_INELIGIBLE 0x10000 /* only set on requests */
+#define F_CTL_LEAKED 0x20000 /* only set on requests */
+#define F_CTL_INVALID 0x40000 /* only set on requests */
#define F_CTL_OVS_VALID 0x80000
#define F_CTL_OVS_INVALID 0x100000
#define F_CTL_OVS_NOTFOUND 0x200000
-#define F_CTL_NEIGHBORS 0x400000 /* only used by bgpctl */
-#define F_CTL_HAS_PATHID 0x800000 /* only set on requests */
+#define F_CTL_NEIGHBORS 0x400000 /* only used by bgpctl */
+#define F_CTL_HAS_PATHID 0x800000 /* only set on requests */
#define F_CTL_AVS_VALID 0x1000000
#define F_CTL_AVS_INVALID 0x2000000
#define F_CTL_AVS_UNKNOWN 0x4000000
+#define F_CTL_SSV 0x80000000 /* only used by bgpctl */
#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \
__attribute__((__unused__))
#define F_PREF_STALE 0x010
#define F_PREF_INVALID 0x020
#define F_PREF_PATH_ID 0x040
-#define F_PREF_OTC_LOOP 0x080
+#define F_PREF_OTC_LEAK 0x080
#define F_PREF_ECMP 0x100
#define F_PREF_AS_WIDE 0x200
-/* $OpenBSD: rde.c,v 1.595 2023/03/10 07:57:15 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.596 2023/03/13 16:52:42 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
}
} else {
/* Only IPv4 and IPv6 unicast do OTC handling */
- state.aspath.flags &= ~F_ATTR_OTC_LOOP;
+ state.aspath.flags &= ~F_ATTR_OTC_LEAK;
}
/* unlock the previously locked nexthop, it is no longer used */
switch (peer->role) {
case ROLE_PROVIDER:
case ROLE_RS:
- a->flags |= F_ATTR_OTC_LOOP;
+ a->flags |= F_ATTR_OTC_LEAK;
break;
case ROLE_PEER:
memcpy(&tmp32, p, sizeof(tmp32));
tmp32 = ntohl(tmp32);
if (tmp32 != peer->conf.remote_as)
- a->flags |= F_ATTR_OTC_LOOP;
+ a->flags |= F_ATTR_OTC_LEAK;
break;
default:
break;
if (prefix_eligible(p))
rib.flags |= F_PREF_ELIGIBLE;
/* otc loop includes parse err so skip the latter if the first is set */
- if (asp->flags & F_ATTR_OTC_LOOP)
- rib.flags |= F_PREF_OTC_LOOP;
+ if (asp->flags & F_ATTR_OTC_LEAK)
+ rib.flags |= F_PREF_OTC_LEAK;
else if (asp->flags & F_ATTR_PARSE_ERR)
rib.flags |= F_PREF_INVALID;
staletime = peer->staletime[p->pt->aid];
if ((req->flags & F_CTL_INVALID) &&
(asp->flags & F_ATTR_PARSE_ERR) == 0)
return;
+ if ((req->flags & F_CTL_INELIGIBLE) && prefix_eligible(p))
+ return;
+ if ((req->flags & F_CTL_LEAKED) &&
+ (asp->flags & F_ATTR_OTC_LEAK) == 0)
+ return;
if ((req->flags & F_CTL_HAS_PATHID)) {
/* Match against the transmit path id if adjout is used. */
if (adjout) {
-/* $OpenBSD: rde.h,v 1.285 2023/03/10 07:57:15 claudio Exp $ */
+/* $OpenBSD: rde.h,v 1.286 2023/03/13 16:52:42 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and
#define F_PREFIX_ANNOUNCED 0x00400
#define F_ANN_DYNAMIC 0x00800
#define F_ATTR_OTC 0x01000 /* OTC present */
-#define F_ATTR_OTC_LOOP 0x02000 /* otc loop, not eligible */
+#define F_ATTR_OTC_LEAK 0x02000 /* otc leak, not eligible */
#define F_ATTR_PARSE_ERR 0x10000 /* parse error, not eligible */
#define F_ATTR_LINKED 0x20000 /* if set path is on various lists */
-/* $OpenBSD: rde_decide.c,v 1.100 2023/03/09 13:12:19 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.101 2023/03/13 16:52:42 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
/* The aspath needs to be loop and error free */
if (asp == NULL ||
- asp->flags & (F_ATTR_LOOP|F_ATTR_OTC_LOOP|F_ATTR_PARSE_ERR))
+ asp->flags & (F_ATTR_LOOP|F_ATTR_OTC_LEAK|F_ATTR_PARSE_ERR))
return 0;
/* The nexthop must be valid. */
-/* $OpenBSD: rde_update.c,v 1.158 2023/03/10 07:57:16 claudio Exp $ */
+/* $OpenBSD: rde_update.c,v 1.159 2023/03/13 16:52:42 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
if (asp == NULL || asp->flags & F_ATTR_PARSE_ERR)
fatalx("try to send out a botched path");
- if (asp->flags & (F_ATTR_LOOP | F_ATTR_OTC_LOOP))
+ if (asp->flags & (F_ATTR_LOOP | F_ATTR_OTC_LEAK))
fatalx("try to send out a looped path");
if (peer == frompeer)