From: Patrick McHardy Date: Thu, 10 Aug 2006 20:42:58 +0000 (+0200) Subject: The current behaviour for IPv6 routing table filters is to derive the X-Git-Tag: v2.6.19-061214~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0b29fe7dd137f7b47eb7c64e7bd07282e7801a2;p=thirdparty%2Fiproute2.git The current behaviour for IPv6 routing table filters is to derive the table from the route type. This doesn't really work anymore now that IPv6 supports multiple tables. Add detection for IPv6 multiple table support (relying on the fact that the first routes dumped belong to the local table and have rtm_table == RT_TABLE_LOCAL with multiple tables) and handle it like other protocols. Signed-off-by: Patrick McHardy --- diff --git a/ip/iproute.c b/ip/iproute.c index 8f4a55d5b..1645f0b4e 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -138,6 +138,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) inet_prefix prefsrc; inet_prefix via; int host_len = -1; + static int ip6_multiple_tables; SPRINT_BUF(b1); @@ -163,7 +164,10 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) else if (r->rtm_family == AF_IPX) host_len = 80; - if (r->rtm_family == AF_INET6) { + if (r->rtm_family == AF_INET6 && r->rtm_table != RT_TABLE_MAIN) + ip6_multiple_tables = 1; + + if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) { if (filter.tb) { if (filter.tb < 0) { if (!(r->rtm_flags&RTM_F_CLONED))