]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - lib/libnetlink.c
libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req
[mirror_iproute2.git] / lib / libnetlink.c
index fda5309ce44d77fa1ccf9d8a8697e2386e0a631b..51ea457cd31a28c6feb150353ca358ef039e5b1a 100644 (file)
@@ -22,6 +22,8 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/uio.h>
+#include <linux/if_addrlabel.h>
+#include <linux/if_bridge.h>
 
 #include "libnetlink.h"
 
@@ -215,6 +217,22 @@ int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
        return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
+{
+       struct {
+               struct nlmsghdr nlh;
+               struct ifaddrlblmsg ifal;
+       } req = {
+               .nlh.nlmsg_len = sizeof(req),
+               .nlh.nlmsg_type = RTM_GETADDRLABEL,
+               .nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+               .nlh.nlmsg_seq = rth->dump = ++rth->seq,
+               .ifal.ifal_family = family,
+       };
+
+       return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 {
        struct {
@@ -231,6 +249,22 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
        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)
 {
        return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);