Netlink: Explicitly skip received cloned routes
Kernel uses cloned routes to keep route cache entries, but reports them together with regular routes. They were skipped implicitly as they do not have rtm_protocol filled. Add explicit check for cloned flag and skip such routes explicitly. Also, improve debug logs of skipped routes.
This commit is contained in:
parent
60e9def9ef
commit
d0dd1d20cd
1 changed files with 7 additions and 3 deletions
|
@ -1535,7 +1535,8 @@ nl_parse_end(struct nl_parse_state *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define SKIP(ARG...) do { DBG("KRT: Ignoring route - " ARG); return; } while(0)
|
#define SKIP0(ARG, ...) do { DBG("KRT: Ignoring route - " ARG, ##__VA_ARGS__); return; } while(0)
|
||||||
|
#define SKIP(ARG, ...) do { DBG("KRT: Ignoring route %N - " ARG, &dst, ##__VA_ARGS__); return; } while(0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
||||||
|
@ -1588,10 +1589,10 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!a[RTA_DST])
|
if (!a[RTA_DST])
|
||||||
SKIP("MPLS route without RTA_DST");
|
SKIP0("MPLS route without RTA_DST\n");
|
||||||
|
|
||||||
if (rta_get_mpls(a[RTA_DST], rta_mpls_stack) != 1)
|
if (rta_get_mpls(a[RTA_DST], rta_mpls_stack) != 1)
|
||||||
SKIP("MPLS route with multi-label RTA_DST");
|
SKIP0("MPLS route with multi-label RTA_DST\n");
|
||||||
|
|
||||||
net_fill_mpls(&dst, rta_mpls_stack[0]);
|
net_fill_mpls(&dst, rta_mpls_stack[0]);
|
||||||
break;
|
break;
|
||||||
|
@ -1609,6 +1610,9 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
||||||
else
|
else
|
||||||
table_id = i->rtm_table;
|
table_id = i->rtm_table;
|
||||||
|
|
||||||
|
if (i->rtm_flags & RTM_F_CLONED)
|
||||||
|
SKIP("cloned\n");
|
||||||
|
|
||||||
/* Do we know this table? */
|
/* Do we know this table? */
|
||||||
p = HASH_FIND(nl_table_map, RTH, i->rtm_family, table_id);
|
p = HASH_FIND(nl_table_map, RTH, i->rtm_family, table_id);
|
||||||
if (!p)
|
if (!p)
|
||||||
|
|
Loading…
Reference in a new issue