summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-04-16 07:36:56 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-04-16 07:36:56 +0000
commitdf45f70f4a8b24517b5e673b1c6e3210e3643e78 (patch)
tree535735888fc701bc047b1f66fa21806998c330aa /sys/net
parent3780e5b4f5289810482231b4c6ddad6246050a65 (diff)
When pipex session is terminated by idle timer, there was a problem that
the session is removed from the pipex_closed_wait_list twice, fixed it. It always causes panic because QUEUE_MACRO_DEBUG is enabled by default. Also remove some needless (struct pipex_session *) casts.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pipex.c20
-rw-r--r--sys/net/pipex_local.h5
2 files changed, 13 insertions, 12 deletions
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index b15b3f79b05..a40ed53101e 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.40 2013/03/28 23:10:05 tedu Exp $ */
+/* $OpenBSD: pipex.c,v 1.41 2013/04/16 07:36:55 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -520,7 +520,7 @@ pipex_close_session(struct pipex_session_close_req *req)
/* remove from close_wait list */
if (session->state == PIPEX_STATE_CLOSE_WAIT)
- LIST_REMOVE((struct pipex_session *)session, state_list);
+ LIST_REMOVE(session, state_list);
/* get statistics before destroy the session */
req->pcr_stat = session->stat;
@@ -579,9 +579,10 @@ pipex_get_closed(struct pipex_session_list_req *req)
while (!LIST_EMPTY(&pipex_close_wait_list)) {
session = LIST_FIRST(&pipex_close_wait_list);
req->plr_ppp_id[req->plr_ppp_id_count++] = session->ppp_id;
- LIST_REMOVE((struct pipex_session *)session, state_list);
+ LIST_REMOVE(session, state_list);
+ session->state = PIPEX_STATE_CLOSE_WAIT2;
if (req->plr_ppp_id_count >= PIPEX_MAX_LISTREQ) {
- if (LIST_NEXT(session, state_list))
+ if (!LIST_EMPTY(&pipex_close_wait_list))
req->plr_flags |= PIPEX_LISTREQ_MORE;
break;
}
@@ -607,18 +608,16 @@ pipex_destroy_session(struct pipex_session *session)
KASSERT(rn != NULL);
}
- LIST_REMOVE((struct pipex_session *)session, id_chain);
- LIST_REMOVE((struct pipex_session *)session, session_list);
+ LIST_REMOVE(session, id_chain);
+ LIST_REMOVE(session, session_list);
#ifdef PIPEX_PPTP
if (session->protocol == PIPEX_PROTO_PPTP) {
- LIST_REMOVE((struct pipex_session *)session,
- peer_addr_chain);
+ LIST_REMOVE(session, peer_addr_chain);
}
#endif
#ifdef PIPEX_L2TP
if (session->protocol == PIPEX_PROTO_L2TP) {
- LIST_REMOVE((struct pipex_session *)session,
- peer_addr_chain);
+ LIST_REMOVE(session, peer_addr_chain);
}
#endif
/* if final session is destroyed, stop timer */
@@ -850,6 +849,7 @@ pipex_timer(void *ignored_arg)
break;
case PIPEX_STATE_CLOSE_WAIT:
+ case PIPEX_STATE_CLOSE_WAIT2:
session->stat.idle_time++;
if (session->stat.idle_time < PIPEX_CLOSE_TIMEOUT)
continue;
diff --git a/sys/net/pipex_local.h b/sys/net/pipex_local.h
index 51e1eeb1ec4..5b6ac77bafa 100644
--- a/sys/net/pipex_local.h
+++ b/sys/net/pipex_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex_local.h,v 1.17 2012/09/19 17:50:17 yasuoka Exp $ */
+/* $OpenBSD: pipex_local.h,v 1.18 2013/04/16 07:36:55 yasuoka Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -162,7 +162,8 @@ struct pipex_session {
#define PIPEX_STATE_INITIAL 0x0000
#define PIPEX_STATE_OPENED 0x0001
#define PIPEX_STATE_CLOSE_WAIT 0x0002
-#define PIPEX_STATE_CLOSED 0x0003
+#define PIPEX_STATE_CLOSE_WAIT2 0x0003
+#define PIPEX_STATE_CLOSED 0x0004
uint16_t ip_forward:1, /* {en|dis}ableIP forwarding */
ip6_forward:1, /* {en|dis}able IPv6 forwarding */