歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> Linux Wireless Programming (1)

Linux Wireless Programming (1)

日期:2017/3/3 12:53:45   编辑:Linux技術
Linux Wireless Programming
在 Linux 的 user space 中如何進行 wireless programming 呢?
(1) 最早的一套API由HP公司員工Jean Tourrilhes於1997年開發,全稱為Linux Wireless Extensions。一般縮寫為wex或wext。這套API使得用戶空間的程序能通過ioctl函數來控制無線網卡驅動。
(2) 由於利用ioctl開展編程的方式不太符合Linux驅動開發的要求,所以後來Linux又提供了cfg80211和nl80211兩套編程接口用於替代wext。其中,cfg80211用於驅動開發,而nl80211 API供用戶空間進程使用以操作那些利用cfg80211 API開發的無線網卡驅動。

Part 1: 關於 Linux Wireless Extensions

(1) Wireless Extensions for Linux
http://www.labs.hpe.com/personal/Jean_Tourrilhes/Linux/Linux.Wireless.Extensions.html
(2) Linux Wireless Wiki
https://wireless.wiki.kernel.org/en/developers/documentation/wireless-extensions
In this section, some questions about WE are answered, e.g.,
Is WE being further developed ?
Why we are abandoning WE ?
What is Wireless-Extensions’ replacement ?
Do we still use WE ?

(3) Some other important information
Wireless Tools for Linux (including WE for Wireless Extensions and WT for Wireless Tools)
http://www.labs.hpe.com/personal/Jean_Tourrilhes/Linux/Tools.html

Part 2: 關於cfg80211和nl80211

(1) cfg80211
https://wireless.wiki.kernel.org/en/developers/documentation/cfg80211
cfg80211 is the Linux 802.11 configuration API. cfg80211 replaces Wireless-Extensions. nl80211 is used to configure a cfg80211 device and is used for kernel ←→ userspace communication. Wireless extensions is now in maintenance mode, no new features will be added to it, we’ll only fix bugs for it. cfg80211 is now feature-par complete with wireless-extensions, it actually has a lot more features that are simply not available and will never be available through wireless extensions.
cfg80211 in Linux Wireless
http://linuxwireless.org/en/developers/Documentation/cfg80211/
(2) nl80211
https://wireless.wiki.kernel.org/en/developers/documentation/nl80211
nl80211 is the new 802.11 netlink interface public header. Together with cfg80211 it is intended to replace Wireless-Extensions. nl80211 and cfg80211 are still under development.
Current users of nl80211:
iw
crda
hostapd
wpa_supplicant (with -Dnl80211)
補充: wpa_supplicant
wpa_supplicant Linux documentation page
https://wireless.wiki.kernel.org/en/users/documentation/wpa_supplicant
Supplicant Home Page
Linux WPA/WPA2/IEEE 802.1X Supplicant
http://w1.fi/wpa_supplicant
Developers’ documentation for wpa_supplicant and hostapd
http://w1.fi/wpa_supplicant/devel


nl for netlink in short
man 7 netlink 可以看到:
netlink - communication between kernel and user space (AF_NETLINK)
Netlink is used to transfer information between kernel and user-space processes.
nl80211 的基礎 libnl
Netlink Protocol Library Suite (libnl)
https://www.infradead.org/~tgr/libnl
Libraries
The interfaces are split into several small libraries to not force applications to link against a single, bloated library.
libnl
Core library implementing the fundamentals required to use the netlink protocol such as socket handling, message construction and parsing, and sending and receiving of data. This library is kept small and minimalistic. Other libraries of the suite depend on this library.
libnl-route
API to the configuration interfaces of the NETLINK_ROUTE family including network interfaces, routes, addresses, neighbours, and traffic control.
libnl-genl
API to the generic netlink protocol, an extended version of the netlink protocol.
libnl-nf
API to netlink based netfilter configuration and monitoring interfaces (conntrack, log, queue)

因此,通過 sudo apt-cache search libnl 會得到:
libnl-3-200 - library for dealing with netlink sockets
libnl-3-200-dbg - debug symbols for libnl3
libnl-3-dev - development library and headers for libnl-3
libnl-cli-3-200 - library for dealing with netlink sockets - cli helpers
libnl-cli-3-dev - development library and headers for libnl-cli-3
libnl-genl-3-200 - library for dealing with netlink sockets - generic netlink
libnl-genl-3-dev - development library and headers for libnl-genl-3
libnl-nf-3-200 - library for dealing with netlink sockets - netfilter interface
libnl-nf-3-dev - development library and headers for libnl-nf-3
libnl-route-3-200 - library for dealing with netlink sockets - route interface
libnl-route-3-dev - development library and headers for libnl-route-3
libnl-dev - development library and headers for libnl
libnl-doc - API documentation for libnl
libnl-utils - Utilities for dealing with netlink sockets
libnl1 - library for dealing with netlink sockets
libnlopt-dev - nonlinear optimization library – development package
libnlopt-guile0 - nonlinear optimization library – Guile bindings
libnlopt0 - nonlinear optimization library
ntrack-module-libnl-0 - libnl based ntrack module
眾多分開的 shared libraries
Copyright © Linux教程網 All Rights Reserved