All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Thery <benjamin.thery@bull.net>
To: Dave Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Benjamin Thery <benjamin.thery@bull.net>
Subject: [PATCH 2/2] net: /proc/net/ip_mr_cache, display Iif as a signed short
Date: Wed, 03 Dec 2008 15:35:42 +0100	[thread overview]
Message-ID: <20081203143540.694846883@localhost.localdomain> (raw)
In-Reply-To: <49368E23.6070406@bull.net>

Today, iproute2 fails to show multicast forwarding unresolved cache
entries while scanning /proc/net/ip_mr_cache.

Indeed, it expects to see -1 in 'Iif' column to identify unresolved
entries but the kernel outputs 65535. It's a signed/unsigned issue:

'Iif', the source interface, is retrieved from member mfc_parent in
struct mfc_cache. mfc_parent is a vifi_t: unsigned short, but is
displayed in ipmr_mfc_seq_show() as "%-3d", signed integer.

In unresolevd entries, the 65535 value (0xFFFF) comes from this define:
#define ALL_VIFS    ((vifi_t)(-1))

That may explains why the guy who added support for this in iproute2
thought a -1 should be expected.

I don't know if this must be fixed in kernel or in iproute2. Who is
right? What is the correct API? How was it designed originally?

I let you decide if it should goes in the kernel or be fixed in iproute2.

Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
 net/ipv4/ipmr.c  |    2 +-
 net/ipv6/ip6mr.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index cb3a57d..244a624 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1879,7 +1879,7 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
 		const struct mfc_cache *mfc = v;
 		const struct ipmr_mfc_iter *it = seq->private;
 
-		seq_printf(seq, "%08lX %08lX %-3d",
+		seq_printf(seq, "%08lX %08lX %-3hd",
 			   (unsigned long) mfc->mfc_mcastgrp,
 			   (unsigned long) mfc->mfc_origin,
 			   mfc->mfc_parent);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 2dc4b01..1446bec 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -297,7 +297,7 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
 		const struct mfc6_cache *mfc = v;
 		const struct ipmr_mfc_iter *it = seq->private;
 
-		seq_printf(seq, "%pI6 %pI6 %-3d",
+		seq_printf(seq, "%pI6 %pI6 %-3hd",
 			   &mfc->mf6c_mcastgrp, &mfc->mf6c_origin,
 			   mfc->mf6c_parent);
 


  parent reply	other threads:[~2008-12-03 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 16:02 [PATCH] net: fix /proc/net/ip_mr_cache display Benjamin Thery
2008-12-01 16:49 ` Benjamin Thery
2008-12-01 17:33   ` Stephen Hemminger
2008-12-01 20:17     ` Benjamin Thery 
2008-12-02 23:03       ` David Miller
2008-12-03 13:48         ` Benjamin Thery
2008-12-03 14:35           ` [PATCH 1/2] net: fix /proc/net/ip_mr_cache display - V2 Benjamin Thery
2008-12-04  6:21             ` David Miller
2008-12-03 14:35           ` Benjamin Thery [this message]
2008-12-04  6:22             ` [PATCH 2/2] net: /proc/net/ip_mr_cache, display Iif as a signed short David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081203143540.694846883@localhost.localdomain \
    --to=benjamin.thery@bull.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.