Bug 196595

Summary: Regression IGMP sysctl init values if not IP_MULTICAST
Product: Networking Reporter: Gerardo Exequiel Pozzi (vmlinuz386)
Component: IPV4Assignee: Stephen Hemminger (stephen)
Severity: normal CC: n.borisov.lkml, vmlinuz386
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.5 - 4.12 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: gmp-Fix-regression-caused-by-igmp-sysctl-namespace-.patch

Description Gerardo Exequiel Pozzi 2017-08-05 23:57:48 UTC
I just upgraded from 4.4.x to 4.12.x and detected that igmp related settings are not set to default values (1, 20, 10):

net.ipv4.igmp_link_local_mcast_reports = 0
net.ipv4.igmp_max_memberships = 0
net.ipv4.igmp_max_msf = 0

This is fixed if I enable IP_MULTICAST. Looks like a regression since some changes made to "Namespaceify" commit dcd87999d415d39cf2ae510bfed6b8206d778e1c  and related commits.
Comment 1 Nikolay Borisov 2017-08-07 06:09:38 UTC
Why should these sysctl have any values whatsoever when igmp is compiled out?
Comment 2 Gerardo Exequiel Pozzi 2017-08-07 22:32:49 UTC
Good question. But I think is not related. I have some points here:

(1) Why these values are set to non-zero in kernel before 4.5 even if IP_MULTICAST is not enabled.
(2) if IGMP is compiled out why these files are present at all and can set any non-zero value.
(3) why I can change these sysctl values and simple multicast apps like (UPNP/DLNA) works again without error 
setsockopt(3, SOL_IP, IP_ADD_MEMBERSHIP, {imr_multiaddr=inet_addr(""), imr_interface=inet_addr("")}, 8) = -1 ENOBUFS (No buffer space available)
Comment 3 Nikolay Borisov 2017-08-08 06:50:13 UTC
1. Because before the commit you referenced they were initialized in tcp_sk_init(), whereas the commit moved them to igmp_net_init, which is the function dealing with any specific igmp init sequence. I though this made more sense from logical point of view. 

2. They are present since they are not guarded by an #ifdef CONFIG_IP_MULTICAST, which indeed might be something I missed when I authored the patchset

3. It seems that the igmp.o object file is always compiled in. I also inspected where those sysctls are used when IP_MULTICAST is not enabled and indeed there are places where it's used irrespective of whether multicast is enabled or not. That is, there are portions of the network code which are always compiled in and enabled, such as ip_mc_join_group. So in this regard I do believe that indeed I introduced a regression. I will create a partial revert and send to the mailing list. Thanks for the report
Comment 4 Nikolay Borisov 2017-08-08 09:23:39 UTC
Created attachment 257857 [details]

Can you test the attached patch and see if it solves your issue?
Comment 5 Gerardo Exequiel Pozzi 2017-08-08 22:53:34 UTC
Yes, the issue gone. Thank you :)
Comment 6 Gerardo Exequiel Pozzi 2017-08-14 23:11:16 UTC
[ Upstream commit 1714020e42b17135032c8606f7185b3fb2ba5d78 ]