* [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
@ 2013-10-04 2:35 Masatake YAMATO
0 siblings, 0 replies; 4+ messages in thread
From: Masatake YAMATO @ 2013-10-04 2:35 UTC (permalink / raw)
To: netdev; +Cc: yamato
Implement print_opt method to veth to show peer ifindex
as ethtool -S does.
A patch submitted with following subject is needed:
veth: Showing peer of veth type dev in ip link (kernel side)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
ip/link_veth.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ip/link_veth.c b/ip/link_veth.c
index 7730f39..bd84815 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -11,6 +11,7 @@
*/
#include <string.h>
+#include <inttypes.h>
#include <net/if.h>
#include <linux/veth.h>
@@ -57,7 +58,22 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
return argc - 1 - err;
}
+static void veth_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+ if (!tb)
+ return;
+
+ if (tb[VETH_INFO_PEER] &&
+ RTA_PAYLOAD(tb[VETH_INFO_PEER]) < sizeof(__u64))
+ return;
+
+ fprintf(f, "peer_ifindex %"PRIu64,
+ (uint64_t)rta_getattr_u64(tb[VETH_INFO_PEER]));
+}
+
struct link_util veth_link_util = {
.id = "veth",
+ .maxattr = VETH_INFO_MAX,
.parse_opt = veth_parse_opt,
+ .print_opt = veth_print_opt,
};
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
2013-10-04 18:23 ` Stephen Hemminger
@ 2013-10-04 18:42 ` Masatake YAMATO
0 siblings, 0 replies; 4+ messages in thread
From: Masatake YAMATO @ 2013-10-04 18:42 UTC (permalink / raw)
To: stephen; +Cc: netdev
Thank you those who review my patch and give me comments.
I'll revise the patch.
Forgive me sending the same patches twice accidentally.
Masatake YAMATO
> On Fri, 4 Oct 2013 13:06:05 +0900
> Masatake YAMATO <yamato@redhat.com> wrote:
>
>> Implement print_opt method to veth to show peer ifindex
>> as ethtool -S does.
>>
>> A patch submitted with following subject is needed:
>>
>> veth: Showing peer of veth type dev in ip link (kernel side)
>>
>> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
>
> NAK, see kernel comments
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
2013-10-04 4:06 Masatake YAMATO
@ 2013-10-04 18:23 ` Stephen Hemminger
2013-10-04 18:42 ` Masatake YAMATO
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2013-10-04 18:23 UTC (permalink / raw)
To: Masatake YAMATO; +Cc: netdev
On Fri, 4 Oct 2013 13:06:05 +0900
Masatake YAMATO <yamato@redhat.com> wrote:
> Implement print_opt method to veth to show peer ifindex
> as ethtool -S does.
>
> A patch submitted with following subject is needed:
>
> veth: Showing peer of veth type dev in ip link (kernel side)
>
> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
NAK, see kernel comments
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
@ 2013-10-04 4:06 Masatake YAMATO
2013-10-04 18:23 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Masatake YAMATO @ 2013-10-04 4:06 UTC (permalink / raw)
To: netdev; +Cc: yamato
Implement print_opt method to veth to show peer ifindex
as ethtool -S does.
A patch submitted with following subject is needed:
veth: Showing peer of veth type dev in ip link (kernel side)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
ip/link_veth.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ip/link_veth.c b/ip/link_veth.c
index 7730f39..bd84815 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -11,6 +11,7 @@
*/
#include <string.h>
+#include <inttypes.h>
#include <net/if.h>
#include <linux/veth.h>
@@ -57,7 +58,22 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
return argc - 1 - err;
}
+static void veth_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+ if (!tb)
+ return;
+
+ if (tb[VETH_INFO_PEER] &&
+ RTA_PAYLOAD(tb[VETH_INFO_PEER]) < sizeof(__u64))
+ return;
+
+ fprintf(f, "peer_ifindex %"PRIu64,
+ (uint64_t)rta_getattr_u64(tb[VETH_INFO_PEER]));
+}
+
struct link_util veth_link_util = {
.id = "veth",
+ .maxattr = VETH_INFO_MAX,
.parse_opt = veth_parse_opt,
+ .print_opt = veth_print_opt,
};
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-04 18:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04 2:35 [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side) Masatake YAMATO
2013-10-04 4:06 Masatake YAMATO
2013-10-04 18:23 ` Stephen Hemminger
2013-10-04 18:42 ` Masatake YAMATO
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).