Commit 2271779d authored by vadimk's avatar vadimk Committed by Stephen Hemminger

ip monitor: Dont print timestamp or banner-label for cloned routes

This is ugly fix but solves the case when timestamp
or banner-label is printed before the cloned route will be skipped
by iproute filter which filters out all cached routes by default.
In such case timestamp will be printed twice:

    Timestamp: Thu Sep  4 19:46:59 2014 457933 usec
    Timestamp: Thu Sep  4 19:47:07 2014 977970 usec
    10.3.5.1 dev wlp3s0 lladdr XX:XX:XX:XX:XX:XX STALE
Signed-off-by: default avatarVadim Kochan <vadim4j@gmail.com>
parent eb5d01ff
...@@ -41,9 +41,6 @@ static int accept_msg(const struct sockaddr_nl *who, ...@@ -41,9 +41,6 @@ static int accept_msg(const struct sockaddr_nl *who,
{ {
FILE *fp = (FILE*)arg; FILE *fp = (FILE*)arg;
if (timestamp)
print_timestamp(fp);
if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) { if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) {
struct rtmsg *r = NLMSG_DATA(n); struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)); int len = n->nlmsg_len - NLMSG_LENGTH(sizeof(*r));
...@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who, ...@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
return -1; return -1;
} }
if (r->rtm_flags & RTM_F_CLONED)
return 0;
if (timestamp)
print_timestamp(fp);
if (r->rtm_family == RTNL_FAMILY_IPMR || if (r->rtm_family == RTNL_FAMILY_IPMR ||
r->rtm_family == RTNL_FAMILY_IP6MR) { r->rtm_family == RTNL_FAMILY_IP6MR) {
if (prefix_banner) if (prefix_banner)
...@@ -66,6 +69,10 @@ static int accept_msg(const struct sockaddr_nl *who, ...@@ -66,6 +69,10 @@ static int accept_msg(const struct sockaddr_nl *who,
return 0; return 0;
} }
} }
if (timestamp)
print_timestamp(fp);
if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) { if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) {
ll_remember_index(who, n, NULL); ll_remember_index(who, n, NULL);
if (prefix_banner) if (prefix_banner)
......
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