Skip to contentSkip to conversation

ip: Showing peer of veth type dev in ip link (ip cmd side)

PATCH NAK Masatake YAMATO 2 participants 3 messages Oct 4, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip: Showing peer of veth type dev in ip link (ip cmd side)

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)

---
 ip/link_veth.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
ip/link_veth.c +16 -0
index 7730f39..bd84815 100644
@@ -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,
 };
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · On Fri, 4 Oct 2013 13:06:05 +0900 Masatake YAMATO <[email protected]> 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)

NAK, see kernel comments

#2 lore raw

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

Quoted 13 lines
Quoted 8 lines · On Fri, 4 Oct 2013 13:06:05 +0900 Masatake YAMATO <[email protected]> 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)

NAK, see kernel comments