From 5a403866f3691e1c2a1b7c7b677e9a7feeec0aa2 Mon Sep 17 00:00:00 2001 From: Hangbin Liu Date: Wed, 26 Jun 2019 09:44:07 +0800 Subject: [PATCH] ip/iptoken: fix dump error when ipv6 disabled When we disable IPv6 from the start up (ipv6.disable=1), there will be no IPv6 route info in the dump message. If we return -1 when ifi->ifi_family != AF_INET6, we will get error like $ ip token list Dump terminated which will make user feel confused. There is no need to return -1 if the dump message not match. Return 0 is enough. Signed-off-by: Hangbin Liu Signed-off-by: Stephen Hemminger --- ip/iptoken.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/iptoken.c b/ip/iptoken.c index f1194c3e1..9f3568900 100644 --- a/ip/iptoken.c +++ b/ip/iptoken.c @@ -60,9 +60,9 @@ static int print_token(struct nlmsghdr *n, void *arg) return -1; if (ifi->ifi_family != AF_INET6) - return -1; + return 0; if (ifi->ifi_index == 0) - return -1; + return 0; if (ifindex > 0 && ifi->ifi_index != ifindex) return 0; if (ifi->ifi_flags & (IFF_LOOPBACK | IFF_NOARP)) -- 2.47.2