ip/ipmroute: use preferred_family to get prefix

The mroute family is reset to RTNL_FAMILY_IPMR or RTNL_FAMILY_IP6MR when
retrieving the multicast routing cache. However, the get_prefix() and
subsequently __get_addr_1() cannot identify these families. Using
preferred_family to obtain the prefix can resolve this issue.

Fixes: 98ce99273f ("mroute: fix up family handling")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Hangbin Liu
2024-10-09 09:53:09 +00:00
committed by Stephen Hemminger
parent 95f4021b48
commit f305296e40

View File

@@ -271,7 +271,7 @@ static int mroute_list(int argc, char **argv)
id = *argv;
} else if (matches(*argv, "from") == 0) {
NEXT_ARG();
if (get_prefix(&filter.msrc, *argv, family))
if (get_prefix(&filter.msrc, *argv, preferred_family))
invarg("from value is invalid\n", *argv);
} else {
if (strcmp(*argv, "to") == 0) {
@@ -279,7 +279,7 @@ static int mroute_list(int argc, char **argv)
}
if (matches(*argv, "help") == 0)
usage();
if (get_prefix(&filter.mdst, *argv, family))
if (get_prefix(&filter.mdst, *argv, preferred_family))
invarg("to value is invalid\n", *argv);
}
argc--; argv++;