Hello,

On Sat, 9 Jul 2022 01:43:41 +0300
Vitaliy Makkoveev <m...@openbsd.org> wrote:
> On Sat, Jul 09, 2022 at 12:08:49AM +0300, Vitaliy Makkoveev wrote:
>> Thanks for pointing.
>> 
>> > On 8 Jul 2022, at 23:13, Alexander Bluhm <alexander.bl...@gmx.net> wrote:
>> > 
>> > On Fri, Jul 08, 2022 at 05:42:23PM +0300, Vitaliy Makkoveev wrote:
>> >> The update diff below. I also found we need to increment 'pxc_oerrors'
>> >> counter on `session_tmp' instead of session.
>> > 
>> >> +                 m = m_copym(m0, 0, M_COPYALL, M_NOWAIT)
>> > 
>> > Does this compile?  There is a ; missing.
>> > 
>> > otherwise OK bluhm@
>> > 
>> 
> 
> The fixed diff. yasuoka@, it this diff ok by you?

Other than the compile error, ok yasuoka

but the last diff seems not ok.

> Index: sys/net/pipex.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pipex.c,v
> retrieving revision 1.143
> diff -u -p -r1.143 pipex.c
> --- sys/net/pipex.c   2 Jul 2022 08:50:42 -0000       1.143
> +++ sys/net/pipex.c   7 Jul 2022 21:52:16 -0000
> @@ -842,20 +842,39 @@ pipex_ip_output(struct mbuf *m0, struct 
>  
>               m0->m_flags &= ~(M_BCAST|M_MCAST);
>  
> -             LIST_FOREACH(session_tmp, &pipex_session_list, session_list) {
> +             mtx_enter(&pipex_list_mtx);
> +
> +             session_tmp = LIST_FIRST(&pipex_session_list);
> +             while (session_tmp != NULL) {
> +                     struct pipex_session *session_save = NULL;
> +
>                       if (session_tmp->ownersc != session->ownersc)
> -                             continue;
> +                             goto next;
>                       if ((session->flags & (PIPEX_SFLAGS_IP_FORWARD |
>                           PIPEX_SFLAGS_IP6_FORWARD)) == 0)
> -                             continue;
> +                             goto next;
>                       m = m_copym(m0, 0, M_COPYALL, M_NOWAIT);
>                       if (m == NULL) {
>                               counters_inc(session->stat_counters,
>                                   pxc_oerrors);
> -                             continue;
> +                             goto next;
>                       }
> +
> +                     refcnt_take(&session->pxs_refcnt);
> +                     mtx_leave(&pipex_list_mtx);
> +

it lost 2 things?

- "need to increment 'pxc_oerrors' counter on `session_tmp' instead of
  session."
- "unlock list just before m_copym(9) call"

>                       pipex_ppp_output(m, session_tmp, PPP_IP);
> +
> +                     mtx_enter(&pipex_list_mtx);
> +                     session_save = session_tmp;
> +next:
> +                     session_tmp = LIST_NEXT(session_tmp, session_list);
> +                     if (session_save != NULL)
> +                             pipex_rele_session(session_save);
>               }
> +
> +             mtx_leave(&pipex_list_mtx);
> +
>               m_freem(m0);
>       }
>  
> 

Reply via email to