Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Fix arplookup logic
details: https://anonhg.NetBSD.org/src/rev/36eb19301128
branches: trunk
changeset: 340841:36eb19301128
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Oct 05 08:17:31 2015 +0000
description:
Fix arplookup logic
It should first lookup and then create an entry if not found (and if
creation is requested).
diffstat:
sys/netinet/if_arp.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (38 lines):
diff -r dbf1db67a3a6 -r 36eb19301128 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Mon Oct 05 04:15:42 2015 +0000
+++ b/sys/netinet/if_arp.c Mon Oct 05 08:17:31 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.181 2015/09/11 10:33:32 roy Exp $ */
+/* $NetBSD: if_arp.c,v 1.182 2015/10/05 08:17:31 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.181 2015/09/11 10:33:32 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.182 2015/10/05 08:17:31 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1471,14 +1471,14 @@
struct llentry *la;
int flags = wlock ? LLE_EXCLUSIVE : 0;
- if (create) {
+ IF_AFDATA_RLOCK(ifp);
+ la = lla_lookup(LLTABLE(ifp), flags, rt_getkey(rt));
+ IF_AFDATA_RUNLOCK(ifp);
+
+ if (la == NULL && create) {
IF_AFDATA_WLOCK(ifp);
la = lla_create(LLTABLE(ifp), flags, rt_getkey(rt));
IF_AFDATA_WUNLOCK(ifp);
- } else {
- IF_AFDATA_RLOCK(ifp);
- la = lla_lookup(LLTABLE(ifp), flags, rt_getkey(rt));
- IF_AFDATA_RUNLOCK(ifp);
}
return la;
Home |
Main Index |
Thread Index |
Old Index