]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
libnetlink: add bridge vlan dump request helper
authorNikolay Aleksandrov <nikolay@nvidia.com>
Sun, 18 Apr 2021 12:01:35 +0000 (15:01 +0300)
committerDavid Ahern <dsahern@kernel.org>
Thu, 22 Apr 2021 05:13:29 +0000 (05:13 +0000)
Add rtnl bridge vlan dump request helper which will be used to retrieve
bridge vlan information and options.

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
include/libnetlink.h
lib/libnetlink.c

index e8ed5d7fb495aaee7f3175885546e7cb336e9958..da96c69b9edef5f1b0150eec588282ef54890f95 100644 (file)
@@ -69,6 +69,8 @@ int rtnl_neightbldump_req(struct rtnl_handle *rth, int family)
        __attribute__((warn_unused_result));
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
        __attribute__((warn_unused_result));
+int rtnl_brvlandump_req(struct rtnl_handle *rth, int family, __u32 dump_flags)
+       __attribute__((warn_unused_result));
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
        __attribute__((warn_unused_result));
 
index 6885087b34f963f7e95a225a8525f31b4d4c60cc..2f2cc1fe0a6160c026b55481f08ea0b037c592a0 100644 (file)
@@ -450,6 +450,25 @@ int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
        return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_brvlandump_req(struct rtnl_handle *rth, int family, __u32 dump_flags)
+{
+       struct {
+               struct nlmsghdr nlh;
+               struct br_vlan_msg bvm;
+               char buf[256];
+       } req = {
+               .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct br_vlan_msg)),
+               .nlh.nlmsg_type = RTM_GETVLAN,
+               .nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+               .nlh.nlmsg_seq = rth->dump = ++rth->seq,
+               .bvm.family = family,
+       };
+
+       addattr32(&req.nlh, sizeof(req), BRIDGE_VLANDB_DUMP_FLAGS, dump_flags);
+
+       return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
 {
        struct {