Re: pf: broken RB comparator drops IPv6 fragments

Alexandr Nedvedicky <[email protected]>
Newsgroups gmane.os.openbsd.bugs
Message-ID <[email protected]>
Hello,

On Fri, Apr 10, 2026 at 11:20:34AM +0200, Otto Moerbeek wrote:
> On Fri, Apr 10, 2026 at 10:41:32AM +0200, Alexandr Nedvedicky wrote:
> 
> > Hello,
> > 
> > On Fri, Apr 10, 2026 at 08:56:33AM +0200, Renaud Allard wrote:
> > > pf_frag_compare() in sys/net/pf_norm.c uses subtraction to compare
> > > u_int32_t fragment IDs:
> > > 
> > > 	if ((diff = a->fr_id - b->fr_id) != 0)
> > > 		return (diff);
> > > 
> > 
> > </snip>
> > 
> >     I wonder if diff below would work too here...
> 
> Maybe, but it's hard to reason about that as it requires intimate
> knowledge of the (implicit) type conversion rules. I much prefer
> writing it out in a clear way as Renaud did. See also the comment in
> qsort(3).
> 
> 	-Otto


    the Renaud's diff is OK sahsan@ then.


thanks and
regards
sashan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.