]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6/addrconf: allow adding multicast addr if IFA_F_MCAUTOJOIN is set
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 20 Aug 2019 02:19:47 +0000 (10:19 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Aug 2019 03:39:29 +0000 (20:39 -0700)
commit80caaadcec5f6f70df2e14296b329927c582dc55
tree9629430e376efeacf222740a81070d27037e80bf
parenta1ed5b3ca2912282a5cbae8aed70895a356eb08e
ipv6/addrconf: allow adding multicast addr if IFA_F_MCAUTOJOIN is set

In commit dc25ef6a88b2 ("multicast: Extend ip address command to enable
multicast group join/leave on") we added a new flag IFA_F_MCAUTOJOIN
to make user able to add multicast address on ethernet interface.

This works for IPv4, but not for IPv6. See the inet6_addr_add code.

static int inet6_addr_add()
{
...
if (cfg->ifa_flags & IFA_F_MCAUTOJOIN) {
ipv6_mc_config(net->ipv6.mc_autojoin_sk, true...)
}

ifp = ipv6_add_addr(idev, cfg, true, extack); <- always fail with maddr
if (!IS_ERR(ifp)) {
...
} else if (cfg->ifa_flags & IFA_F_MCAUTOJOIN) {
ipv6_mc_config(net->ipv6.mc_autojoin_sk, false...)
}
}

But in ipv6_add_addr() it will check the address type and reject multicast
address directly. So this feature is never worked for IPv6.

We should not remove the multicast address check totally in ipv6_add_addr(),
but could accept multicast address only when IFA_F_MCAUTOJOIN flag supplied.

v2: update commit description

Fixes: dc25ef6a88b2 ("multicast: Extend ip address command to enable multicast group join/leave on")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c