mroute: fix up family handling

Only ipv4 and ipv6 have multicast routing. Set family
accordingly and just return for other cases.

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2018-12-19 13:11:15 -08:00
parent c7e6371bc4
commit 98ce99273f

View File

@ -223,18 +223,20 @@ void ipmroute_reset_filter(int ifindex)
static int mroute_list(int argc, char **argv) static int mroute_list(int argc, char **argv)
{ {
char *id = NULL; char *id = NULL;
int family; int family = preferred_family;
ipmroute_reset_filter(0); ipmroute_reset_filter(0);
if (preferred_family == AF_UNSPEC) if (family == AF_INET || family == AF_UNSPEC) {
family = AF_INET; family = RTNL_FAMILY_IPMR;
else
family = AF_INET6;
if (family == AF_INET) {
filter.af = RTNL_FAMILY_IPMR; filter.af = RTNL_FAMILY_IPMR;
filter.tb = RT_TABLE_DEFAULT; /* for backward compatibility */ filter.tb = RT_TABLE_DEFAULT; /* for backward compatibility */
} else } else if (family == AF_INET6) {
family = RTNL_FAMILY_IP6MR;
filter.af = RTNL_FAMILY_IP6MR; filter.af = RTNL_FAMILY_IP6MR;
} else {
/* family does not have multicast routing */
return 0;
}
filter.msrc.family = filter.mdst.family = family; filter.msrc.family = filter.mdst.family = family;