* [PATCH iproute2] iplink: display the value of IFLA_PROMISCUITY
@ 2013-01-28 14:38 Nicolas Dichtel
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Dichtel @ 2013-01-28 14:38 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel
This is usefull 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).
Note that I add a space after qlen (instead of before promiscuity) to be
coherent with the rest of the code.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
ip/ipaddress.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 5498f46..0d988ae 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -171,7 +171,7 @@ static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1])
qlen = ifr.ifr_qlen;
}
if (qlen)
- fprintf(f, "qlen %d", qlen);
+ fprintf(f, "qlen %d ", qlen);
}
static const char *link_modes[] = {
@@ -438,6 +438,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
if (filter.showqueue)
print_queuelen(fp, tb);
+ if (tb[IFLA_PROMISCUITY] && *(int*)RTA_DATA(tb[IFLA_PROMISCUITY]) > 0)
+ fprintf(fp, "promiscuity %u ", *(int*)RTA_DATA(tb[IFLA_PROMISCUITY]));
+
if (!filter.family || filter.family == AF_PACKET) {
SPRINT_BUF(b1);
fprintf(fp, "%s", _SL_);
--
1.8.0.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] iplink: display the value of IFLA_PROMISCUITY
[not found] <CB4696DA7737D0409230B481D0363B1414F0E60461@HQ1-EXCH03.corp.brocade.com>
@ 2013-02-04 17:04 ` Stephen Hemminger
2013-02-04 17:27 ` Nicolas Dichtel
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2013-02-04 17:04 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: netdev
On Mon, 28 Jan 2013 06:47:56 -0800
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> This is usefull 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).
>
> Note that I add a space after qlen (instead of before promiscuity) to be
> coherent with the rest of the code.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> ip/ipaddress.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
The idea is good, but I can't accept in the current form.
The problem with this is that it violates the unwritten assumption that the output
of ip command should be the arguments used to setup that interface. There were even
some VPN's that depended on that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] iplink: display the value of IFLA_PROMISCUITY
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
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Dichtel @ 2013-02-04 17:27 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Le 04/02/2013 18:04, Stephen Hemminger a écrit :
> On Mon, 28 Jan 2013 06:47:56 -0800
> Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
>
>> This is usefull 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).
>>
>> Note that I add a space after qlen (instead of before promiscuity) to be
>> coherent with the rest of the code.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> ---
>> ip/ipaddress.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> The idea is good, but I can't accept in the current form.
> The problem with this is that it violates the unwritten assumption that the output
> of ip command should be the arguments used to setup that interface. There were even
> some VPN's that depended on that.
>
Would it be acceptable to display this information when '-d' (ip -details link)
is provided by the user?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] iplink: display the value of IFLA_PROMISCUITY
2013-02-04 17:27 ` Nicolas Dichtel
@ 2013-02-04 17:56 ` Stephen Hemminger
2013-02-05 8:28 ` [PATCH iproute2 v2] " Nicolas Dichtel
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2013-02-04 17:56 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev
On Mon, 04 Feb 2013 18:27:51 +0100
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Le 04/02/2013 18:04, Stephen Hemminger a écrit :
> > On Mon, 28 Jan 2013 06:47:56 -0800
> > Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> >
> >> This is usefull 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).
> >>
> >> Note that I add a space after qlen (instead of before promiscuity) to be
> >> coherent with the rest of the code.
> >>
> >> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> >> ---
> >> ip/ipaddress.c | 5 ++++-
> >> 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > The idea is good, but I can't accept in the current form.
> > The problem with this is that it violates the unwritten assumption that the output
> > of ip command should be the arguments used to setup that interface. There were even
> > some VPN's that depended on that.
> >
> Would it be acceptable to display this information when '-d' (ip -details link)
> is provided by the user?
Yeah, that seems to be where such things end up.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iproute2 v2] iplink: display the value of IFLA_PROMISCUITY
2013-02-04 17:56 ` Stephen Hemminger
@ 2013-02-05 8:28 ` Nicolas Dichtel
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Dichtel @ 2013-02-05 8:28 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-02-05 8:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [PATCH iproute2 v2] " Nicolas Dichtel
2013-01-28 14:38 [PATCH iproute2] " Nicolas Dichtel
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.