summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_tun.c4
-rw-r--r--sys/net/pipex.c20
-rw-r--r--sys/net/pipex.h5
-rw-r--r--sys/net/pipex_local.h4
4 files changed, 22 insertions, 11 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index b68e5a2eec5..2350c436e5e 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.128 2014/09/08 06:24:13 jsg Exp $ */
+/* $OpenBSD: if_tun.c,v 1.129 2014/10/21 10:52:53 yasuoka Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -226,7 +226,7 @@ tun_clone_destroy(struct ifnet *ifp)
int s;
#ifdef PIPEX
- pipex_iface_stop(&tp->pipex_iface);
+ pipex_iface_fini(&tp->pipex_iface);
#endif
tun_wakeup(tp);
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 74492041cc4..72ce32eb0e8 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.57 2014/10/20 16:33:32 uebayasi Exp $ */
+/* $OpenBSD: pipex.c,v 1.58 2014/10/21 10:52:53 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -184,20 +184,18 @@ pipex_iface_init(struct pipex_iface_context *pipex_iface, struct ifnet *ifp)
pipex_iface->multicast_session = session;
}
-void
+Static void
pipex_iface_start(struct pipex_iface_context *pipex_iface)
{
pipex_iface->pipexmode = 1;
}
-void
+Static void
pipex_iface_stop(struct pipex_iface_context *pipex_iface)
{
struct pipex_session *session;
struct pipex_session *session_next;
- int s;
- s = splnet();
pipex_iface->pipexmode = 0;
/*
* traversal all pipex sessions.
@@ -209,6 +207,18 @@ pipex_iface_stop(struct pipex_iface_context *pipex_iface)
if (session->pipex_iface == pipex_iface)
pipex_destroy_session(session);
}
+}
+
+void
+pipex_iface_fini(struct pipex_iface_context *pipex_iface)
+{
+ int s;
+
+ s = splnet();
+
+ pool_put(&pipex_session_pool, pipex_iface->multicast_session);
+ pipex_iface_stop(pipex_iface);
+
splx(s);
}
diff --git a/sys/net/pipex.h b/sys/net/pipex.h
index 3d4fcbfefef..6ebcc4d927c 100644
--- a/sys/net/pipex.h
+++ b/sys/net/pipex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.h,v 1.18 2014/07/11 16:24:00 yasuoka Exp $ */
+/* $OpenBSD: pipex.h,v 1.19 2014/10/21 10:52:53 yasuoka Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -194,8 +194,7 @@ struct pipex_iface_context {
__BEGIN_DECLS
void pipex_init (void);
void pipex_iface_init (struct pipex_iface_context *, struct ifnet *);
-void pipex_iface_start (struct pipex_iface_context *);
-void pipex_iface_stop (struct pipex_iface_context *);
+void pipex_iface_fini (struct pipex_iface_context *);
int pipex_notify_close_session(struct pipex_session *session);
int pipex_notify_close_session_all(void);
diff --git a/sys/net/pipex_local.h b/sys/net/pipex_local.h
index 520704fb7cd..8daa8924f85 100644
--- a/sys/net/pipex_local.h
+++ b/sys/net/pipex_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex_local.h,v 1.19 2013/04/20 07:54:28 yasuoka Exp $ */
+/* $OpenBSD: pipex_local.h,v 1.20 2014/10/21 10:52:53 yasuoka Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -374,6 +374,8 @@ extern struct pipex_hash_head pipex_id_hashtable[];
/*
* static function prototypes
*/
+Static void pipex_iface_start (struct pipex_iface_context *);
+Static void pipex_iface_stop (struct pipex_iface_context *);
Static int pipex_add_session (struct pipex_session_req *, struct pipex_iface_context *);
Static int pipex_close_session (struct pipex_session_close_req *);
Static int pipex_config_session (struct pipex_session_config_req *);