Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Clean up rtcache_setdst
details: https://anonhg.NetBSD.org/src/rev/73c1bfb3f291
branches: trunk
changeset: 807366:73c1bfb3f291
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Apr 07 04:36:19 2015 +0000
description:
Clean up rtcache_setdst
We can assume sockaddr_copy never return NULL when we pass
non-NULL dst (1st argument).
diffstat:
sys/net/route.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diffs (43 lines):
diff -r eb0bd2249ec8 -r 73c1bfb3f291 sys/net/route.c
--- a/sys/net/route.c Tue Apr 07 03:19:24 2015 +0000
+++ b/sys/net/route.c Tue Apr 07 04:36:19 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.141 2015/04/06 08:39:06 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.142 2015/04/07 04:36:19 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.141 2015/04/06 08:39:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.142 2015/04/07 04:36:19 ozaki-r Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -1468,15 +1468,16 @@
KASSERT(sa != NULL);
rtcache_invariants(ro);
- if (ro->ro_sa != NULL && ro->ro_sa->sa_family == sa->sa_family) {
- rtcache_clear(ro);
- if (sockaddr_copy(ro->ro_sa, ro->ro_sa->sa_len, sa) != NULL) {
- rtcache_invariants(ro);
- return 0;
+ if (ro->ro_sa != NULL) {
+ if (ro->ro_sa->sa_family == sa->sa_family) {
+ rtcache_clear(ro);
+ sockaddr_copy(ro->ro_sa, ro->ro_sa->sa_len, sa);
+ sockaddr_free(ro->ro_sa);
+ } else {
+ /* free ro_sa, wrong family */
+ rtcache_free(ro);
}
- sockaddr_free(ro->ro_sa);
- } else if (ro->ro_sa != NULL)
- rtcache_free(ro); /* free ro_sa, wrong family */
+ }
KASSERT(ro->_ro_rt == NULL);
Home |
Main Index |
Thread Index |
Old Index