Netdev List
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: shemminger@vyatta.com
Cc: netdev@vger.kernel.org, Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [PATCH iproute2 v2] iplink: display the value of IFLA_PROMISCUITY
Date: Tue,  5 Feb 2013 09:28:01 +0100	[thread overview]
Message-ID: <1360052881-17935-1-git-send-email-nicolas.dichtel@6wind.com> (raw)
In-Reply-To: <20130204095636.64b57bd0@nehalam.linuxnetplumber.net>

This is useful to know the 'real' status of an interface (the flag IFF_PROMISC
is exported by the kernel only when the user set it explicitly, for example it
will not be exported when a tcpdump is running).

This information will be displayed when '-details' is provided by the user.

Example:
$ ip -d l l tun10
6: tun10: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN mode DEFAULT
    link/sit 10.16.0.249 peer 10.16.0.121
    sit remote 10.16.0.121 local 10.16.0.249 ttl inherit pmtudisc 6rd-prefix 2002::/16
    promiscuity 2

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v2: because IFLA_PROMISCUITY is read only, display it only when '-details' is
    provided (and even if the value is zero)

 ip/ipaddress.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 2eb1a0a..e8cab40 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -464,6 +464,10 @@ int print_linkinfo(const struct sockaddr_nl *who,
 	if (do_link && tb[IFLA_LINKINFO] && show_details)
 		print_linktype(fp, tb[IFLA_LINKINFO]);
 
+	if (do_link && tb[IFLA_PROMISCUITY] && show_details)
+		fprintf(fp, "\n    promiscuity %u ",
+			*(int*)RTA_DATA(tb[IFLA_PROMISCUITY]));
+
 	if (do_link && tb[IFLA_IFALIAS])
 		fprintf(fp,"\n    alias %s", 
 			rta_getattr_str(tb[IFLA_IFALIAS]));
-- 
1.8.0.1

      reply	other threads:[~2013-02-05  8:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CB4696DA7737D0409230B481D0363B1414F0E60461@HQ1-EXCH03.corp.brocade.com>
2013-02-04 17:04 ` [PATCH iproute2] iplink: display the value of IFLA_PROMISCUITY Stephen Hemminger
2013-02-04 17:27   ` Nicolas Dichtel
2013-02-04 17:56     ` Stephen Hemminger
2013-02-05  8:28       ` Nicolas Dichtel [this message]

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=1360052881-17935-1-git-send-email-nicolas.dichtel@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox