summaryrefslogtreecommitdiff
path: root/sys/net/bfd.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2016-09-04 13:24:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2016-09-04 13:24:28 +0000
commit58704404d2c6d7c7fd33b4c4261ada850ef1089c (patch)
tree724a64f4ada9ddd09464316f7034b852c917be4a /sys/net/bfd.c
parent296ebbefd66d2704cc1c777238139196ca63bdfb (diff)
Only allow bfd on host routes and non-gateway routes for now.
Also just use bfd_lookup() instead of handrolling the same lookup.
Diffstat (limited to 'sys/net/bfd.c')
-rw-r--r--sys/net/bfd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/net/bfd.c b/sys/net/bfd.c
index 94c40cd6cb6..6de5bb97813 100644
--- a/sys/net/bfd.c
+++ b/sys/net/bfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bfd.c,v 1.17 2016/09/04 11:34:56 claudio Exp $ */
+/* $OpenBSD: bfd.c,v 1.18 2016/09/04 13:24:27 claudio Exp $ */
/*
* Copyright (c) 2016 Peter Hessler <phessler@openbsd.org>
@@ -201,13 +201,13 @@ bfd_rtalloc(struct rtentry *rt)
{
struct bfd_softc *sc;
- /* make sure we don't already have this setup */
- TAILQ_FOREACH(sc, &bfd_queue, bfd_next) {
- if (sc->sc_rt == rt)
- return (EADDRINUSE);
- }
+ /* at the moment it is not allowed to run BFD on indirect routes */
+ if (ISSET(rt->rt_flags, RTF_GATEWAY) || !ISSET(rt->rt_flags, RTF_HOST))
+ return (EINVAL);
- /* XXX - do we need to force RTM_RESOLVE? */
+ /* make sure we don't already have this setup */
+ if (bfd_lookup(rt) != NULL)
+ return (EADDRINUSE);
/* Do our necessary memory allocations upfront */
if ((sc = pool_get(&bfd_pool, PR_WAITOK | PR_ZERO)) == NULL)