]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
mroute: fix up family handling
authorDavid Ahern <dsahern@gmail.com>
Wed, 19 Dec 2018 21:11:15 +0000 (13:11 -0800)
committerDavid Ahern <dsahern@gmail.com>
Thu, 27 Dec 2018 23:34:28 +0000 (15:34 -0800)
Only ipv4 and ipv6 have multicast routing. Set family
accordingly and just return for other cases.

Signed-off-by: David Ahern <dsahern@gmail.com>
ip/ipmroute.c

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