From: Alexandr Nedvedicky Subject: Re: assert inp has correct IPv6 flag To: Alexander Bluhm Cc: tech@openbsd.org Date: Fri, 19 Jan 2024 20:18:44 +0100 Hello, everything looks good to me. I have a question, see below. On Fri, Jan 19, 2024 at 05:50:57PM +0100, Alexander Bluhm wrote: > Index: netinet/udp_usrreq.c > =================================================================== > RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v > diff -u -p -r1.314 udp_usrreq.c > --- netinet/udp_usrreq.c 19 Jan 2024 02:24:07 -0000 1.314 > +++ netinet/udp_usrreq.c 19 Jan 2024 16:00:13 -0000 > @@ -381,7 +381,7 @@ udp_input(struct mbuf **mp, int *offp, i > > if (m->m_flags & (M_BCAST|M_MCAST)) { > SIMPLEQ_HEAD(, inpcb) inpcblist; > - struct inpcbtable *tb; > + struct inpcbtable *table; > > /* > * Deliver a multicast or broadcast datagram to *all* sockets > @@ -406,23 +406,21 @@ udp_input(struct mbuf **mp, int *offp, i > SIMPLEQ_INIT(&inpcblist); > #ifdef INET6 > if (ip6) > - tb = &udb6table; > + table = &udb6table; > else > #endif > - tb = &udbtable; > + table = &udbtable; > > - rw_enter_write(&tb->inpt_notify); > - mtx_enter(&tb->inpt_mtx); > - TAILQ_FOREACH(inp, &tb->inpt_queue, inp_queue) { > - if (inp->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE) > - continue; > -#ifdef INET6 > - /* table is per AF, panic if it does not match */ > + rw_enter_write(&table->inpt_notify); > + mtx_enter(&table->inpt_mtx); > + TAILQ_FOREACH(inp, &table->inpt_queue, inp_queue) { > if (ip6) > KASSERT(ISSET(inp->inp_flags, INP_IPV6)); > else > KASSERT(!ISSET(inp->inp_flags, INP_IPV6)); > -#endif > + > + if (inp->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE) > + continue; > if (rtable_l2(inp->inp_rtableid) != > rtable_l2(m->m_pkthdr.ph_rtableid)) > continue; is change above intentional? the check makes sense here, I'm just asking because you have not mentioned that. perhaps you might want to ask tb@ if it is ok to replace tb with table. OK sashan