[PATCH 0/4] net: bridge: mcast: add multicast exponential field encoding

Ujjal Roy posted 4 patches 1 week ago
There is a newer version of this series
include/linux/igmp.h      | 158 +++++++++++++++++++++++++++++++--
include/net/mld.h         | 179 ++++++++++++++++++++++++++++++++++++--
net/bridge/br_multicast.c |  22 +++--
net/ipv4/igmp.c           |   6 +-
net/ipv6/mcast.c          |  19 +---
5 files changed, 336 insertions(+), 48 deletions(-)
[PATCH 0/4] net: bridge: mcast: add multicast exponential field encoding
Posted by Ujjal Roy 1 week ago
Description:
This series addresses a mismatch in how multicast query
intervals and response codes are handled across IPv4 (IGMPv3)
and IPv6 (MLDv2). While decoding logic currently exists,
the corresponding encoding logic is missing during query
packet generation. This leads to incorrect intervals being
transmitted when values exceed their linear thresholds.

The patches introduce a unified floating-point encoding
approach based on RFC3376 and RFC3810, ensuring that large
intervals are correctly represented in QQIC and MRC fields
using the exponent-mantissa format.

Key Changes:
* ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
  Removes legacy macros in favor of a cleaner, unified
  calculation for retrieving intervals from encoded fields,
  improving code maintainability.

* ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
  Standardizes MLDv2 terminology by renaming mldv2_mrc()
  to mldv2_mrd() (Maximum Response Delay) and introducing
  a new API mldv2_qqi for QQI calculation, improving code
  readability.

* ipv4: igmp: encode multicast exponential fields
  Introduces the logic to dynamically calculate the exponent
  and mantissa using bit-scan (fls). This ensures QQIC and
  MRC fields (8-bit) are properly encoded when transmitting
  query packets with intervals that exceed their respective
  linear threshold value of 128 (for QQI/MRT).

* ipv6: mld: encode multicast exponential fields
  Applies similar encoding logic for MLDv2. This ensures
  QQIC (8-bit) and MRC (16-bit) fields are properly encoded
  when transmitting query packets with intervals that exceed
  their respective linear thresholds (128 for QQI; 32768
  for MRD).

Impact:
These changes ensure that multicast queriers and listeners
stay synchronized on timing intervals, preventing protocol
timeouts or premature group membership expiration caused
by incorrectly formatted packet headers.

Ujjal Roy (4):
  ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
  ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
  ipv4: igmp: encode multicast exponential fields
  ipv6: mld: encode multicast exponential fields

 include/linux/igmp.h      | 158 +++++++++++++++++++++++++++++++--
 include/net/mld.h         | 179 ++++++++++++++++++++++++++++++++++++--
 net/bridge/br_multicast.c |  22 +++--
 net/ipv4/igmp.c           |   6 +-
 net/ipv6/mcast.c          |  19 +---
 5 files changed, 336 insertions(+), 48 deletions(-)

-- 
2.43.0
Re: [PATCH 0/4] net: bridge: mcast: add multicast exponential field encoding
Posted by Nikolay Aleksandrov 6 days, 12 hours ago
On 26/03/2026 17:07, Ujjal Roy wrote:
> Description:
> This series addresses a mismatch in how multicast query
> intervals and response codes are handled across IPv4 (IGMPv3)
> and IPv6 (MLDv2). While decoding logic currently exists,
> the corresponding encoding logic is missing during query
> packet generation. This leads to incorrect intervals being
> transmitted when values exceed their linear thresholds.
> 
> The patches introduce a unified floating-point encoding
> approach based on RFC3376 and RFC3810, ensuring that large
> intervals are correctly represented in QQIC and MRC fields
> using the exponent-mantissa format.
> 
> Key Changes:
> * ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
>    Removes legacy macros in favor of a cleaner, unified
>    calculation for retrieving intervals from encoded fields,
>    improving code maintainability.
> 
> * ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
>    Standardizes MLDv2 terminology by renaming mldv2_mrc()
>    to mldv2_mrd() (Maximum Response Delay) and introducing
>    a new API mldv2_qqi for QQI calculation, improving code
>    readability.
> 
> * ipv4: igmp: encode multicast exponential fields
>    Introduces the logic to dynamically calculate the exponent
>    and mantissa using bit-scan (fls). This ensures QQIC and
>    MRC fields (8-bit) are properly encoded when transmitting
>    query packets with intervals that exceed their respective
>    linear threshold value of 128 (for QQI/MRT).
> 
> * ipv6: mld: encode multicast exponential fields
>    Applies similar encoding logic for MLDv2. This ensures
>    QQIC (8-bit) and MRC (16-bit) fields are properly encoded
>    when transmitting query packets with intervals that exceed
>    their respective linear thresholds (128 for QQI; 32768
>    for MRD).
> 
> Impact:
> These changes ensure that multicast queriers and listeners
> stay synchronized on timing intervals, preventing protocol
> timeouts or premature group membership expiration caused
> by incorrectly formatted packet headers.
> 

Can you add selftests which cover these cases?
Re: [PATCH 0/4] net: bridge: mcast: add multicast exponential field encoding
Posted by Nikolay Aleksandrov 6 days, 7 hours ago
On 27/03/2026 08:41, Nikolay Aleksandrov wrote:
> On 26/03/2026 17:07, Ujjal Roy wrote:
>> Description:
>> This series addresses a mismatch in how multicast query
>> intervals and response codes are handled across IPv4 (IGMPv3)
>> and IPv6 (MLDv2). While decoding logic currently exists,
>> the corresponding encoding logic is missing during query
>> packet generation. This leads to incorrect intervals being
>> transmitted when values exceed their linear thresholds.
>>
>> The patches introduce a unified floating-point encoding
>> approach based on RFC3376 and RFC3810, ensuring that large
>> intervals are correctly represented in QQIC and MRC fields
>> using the exponent-mantissa format.
>>
>> Key Changes:
>> * ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
>>    Removes legacy macros in favor of a cleaner, unified
>>    calculation for retrieving intervals from encoded fields,
>>    improving code maintainability.
>>
>> * ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
>>    Standardizes MLDv2 terminology by renaming mldv2_mrc()
>>    to mldv2_mrd() (Maximum Response Delay) and introducing
>>    a new API mldv2_qqi for QQI calculation, improving code
>>    readability.
>>
>> * ipv4: igmp: encode multicast exponential fields
>>    Introduces the logic to dynamically calculate the exponent
>>    and mantissa using bit-scan (fls). This ensures QQIC and
>>    MRC fields (8-bit) are properly encoded when transmitting
>>    query packets with intervals that exceed their respective
>>    linear threshold value of 128 (for QQI/MRT).
>>
>> * ipv6: mld: encode multicast exponential fields
>>    Applies similar encoding logic for MLDv2. This ensures
>>    QQIC (8-bit) and MRC (16-bit) fields are properly encoded
>>    when transmitting query packets with intervals that exceed
>>    their respective linear thresholds (128 for QQI; 32768
>>    for MRD).
>>
>> Impact:
>> These changes ensure that multicast queriers and listeners
>> stay synchronized on timing intervals, preventing protocol
>> timeouts or premature group membership expiration caused
>> by incorrectly formatted packet headers.
>>
> 
> Can you add selftests which cover these cases?
> 
> 

Forgot to mention - for improvements and new features please target net-next.

Cheers,
  Nik