From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, christian@brauner.io,
David Ahern <dsahern@gmail.com>
Subject: [PATCH iproute2-next 10/11] libnetlink: Rename rtnl_wilddump_* to rtnl_linkdump_*
Date: Sat, 29 Sep 2018 10:59:30 -0700 [thread overview]
Message-ID: <20180929175931.18448-11-dsahern@kernel.org> (raw)
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
Rename rtnl_wilddump_req_filter to rtnl_linkdump_req_filter,
rtnl_wilddump_request to rtnl_linkdump_request and
rtnl_wilddump_req_filter_fn to rtnl_linkdump_req_filter_fn.
In all cases drop the type argument which at this point is only
RTM_GETLINK and hardcode in the functions.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
bridge/link.c | 4 ++--
bridge/vlan.c | 2 +-
include/libnetlink.h | 7 +++----
ip/ipaddress.c | 4 ++--
ip/iptoken.c | 2 +-
ip/iptuntap.c | 2 +-
ip/rtmon.c | 2 +-
ip/tunnel.c | 2 +-
lib/libnetlink.c | 12 ++++++------
lib/ll_map.c | 2 +-
misc/ifstat.c | 2 +-
11 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index 8557026387d2..5d4f9b525cad 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -502,7 +502,7 @@ static int brlink_show(int argc, char **argv)
}
if (show_details) {
- if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
+ if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
(compress_vlans ?
RTEXT_FILTER_BRVLAN_COMPRESSED :
RTEXT_FILTER_BRVLAN)) < 0) {
@@ -510,7 +510,7 @@ static int brlink_show(int argc, char **argv)
exit(1);
}
} else {
- if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(&rth, PF_BRIDGE) < 0) {
perror("Cannon send dump request");
exit(1);
}
diff --git a/bridge/vlan.c b/bridge/vlan.c
index bdce55ae4e14..59ed1964bcd2 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -575,7 +575,7 @@ static int vlan_show(int argc, char **argv)
new_json_obj(json);
if (!show_stats) {
- if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
+ if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
(compress_vlans ?
RTEXT_FILTER_BRVLAN_COMPRESSED :
RTEXT_FILTER_BRVLAN)) < 0) {
diff --git a/include/libnetlink.h b/include/libnetlink.h
index f22c92ac03dc..29eb906ec9eb 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -66,15 +66,14 @@ int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
__attribute__((warn_unused_result));
-int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
+int rtnl_linkdump_request(struct rtnl_handle *rth, int fam)
__attribute__((warn_unused_result));
-int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
- __u32 filt_mask)
+int rtnl_linkdump_req_filter(struct rtnl_handle *rth, int fam, __u32 filt_mask)
__attribute__((warn_unused_result));
typedef int (*req_filter_fn_t)(struct nlmsghdr *nlh, int reqlen);
-int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int fam, int type,
+int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int fam,
req_filter_fn_t fn)
__attribute__((warn_unused_result));
int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index f29480ce51d4..ffe1e1617cba 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1778,7 +1778,7 @@ static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
int ip_linkaddr_list(int family, req_filter_fn_t filter_fn,
struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo)
{
- if (rtnl_wilddump_req_filter_fn(&rth, preferred_family, RTM_GETLINK,
+ if (rtnl_linkdump_req_filter_fn(&rth, preferred_family,
filter_fn) < 0) {
perror("Cannot send dump request");
return 1;
@@ -2031,7 +2031,7 @@ void ipaddr_get_vf_rate(int vfnum, int *min, int *max, const char *dev)
exit(1);
}
- if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(&rth, AF_UNSPEC) < 0) {
perror("Cannot send dump request");
exit(1);
}
diff --git a/ip/iptoken.c b/ip/iptoken.c
index fb64da4ec262..ce0051dfdf8a 100644
--- a/ip/iptoken.c
+++ b/ip/iptoken.c
@@ -109,7 +109,7 @@ static int iptoken_list(int argc, char **argv)
argc--; argv++;
}
- if (rtnl_wilddump_request(&rth, af, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(&rth, af) < 0) {
perror("Cannot send dump request");
return -1;
}
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 58996e6c5733..8c84e6206fa9 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -459,7 +459,7 @@ static int print_tuntap(const struct sockaddr_nl *who,
static int do_show(int argc, char **argv)
{
- if (rtnl_wilddump_req_filter_fn(&rth, AF_UNSPEC, RTM_GETLINK,
+ if (rtnl_linkdump_req_filter_fn(&rth, AF_UNSPEC,
tuntap_filter_req) < 0) {
perror("Cannot send dump request\n");
return -1;
diff --git a/ip/rtmon.c b/ip/rtmon.c
index 0e795f740e62..86b4fe2e448d 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -163,7 +163,7 @@ main(int argc, char **argv)
if (rtnl_open(&rth, groups) < 0)
exit(1);
- if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(&rth, AF_UNSPEC) < 0) {
perror("Cannot send dump request");
exit(1);
}
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 79de7f2406f0..41ff1a686a9f 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -392,7 +392,7 @@ static int print_nlmsg_tunnel(const struct sockaddr_nl *who,
int do_tunnels_list(struct tnl_print_nlmsg_info *info)
{
- if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(&rth, preferred_family) < 0) {
perror("Cannot send dump request\n");
return -1;
}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 2dd14ac5ea58..bc72272be9c4 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -346,12 +346,12 @@ int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
return send(rth->fd, &req, sizeof(req), 0);
}
-int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
+int rtnl_linkdump_request(struct rtnl_handle *rth, int family)
{
- return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
+ return rtnl_linkdump_req_filter(rth, family, RTEXT_FILTER_VF);
}
-int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
+int rtnl_linkdump_req_filter(struct rtnl_handle *rth, int family,
__u32 filt_mask)
{
struct {
@@ -362,7 +362,7 @@ int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
__u32 ext_filter_mask;
} req = {
.nlh.nlmsg_len = sizeof(req),
- .nlh.nlmsg_type = type,
+ .nlh.nlmsg_type = RTM_GETLINK,
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
.nlh.nlmsg_seq = rth->dump = ++rth->seq,
.ifm.ifi_family = family,
@@ -374,7 +374,7 @@ int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
return send(rth->fd, &req, sizeof(req), 0);
}
-int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
+int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int family,
req_filter_fn_t filter_fn)
{
struct {
@@ -383,7 +383,7 @@ int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
char buf[1024];
} req = {
.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
- .nlh.nlmsg_type = type,
+ .nlh.nlmsg_type = RTM_GETLINK,
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
.nlh.nlmsg_seq = rth->dump = ++rth->seq,
.ifm.ifi_family = family,
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 0afe68979283..4c3ed0d71913 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -218,7 +218,7 @@ void ll_init_map(struct rtnl_handle *rth)
if (initialized)
return;
- if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(rth, AF_UNSPEC) < 0) {
perror("Cannot send dump request");
exit(1);
}
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 50b906e86d5d..36eba605d5ba 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -214,7 +214,7 @@ static void load_info(void)
exit(1);
}
} else {
- if (rtnl_wilddump_request(&rth, AF_INET, RTM_GETLINK) < 0) {
+ if (rtnl_linkdump_request(&rth, AF_INET) < 0) {
perror("Cannot send dump request");
exit(1);
}
--
2.11.0
next prev parent reply other threads:[~2018-09-30 0:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-29 17:59 [PATCH iproute2-next 00/11] Fix dump requests to use proper header for type David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 01/11] libnetlink: Convert GETADDR dumps to use rtnl_addrdump_req David Ahern
2018-09-30 9:35 ` Stephen Hemminger
2018-09-30 15:37 ` David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 02/11] libnetlink: Convert GETROUTE dumps to use rtnl_routedump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 03/11] libnetlink: Convert GETADDRLABEL dumps to use rtnl_addrlbldump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 04/11] libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 05/11] libnetlink: Convert GETNETCONF dumps to use rtnl_netconfdump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 06/11] libnetlink: Convert GETRULE dumps to use rtnl_ruledump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 07/11] libnetlink: Convert GETNEIGH dumps to use rtnl_neighdump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 08/11] libnetlink: Convert GETNEIGHTBL dumps to use rtnl_neightbldump_req David Ahern
2018-09-29 17:59 ` [PATCH iproute2-next 09/11] libnetlink: Convert GETNSID dumps to use rtnl_nsiddump_req David Ahern
2018-09-29 17:59 ` David Ahern [this message]
2018-09-29 17:59 ` [PATCH iproute2-next 11/11] libnetlink: Rename rtnl_wilddump_stats_req_filter to rtnl_statsdump_req_filter David Ahern
2018-09-30 18:45 ` [PATCH iproute2-next 00/11] Fix dump requests to use proper header for type Christian Brauner
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=20180929175931.18448-11-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=christian@brauner.io \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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;
as well as URLs for NNTP newsgroup(s).