Bug 209270

Summary: [igmp] logic error in igmp_v3_suppress_group_record
Product: Base System Reporter: Miles Ohlrich <turingsboy>
Component: kernAssignee: freebsd-net mailing list <net>
Status: New ---    
Severity: Affects Only Me CC: bms
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Miles Ohlrich 2016-05-04 20:45:16 UTC
In igmp_v2_suppress_group_record, I see the following:

        if (inm->inm_state != IGMP_G_QUERY_PENDING_MEMBER ||
            inm->inm_state != IGMP_SG_QUERY_PENDING_MEMBER)
                return;

This is always true due to the logical OR.

It looks like it should be this:

        if (inm->inm_state != IGMP_G_QUERY_PENDING_MEMBER &&
            inm->inm_state != IGMP_SG_QUERY_PENDING_MEMBER)
                return;

I do not know the affect of the change, but the code as written looks 
very suspiciously like a programming error.
Comment 1 Enji Cooper freebsd_committer 2016-05-04 21:22:17 UTC
This change has been in since 2009:

71233409e (bms     2009-03-09 17:53:05 +0000 1939)      if (inm->inm_state != IGMP_G_QUERY_PENDING_MEMBER ||
71233409e (bms     2009-03-09 17:53:05 +0000 1940)          inm->inm_state != IGMP_SG_QUERY_PENDING_MEMBER)
71233409e (bms     2009-03-09 17:53:05 +0000 1941)              return;

I agree with this likely being a logic error. Forwarding over to net@ for inspection though.