Index | Thread | Search

From:
Alexander Bluhm <alexander.bluhm@gmx.net>
Subject:
Re: assert inp has correct IPv6 flag
To:
Alexandr Nedvedicky <sashan@fastmail.net>
Cc:
tech@openbsd.org
Date:
Fri, 19 Jan 2024 21:30:08 +0100

Download raw body.

Thread
On Fri, Jan 19, 2024 at 08:18:44PM +0100, Alexandr Nedvedicky wrote:
> > -		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;
> 
>     is change above intentional? the check makes sense here, I'm just asking
>     because you have not mentioned that. 

The only change is removing #ifdef and the /* table ... */ comment.
It is just moving the KASSERT at the beginning of the loop.
Diff's distribution of - and + makes it hard to spot.