summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2017-02-28 10:16:38 +0000
committermpi <mpi@openbsd.org>2017-02-28 10:16:38 +0000
commitf68d43e61852b7ef3a33beaf1f13bb9595e8e9ab (patch)
treea7dbf4f4ad002e702a36991eb4407402e4a9d7fa
parentSome refactoring in ip6_input() needed to un-KERNEL_LOCK() the IPv6 (diff)
downloadwireguard-openbsd-f68d43e61852b7ef3a33beaf1f13bb9595e8e9ab.tar.xz
wireguard-openbsd-f68d43e61852b7ef3a33beaf1f13bb9595e8e9ab.zip
Use rtable_match() rather than rtalloc(9) when adding a new route.
rtalloc(9) should be reserved for the hot path otherwise it's hard to interpret the value of the 'use' counter. ok claudio@
-rw-r--r--sys/net/route.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 397478c94c2..dae732130f8 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.351 2017/02/15 18:53:29 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.352 2017/02/28 10:16:38 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1084,7 +1084,8 @@ rtrequest(int req, struct rt_addrinfo *info, u_int8_t prio,
error = rtable_insert(tableid, ndst,
info->rti_info[RTAX_NETMASK], info->rti_info[RTAX_GATEWAY],
rt->rt_priority, rt);
- if (error != 0 && (crt = rtalloc(ndst, 0, tableid)) != NULL) {
+ if (error != 0 &&
+ (crt = rtable_match(tableid, ndst, NULL)) != NULL) {
/* overwrite cloned route */
if (ISSET(crt->rt_flags, RTF_CLONED)) {
struct ifnet *cifp;