#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)
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) {
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;
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;
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;