libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req
Add rtnl_mdbdump_req for mdb dumps using the proper br_port_msg as the header. Convert existing RTM_GETMDB dumps to use it. Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
393600231a
commit
9dbe6df411
|
|
@ -293,7 +293,7 @@ static int mdb_show(int argc, char **argv)
|
||||||
new_json_obj(json);
|
new_json_obj(json);
|
||||||
|
|
||||||
/* get mdb entries*/
|
/* get mdb entries*/
|
||||||
if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETMDB) < 0) {
|
if (rtnl_mdbdump_req(&rth, PF_BRIDGE) < 0) {
|
||||||
perror("Cannot send dump request");
|
perror("Cannot send dump request");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
|
||||||
__attribute__((warn_unused_result));
|
__attribute__((warn_unused_result));
|
||||||
int rtnl_routedump_req(struct rtnl_handle *rth, int family)
|
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)
|
||||||
|
__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));
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <linux/if_addrlabel.h>
|
#include <linux/if_addrlabel.h>
|
||||||
|
#include <linux/if_bridge.h>
|
||||||
|
|
||||||
#include "libnetlink.h"
|
#include "libnetlink.h"
|
||||||
|
|
||||||
|
|
@ -248,6 +249,22 @@ int rtnl_routedump_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_mdbdump_req(struct rtnl_handle *rth, int family)
|
||||||
|
{
|
||||||
|
struct {
|
||||||
|
struct nlmsghdr nlh;
|
||||||
|
struct br_port_msg bpm;
|
||||||
|
} req = {
|
||||||
|
.nlh.nlmsg_len = sizeof(req),
|
||||||
|
.nlh.nlmsg_type = RTM_GETMDB,
|
||||||
|
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
|
||||||
|
.nlh.nlmsg_seq = rth->dump = ++rth->seq,
|
||||||
|
.bpm.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