]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ipmroute: better error message if no kernel mroute
authorStephen Hemminger <sthemmin@microsoft.com>
Fri, 9 Mar 2018 02:02:19 +0000 (18:02 -0800)
committerDavid Ahern <dsahern@gmail.com>
Mon, 12 Mar 2018 01:52:34 +0000 (18:52 -0700)
If kernel does not support the IP multicast address family,
then it will report all routes (PF_UNSPEC).
Give the user a better error message and abort the command.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
ip/ipmroute.c

index 03087b6c439b3176b11e564469671d7fcc87985b..59c5b7718e1823a0c00116b3e2993e6cdc74bc2b 100644 (file)
@@ -75,10 +75,11 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
                fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
                return -1;
        }
+
        if (r->rtm_type != RTN_MULTICAST) {
-               fprintf(stderr, "Not a multicast route (type: %s)\n",
-                       rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1)));
-               return 0;
+               fprintf(stderr,
+                       "Non multicast route received, kernel does support IP multicast?\n");
+               return -1;
        }
 
        parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);