Commit 44792827 authored by Ulrich Weber's avatar Ulrich Weber Committed by Stephen Hemminger

iproute2: filter routing entries based on clone flag

Before IPv6 routing cache entries were always displayed
if additional tables beside MAIN and LOCAL are installed.
Signed-off-by: default avatarUlrich Weber <uweber@astaro.com>
parent b6c8e808
...@@ -160,14 +160,11 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) ...@@ -160,14 +160,11 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN) if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
ip6_multiple_tables = 1; ip6_multiple_tables = 1;
if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
return 0;
if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) { if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {
if (filter.cloned) {
if (!(r->rtm_flags&RTM_F_CLONED))
return 0;
}
if (filter.tb) { if (filter.tb) {
if (!filter.cloned && r->rtm_flags&RTM_F_CLONED)
return 0;
if (filter.tb == RT_TABLE_LOCAL) { if (filter.tb == RT_TABLE_LOCAL) {
if (r->rtm_type != RTN_LOCAL) if (r->rtm_type != RTN_LOCAL)
return 0; return 0;
...@@ -179,10 +176,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) ...@@ -179,10 +176,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
} }
} }
} else { } else {
if (filter.cloned) {
if (!(r->rtm_flags&RTM_F_CLONED))
return 0;
}
if (filter.tb > 0 && filter.tb != table) if (filter.tb > 0 && filter.tb != table)
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment