• Hangbin Liu's avatar
    ipv6/mcast: init as INCLUDE when join SSM INCLUDE group · c7ea20c9
    Hangbin Liu authored
    This an IPv6 version patch of "ipv4/igmp: init group mode as INCLUDE when
    join source group". From RFC3810, part 6.1:
    
       If no per-interface state existed for that
       multicast address before the change (i.e., the change consisted of
       creating a new per-interface record), or if no state exists after the
       change (i.e., the change consisted of deleting a per-interface
       record), then the "non-existent" state is considered to have an
       INCLUDE filter mode and an empty source list.
    
    Which means a new multicast group should start with state IN(). Currently,
    for MLDv2 SSM JOIN_SOURCE_GROUP mode, we first call ipv6_sock_mc_join(),
    then ip6_mc_source(), which will trigger a TO_IN() message instead of
    ALLOW().
    
    The issue was exposed by commit a052517a ("net/multicast: should not
    send source list records when have filter mode change"). Before this change,
    we sent both ALLOW(A) and TO_IN(A). Now, we only send TO_IN(A).
    
    Fix it by adding a new parameter to init group mode. Also add some wrapper
    functions to avoid changing too much code.
    
    v1 -> v2:
    In the first version I only cleared the group change record. But this is not
    enough. Because when a new group join, it will init as EXCLUDE and trigger
    a filter mode change in ip/ip6_mc_add_src(), which will clear all source
    addresses sf_crcount. This will prevent early joined address sending state
    change records if multi source addressed joined at the same time.
    
    In v2 patch, I fixed it by directly initializing the mode to INCLUDE for SSM
    JOIN_SOURCE_GROUP. I also split the original patch into two separated patches
    for IPv4 and IPv6.
    
    There is also a difference between v4 and v6 version. For IPv6, when the
    interface goes down and up, we will send correct state change record with
    unspecified IPv6 address (::) with function ipv6_mc_up(). But after DAD is
    completed, we resend the change record TO_IN() in mld_send_initial_cr().
    Fix it by sending ALLOW() for INCLUDE mode in mld_send_initial_cr().
    
    Fixes: a052517a ("net/multicast: should not send source list records when have filter mode change")
    Reviewed-by: default avatarStefano Brivio <sbrivio@redhat.com>
    Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c7ea20c9
ipv6.h 31.5 KB