Skip to contentSkip to conversation

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

PATCH Superseded Vadim Kochan 3 participants 7 messages Sep 4, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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
---
 ip/ipmonitor.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
ip/ipmonitor.c +10 -3
index 70f2a7a..2bd3fed 100644
@@ -41,9 +41,6 @@ static int accept_msg(const struct sockaddr_nl *who,
 {
 	FILE *fp = (FILE*)arg;
 
-	if (timestamp)
-		print_timestamp(fp);
-
 	if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) {
 		struct rtmsg *r = NLMSG_DATA(n);
 		int len = n->nlmsg_len - NLMSG_LENGTH(sizeof(*r));
@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
 			return -1;
 		}
 
+		if (r->rtm_flags&RTM_F_CLONED)
+			return 0;
+
+		if (timestamp)
+			print_timestamp(fp);
+
 		if (r->rtm_family == RTNL_FAMILY_IPMR ||
 		    r->rtm_family == RTNL_FAMILY_IP6MR) {
 			if (prefix_banner)
@@ -66,6 +69,10 @@ static int accept_msg(const struct sockaddr_nl *who,
 			return 0;
 		}
 	}
+
+	if (timestamp)
+		print_timestamp(fp);
+
 	if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) {
 		ll_remember_index(who, n, NULL);
 		if (prefix_banner)
Signature · 1 line
2.1.0
#1 lore raw

Hello.

Quoted 18 lines · Vadim Kochan

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
---
  ip/ipmonitor.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
ip/ipmonitor.c +0 -0
index 70f2a7a..2bd3fed 100644

[...]

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 53

Quoted 5 lines
ip/ipmonitor.c +1 -0
@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
  			return -1;
  		}
 
+		if (r->rtm_flags&RTM_F_CLONED)

Judging on the patched code, spaces are needed around &.

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 61

Quoted 8 lines
ip/ipmonitor.c +5 -0
+			return 0;
+
+		if (timestamp)
+			print_timestamp(fp);
+
  		if (r->rtm_family == RTNL_FAMILY_IPMR ||
  		    r->rtm_family == RTNL_FAMILY_IP6MR) {
  			if (prefix_banner)

[...]

WBR, Sergei

#2 lore raw

Thanks!

Should I re-send the fixed patch with some special subject after comments/review ?

Quoted 52 lines · Sergei Shtylyov

Hello.

Quoted 21 lines · Vadim Kochan

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
---
  ip/ipmonitor.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
ip/ipmonitor.c +0 -0
index 70f2a7a..2bd3fed 100644

[...]

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 53

Quoted 5 lines
ip/ipmonitor.c +1 -0
@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
                        return -1;
                }
 
+               if (r->rtm_flags&RTM_F_CLONED)

Judging on the patched code, spaces are needed around &.

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 61

Quoted 8 lines
ip/ipmonitor.c +5 -0
+                       return 0;
+
+               if (timestamp)
+                       print_timestamp(fp);
+
                if (r->rtm_family == RTNL_FAMILY_IPMR ||
                    r->rtm_family == RTNL_FAMILY_IP6MR) {
                        if (prefix_banner)

[...]

WBR, Sergei

#3 lore raw
Quoted 4 lines · Vadim Kochan

Thanks!

Should I re-send the fixed patch with some special subject after comments/review ?

Typically a [PATCH v2] and so on if there are comments on v2.

-vlad

Quoted 60 lines
Quoted 50 lines · Sergei Shtylyov

Hello.

Quoted 21 lines · Vadim Kochan

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
---
  ip/ipmonitor.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
ip/ipmonitor.c +0 -0
index 70f2a7a..2bd3fed 100644

[...]

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 53

Quoted 5 lines
ip/ipmonitor.c +1 -0
@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
                        return -1;
                }
 
+               if (r->rtm_flags&RTM_F_CLONED)

Judging on the patched code, spaces are needed around &.

Quoted 8 lines
ip/ipmonitor.c +5 -0
+                       return 0;
+
+               if (timestamp)
+                       print_timestamp(fp);
+
                if (r->rtm_family == RTNL_FAMILY_IPMR ||
                    r->rtm_family == RTNL_FAMILY_IP6MR) {
                        if (prefix_banner)

[...]

Quoted 2 lines

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hm thats strange I changed subject of the fixed patch to the [PATCH v2] form but it appeared in this thread w/o v2.

Quoted 71 lines · Vlad Yasevich
Quoted 4 lines · Vadim Kochan

Thanks!

Should I re-send the fixed patch with some special subject after comments/review ?

Typically a [PATCH v2] and so on if there are comments on v2.

-vlad

Quoted 60 lines
Quoted 50 lines · Sergei Shtylyov

Hello.

Quoted 21 lines · Vadim Kochan

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
---
  ip/ipmonitor.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
ip/ipmonitor.c +0 -0
index 70f2a7a..2bd3fed 100644

[...]

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 53

Quoted 5 lines
ip/ipmonitor.c +1 -0
@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
                        return -1;
                }
 
+               if (r->rtm_flags&RTM_F_CLONED)

Judging on the patched code, spaces are needed around &.

Quoted 8 lines
ip/ipmonitor.c +5 -0
+                       return 0;
+
+               if (timestamp)
+                       print_timestamp(fp);
+
                if (r->rtm_family == RTNL_FAMILY_IPMR ||
                    r->rtm_family == RTNL_FAMILY_IP6MR) {
                        if (prefix_banner)

[...]

Quoted 2 lines

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

But here http://patchwork.ozlabs.org/project/netdev/list/ I see the v2.

Quoted 75 lines · Vadim Kochan

Hm thats strange I changed subject of the fixed patch to the [PATCH v2] form but it appeared in this thread w/o v2.

Quoted 71 lines · Vlad Yasevich
Quoted 4 lines · Vadim Kochan

Thanks!

Should I re-send the fixed patch with some special subject after comments/review ?

Typically a [PATCH v2] and so on if there are comments on v2.

-vlad

Quoted 60 lines
Quoted 50 lines · Sergei Shtylyov

Hello.

Quoted 21 lines · Vadim Kochan

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
---
  ip/ipmonitor.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
ip/ipmonitor.c +0 -0
index 70f2a7a..2bd3fed 100644

[...]

ip/ipmonitor.c static int accept_msg(const struct sockaddr_nl *who, · line 53

Quoted 5 lines
ip/ipmonitor.c +1 -0
@@ -53,6 +50,12 @@ static int accept_msg(const struct sockaddr_nl *who,
                        return -1;
                }
 
+               if (r->rtm_flags&RTM_F_CLONED)

Judging on the patched code, spaces are needed around &.

Quoted 8 lines
ip/ipmonitor.c +5 -0
+                       return 0;
+
+               if (timestamp)
+                       print_timestamp(fp);
+
                if (r->rtm_family == RTNL_FAMILY_IPMR ||
                    r->rtm_family == RTNL_FAMILY_IP6MR) {
                        if (prefix_banner)

[...]

Quoted 2 lines

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 1 line · Vadim Kochan

But here http://patchwork.ozlabs.org/project/netdev/list/ I see the v2.

I'm seeing v2 on your posting as well.

Quoted 4 lines · Vadim Kochan
Quoted 3 lines

Hm thats strange I changed subject of the fixed patch to the [PATCH v2] form but it appeared in this thread w/o v2.

The v2 is on its own thread (how it should be).

Quoted 10 lines
Quoted 10 lines · Vlad Yasevich
Quoted 9 lines · Vadim Kochan
Quoted 4 lines

Thanks!

Should I re-send the fixed patch with some special subject after comments/review ?

Typically a [PATCH v2] and so on if there are comments on v2.

-vlad

WBR, Sergei