net: bridge: mcast: support exponential field encoding
Subsystems (5)
v4 cover net: bridge: mcast: support exponential field encoding
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).
* selftests: net: bridge: add MRC and QQIC field encoding tests Updates bridge selftests to validate both linear and non-linear (exponential) encoding for MRC and QQIC fields, ensuring protocol compliance across IGMPv3 and MLDv2.
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.
Test results:
Giving results only from vlmc_query_intvl_test and vlmc_query_response_intvl_test of the script bridge_vlan_mcast.sh.
Without patchset, here is the result.
- TEST: Vlan multicast snooping enable [ OK ]
- TEST: Vlan mcast_query_interval global option default value [ OK ]
- INFO: Vlan 10 mcast_query_interval (QQIC) test cases:
- TEST: Number of tagged IGMPv2 general query [ OK ]
- TEST: IGMPv3 QQIC linear value 60 [ OK ]
- TEST: MLDv2 QQIC linear value 60 [ OK ]
- TEST: IGMPv3 QQIC non linear value 160 [FAIL]
- Wrong QQIC in generated IGMPv3 general queries
- TEST: MLDv2 QQIC non linear value 160 [FAIL]
- Wrong QQIC in generated MLDv2 general queries
- TEST: Vlan mcast_query_response_interval global option default value [ OK ]
- INFO: Vlan 10 mcast_query_response_interval (MRC) test cases:
- TEST: IGMPv3 MRC linear value 60 [ OK ]
- TEST: IGMPv3 MRC non linear value 160 [FAIL]
- Wrong MRC in generated IGMPv3 general queries
- TEST: MLDv2 MRC linear value 30000 [ OK ]
- TEST: MLDv2 MRC non linear value 60000 [FAIL]
- Wrong MRC in generated MLDv2 general queries
With these patchset, here is the result.
* TEST: Vlan multicast snooping enable [ OK ]
* TEST: Vlan mcast_query_interval global option default value [ OK ]
* INFO: Vlan 10 mcast_query_interval (QQIC) test cases:
* TEST: Number of tagged IGMPv2 general query [ OK ]
* TEST: IGMPv3 QQIC linear value 60 [ OK ]
* TEST: MLDv2 QQIC linear value 60 [ OK ]
* TEST: IGMPv3 QQIC non linear value 160 [ OK ]
* TEST: MLDv2 QQIC non linear value 160 [ OK ]
* TEST: Vlan mcast_query_response_interval global option default value [ OK ]
* INFO: Vlan 10 mcast_query_response_interval (MRC) test cases:
* TEST: IGMPv3 MRC linear value 60 [ OK ]
* TEST: IGMPv3 MRC non linear value 160 [ OK ]
* TEST: MLDv2 MRC linear value 30000 [ OK ]
* TEST: MLDv2 MRC non linear value 60000 [ OK ]
v4:
- Removed binary application and related codes for selftests
- Decided hard coded match based on extra arguments for selftests
- Ran shellcheck on modified selftests code and fixed
- Updated comments on patch[1,2,3,4] as per review
- Added 'Reviewed-by:' as requested on patch4
v3:
- Updated the series title for better clarity; old one is here
https://lore.kernel.org/all/[email protected]/
- Added key changes section for new selftests patch
- Updated netdev style comments and addressed review comments
- Fixed MLDv2 MRC conversion logic during query generation
- Mentioned intervals in units wherever applicable
- Dropped type casting and fixed indentations
v2:
- Retargeted the series to net-next as suggested
- Fixed a compilation warning in the MLD rename change
- Kept reverse xmas tree order in IGMP exponential encoding change
- Added bridge selftests to validate IGMPv3 Query MRC and QQIC handling
Ujjal Roy (5):
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
selftests: net: bridge: add MRC and QQIC field encoding tests
include/linux/igmp.h | 167 +++++++++++++++- include/net/mld.h | 183 +++++++++++++++++- net/bridge/br_multicast.c | 22 +-- net/ipv4/igmp.c | 6 +- net/ipv6/mcast.c | 19 +- .../net/forwarding/bridge_vlan_mcast.sh | 150 +++++++++++++- 6 files changed, 491 insertions(+), 56 deletions(-)
base-commit: 3f3a2aefbc661b837c8e344f944982d61c2ae037
Signature · 1 line
2.43.0
PATCH v4 1/5 ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
Get rid of the IGMPV3_MRC macro and use the igmpv3_mrt() API to calculate the Max Resp Time from the Maximum Response Code.
Similarly, for IGMPV3_QQIC, use the igmpv3_qqi() API to calculate the Querier's Query Interval from the QQIC field.
--- include/linux/igmp.h | 80 +++++++++++++++++++++++++++++++++++---- net/bridge/br_multicast.c | 2 +- net/ipv4/igmp.c | 6 +-- 3 files changed, 76 insertions(+), 12 deletions(-)
include/linux/igmp.h +72 -8
@@ -92,15 +92,79 @@ struct ip_mc_list {struct rcu_head rcu; }; +/* RFC3376, relevant sections: +* - 4.1.1. Maximum Response Code +* - 4.1.7. QQIC (Querier's Query Interval Code) +* +* For both MRC and QQIC, values >= 128 use the same floating-point +* encoding as follows: +* +* 0 1 2 3 4 5 6 7 +* +-+-+-+-+-+-+-+-+ +* |1| exp | mant | +* +-+-+-+-+-+-+-+-+ +*/ +#define IGMPV3_FP_EXP (value) (((value) >> 4) & 0x07) +#define IGMPV3_FP_MAN (value) ((value) & 0x0f) + +/* IGMPV3 floating-point exponential field threshold */ +#define IGMPV3_EXP_MIN_THRESHOLD 128 +/* V3 exponential field decoding */ -#define IGMPV3_MASK (value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) -#define IGMPV3_EXP (thresh, nbmant, nbexp, value) \ - ((value) < (thresh) ? (value) : \ - ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \ - (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp)))) - -#define IGMPV3_QQIC (value) IGMPV3_EXP(0x80, 4, 3, value) -#define IGMPV3_MRC (value) IGMPV3_EXP(0x80, 4, 3, value) + +/* IGMPv3 MRC/QQIC 8-bit exponential field decode +* +* RFC3376, 4.1.1 & 4.1.7. defines the decoding formula: +* 0 1 2 3 4 5 6 7 +* +-+-+-+-+-+-+-+-+ +* |1| exp | mant | +* +-+-+-+-+-+-+-+-+ +* Max Resp Time = (mant | 0x10) << (exp + 3) +* QQI = (mant | 0x10) << (exp + 3) +*/ +static inline unsigned long igmpv3_exp_field_decode (const u8 code) +{ +if (code <IGMPV3_EXP_MIN_THRESHOLD ) { +return code; + }else { +unsigned long mc_man, mc_exp; + + mc_exp =IGMPV3_FP_EXP (code); + mc_man =IGMPV3_FP_MAN (code); + +return (mc_man |0x10 ) << (mc_exp +3 ); + } +} + +/* Calculate Max Resp Time from Maximum Response Code +* +* RFC3376, relevant sections: +* - 4.1.1. Maximum Response Code +* - 8.3. Query Response Interval +* +* After decode, MRC represents the Maximum Response Time (MRT) in +* units of 0.1 seconds (100 ms). +*/ +static inline unsigned long igmpv3_mrt (const struct igmpv3_query *ih3) +{ +return igmpv3_exp_field_decode (ih3->code); +} + +/* Calculate Querier's Query Interval from Querier's Query Interval Code +* +* RFC3376, relevant sections: +* - 4.1.7. QQIC (Querier's Query Interval Code) +* - 8.2. Query Interval +* - 8.12. Older Version Querier Present Timeout +* (the [Query Interval] in the last Query received) +* +* After decode, QQIC represents the Querier's Query Interval in units +* of seconds. +*/ +static inline unsigned long igmpv3_qqi (const struct igmpv3_query *ih3) +{ +return igmpv3_exp_field_decode (ih3->qqic); +}static inline int ip_mc_may_pull (struct sk_buff *skb,unsigned int len) {
net/bridge/br_multicast.c +1 -1
@@ -3518,7 +3518,7 @@ static void br_ip4_multicast_query(struct net_bridge_mcast *brmctx, goto out; max_delay = ih3->code ? -IGMPV3_MRC (ih3->code) * (HZ /IGMP_TIMER_SCALE ) :1 ; +igmpv3_mrt (ih3) * (HZ /IGMP_TIMER_SCALE ) :1 ; }else { goto out; }
net/ipv4/igmp.c +3 -3
@@ -991,7 +991,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,* different encoding. We use the v3 encoding as more likely * to be intended in a v3 query. */ - max_delay =IGMPV3_MRC (ih3->code)*(HZ /IGMP_TIMER_SCALE ); + max_delay =igmpv3_mrt (ih3) * (HZ /IGMP_TIMER_SCALE );if (!max_delay) max_delay =1 ;/* can't mod w/ 0 */ }else {/* v3 */
@@ -1006,7 +1006,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ih3 =igmpv3_query_hdr (skb); } - max_delay =IGMPV3_MRC (ih3->code)*(HZ /IGMP_TIMER_SCALE ); + max_delay =igmpv3_mrt (ih3) * (HZ /IGMP_TIMER_SCALE );if (!max_delay) max_delay =1 ;/* can't mod w/ 0 */ WRITE_ONCE (in_dev->mr_maxdelay, max_delay);
@@ -1016,7 +1016,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,* configured value. */ in_dev->mr_qrv = ih3->qrv ?:READ_ONCE (net->ipv4.sysctl_igmp_qrv); - in_dev->mr_qi =IGMPV3_QQIC (ih3->qqic)*HZ ?:IGMP_QUERY_INTERVAL ; + in_dev->mr_qi =igmpv3_qqi (ih3) *HZ ? :IGMP_QUERY_INTERVAL ;/* RFC3376, 8.3. Query Response Interval: * The number of seconds represented by the [Query Response
Signature · 1 line
2.43.0
PATCH v4 2/5 ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
In reply to Ujjal RoyRename mldv2_mrc() to mldv2_mrd() as it is used to calculate the Maximum Response Delay from the Maximum Response Code.
Introduce a new API mldv2_qqi() to define the existing calculation logic of QQI from QQIC. This also organizes the existing mld_update_qi() API.
--- include/net/mld.h | 64 +++++++++++++++++++++++++++++++++------ net/bridge/br_multicast.c | 2 +- net/ipv6/mcast.c | 19 ++---------- 3 files changed, 59 insertions(+), 26 deletions(-)
include/net/mld.h +55 -9
@@ -89,29 +89,75 @@ struct mld2_query {#define MLDV2_QQIC_EXP (value) (((value) >> 4) & 0x07)#define MLDV2_QQIC_MAN (value) ((value) & 0x0f) -#define MLD_EXP_MIN_LIMIT 32768UL -#define MLDV1_MRD_MAX_COMPAT (MLD_EXP_MIN_LIMIT - 1) +#define MLD_QQIC_MIN_THRESHOLD 128 +#define MLD_MRC_MIN_THRESHOLD 32768UL +#define MLDV1_MRD_MAX_COMPAT (MLD_MRC_MIN_THRESHOLD - 1)#define MLD_MAX_QUEUE 8#define MLD_MAX_SKBS 32 -static inline unsigned long mldv2_mrc (const struct mld2_query *mlh2) +/* V2 exponential field decoding */ + +/* Calculate Maximum Response Delay from Maximum Response Code +* +* RFC3810, relevant sections: +* - 5.1.3. Maximum Response Code defines the decoding formula: +* 0 1 2 3 4 5 6 7 8 9 A B C D E F +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* |1| exp | mant | +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* Maximum Response Delay = (mant | 0x1000) << (exp+3) +* - 9.3. Query Response Interval +* +* After decode, MRC represents the Maximum Response Delay (MRD) in +* units of milliseconds. +*/ +static inline unsigned long mldv2_mrd (const struct mld2_query *mlh2) { -/* RFC3810, 5.1.3. Maximum Response Code */ -unsigned long ret, mc_mrc =ntohs (mlh2->mld2q_mrc); +unsigned long mc_mrc =ntohs (mlh2->mld2q_mrc); -if (mc_mrc <MLD_EXP_MIN_LIMIT ) { - ret = mc_mrc; +if (mc_mrc <MLD_MRC_MIN_THRESHOLD ) { +return mc_mrc; }else {unsigned long mc_man, mc_exp; mc_exp =MLDV2_MRC_EXP (mc_mrc); mc_man =MLDV2_MRC_MAN (mc_mrc); - ret = (mc_man |0x1000 ) << (mc_exp +3 ); +return (mc_man |0x1000 ) << (mc_exp +3 ); } +} -return ret; +/* Calculate Querier's Query Interval from Querier's Query Interval Code +* +* RFC3810, relevant sections: +* - 5.1.9. QQIC (Querier's Query Interval Code) defines the decoding formula: +* 0 1 2 3 4 5 6 7 +* +-+-+-+-+-+-+-+-+ +* |1| exp | mant | +* +-+-+-+-+-+-+-+-+ +* QQI = (mant | 0x10) << (exp + 3) +* - 9.2. Query Interval +* - 9.12. Older Version Querier Present Timeout +* (the [Query Interval] in the last Query received) +* +* After decode, QQIC represents the Querier's Query Interval in units +* of seconds. +*/ +static inline unsigned long mldv2_qqi (const struct mld2_query *mlh2) +{ +unsigned long qqic = mlh2->mld2q_qqic; + +if (qqic <MLD_QQIC_MIN_THRESHOLD ) { +return qqic; + }else { +unsigned long mc_man, mc_exp; + + mc_exp =MLDV2_QQIC_EXP (qqic); + mc_man =MLDV2_QQIC_MAN (qqic); + +return (mc_man |0x10 ) << (mc_exp +3 ); + } }#endif
net/bridge/br_multicast.c +1 -1
@@ -3606,7 +3606,7 @@ static int br_ip6_multicast_query(struct net_bridge_mcast *brmctx, mld2q->mld2q_suppress) goto out; - max_delay =max (msecs_to_jiffies (mldv2_mrc (mld2q)),1UL ); + max_delay =max (msecs_to_jiffies (mldv2_mrd (mld2q)),1UL ); } is_general_query = group &&ipv6_addr_any (group);
net/ipv6/mcast.c +3 -16
@@ -1315,20 +1315,7 @@ static void mld_update_qi(struct inet6_dev *idev,* - 9.12. Older Version Querier Present Timeout * (the [Query Interval] in the last Query received) */ -unsigned long mc_qqi; - -if (mlh2->mld2q_qqic <128 ) { - mc_qqi = mlh2->mld2q_qqic; - }else { -unsigned long mc_man, mc_exp; - - mc_exp =MLDV2_QQIC_EXP (mlh2->mld2q_qqic); - mc_man =MLDV2_QQIC_MAN (mlh2->mld2q_qqic); - - mc_qqi = (mc_man |0x10 ) << (mc_exp +3 ); - } - - idev->mc_qi = mc_qqi *HZ ; + idev->mc_qi =mldv2_qqi (mlh2) *HZ ; } static void mld_update_qri(struct inet6_dev *idev,
@@ -1338,7 +1325,7 @@ static void mld_update_qri(struct inet6_dev *idev,* - 5.1.3. Maximum Response Code * - 9.3. Query Response Interval */ - idev->mc_qri =msecs_to_jiffies (mldv2_mrc (mlh2)); + idev->mc_qri =msecs_to_jiffies (mldv2_mrd (mlh2)); } static int mld_process_v1(struct inet6_dev *idev, struct mld_msg *mld,
@@ -1390,7 +1377,7 @@ static int mld_process_v1(struct inet6_dev *idev, struct mld_msg *mld,static void mld_process_v2 (struct inet6_dev *idev,struct mld2_query *mld,unsigned long *max_delay) { - *max_delay =max (msecs_to_jiffies (mldv2_mrc (mld)),1UL ); + *max_delay =max (msecs_to_jiffies (mldv2_mrd (mld)),1UL );mld_update_qrv (idev, mld);mld_update_qi (idev, mld);
Signature · 1 line
2.43.0
PATCH v4 3/5 ipv4: igmp: encode multicast exponential fields
In reply to Ujjal RoyIn IGMP, MRC and QQIC fields are not correctly encoded when generating query packets. Since the receiver of the query interprets these fields using the IGMPv3 floating- point decoding logic, any value that exceeds the linear threshold is incorrectly parsed as an exponential value, leading to an incorrect interval calculation.
Encode and assign the corresponding protocol fields during query generation. Introduce the logic to dynamically calculate the exponent and mantissa using bit-scan (fls). This ensures MRC and QQIC fields (8-bit) are properly encoded when transmitting query packets with intervals that exceed their respective linear threshold value of 128 (for MRT/QQI).
RFC3376: for both MRC and QQIC, values >= 128 represent the same floating-point encoding as follows:
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|1| exp | mant |
+-+-+-+-+-+-+-+-+--- include/linux/igmp.h | 87 +++++++++++++++++++++++++++++++++++++++ net/bridge/br_multicast.c | 14 +++---- 2 files changed, 93 insertions(+), 8 deletions(-)
include/linux/igmp.h +87 -0
@@ -109,6 +109,93 @@ struct ip_mc_list {/* IGMPV3 floating-point exponential field threshold */ #define IGMPV3_EXP_MIN_THRESHOLD 128 +/* Max representable (mant = 0xF, exp = 7) -> 31744 */ +#define IGMPV3_EXP_MAX_THRESHOLD 31744 + +/* V3 exponential field encoding */ + +/* IGMPv3 MRC/QQIC 8-bit exponential field encode +* +* RFC3376, 4.1.1 & 4.1.7. defines only the decoding formula: +* MRT/QQI = (mant | 0x10) << (exp + 3) +* +* but does NOT define the encoding procedure. To derive exponent: +* +* For any value of mantissa and exponent, the decoding formula +* indicates that the "hidden bit" (0x10) is shifted 4 bits left +* to sit above the 4-bit mantissa. The RFC again shifts this +* entire block left by (exp + 3) to reconstruct the value. +* So, 'hidden bit' is the MSB which is shifted by (4 + exp + 3). +* +* Total left shift of the 'hidden bit' = 4 + (exp + 3) = exp + 7. +* This is the MSB at the 0-based bit position: (exp + 7). +* Since fls() is 1-based, fls(value) - 1 = exp + 7. +* +* Therefore: +* exp = fls(value) - 8 +* mant = (value >> (exp + 3)) & 0x0F +* +* Final encoding formula: +* 0x80 | (exp << 4) | mant +* +* Example (value = 3200): +* 0 1 +* 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* |0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0| (value = 3200) +* | ^-^-mant^ ^..(exp+3)..^| exp = 4, mant = 9 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* +* Encoded: +* 0x80 | (4 << 4) | 9 = 0xC9 +*/ +static inline u8 igmpv3_exp_field_encode (unsigned long value) +{ +u8 mc_exp, mc_man; + +/* MRC/QQIC < 128 is literal */ +if (value <IGMPV3_EXP_MIN_THRESHOLD ) +return value; + +/* Saturate at max representable (mant = 0xF, exp = 7) -> 31744 */ +if (value >=IGMPV3_EXP_MAX_THRESHOLD ) +return 0xFF ; + + mc_exp =fls (value) -8 ; + mc_man = (value >> (mc_exp +3 )) &0x0F ; + +return 0x80 | (mc_exp <<4 ) | mc_man; +} + +/* Calculate Maximum Response Code from Max Resp Time +* +* RFC3376, relevant sections: +* - 4.1.1. Maximum Response Code +* - 8.3. Query Response Interval +* +* MRC represents the encoded form of Max Resp Time (MRT); once +* decoded, the resulting value is in units of 0.1 seconds (100 ms). +*/ +static inline u8 igmpv3_mrc (unsigned long mrt) +{ +return igmpv3_exp_field_encode (mrt); +} + +/* Calculate Querier's Query Interval Code from Querier's Query Interval +* +* RFC3376, relevant sections: +* - 4.1.7. QQIC (Querier's Query Interval Code) +* - 8.2. Query Interval +* - 8.12. Older Version Querier Present Timeout +* (the [Query Interval] in the last Query received) +* +* QQIC represents the encoded form of Querier's Query Interval (QQI); +* once decoded, the resulting value is in units of seconds. +*/ +static inline u8 igmpv3_qqic (unsigned long qi) +{ +return igmpv3_exp_field_encode (qi); +}/* V3 exponential field decoding */
net/bridge/br_multicast.c +6 -8
@@ -934,12 +934,12 @@ static struct sk_buff *br_ip4_multicast_alloc_query(struct net_bridge_mcast *brmsize_t pkt_size, igmp_hdr_size;unsigned long now = jiffies;struct igmpv3_query *ihv3; +unsigned long lmqt, mrt;void *csum_start =NULL ;__sum16 *csum =NULL ;struct sk_buff *skb;struct igmphdr *ih;struct ethhdr *eth; -unsigned long lmqt;struct iphdr *iph;u16 lmqt_srcs =0 ;
@@ -1004,15 +1004,15 @@ static struct sk_buff *br_ip4_multicast_alloc_query(struct net_bridge_mcast *brmskb_put (skb,24 );skb_set_transport_header (skb, skb->len); + mrt = group ? brmctx->multicast_last_member_interval : + brmctx->multicast_query_response_interval; *igmp_type =IGMP_HOST_MEMBERSHIP_QUERY ;switch (brmctx->multicast_igmp_version) {case 2 : ih =igmp_hdr (skb); ih->type =IGMP_HOST_MEMBERSHIP_QUERY ; - ih->code = (group ? brmctx->multicast_last_member_interval : - brmctx->multicast_query_response_interval) / - (HZ /IGMP_TIMER_SCALE ); + ih->code = mrt / (HZ /IGMP_TIMER_SCALE ); ih->group = group; ih->csum =0 ; csum = &ih->csum;
@@ -1021,11 +1021,9 @@ static struct sk_buff *br_ip4_multicast_alloc_query(struct net_bridge_mcast *brmcase 3 : ihv3 =igmpv3_query_hdr (skb); ihv3->type =IGMP_HOST_MEMBERSHIP_QUERY ; - ihv3->code = (group ? brmctx->multicast_last_member_interval : - brmctx->multicast_query_response_interval) / - (HZ /IGMP_TIMER_SCALE ); + ihv3->code =igmpv3_mrc (mrt / (HZ /IGMP_TIMER_SCALE )); ihv3->group = group; - ihv3->qqic = brmctx->multicast_query_interval /HZ ; + ihv3->qqic =igmpv3_qqic (brmctx->multicast_query_interval /HZ ); ihv3->nsrcs =htons (lmqt_srcs); ihv3->resv =0 ; ihv3->suppress = sflag;
Signature · 1 line
2.43.0
PATCH v4 4/5 ipv6: mld: encode multicast exponential fields
In reply to Ujjal RoyIn MLD, MRC and QQIC fields are not correctly encoded when generating query packets. Since the receiver of the query interprets these fields using the MLDv2 floating-point decoding logic, any value that exceeds the linear threshold is incorrectly parsed as an exponential value, leading to an incorrect interval calculation.
Encode and assign the corresponding protocol fields during query generation. Introduce the logic to dynamically calculate the exponent and mantissa using bit-scan (fls). This ensures MRC (16-bit) and QQIC (8-bit) fields are properly encoded when transmitting query packets with intervals that exceed their respective linear thresholds (32768 for MRD; 128 for QQI).
RFC3810: If Maximum Response Code >= 32768, the Maximum Response Code field represents a floating-point value as follows:
0 1 2 3 4 5 6 7 8 9 A B C D E F
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1| exp | mant |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+RFC3810: If QQIC >= 128, the QQIC field represents a floating-point value as follows:
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|1| exp | mant |
+-+-+-+-+-+-+-+-+--- include/net/mld.h | 119 ++++++++++++++++++++++++++++++++++++++ net/bridge/br_multicast.c | 4 +- 2 files changed, 121 insertions(+), 2 deletions(-)
include/net/mld.h +119 -0
@@ -90,12 +90,131 @@ struct mld2_query {#define MLDV2_QQIC_MAN (value) ((value) & 0x0f)#define MLD_QQIC_MIN_THRESHOLD 128 +/* Max representable (mant = 0xF, exp = 7) -> 31744 */ +#define MLD_QQIC_MAX_THRESHOLD 31744#define MLD_MRC_MIN_THRESHOLD 32768UL +/* Max representable (mant = 0xFFF, exp = 7) -> 8387584 */ +#define MLD_MRC_MAX_THRESHOLD 8387584#define MLDV1_MRD_MAX_COMPAT (MLD_MRC_MIN_THRESHOLD - 1)#define MLD_MAX_QUEUE 8#define MLD_MAX_SKBS 32 +/* V2 exponential field encoding */ + +/* +* Calculate Maximum Response Code from Maximum Response Delay +* +* MRC represents the 16-bit encoded form of Maximum Response Delay (MRD); +* once decoded, the resulting value is in milliseconds. +* +* RFC3810, 5.1.3. defines only the decoding formula: +* Maximum Response Delay = (mant | 0x1000) << (exp + 3) +* +* but does NOT define the encoding procedure. To derive exponent: +* +* For the 16-bit MRC, the "hidden bit" (0x1000) is left shifted by 12 to +* sit above the 12-bit mantissa. The RFC then shifts this entire block +* left by (exp + 3) to reconstruct the value. So, 'hidden bit' is the +* MSB which is shifted by (12 + exp + 3). +* +* Total left shift of the hidden bit = 12 + (exp + 3) = exp + 15. +* This is the MSB at the 0-based bit position: (exp + 15). +* Since fls() is 1-based, fls(value) - 1 = exp + 15. +* +* Therefore: +* exp = fls(value) - 16 +* mant = (value >> (exp + 3)) & 0x0FFF +* +* Final encoding formula: +* 0x8000 | (exp << 12) | mant +* +* Example (value = 1311744): +* 0 1 2 3 +* 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* |0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0| 1311744 +* | ^-^--------mant---------^ ^...(exp+3)...^| exp=5 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* +* Encoded: +* 0x8000 | (5 << 12) | 0x404 = 0xD404 +*/ +static inline u16 mldv2_mrc (unsigned long mrd) +{ +u16 mc_man, mc_exp; + +/* MRC < 32768 is literal */ +if (mrd <MLD_MRC_MIN_THRESHOLD ) +return mrd; + +/* Saturate at max representable (mant = 0xFFF, exp = 7) -> 8387584 */ +if (mrd >=MLD_MRC_MAX_THRESHOLD ) +return 0xFFFF ; + + mc_exp =fls (mrd) -16 ; + mc_man = (mrd >> (mc_exp +3 )) &0x0FFF ; + +return 0x8000 | (mc_exp <<12 ) | mc_man; +} + +/* +* Calculate Querier's Query Interval Code from Querier's Query Interval +* +* QQIC represents the 8-bit encoded form of Querier's Query Interval (QQI); +* once decoded, the resulting value is in seconds. +* +* RFC3810, 5.1.9. defines only the decoding formula: +* QQI = (mant | 0x10) << (exp + 3) +* +* but does NOT define the encoding procedure. To derive exponent: +* +* For any value of mantissa and exponent, the decoding formula indicates +* that the "hidden bit" (0x10) is shifted 4 bits left to sit above the +* 4-bit mantissa. The RFC again shifts this entire block left by (exp + 3) +* to reconstruct the value. So, 'hidden bit' is the MSB which is shifted +* by (4 + exp + 3). +* +* Total left shift of the 'hidden bit' = 4 + (exp + 3) = exp + 7. +* This is the MSB at the 0-based bit position: (exp + 7). +* Since fls() is 1-based, fls(value) - 1 = exp + 7. +* +* Therefore: +* exp = fls(value) - 8 +* mant = (value >> (exp + 3)) & 0x0F +* +* Final encoding formula: +* 0x80 | (exp << 4) | mant +* +* Example (value = 3200): +* 0 1 +* 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* |0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0| (value = 3200) +* | ^-^-mant^ ^..(exp+3)..^| exp = 4, mant = 9 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* +* Encoded: +* 0x80 | (4 << 4) | 9 = 0xC9 +*/ +static inline u8 mldv2_qqic (unsigned long value) +{ +u8 mc_man, mc_exp; + +/* QQIC < 128 is literal */ +if (value <MLD_QQIC_MIN_THRESHOLD ) +return value; + +/* Saturate at max representable (mant = 0xF, exp = 7) -> 31744 */ +if (value >=MLD_QQIC_MAX_THRESHOLD ) +return 0xFF ; + + mc_exp =fls (value) -8 ; + mc_man = (value >> (mc_exp +3 )) &0x0F ; + +return 0x80 | (mc_exp <<4 ) | mc_man; +} +/* V2 exponential field decoding */ /* Calculate Maximum Response Delay from Maximum Response Code
net/bridge/br_multicast.c +2 -2
@@ -1181,7 +1181,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge_mcast *brmbreak ;case 2 : mld2q = (struct mld2_query *)icmp6_hdr (skb); - mld2q->mld2q_mrc =htons ((u16 )jiffies_to_msecs (interval)); + mld2q->mld2q_mrc =htons (mldv2_mrc (jiffies_to_msecs (interval))); mld2q->mld2q_type =ICMPV6_MGM_QUERY ; mld2q->mld2q_code =0 ; mld2q->mld2q_cksum =0 ;
@@ -1190,7 +1190,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge_mcast *brm mld2q->mld2q_suppress = sflag; mld2q->mld2q_qrv =2 ; mld2q->mld2q_nsrcs =htons (llqt_srcs); - mld2q->mld2q_qqic = brmctx->multicast_query_interval /HZ ; + mld2q->mld2q_qqic =mldv2_qqic (brmctx->multicast_query_interval /HZ ); mld2q->mld2q_mca = *group; csum = &mld2q->mld2q_cksum; csum_start = (void *)mld2q;
Signature · 1 line
2.43.0
PATCH v4 5/5 selftests: net: bridge: add MRC and QQIC field encoding tests
In reply to Ujjal RoyEnhance vlmc_query_intvl_test and vlmc_query_response_intvl_test in bridge_vlan_mcast.sh to validate IGMPv3/MLDv2 protocol compliance for MRC and QQIC field encoding across both linear and exponential ranges.
TEST: Vlan multicast snooping enable [ OK ]
TEST: Vlan mcast_query_interval global option default value [ OK ]
INFO: Vlan 10 mcast_query_interval (QQIC) test cases:
TEST: Number of tagged IGMPv2 general query [ OK ]
TEST: IGMPv3 QQIC linear value 60 [ OK ]
TEST: MLDv2 QQIC linear value 60 [ OK ]
TEST: IGMPv3 QQIC non linear value 160 [ OK ]
TEST: MLDv2 QQIC non linear value 160 [ OK ]
TEST: Vlan mcast_query_response_interval global option default value [ OK ]
INFO: Vlan 10 mcast_query_response_interval (MRC) test cases:
TEST: IGMPv3 MRC linear value 60 [ OK ]
TEST: IGMPv3 MRC non linear value 160 [ OK ]
TEST: MLDv2 MRC linear value 30000 [ OK ]
TEST: MLDv2 MRC non linear value 60000 [ OK ]
--- .../net/forwarding/bridge_vlan_mcast.sh | 150 +++++++++++++++++- 1 file changed, 142 insertions(+), 8 deletions(-)
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +142 -8
@@ -162,14 +162,27 @@ vlmc_query_cnt_setup() { local type=$1 local dev=$2 + local match=$3 if [[ $type == "igmp" ]]; then - tc filter add dev $dev egress pref 10 prot 802.1Q \ + # This matches: IP Protocol 2 (IGMP) + tc filter add dev "$dev" egress pref 10 prot 802.1Q \ flower vlan_id 10 vlan_ethtype ipv4 dst_ip 224.0.0.1 ip_proto 2 \ + action continue + # AND Type 0x11 (Query) at offset 24 after IP + # IP (20 byte IP + 4 bytes Option) + match=(match u8 0x11 0xff at 24 $match) + tc filter add dev "$dev" egress pref 20 prot 802.1Q u32 "${match[@]}" \ action pass else - tc filter add dev $dev egress pref 10 prot 802.1Q \ + # This matches: ICMPv6 + tc filter add dev "$dev" egress pref 10 prot 802.1Q \ flower vlan_id 10 vlan_ethtype ipv6 dst_ip ff02::1 ip_proto icmpv6 \ + action continue + # AND Type 0x82 (Query) at offset 48 after IPv6 + # IPv6 (40 bytes IPv6 + 2 bytes next HDR + 4 bytes Option + 2 byte pad) + match=(match u8 0x82 0xff at 48 $match) + tc filter add dev "$dev" egress pref 20 prot 802.1Q u32 "${match[@]}" \ action pass fi
@@ -181,7 +194,53 @@ vlmc_query_cnt_cleanup() local dev=$1 ip link set dev br0 type bridge mcast_stats_enabled 0 - tc filter del dev $dev egress pref 10 + tc filter del dev "$dev" egress pref 20 + tc filter del dev "$dev" egress pref 10 +} + +vlmc_query_get_intvl_match() +{ + local type=$1 + local version=$2 + local test=$3 + local interval=$4 + + if [ "$test" = "qqic" ]; then + # QQIC is 8-bit floating point encoding for IGMPv3 and MLDv2 + if [ "${type}v${version}" = "igmpv3" ]; then + # IP 20 bytes + 4 bytes Option + IGMPv3[9] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 33" + else + echo "match u8 0x84 0xff at 33" + fi + elif [ "${type}v${version}" = "mldv2" ]; then + # IPv6 40 + 2 next HDR + 4 Option + 2 pad + MLDv2[25] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 73" + else + echo "match u8 0x84 0xff at 73" + fi + fi + elif [ "$test" = "mrc" ]; then + if [ "${type}v${version}" = "igmpv3" ]; then + # MRC is 8-bit floating point encoding for IGMPv3 + # IP 20 bytes + 4 bytes Option + IGMPv3[1] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 25" + else + echo "match u8 0x84 0xff at 25" + fi + elif [ "${type}v${version}" = "mldv2" ]; then + # MRC is 16-bit floating point encoding for MLDv2 + # IPv6 40 + 2 next HDR + 4 Option + 2 pad + MLDv2[4] + if [[ $interval -lt 32768 ]]; then + echo "match u16 0x7530 0xffff at 52" + else + echo "match u16 0x8d4c 0xffff at 52" + fi + fi + fi } vlmc_check_query()
@@ -191,9 +250,13 @@ vlmc_check_query() local dev=$3 local expect=$4 local time=$5 + local test=$6 + local interval=$7 + local intvl_match="" local ret=0 - vlmc_query_cnt_setup $type $dev + intvl_match="$(vlmc_query_get_intvl_match "$type" "$version" "$test" "$interval")" + vlmc_query_cnt_setup "$type" "$dev" "$intvl_match" local pre_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 1
@@ -201,7 +264,7 @@ vlmc_check_query() if [[ $ret -eq 0 ]]; then sleep $time - local tcstats=$(tc_rule_stats_get $dev 10 egress) + local tcstats=$(tc_rule_stats_get "$dev" 20 egress) local post_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) if [[ $tcstats != $expect || \
@@ -441,6 +504,7 @@ vlmc_query_intvl_test() check_err $? "Wrong default mcast_query_interval global vlan option value" log_test "Vlan mcast_query_interval global option default value" + log_info "Vlan 10 mcast_query_interval (QQIC) test cases:" RET=0 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 0 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 200
@@ -448,8 +512,42 @@ vlmc_query_intvl_test() # 1 is sent immediately, then 2 more in the next 5 seconds vlmc_check_query igmp 2 $swp1 3 5 check_err $? "Wrong number of tagged IGMPv2 general queries sent" - log_test "Vlan 10 mcast_query_interval option changed to 200" + log_test "Number of tagged IGMPv2 general query" + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3 + check_err $? "Could not set mcast_igmp_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2 + check_err $? "Could not set mcast_mld_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 6000 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, IGMPv3 QQIC should match with linear value 60s + vlmc_check_query igmp 3 $swp1 1 1 qqic 60 + check_err $? "Wrong QQIC in generated IGMPv3 general queries" + log_test "IGMPv3 QQIC linear value 60" + + RET=0 + # 1 is sent immediately, MLDv2 QQIC should match with linear value 60s + vlmc_check_query mld 2 $swp1 1 1 qqic 60 + check_err $? "Wrong QQIC in generated MLDv2 general queries" + log_test "MLDv2 QQIC linear value 60" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 16000 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, IGMPv3 QQIC should match with non linear value 160s + vlmc_check_query igmp 3 $swp1 1 1 qqic 160 + check_err $? "Wrong QQIC in generated IGMPv3 general queries" + log_test "IGMPv3 QQIC non linear value 160" + + RET=0 + # 1 is sent immediately, MLDv2 QQIC should match with non linear value 160s + vlmc_check_query mld 2 $swp1 1 1 qqic 160 + check_err $? "Wrong QQIC in generated MLDv2 general queries" + log_test "MLDv2 QQIC non linear value 160" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 12500 }
@@ -468,11 +566,47 @@ vlmc_query_response_intvl_test() check_err $? "Wrong default mcast_query_response_interval global vlan option value" log_test "Vlan mcast_query_response_interval global option default value" + log_info "Vlan 10 mcast_query_response_interval (MRC) test cases:" + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3 + check_err $? "Could not set mcast_igmp_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 600 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + # 1 is sent immediately, IGMPv3 MRC should match with linear value 60 units of 1/10s + vlmc_check_query igmp 3 $swp1 1 1 mrc 60 + check_err $? "Wrong MRC in generated IGMPv3 general queries" + log_test "IGMPv3 MRC linear value 60" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1600 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + # 1 is sent immediately, IGMPv3 MRC should match with non linear value 160 unit of 1/10s + vlmc_check_query igmp 3 $swp1 1 1 mrc 160 + check_err $? "Wrong MRC in generated IGMPv3 general queries" + log_test "IGMPv3 MRC non linear value 160" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2 + check_err $? "Could not set mcast_mld_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 3000 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + # 1 is sent immediately, MLDv2 MRC should match with linear value 30000(ms) + vlmc_check_query mld 2 $swp1 1 1 mrc 30000 + check_err $? "Wrong MRC in generated MLDv2 general queries" + log_test "MLDv2 MRC linear value 30000" + RET=0 - bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 200 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 6000 check_err $? "Could not set mcast_query_response_interval in vlan 10" - log_test "Vlan 10 mcast_query_response_interval option changed to 200" + # 1 is sent immediately, MLDv2 MRC should match with non linear value 60000(ms) + vlmc_check_query mld 2 $swp1 1 1 mrc 60000 + check_err $? "Wrong MRC in generated MLDv2 general queries" + log_test "MLDv2 MRC non linear value 60000" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1000 }
Signature · 1 line
2.43.0
Re: [PATCH net-next v4 1/5] ipv4: igmp: get rid of IGMPV3_{QQIC,MRC} and simplify calculation
In reply to Ujjal RoyQuoted 7 lines · Ujjal Roy
Get rid of the
IGMPV3_MRCmacro and use theigmpv3_mrt()API to calculate the Max Resp Time from the Maximum Response Code.Similarly, for
IGMPV3_QQIC, use theigmpv3_qqi()API to calculate the Querier's Query Interval from the QQIC field.Signed-off-by Ujjal Roy <[email protected]>
Re: [PATCH net-next v4 2/5] ipv6: mld: rename mldv2_mrc() and add mldv2_qqi()
In reply to Ujjal RoyQuoted 8 lines · Ujjal Roy
Rename
mldv2_mrc()tomldv2_mrd()as it is used to calculate the Maximum Response Delay from the Maximum Response Code.Introduce a new API
mldv2_qqi()to define the existing calculation logic of QQI from QQIC. This also organizes the existingmld_update_qi()API.Signed-off-by Ujjal Roy <[email protected]>
Re: [PATCH net-next v4 3/5] ipv4: igmp: encode multicast exponential fields
In reply to Ujjal RoyQuoted 15 lines · Ujjal Roy
In IGMP, MRC and QQIC fields are not correctly encoded when generating query packets. Since the receiver of the query interprets these fields using the IGMPv3 floating- point decoding logic, any value that exceeds the linear threshold is incorrectly parsed as an exponential value, leading to an incorrect interval calculation.
Encode and assign the corresponding protocol fields during query generation. Introduce the logic to dynamically calculate the exponent and mantissa using bit-scan (fls). This ensures MRC and QQIC fields (8-bit) are properly encoded when transmitting query packets with intervals that exceed their respective linear threshold value of 128 (for MRT/QQI).
Quoted 8 lines
RFC3376: for both MRC and QQIC, values >= 128 represent the same floating-point encoding as follows:
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |1| exp | mant | +-+-+-+-+-+-+-+-+Signed-off-by Ujjal Roy <[email protected]>
Ido Schimmel
maintainerRe: [PATCH net-next v4 5/5] selftests: net: bridge: add MRC and QQIC field encoding tests
In reply to Ujjal RoySee some comments below, but note that net-next is closed:
https://lore.kernel.org/netdev/[email protected]/
So you can either wait with v5 until it is open again or post it as RFC so that we can at least review (but not merge) it while net-next is closed.
Quoted 32 lines · Ujjal Roy
Enhance
vlmc_query_intvl_testandvlmc_query_response_intvl_testinbridge_vlan_mcast.shto validate IGMPv3/MLDv2 protocol compliance for MRC and QQIC field encoding across both linear and exponential ranges.TEST: Vlan multicast snooping enable [ OK ]
TEST: Vlanmcast_query_intervalglobal option default value [ OK ]
INFO: Vlan 10mcast_query_interval(QQIC) test cases:
TEST: Number of tagged IGMPv2 general query [ OK ]
TEST: IGMPv3 QQIC linear value 60 [ OK ]
TEST: MLDv2 QQIC linear value 60 [ OK ]
TEST: IGMPv3 QQIC non linear value 160 [ OK ]
TEST: MLDv2 QQIC non linear value 160 [ OK ]
TEST: Vlanmcast_query_response_intervalglobal option default value [ OK ]
INFO: Vlan 10mcast_query_response_interval(MRC) test cases:
TEST: IGMPv3 MRC linear value 60 [ OK ]
TEST: IGMPv3 MRC non linear value 160 [ OK ]
TEST: MLDv2 MRC linear value 30000 [ OK ]
TEST: MLDv2 MRC non linear value 60000 [ OK ]Signed-off-by Ujjal Roy <[email protected]>--- .../net/forwarding/bridge_vlan_mcast.sh | 150 +++++++++++++++++- 1 file changed, 142 insertions(+), 8 deletions(-)tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +0
-0@@ -162,14 +162,27 @@ vlmc_query_cnt_setup() { local type=$1 local dev=$2
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_setup() · line 173
Quoted 10 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +6
-1+ local match=$3 if [[ $type == "igmp" ]]; then - tc filter add dev $dev egress pref 10 prot 802.1Q \ + # This matches: IP Protocol 2 (IGMP) + tc filter add dev "$dev" egress pref 10 prot 802.1Q \ flower vlan_id 10 vlan_ethtype ipv4 dst_ip 224.0.0.1 ip_proto 2 \ + action continue + # AND Type 0x11 (Query) at offset 24 after IP + # IP (20 byte IP + 4 bytes Option)
Let's make it clearer: 20 bytes IPv4 header + 4 bytes Router Alert option
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_setup() · line 183
Quoted 11 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +7
-1+ match=(match u8 0x11 0xff at 24 $match) + tc filter add dev "$dev" egress pref 20 prot 802.1Q u32 "${match[@]}" \ action pass else - tc filter add dev $dev egress pref 10 prot 802.1Q \ + # This matches: ICMPv6 + tc filter add dev "$dev" egress pref 10 prot 802.1Q \ flower vlan_id 10 vlan_ethtype ipv6 dst_ip ff02::1 ip_proto icmpv6 \ + action continue + # AND Type 0x82 (Query) at offset 48 after IPv6 + # IPv6 (40 bytes IPv6 + 2 bytes next HDR + 4 bytes Option + 2 byte pad)
Same: 40 bytes IPv6 header + 8 bytes Hop-by-hop option
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_setup() · line 187
Quoted 4 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +2
-0+ match=(match u8 0x82 0xff at 48 $match) + tc filter add dev "$dev" egress pref 20 prot 802.1Q u32 "${match[@]}" \ action pass fi
Sashiko has a relevant comment:
"
Does this configuration evaluate all packets against the pref 20 filter, regardless of the pref 10 result?
In tc, if a packet does not match a filter, classification automatically falls through to the next priority filter. By using "action continue" on pref 10, matching packets are also instructed to continue evaluation at the next filter.
Because both matching and non-matching packets proceed to pref 20, pref 10 seems to act as a no-op gate. Could this cause the u32 rules in pref 20 to inadvertently match unrelated background traffic on the interface?
To implement a logical AND across different classifiers, should pref 10 use "action goto chain 1" with pref 20 placed inside chain 1?
"
Quoted 13 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +7
-1@@ -181,7 +194,53 @@ vlmc_query_cnt_cleanup() local dev=$1 ip link set dev br0 type bridge mcast_stats_enabled 0 - tc filter del dev $dev egress pref 10 + tc filter del dev "$dev" egress pref 20 + tc filter del dev "$dev" egress pref 10 +} + +vlmc_query_get_intvl_match() +{ + local type=$1
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_cleanup() · line 213
Quoted 10 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +10
-0+ local version=$2 + local test=$3 + local interval=$4 + + if [ "$test" = "qqic" ]; then + # QQIC is 8-bit floating point encoding for IGMPv3 and MLDv2 + if [ "${type}v${version}" = "igmpv3" ]; then + # IP 20 bytes + 4 bytes Option + IGMPv3[9] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 33"
Please pass the expected value as an argument instead of hard coding "0x3c" here. Same in other places in the function.
Quoted 58 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +36
-2+ else + echo "match u8 0x84 0xff at 33" + fi + elif [ "${type}v${version}" = "mldv2" ]; then + # IPv6 40 + 2 next HDR + 4 Option + 2 pad + MLDv2[25] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 73" + else + echo "match u8 0x84 0xff at 73" + fi + fi + elif [ "$test" = "mrc" ]; then + if [ "${type}v${version}" = "igmpv3" ]; then + # MRC is 8-bit floating point encoding for IGMPv3 + # IP 20 bytes + 4 bytes Option + IGMPv3[1] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 25" + else + echo "match u8 0x84 0xff at 25" + fi + elif [ "${type}v${version}" = "mldv2" ]; then + # MRC is 16-bit floating point encoding for MLDv2 + # IPv6 40 + 2 next HDR + 4 Option + 2 pad + MLDv2[4] + if [[ $interval -lt 32768 ]]; then + echo "match u16 0x7530 0xffff at 52" + else + echo "match u16 0x8d4c 0xffff at 52" + fi + fi + fi } vlmc_check_query()@@ -191,9 +250,13 @@ vlmc_check_query() local dev=$3 local expect=$4 local time=$5 + local test=$6 + local interval=$7 + local intvl_match="" local ret=0 - vlmc_query_cnt_setup $type $dev + intvl_match="$(vlmc_query_get_intvl_match "$type" "$version" "$test" "$interval")" + vlmc_query_cnt_setup "$type" "$dev" "$intvl_match" local pre_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 1@@ -201,7 +264,7 @@ vlmc_check_query() if [[ $ret -eq 0 ]]; then sleep $time - local tcstats=$(tc_rule_stats_get $dev 10 egress) + local tcstats=$(tc_rule_stats_get "$dev" 20 egress) local post_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) if [[ $tcstats != $expect || \
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_intvl_test() · line 507
Quoted 4 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +1
-0@@ -441,6 +504,7 @@ vlmc_query_intvl_test() check_err $? "Wrong default mcast_query_interval global vlan option value" log_test "Vlan mcast_query_interval global option default value" + log_info "Vlan 10 mcast_query_interval (QQIC) test cases:"
Let's remove this as it makes the output confusing:
INFO: Vlan 10 mcast_query_response_interval (MRC) test cases:
TEST: IGMPv3 MRC linear value 60 [ OK ]
[...]
TEST: Flood unknown vlan multicast packets to router port only [ OK ]
TEST: Disable multicast vlan snooping when vlan filtering is disabled [ OK ]
Quoted 48 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +35
-1RET=0 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 0 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 200@@ -448,8 +512,42 @@ vlmc_query_intvl_test() # 1 is sent immediately, then 2 more in the next 5 seconds vlmc_check_query igmp 2 $swp1 3 5 check_err $? "Wrong number of tagged IGMPv2 general queries sent" - log_test "Vlan 10 mcast_query_interval option changed to 200" + log_test "Number of tagged IGMPv2 general query" + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3 + check_err $? "Could not set mcast_igmp_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2 + check_err $? "Could not set mcast_mld_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 6000 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, IGMPv3 QQIC should match with linear value 60s + vlmc_check_query igmp 3 $swp1 1 1 qqic 60 + check_err $? "Wrong QQIC in generated IGMPv3 general queries" + log_test "IGMPv3 QQIC linear value 60" + + RET=0 + # 1 is sent immediately, MLDv2 QQIC should match with linear value 60s + vlmc_check_query mld 2 $swp1 1 1 qqic 60 + check_err $? "Wrong QQIC in generated MLDv2 general queries" + log_test "MLDv2 QQIC linear value 60" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 16000 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, IGMPv3 QQIC should match with non linear value 160s + vlmc_check_query igmp 3 $swp1 1 1 qqic 160 + check_err $? "Wrong QQIC in generated IGMPv3 general queries" + log_test "IGMPv3 QQIC non linear value 160" + + RET=0 + # 1 is sent immediately, MLDv2 QQIC should match with non linear value 160s + vlmc_check_query mld 2 $swp1 1 1 qqic 160 + check_err $? "Wrong QQIC in generated MLDv2 general queries" + log_test "MLDv2 QQIC non linear value 160" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 12500 }
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_response_intvl_test() · line 569
Quoted 4 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +1
-0@@ -468,11 +566,47 @@ vlmc_query_response_intvl_test() check_err $? "Wrong default mcast_query_response_interval global vlan option value" log_test "Vlan mcast_query_response_interval global option default value" + log_info "Vlan 10 mcast_query_response_interval (MRC) test cases:"
Same
Quoted 48 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +37
-2+ RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3 + check_err $? "Could not set mcast_igmp_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 600 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + # 1 is sent immediately, IGMPv3 MRC should match with linear value 60 units of 1/10s + vlmc_check_query igmp 3 $swp1 1 1 mrc 60 + check_err $? "Wrong MRC in generated IGMPv3 general queries" + log_test "IGMPv3 MRC linear value 60" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1600 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + # 1 is sent immediately, IGMPv3 MRC should match with non linear value 160 unit of 1/10s + vlmc_check_query igmp 3 $swp1 1 1 mrc 160 + check_err $? "Wrong MRC in generated IGMPv3 general queries" + log_test "IGMPv3 MRC non linear value 160" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2 + check_err $? "Could not set mcast_mld_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 3000 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + # 1 is sent immediately, MLDv2 MRC should match with linear value 30000(ms) + vlmc_check_query mld 2 $swp1 1 1 mrc 30000 + check_err $? "Wrong MRC in generated MLDv2 general queries" + log_test "MLDv2 MRC linear value 30000" + RET=0 - bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 200 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 6000 check_err $? "Could not set mcast_query_response_interval in vlan 10" - log_test "Vlan 10 mcast_query_response_interval option changed to 200" + # 1 is sent immediately, MLDv2 MRC should match with non linear value 60000(ms) + vlmc_check_query mld 2 $swp1 1 1 mrc 60000 + check_err $? "Wrong MRC in generated MLDv2 general queries" + log_test "MLDv2 MRC non linear value 60000" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1000 }Signature · 1 line
2.43.0
Re: [PATCH net-next v4 5/5] selftests: net: bridge: add MRC and QQIC field encoding tests
Quoted 8 lines · Ido Schimmel
See some comments below, but note that net-next is closed:
https://lore.kernel.org/netdev/[email protected]/
So you can either wait with v5 until it is open again or post it as RFC so that we can at least review (but not merge) it while net-next is closed.
Let me clear the changes asked here inline, so that I will be prepared with v5 until net-next is open. You can ask me to send it as RFC v5, if you have doubts about inline answers.
Quoted 36 lines · Ujjal Roy
Quoted 34 lines
Enhance
vlmc_query_intvl_testandvlmc_query_response_intvl_testinbridge_vlan_mcast.shto validate IGMPv3/MLDv2 protocol compliance for MRC and QQIC field encoding across both linear and exponential ranges.TEST: Vlan multicast snooping enable [ OK ]
TEST: Vlanmcast_query_intervalglobal option default value [ OK ]
INFO: Vlan 10mcast_query_interval(QQIC) test cases:
TEST: Number of tagged IGMPv2 general query [ OK ]
TEST: IGMPv3 QQIC linear value 60 [ OK ]
TEST: MLDv2 QQIC linear value 60 [ OK ]
TEST: IGMPv3 QQIC non linear value 160 [ OK ]
TEST: MLDv2 QQIC non linear value 160 [ OK ]
TEST: Vlanmcast_query_response_intervalglobal option default value [ OK ]
INFO: Vlan 10mcast_query_response_interval(MRC) test cases:
TEST: IGMPv3 MRC linear value 60 [ OK ]
TEST: IGMPv3 MRC non linear value 160 [ OK ]
TEST: MLDv2 MRC linear value 30000 [ OK ]
TEST: MLDv2 MRC non linear value 60000 [ OK ]Signed-off-by Ujjal Roy <[email protected]>--- .../net/forwarding/bridge_vlan_mcast.sh | 150 +++++++++++++++++- 1 file changed, 142 insertions(+), 8 deletions(-)tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +1
-0@@ -162,14 +162,27 @@ vlmc_query_cnt_setup() { local type=$1 local dev=$2 + local match=$3
Quoted 10 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_setup() · line 173
Quoted 8 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +5
-1if [[ $type == "igmp" ]]; then - tc filter add dev $dev egress pref 10 prot 802.1Q \ + # This matches: IP Protocol 2 (IGMP) + tc filter add dev "$dev" egress pref 10 prot 802.1Q \ flower vlan_id 10 vlan_ethtype ipv4 dst_ip 224.0.0.1 ip_proto 2 \ + action continue + # AND Type 0x11 (Query) at offset 24 after IP + # IP (20 byte IP + 4 bytes Option)Let's make it clearer: 20 bytes IPv4 header + 4 bytes Router Alert option
# 20 bytes IPv4 header + 4 bytes Router Alert option +
IGMP[offset 0] Query
Quoted 13 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_setup() · line 183
Quoted 12 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +7
-1+ match=(match u8 0x11 0xff at 24 $match) + tc filter add dev "$dev" egress pref 20 prot 802.1Q u32 "${match[@]}" \ action pass else - tc filter add dev $dev egress pref 10 prot 802.1Q \ + # This matches: ICMPv6 + tc filter add dev "$dev" egress pref 10 prot 802.1Q \ flower vlan_id 10 vlan_ethtype ipv6 dst_ip ff02::1 ip_proto icmpv6 \ + action continue + # AND Type 0x82 (Query) at offset 48 after IPv6 + # IPv6 (40 bytes IPv6 + 2 bytes next HDR + 4 bytes Option + 2 byte pad)
Quoted 1 line
Same: 40 bytes IPv6 header + 8 bytes Hop-by-hop option
# 40 bytes IPv6 header + 8 bytes Hop-by-hop option +
MLD[offset 0] Query
Quoted 16 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_setup() · line 187
Quoted 5 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +2
-0+ match=(match u8 0x82 0xff at 48 $match) + tc filter add dev "$dev" egress pref 20 prot 802.1Q u32 "${match[@]}" \ action pass fiSashiko has a relevant comment:
"
Does this configuration evaluate all packets against the pref 20 filter, regardless of the pref 10 result?In tc, if a packet does not match a filter, classification automatically falls through to the next priority filter. By using "action continue" on pref 10, matching packets are also instructed to continue evaluation at the next filter.
Quoted 7 lines
Because both matching and non-matching packets proceed to pref 20, pref 10 seems to act as a no-op gate. Could this cause the u32 rules in pref 20 to inadvertently match unrelated background traffic on the interface?
To implement a logical AND across different classifiers, should pref 10 use "action goto chain 1" with pref 20 placed inside chain 1?
"
Answer: No, it should evaluate IGMP only by pref 10 filter AND IGMPv3 Query by pref 20 filter. Query filter may include additional match for QQIC/MRC.
Here is my new filter:
tc filter add dev "$dev" egress pref 10 prot 802.1Q \
flower vlan_id 10 vlan_ethtype ipv4 dst_ip
224.0.0.1 ip_proto 2 \
action goto chain 1
Quoted 19 lines
Quoted 19 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +12
-1@@ -181,7 +194,53 @@ vlmc_query_cnt_cleanup() local dev=$1 ip link set dev br0 type bridge mcast_stats_enabled 0 - tc filter del dev $dev egress pref 10 + tc filter del dev "$dev" egress pref 20 + tc filter del dev "$dev" egress pref 10 +} + +vlmc_query_get_intvl_match() +{ + local type=$1 + local version=$2 + local test=$3 + local interval=$4 + + if [ "$test" = "qqic" ]; then
Quoted 8 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_cnt_cleanup() · line 213
Quoted 5 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +5
-0+ # QQIC is 8-bit floating point encoding for IGMPv3 and MLDv2 + if [ "${type}v${version}" = "igmpv3" ]; then + # IP 20 bytes + 4 bytes Option + IGMPv3[9] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 33"Please pass the expected value as an argument instead of hard coding "
0x3c" here. Same in other places in the function.
Will pass the expected code as an argument. Also will update the comments here.
# 20 bytes IPv4 header + 4 bytes Router Alert
option + IGMPv3[offset 9] QQIC
Quoted 57 lines
Quoted 57 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +36
-2+ else + echo "match u8 0x84 0xff at 33" + fi + elif [ "${type}v${version}" = "mldv2" ]; then + # IPv6 40 + 2 next HDR + 4 Option + 2 pad + MLDv2[25] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 73" + else + echo "match u8 0x84 0xff at 73" + fi + fi + elif [ "$test" = "mrc" ]; then + if [ "${type}v${version}" = "igmpv3" ]; then + # MRC is 8-bit floating point encoding for IGMPv3 + # IP 20 bytes + 4 bytes Option + IGMPv3[1] + if [[ $interval -lt 128 ]]; then + echo "match u8 0x3c 0xff at 25" + else + echo "match u8 0x84 0xff at 25" + fi + elif [ "${type}v${version}" = "mldv2" ]; then + # MRC is 16-bit floating point encoding for MLDv2 + # IPv6 40 + 2 next HDR + 4 Option + 2 pad + MLDv2[4] + if [[ $interval -lt 32768 ]]; then + echo "match u16 0x7530 0xffff at 52" + else + echo "match u16 0x8d4c 0xffff at 52" + fi + fi + fi } vlmc_check_query()@@ -191,9 +250,13 @@ vlmc_check_query() local dev=$3 local expect=$4 local time=$5 + local test=$6 + local interval=$7 + local intvl_match="" local ret=0 - vlmc_query_cnt_setup $type $dev + intvl_match="$(vlmc_query_get_intvl_match "$type" "$version" "$test" "$interval")" + vlmc_query_cnt_setup "$type" "$dev" "$intvl_match" local pre_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 1@@ -201,7 +264,7 @@ vlmc_check_query() if [[ $ret -eq 0 ]]; then sleep $time - local tcstats=$(tc_rule_stats_get $dev 10 egress) + local tcstats=$(tc_rule_stats_get "$dev" 20 egress) local post_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev)
Quoted 8 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_intvl_test() · line 507
Quoted 6 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +1
-0if [[ $tcstats != $expect || \@@ -441,6 +504,7 @@ vlmc_query_intvl_test() check_err $? "Wrong default mcast_query_interval global vlan option value" log_test "Vlan mcast_query_interval global option default value" + log_info "Vlan 10 mcast_query_interval (QQIC) test cases:"Let's remove this as it makes the output confusing:
Sure, I will remove this line.
Quoted 58 lines
INFO: Vlan 10
mcast_query_response_interval(MRC) test cases:
TEST: IGMPv3 MRC linear value 60 [ OK ]
[...]
TEST: Flood unknown vlan multicast packets to router port only [ OK ]
TEST: Disable multicast vlan snooping when vlan filtering is disabled [ OK ]Quoted 51 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +35
-1RET=0 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 0 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 200@@ -448,8 +512,42 @@ vlmc_query_intvl_test() # 1 is sent immediately, then 2 more in the next 5 seconds vlmc_check_query igmp 2 $swp1 3 5 check_err $? "Wrong number of tagged IGMPv2 general queries sent" - log_test "Vlan 10 mcast_query_interval option changed to 200" + log_test "Number of tagged IGMPv2 general query" + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3 + check_err $? "Could not set mcast_igmp_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2 + check_err $? "Could not set mcast_mld_version in vlan 10" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 6000 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, IGMPv3 QQIC should match with linear value 60s + vlmc_check_query igmp 3 $swp1 1 1 qqic 60 + check_err $? "Wrong QQIC in generated IGMPv3 general queries" + log_test "IGMPv3 QQIC linear value 60" + + RET=0 + # 1 is sent immediately, MLDv2 QQIC should match with linear value 60s + vlmc_check_query mld 2 $swp1 1 1 qqic 60 + check_err $? "Wrong QQIC in generated MLDv2 general queries" + log_test "MLDv2 QQIC linear value 60" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 16000 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, IGMPv3 QQIC should match with non linear value 160s + vlmc_check_query igmp 3 $swp1 1 1 qqic 160 + check_err $? "Wrong QQIC in generated IGMPv3 general queries" + log_test "IGMPv3 QQIC non linear value 160" + + RET=0 + # 1 is sent immediately, MLDv2 QQIC should match with non linear value 160s + vlmc_check_query mld 2 $swp1 1 1 qqic 160 + check_err $? "Wrong QQIC in generated MLDv2 general queries" + log_test "MLDv2 QQIC non linear value 160" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 12500 }@@ -468,11 +566,47 @@ vlmc_query_response_intvl_test() check_err $? "Wrong default mcast_query_response_interval global vlan option value" log_test "Vlan mcast_query_response_interval global option default value"
Quoted 3 lines
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh vlmc_query_response_intvl_test() · line 569
Quoted 1 line
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +1
-0+ log_info "Vlan 10 mcast_query_response_interval (MRC) test cases:"Same
I will remove this line also.
[...]
Ido Schimmel
maintainerRe: [PATCH net-next v4 5/5] selftests: net: bridge: add MRC and QQIC field encoding tests
Quoted 6 lines · Ujjal Roy
Quoted 5 lines · Ido Schimmel
See some comments below, but note that net-next is closed:
Quoted 7 lines
Quoted 3 lines
So you can either wait with v5 until it is open again or post it as RFC so that we can at least review (but not merge) it while net-next is closed.
Let me clear the changes asked here inline, so that I will be prepared with v5 until net-next is open. You can ask me to send it as RFC v5, if you have doubts about inline answers.
I checked the proposed changes and they look fine to me.
Thanks