]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - genl.c
iw: bump version to 4.7
[thirdparty/iw.git] / genl.c
diff --git a/genl.c b/genl.c
index 8f83d138d69cb6229c33d80c1a202a3036369c20..7dc27f78c735668393f452cc5dbce970668f4d67 100644 (file)
--- a/genl.c
+++ b/genl.c
@@ -5,9 +5,12 @@
 #include <asm/errno.h>
 #include <netlink/genl/genl.h>
 #include <netlink/genl/family.h>
-#include <netlink/genl/ctrl.h>  
+#include <netlink/genl/ctrl.h>
 #include <netlink/msg.h>
 #include <netlink/attr.h>
+#include <linux/genetlink.h>
+
+#include "iw.h"
 
 static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
                         void *arg)
@@ -40,7 +43,7 @@ static int family_handler(struct nl_msg *msg, void *arg)
        nla_parse(tb, CTRL_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
                  genlmsg_attrlen(gnlh, 0), NULL);
 
-        if (!tb[CTRL_ATTR_MCAST_GROUPS])
+       if (!tb[CTRL_ATTR_MCAST_GROUPS])
                return NL_SKIP;
 
        nla_for_each_nested(mcgrp, tb[CTRL_ATTR_MCAST_GROUPS], rem_mcgrp) {
@@ -58,11 +61,11 @@ static int family_handler(struct nl_msg *msg, void *arg)
                grp->id = nla_get_u32(tb_mcgrp[CTRL_ATTR_MCAST_GRP_ID]);
                break;
        }
-       
+
        return NL_SKIP;
 }
 
-int nl_get_multicast_id(struct nl_handle *handle, const char *family, const char *group)
+int nl_get_multicast_id(struct nl_sock *sock, const char *family, const char *group)
 {
        struct nl_msg *msg;
        struct nl_cb *cb;
@@ -82,15 +85,15 @@ int nl_get_multicast_id(struct nl_handle *handle, const char *family, const char
                goto out_fail_cb;
        }
 
-       ctrlid = genl_ctrl_resolve(handle, "nlctrl");
+       ctrlid = genl_ctrl_resolve(sock, "nlctrl");
 
-        genlmsg_put(msg, 0, 0, ctrlid, 0,
+       genlmsg_put(msg, 0, 0, ctrlid, 0,
                    0, CTRL_CMD_GETFAMILY, 0);
 
        ret = -ENOBUFS;
        NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, family);
 
-       ret = nl_send_auto_complete(handle, msg);
+       ret = nl_send_auto_complete(sock, msg);
        if (ret < 0)
                goto out;
 
@@ -101,7 +104,7 @@ int nl_get_multicast_id(struct nl_handle *handle, const char *family, const char
        nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, family_handler, &grp);
 
        while (ret > 0)
-               nl_recvmsgs(handle, cb);
+               nl_recvmsgs(sock, cb);
 
        if (ret == 0)
                ret = grp.id;