netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: JH <jupiter.hce@gmail.com>
To: netfilter-devel <netfilter-devel@vger.kernel.org>
Subject: Calling mnl_socket_sendto caused error of netlink attribute type 1 has an invalid length
Date: Mon, 30 Dec 2019 19:50:56 +1100	[thread overview]
Message-ID: <CAA=hcWTJWi3wcWez-adCE4NvzVbbeWSpwSNCz9cebnSDnGPtcQ@mail.gmail.com> (raw)

Hi,

I have following error of attribute type 1 has an invalid length when
calling following mnl_socket_sendto(channel->mnlSocket, nlh,
nlh->nlmsg_len), I cannot see what was wrong about it, the
nlh->nlmsg_len = 40 which is from libnml, is that wrong? Please advise
how to fix it.

[ 3240.939609] netlink: 'wifi_signal': attribute type 1 has an invalid
length. I have a WiFi function using nml API:

typedef struct {
        struct mnl_socket *mnlSocket;
        char buf[BUFFER_SIZE];
        uint16_t channelId;
        uint32_t interfaceIndex;
        uint32_t sequence;
        void *context;
} __attribute__ ((packed)) Netlink80211Channel_t;

void WiFiScan::Send80211Message(struct nlmsghdr *nlh,
Netlink80211Channel_t *channel) {
    if (mnl_socket_sendto(channel->mnlSocket, nlh, nlh->nlmsg_len) < 0) {
         std::cout << "Failed to send socket" << std::endl;
    }
}

Thank you.

- jh

             reply	other threads:[~2019-12-30  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  8:50 JH [this message]
2019-12-31  0:32 ` Calling mnl_socket_sendto caused error of netlink attribute type 1 has an invalid length Duncan Roe
2020-01-02  7:59   ` JH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA=hcWTJWi3wcWez-adCE4NvzVbbeWSpwSNCz9cebnSDnGPtcQ@mail.gmail.com' \
    --to=jupiter.hce@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).