IGMP version higher than net.inet.igmp.default_version
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- [x] I have read the contributing guide lines at https://github.com/opnsense/src/blob/master/CONTRIBUTING.md
- [x] I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/src/issues?q=is%3Aissue
Describe the bug
The tunable net.inet.igmp.default_version has not effect on the IGMP version used on interfaces. The problem was also present in 24.7.
Tip: to validate your setup was working with the previous version, use opnsense-revert (https://docs.opnsense.org/manual/opnsense_tools.html#opnsense-revert)
To Reproduce
Steps to reproduce the behavior:
- Go to 'System: Settings: Tunables' and set 2 for
net.inet.igmp.default_version - Apply settings and reboot to be sure that change is taken into account
- Open a shell and run
sysctl net.inet.igmpto see that default_version is 2 - Run
ifmcstat -f inetto notice that igmpv3 is indicated for each interface
Expected behavior
When runing the command ifmcstat -f inet, the igmp version should be less or equal than the net.inet.igmp.default_version
Describe alternatives you considered
I have applied the commit https://github.com/freebsd/freebsd-src/commit/b94ec00ba73ef4769f62555bfcb840919143e198 as this topic has been discussed in the main branch of FreeBSD. However, it is not sufficient and ifmcstat -f inet still indicate version 3.
In addition to the commit above, I have changed VNET_DEFINE_STATIC(int, igmp_default_version) = IGMP_VERSION_2; in igmp.c. This modification allows:
- to have IGMPv2 after a reboot
- to switch to IGMPv3 at runtime if
net.inet.igmp.default_versionis set to 3
However, this modification does not allow:
- to switch from IGMPv3 to IGMPv2 at runtime
Environment
OPNsense 25.1 (amd64)
To answer to myself, I found a solution which is to update the function sysctl_igmp_default_version to update igmp version of each interface when the actual value is above the new value defined in net.inet.igmp.default_version. This way, at runtime, the igmp version can go from IGMPv3 to IGMPv2 as soon as the version is switched and IGMPv2 to IGMPv3 after the timeout for IGMPv2.
The solution is to :
- apply https://github.com/freebsd/freebsd-src/commit/b94ec00ba73ef4769f62555bfcb840919143e198
- apply the patch in the attached file
The issue is corrected in the upstream repo. However, it is not in the 14.x branch.