When pipex(4) session state is PIPEX_STATE_CLOSE_WAIT{,2} this means the
session is already reached time to live timeout, and the garbage
collector waits a little to before kill it. The meaning of `idle_time'
has been changed.

Don't reset `idle_time' timeout for such sessions in packet processing
path, because they are already dead. Otherwise we could make session's
life time more then PIPEX_CLOSE_TIMEOUT.

Index: sys/net/pipex.c
===================================================================
RCS file: /cvs/src/sys/net/pipex.c,v
retrieving revision 1.138
diff -u -p -r1.138 pipex.c
--- sys/net/pipex.c     26 Jun 2022 15:50:21 -0000      1.138
+++ sys/net/pipex.c     26 Jun 2022 16:51:12 -0000
@@ -779,7 +779,8 @@ pipex_ip_output(struct mbuf *m0, struct 
                        if (is_idle == 0) {
                                mtx_enter(&pipex_list_mtx);
                                /* update expire time */
-                               session->idle_time = 0;
+                               if (session->state == PIPEX_STATE_OPENED)
+                                       session->idle_time = 0;
                                mtx_leave(&pipex_list_mtx);
                        }
                }
@@ -1001,7 +1002,8 @@ pipex_ip_input(struct mbuf *m0, struct p
                if (is_idle == 0) {
                        /* update expire time */
                        mtx_enter(&pipex_list_mtx);
-                       session->idle_time = 0;
+                       if (session->state == PIPEX_STATE_OPENED)
+                               session->idle_time = 0;
                        mtx_leave(&pipex_list_mtx);
                }
        }

Reply via email to