libnetlink: Convert GETNETCONF dumps to use rtnl_netconfdump_req
Add rtnl_netconfdump_req for netconf dumps using the proper netconfmsg as the header. Convert existing RTM_GETNETCONF dumps to use it. Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
9dbe6df411
commit
ddee16bc96
|
|
@ -55,6 +55,8 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
|
||||||
__attribute__((warn_unused_result));
|
__attribute__((warn_unused_result));
|
||||||
int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
|
int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
|
||||||
__attribute__((warn_unused_result));
|
__attribute__((warn_unused_result));
|
||||||
|
int rtnl_netconfdump_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_wilddump_request(struct rtnl_handle *rth, int fam, int type)
|
||||||
__attribute__((warn_unused_result));
|
__attribute__((warn_unused_result));
|
||||||
|
|
|
||||||
|
|
@ -210,8 +210,7 @@ static int do_show(int argc, char **argv)
|
||||||
} else {
|
} else {
|
||||||
rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
|
rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
|
||||||
dump:
|
dump:
|
||||||
if (rtnl_wilddump_request(&rth, filter.family,
|
if (rtnl_netconfdump_req(&rth, filter.family) < 0) {
|
||||||
RTM_GETNETCONF) < 0) {
|
|
||||||
perror("Cannot send dump request");
|
perror("Cannot send dump request");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,22 @@ int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
|
||||||
return send(rth->fd, &req, sizeof(req), 0);
|
return send(rth->fd, &req, sizeof(req), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
|
||||||
|
{
|
||||||
|
struct {
|
||||||
|
struct nlmsghdr nlh;
|
||||||
|
struct netconfmsg ncm;
|
||||||
|
} req = {
|
||||||
|
.nlh.nlmsg_len = sizeof(req),
|
||||||
|
.nlh.nlmsg_type = RTM_GETNETCONF,
|
||||||
|
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
|
||||||
|
.nlh.nlmsg_seq = rth->dump = ++rth->seq,
|
||||||
|
.ncm.ncm_family = family,
|
||||||
|
};
|
||||||
|
|
||||||
|
return send(rth->fd, &req, sizeof(req), 0);
|
||||||
|
}
|
||||||
|
|
||||||
int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
|
int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
|
||||||
{
|
{
|
||||||
return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
|
return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue