summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphessler <phessler@openbsd.org>2016-09-03 14:20:25 +0000
committerphessler <phessler@openbsd.org>2016-09-03 14:20:25 +0000
commit0211a728c2614da81823ab2ea291b6d00b2253db (patch)
treeb48b85fe494fb7177f1d0946d67e5d8533e82650
parentsync (diff)
downloadwireguard-openbsd-0211a728c2614da81823ab2ea291b6d00b2253db.tar.xz
wireguard-openbsd-0211a728c2614da81823ab2ea291b6d00b2253db.zip
Add in the (disabled) kernel glue for BFD
OK claudio@, henning@
-rw-r--r--sys/conf/GENERIC3
-rw-r--r--sys/conf/files3
-rw-r--r--sys/net/route.c19
-rw-r--r--sys/net/route.h4
4 files changed, 25 insertions, 4 deletions
diff --git a/sys/conf/GENERIC b/sys/conf/GENERIC
index 5c328c87f5e..483fd9a5733 100644
--- a/sys/conf/GENERIC
+++ b/sys/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.231 2016/09/01 10:06:32 goda Exp $
+# $OpenBSD: GENERIC,v 1.232 2016/09/03 14:20:25 phessler Exp $
#
# Machine-independent option; used by all architectures for their
# GENERIC kernel
@@ -60,6 +60,7 @@ option PIPEX # Ppp IP EXtension, for npppd
option MROUTING # Multicast router
#option PIM # Protocol Independent Multicast
option MPLS # Multi-Protocol Label Switching
+#option BFD # Bi-directional Forwarding Detection
#mpath0 at root # SCSI Multipathing
#scsibus* at mpath?
diff --git a/sys/conf/files b/sys/conf/files
index a478e7d5148..ce3ca166851 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.625 2016/09/01 10:06:33 goda Exp $
+# $OpenBSD: files,v 1.626 2016/09/03 14:20:26 phessler Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -800,6 +800,7 @@ file net/if_vether.c vether needs-count
file net/if_pair.c pair needs-count
file net/if_pppx.c pppx needs-count
file net/if_vxlan.c vxlan needs-count
+file net/bfd.c bfd
file net80211/ieee80211.c wlan
file net80211/ieee80211_amrr.c wlan
file net80211/ieee80211_crypto.c wlan
diff --git a/sys/net/route.c b/sys/net/route.c
index f8fd23c2039..e6fbda6d0c9 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.321 2016/09/01 15:40:38 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.322 2016/09/03 14:20:26 phessler Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -139,6 +139,10 @@
#include <net/if_enc.h>
#endif
+#if BFD
+#include <net/bfd.h>
+#endif
+
#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
/* Give some jitter to hash, to avoid synchronization between routers. */
@@ -196,6 +200,9 @@ route_init(void)
if (rtable_add(0) != 0)
panic("route_init rtable_add");
+#if BFD
+ bfdinit();
+#endif
}
/*
@@ -907,6 +914,11 @@ rtrequest_delete(struct rt_addrinfo *info, u_int8_t prio, struct ifnet *ifp,
rtfree(rt);
return (ESRCH);
}
+
+#if BFD
+ if (ISSET(rt->rt_flags, RTF_BFD))
+ (void)bfd_rtfree(rt);
+#endif /* BFD */
#endif
error = rtable_delete(tableid, info->rti_info[RTAX_DST],
@@ -1166,6 +1178,11 @@ rtrequest(int req, struct rt_addrinfo *info, u_int8_t prio,
pool_put(&rtentry_pool, rt);
return (EEXIST);
}
+#if BFD
+ if (ISSET(rt->rt_flags, RTF_BFD)) {
+ error = bfd_rtalloc(rt, NULL);
+ }
+#endif
ifp->if_rtrequest(ifp, req, rt);
if_group_routechange(info->rti_info[RTAX_DST],
diff --git a/sys/net/route.h b/sys/net/route.h
index 19dc972ea49..82d4b62c373 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.144 2016/08/31 21:32:06 bluhm Exp $ */
+/* $OpenBSD: route.h,v 1.145 2016/09/03 14:20:26 phessler Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -149,6 +149,7 @@ struct rtentry {
#define RTF_LOCAL 0x200000 /* route to a local address */
#define RTF_BROADCAST 0x400000 /* route associated to a bcast addr. */
#define RTF_CONNECTED 0x800000 /* interface route */
+#define RTF_BFD 0x1000000 /* Link state controlled by BFD */
/* mask of RTF flags that are allowed to be modified by RTM_CHANGE */
#define RTF_FMASK \
@@ -233,6 +234,7 @@ struct rt_msghdr {
#define RTM_IFANNOUNCE 0xf /* iface arrival/departure */
#define RTM_DESYNC 0x10 /* route socket buffer overflow */
#define RTM_INVALIDATE 0x11 /* Invalidate cache of L2 route */
+#define RTM_BFD 0x12 /* bidirectional forwarding detection */
#define RTV_MTU 0x1 /* init or lock _mtu */
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */