iproute2: Add flag to indicate extended dump info
Subsystems (3)
RFC PATCH 1/1 iproute2: Add flag to indicate extended dump info
Add flag to the ip link dump command to indicate to the kernel that the application is requesting the extended interface information such as VFs. The kernel will take this flag as an implicit indication that the application has allocated a 16K or larger buffer, which is what the 'ip' command in fact does.
---
include/linux/netlink.h | 1 + lib/libnetlink.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
include/linux/netlink.h +1 -0
@@ -59,6 +59,7 @@ struct nlmsghdr {#define NLM_F_MATCH 0x200/* return all matching */ #define NLM_F_ATOMIC 0x400/* atomic GET */ #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) +#define NLM_F_EXT 0x800/* Get extended interface info such as VFs */ /* Modifiers to NEW request */ #define NLM_F_REPLACE 0x100/* Override existing */
lib/libnetlink.c +1 -1
@@ -99,7 +99,7 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)memset (&req,0 ,sizeof (req)); req.nlh.nlmsg_len =sizeof (req); req.nlh.nlmsg_type = type; - req.nlh.nlmsg_flags =NLM_F_DUMP |NLM_F_REQUEST ; + req.nlh.nlmsg_flags =NLM_F_DUMP |NLM_F_REQUEST |NLM_F_EXT ; req.nlh.nlmsg_pid =0 ; req.nlh.nlmsg_seq = rth->dump = ++rth->seq; req.g.rtgen_family = family;
Quoted 31 lines · On Fri, 10 Feb 2012 07:18:05 -0800 Greg Rose <[email protected]> wrote:
Add flag to the ip link dump command to indicate to the kernel that the application is requesting the extended interface information such as VFs. The kernel will take this flag as an implicit indication that the application has allocated a 16K or larger buffer, which is what the 'ip' command in fact does.
Signed-off-by Greg Rose <[email protected]>---
include/linux/netlink.h | 1 + lib/libnetlink.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)include/linux/netlink.h +1
-0@@ -59,6 +59,7 @@ struct nlmsghdr {#define NLM_F_MATCH 0x200/* return all matching */ #define NLM_F_ATOMIC 0x400/* atomic GET */ #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) +#define NLM_F_EXT 0x800/* Get extended interface info such as VFs */ /* Modifiers to NEW request */ #define NLM_F_REPLACE 0x100/* Override existing */ lib/libnetlink.c +0
-0
lib/libnetlink.c int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) · line 105
Quoted 8 lines
lib/libnetlink.c +1
-1@@ -99,7 +99,7 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)memset (&req,0 ,sizeof (req)); req.nlh.nlmsg_len =sizeof (req); req.nlh.nlmsg_type = type; - req.nlh.nlmsg_flags =NLM_F_DUMP |NLM_F_REQUEST ; + req.nlh.nlmsg_flags =NLM_F_DUMP |NLM_F_REQUEST |NLM_F_EXT ; req.nlh.nlmsg_pid =0 ; req.nlh.nlmsg_seq = rth->dump = ++rth->seq; req.g.rtgen_family = family;
Make sure and test backwards compatibility with older kernels. It should be fine as long as the flag is ignored now.
Quoted 42 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Friday, February 10, 2012 8:41 AM
To: Rose, Gregory V
Cc: [email protected]; [email protected]
Subject: Re: [RFC PATCH] iproute2: Add flag to indicate extended dump infoQuoted 18 lines · On Fri, 10 Feb 2012 07:18:05 -0800 Greg Rose <[email protected]> wrote:
Add flag to the ip link dump command to indicate to the kernel that the application is requesting the extended interface information such as VFs. The kernel will take this flag as an implicit indication that the application has allocated a 16K or larger buffer, which is what the 'ip' command in fact does.
Signed-off-by Greg Rose <[email protected]>---
include/linux/netlink.h | 1 + lib/libnetlink.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)include/linux/netlink.h +0
-0include/linux/netlink.h struct nlmsghdr { · line 62
Quoted 4 lines
include/linux/netlink.h +1
-0@@ -59,6 +59,7 @@ struct nlmsghdr {#define NLM_F_MATCH 0x200/* return all matching */ #define NLM_F_ATOMIC 0x400/* atomic GET */ #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) +#define NLM_F_EXT 0x800/* Get extended interface info such as VFs */
lib/libnetlink.c int rtnl_wilddump_request(struct rtnl_handle *rth, int
Quoted 8 lines
include/linux/netlink.h +0
-0/* Modifiers to NEW request */ #define NLM_F_REPLACE 0x100/* Override existing */ lib/libnetlink.c +0
-0@@ -99,7 +99,7 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, intfamily, int type)
Quoted 12 lines
lib/libnetlink.c int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) · line 105
Quoted 9 lines
lib/libnetlink.c +1
-1memset (&req,0 ,sizeof (req)); req.nlh.nlmsg_len =sizeof (req); req.nlh.nlmsg_type = type; - req.nlh.nlmsg_flags =NLM_F_DUMP |NLM_F_REQUEST ; + req.nlh.nlmsg_flags =NLM_F_DUMP |NLM_F_REQUEST |NLM_F_EXT ; req.nlh.nlmsg_pid =0 ; req.nlh.nlmsg_seq = rth->dump = ++rth->seq; req.g.rtgen_family = family;Make sure and test backwards compatibility with older kernels. It should be fine as long as the flag is ignored now.
We'll do that as soon as I get an indication that this associated kernel patch might actually fly. I've been shot down in flames and wreckage once already so I'm not placing any bets.
Thanks,
- Greg