Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Restructure rtcache_lookup2 to make it clear what it...
details: https://anonhg.NetBSD.org/src/rev/93b668c944c7
branches: trunk
changeset: 337113:93b668c944c7
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Apr 03 05:44:13 2015 +0000
description:
Restructure rtcache_lookup2 to make it clear what it does
No functional change.
diffstat:
sys/net/route.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diffs (57 lines):
diff -r 21404e057adf -r 93b668c944c7 sys/net/route.c
--- a/sys/net/route.c Fri Apr 03 01:09:42 2015 +0000
+++ b/sys/net/route.c Fri Apr 03 05:44:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.137 2015/03/26 04:38:17 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.138 2015/04/03 05:44:13 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@
#include "opt_route.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.137 2015/03/26 04:38:17 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.138 2015/04/03 05:44:13 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -1420,20 +1420,28 @@
struct rtentry *rt = NULL;
odst = rtcache_getdst(ro);
+ if (odst == NULL)
+ goto miss;
- if (odst == NULL)
- ;
- else if (sockaddr_cmp(odst, dst) != 0)
+ if (sockaddr_cmp(odst, dst) != 0) {
rtcache_free(ro);
- else if ((rt = rtcache_validate(ro)) == NULL)
+ goto miss;
+ }
+
+ rt = rtcache_validate(ro);
+ if (rt == NULL) {
rtcache_clear(ro);
+ goto miss;
+ }
- if (rt == NULL) {
- *hitp = 0;
- if (rtcache_setdst(ro, dst) == 0)
- rt = _rtcache_init(ro, clone);
- } else
- *hitp = 1;
+ *hitp = 1;
+ rtcache_invariants(ro);
+
+ return rt;
+miss:
+ *hitp = 0;
+ if (rtcache_setdst(ro, dst) == 0)
+ rt = _rtcache_init(ro, clone);
rtcache_invariants(ro);
Home |
Main Index |
Thread Index |
Old Index