summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-11-20 12:27:43 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-11-20 12:27:43 +0000
commite313fe8c34e2271b9c57faee82709bbf4ee4d3ae (patch)
treeb1aaa9c7da74a936945c9489dfe91c45b0bf4fdf /sys/net
parent199b9779529613a990e581d0e32fe8e1c014f051 (diff)
Keep if_ref() private, if_get() is what you want to use before if_put().
The thread detaching an interface will sleep until all references to this interface have been released. So we decided to only keep references for a short period of time. Keeping if_ref() private will hopefully help preserve this goal as long as it makes sense. Calling if_get()/if_put() in the same function also allows us to make use of static analysis tools (thanks jsg@!) to catch our errors. ok dlg@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c3
-rw-r--r--sys/net/if.h3
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index f899cd8788c..47532fbbf15 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.410 2015/11/20 11:15:07 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.411 2015/11/20 12:27:42 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -174,6 +174,7 @@ void ifa_print_all(void);
void if_ifp_dtor(void *, void *);
void if_map_dtor(void *, void *);
+struct ifnet *if_ref(struct ifnet *);
/*
* struct if_map
diff --git a/sys/net/if.h b/sys/net/if.h
index 78307253e78..711ea0c4194 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.172 2015/10/24 10:52:05 reyk Exp $ */
+/* $OpenBSD: if.h,v 1.173 2015/11/20 12:27:42 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -473,7 +473,6 @@ int if_delgroup(struct ifnet *, const char *);
void if_group_routechange(struct sockaddr *, struct sockaddr *);
struct ifnet *ifunit(const char *);
struct ifnet *if_get(unsigned int);
-struct ifnet *if_ref(struct ifnet *);
void if_put(struct ifnet *);
void ifnewlladdr(struct ifnet *);
void if_congestion(void);