<div text="#000000" bgcolor="#ffffff">
    Hi,<br>
    <br>
    I need to received some action frames to process in userspace. I&#39;m
    registering its receptions by sending a @NL80211_CMD_REGISTER_ACTION
    message. Everything seems correct until this point. The problem is
    that I can&#39;t receive anything at userspace. I defined the handler
    and wait for incoming messages but nothing seems to arrive.<br>
    <br>
    Next it&#39;s the code I use to register and wait for the actions
    frames.<br>
    <br>
    <small><small>int mac80211_reg_action(const char *interface) {<br>
            struct nl_sock *nl_handle = NULL;<br>
            struct nl_cache *nl_cache = NULL;<br>
            struct genl_family *nl80211 = NULL;<br>
            struct nl_msg *msg;<br>
        <br>
            // Init mac80211 connection<br>
            if (mac80211_connect(interface,<br>
                                 (void **) &amp;nl_handle, <br>
                                 (void **) &amp;nl_cache,<br>
                                 (void **) &amp;nl80211) &lt; 0) {<br>
                return -1;<br>
            }<br>
        <br>
            if ((msg = nlmsg_alloc()) == NULL) {<br>
                mac80211_disconnect(nl_handle);<br>
                return -2;<br>
            }<br>
            //    <br>
        <br>
            // Create message to send to mac80211<br>
            genlmsg_put(msg, 0, 0, genl_family_get_id(nl80211), 0, 0,
        NL80211_CMD_REGISTER_ACTION, 0);<br>
            NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX,
        if_nametoindex(interface));<br>
            nla_put_u8(msg, NL80211_ATTR_FRAME_MATCH, 2);<br>
        <br>
            if (nl_send_auto_complete(nl_handle, msg) &lt; 0) {<br>
        nla_put_failure:<br>
                nlmsg_free(msg);<br>
                mac80211_disconnect(nl_handle);<br>
        <br>
                return errno;<br>
            }<br>
            //<br>
        <br>
        <br>
            // wait for incoming messages<br>
           struct nl_cb *cb;<br>
            int err;<br>
        <br>
            cb = nl_cb_alloc(NL_CB_DEFAULT);<br>
        <br>
            err = 1;<br>
        <br>
            nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler,
        NULL);<br>
            nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, error_handler,
        &amp;err);<br>
        <br>
            while (err &gt; 0)<br>
                nl_recvmsgs(nl_handle, cb);<br>
        <br>
             nlmsg_free(msg);<br>
          <br>
            return 0;<br>
        }</small></small><br>
    <br>
    What could be wrong?<br>
    <br>
    Thanks,<br>
    Carlos<br>
  </div>