thom311 / libnl

Netlink Library Suite
GNU Lesser General Public License v2.1
419 stars 309 forks source link

question: call to nl_send_sync() sometimes return error 33 (NLE_DUMP_INTR) #252

Open qlem opened 4 years ago

qlem commented 4 years ago

Hi,

I'm looking for explanations about error 33 (NLE_DUMP_INTR or Dump inconsistency detected, interrupted) which is sometimes returned by nl_send_sync().

Here is my code:

...
    if ((err = nl_socket_modify_cb(wlan->socket, NL_CB_VALID, NL_CB_CUSTOM,
        nl_scan_cb, wlan)) < 0) {
        printf("Call to nl_socket_modify_cb() failed: %s\n", nl_geterror(err));
        return -1;
    }
    if ((msg = nlmsg_alloc()) == NULL) {
        printf("Call to nlmsg_alloc() failed\n");
        return -1;
    }
    if (genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, wlan->nl80211_id, 0,
        NLM_F_DUMP, NL80211_CMD_GET_SCAN, 0) == NULL) {
        printf("Call to genlmsg_put() failed\n");
        nlmsg_free(msg);
        return -1;
    }
    if ((err = nla_put_u32(msg, NL80211_ATTR_IFINDEX, wlan->ifindex)) < 0) {
        printf("Call to nla_put_u32() failed: %s\n", nl_geterror(err));
        nlmsg_free(msg);
        return -1;
    }
    if ((err = nl_send_sync(wlan->socket, msg)) < 0) {
        printf("Call to nl_send_sync() failed: %s\n", nl_geterror(err));
        return -1;
    }
...

Any information is welcome.

vivekrnv commented 3 years ago

Hi,

This Dump Inconsistency Flag is introduced here: Link, which has some explanation on when it could happen.

I do happen to see it when calling nl_recvmsgs_default. Code:

m_socket = nl_socket_alloc();
nl_socket_disable_seq_check(m_socket); 
nl_socket_modify_cb(m_socket, NL_CB_VALID, NL_CB_CUSTOM, onNetlinkMsg, this);
int err = nl_connect(m_socket, NETLINK_ROUTE);
nl_socket_set_nonblocking(m_socket);
nl_socket_set_buffer_size(m_socket, 3145728, 0);

err = nl_recvmsgs_default(m_socket);  \\ This is called once for every 1 sec

This doesn't have any functional impact as such. But am very curious know, why is this happening and what could be done to avoid them

Any additional information is highly appreciated.

Thanks in Advance