summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-02-28 10:16:39 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-02-28 10:16:39 +0000
commit843d91c989fa8478d122203a14ae8625c62528bc (patch)
treeb1b4219356239ceb2ad70d65bfb8fbf9b884053c
parent2c11c8d6cb4842975a510dc7b9f9aaa27afd7abf (diff)
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;