c - nl80211库和cfg80211是如何工作的?

标签 c linux-kernel linux-device-driver wifi

我想详细了解nl80211cfg80211是如何工作的,例如:功能流程以及nl80211如何与网络工具交互,例如wpa_supplicantiw

最佳答案

为了能够从用户空间控制无线驱动程序,使用了内核和用户空间之间的一些 IPC 通信过程。

  • 首先使用了具有供应商相关 API 的 ioctl
  • 1996 年,Jean Tourrilhes 创造了 wireless extensions (我们或 WEXT)。

The Wireless Extension (WE) is a generic API allowing a driver to expose to the user space configuration and statistics specific to common Wireless LANs.

  • 2006 年,John Linville 创建了 mac80211和 Johannes Berg 创建了 cfg80211nl80211 .它一起旨在取代无线扩展。

    +-------------+
    |             |
    |  Userspace  |
    |             |
    +-------------+
          ^
    - - - | - - - - 
          | nl80211
          v
    +-------------+
    |             |
    |  cfg80211   |
    |             |
    +-------------+
    +-------------+
    |             |
    |  mac80211   |
    |   driver    |
    |             |
    +-------------+
    

重要的一点是nl80211/cfg80211/mac80211不再使用ioctl,他们使用netlink .

因此,像 iw 这样的工具, hostapdwpa_supplicant使用一些 netlink 库(如 libnllibnl-tiny )和 netlink 接口(interface)公共(public) header ,这当然是 nl80211.h .

没有那么多文档,但我建议你阅读 libnl documentation然后是 iw source code (因为我使用 libnl)。

关于c - nl80211库和cfg80211是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21456235/

相关文章:

linux - 简单的 SPI 设备驱动程序

linux - 如何编写 Linux 内核模块?

c - 下面声明的类型不应是不完整类型的声明是什么意思

C 大型二维数组创建

c - 给出输入时字符串和数组的区别

windows - 可能和不太可能的宏

Objective-C C 风格函数

linux - Kernel中的链表遍历

android - 直接在移动网络上访问android应用程序端口

Linux 驱动程序。仅读取 IOCTL 命令有效