All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Thielemann <thomas@th-thielemann.de>
To: linux-wireless@vger.kernel.org
Subject: How to use netlink to determine wifi protection WEP
Date: Wed, 5 Apr 2017 09:27:03 +0200	[thread overview]
Message-ID: <163FFAFB-1BA3-42A1-9F84-0EAEDFEBE5AE@th-thielemann.de> (raw)

Hello!

I need a solution to determine whether a WiFi is using WEP. I know there is a protection flag within MAC frame but do not know how to access.

To detect whether a WiFi i protected by WPA2 I found the following solution: 

Scan with

nl_sock* socket = nl_socket_alloc();
genl_connect(socket);
struct nl_msg* msg = nlmsg_alloc();
int driverId = genl_ctrl_resolve(socket, "nl80211"); 
genlmsg_put(msg, 0, 0, driverId, 0, 0, NL80211_CMD_TRIGGER_SCAN, 0);

and fetch with

genlmsg_put(msg, 0, 0, driverId, 0, NLM_F_DUMP, NL80211_CMD_GET_SCAN, 0);

Read the received structure using nl80211_bss:: NL80211_BSS_INFORMATION_ELEMENTS from nl80211.h and

examine the field RSN(id=48) (see IEEE802.11-2012.pdf, chapter 8.4.2 Information elements)

Which netlink command gives me the related data? Is it NL80211_CMD_GET_BEACON?

Regards,
Thomas

E-Mail: th-thielemann@web.de

             reply	other threads:[~2017-04-05  7:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05  7:27 Thomas Thielemann [this message]
2017-04-05 17:24 ` How to use netlink to determine wifi protection WEP Dan Williams
2017-04-06 14:27   ` Thomas Thielemann
2017-04-06 15:41     ` Dan Williams

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=163FFAFB-1BA3-42A1-9F84-0EAEDFEBE5AE@th-thielemann.de \
    --to=thomas@th-thielemann.de \
    --cc=linux-wireless@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.