惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
V
V2EX
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
Recent Announcements
Recent Announcements
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
美团技术团队
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks

NetworkManager

NetworkManager 1.58 NetworkManager 1.54 NetworkManager 1.52 Protect your VPN from TunnelVision attacks NetworkManager 1.50 Addressing hostname assignment in NetworkManager 1.40 Help NetworkManager project to triage issues NetworkManager 1.48 NetworkManager 1.46 NetworkManager 1.44 NetworkManager 1.42 Set up NMCI on Fedora Linux VM Using Python and NetworkManager to control the network [link] Notes on D-Bus NetworkManager 1.40 NetworkManager 1.38 From ifcfg to keyfiles [link] NetworkManager 1.36 NetworkManager 1.34 NetworkManager 1.32 NetworkManager 1.30 Initscripts’ ifcfg-rh Format in NetworkManager and its Future [link] How to set up your NetworkManager environment [link] NetworkManager 1.28 [link] Looking forward to Linux network configuration in the initial ramdisk (initrd) [link] NetworkManager 1.26 [link] Internet connection sharing with NetworkManager [link] Why NetworkManager? [link] Please welcome: NetworkManager 1.20 [link] Becoming friends with NetworkManager [link]
RFKill
2001-01-01 · via NetworkManager

The rfkill subsystem in Linux provides a mechanism to disable radio transmitters, as Wi-Fi, Bluetooth cards or WWAN modems installed in the system.

From the kernel point of view, such devices typically have a associated rfkill device (also called killswitch) that is visible in the output of the rfkill utility.

$ rfkill
ID TYPE      DEVICE                 SOFT      HARD
 0 bluetooth tpacpi_bluetooth_sw blocked unblocked
 2 wlan      phy0                blocked unblocked

Each rfkill device has a type (bluetooth, wlan, wwan) and two flags to indicate whether the killswitch is hard-blocked (when radio transmission is blocked via a hardware switch) or soft-blocked (when radio is disabled but can be re-enabled in software).

Support in NetworkManager

NetworkManager can manage the global rfkill state for Wi-Fi and WWAN devices.

It uses udev to discover (at startup, but also at runtime) the available killswitches. For each of them, NetworkManager keeps track of the current state (unblocked, soft-blocked, hard-blocked).

Each killswitch can be a platform one or a non-platform (or device) one. Platform killswitches are those belonging to the “platform” or “acpi” udev subsystem. Device switches, if hard-killed typically cannot be changed except by a physical hardware switch. Also it is common that platform killswitches control device killswitches. That is, a hard-blocked device switch can often be unblocked by a platform switch.

Therefore, when determining the global killswitch state for a given hardware type (Wi-Fi or WWAN), blocked platform switches have higher priority. If all platform switches are unblocked, then the global state is the maximum blocked state of device switches.

The global killswitch state for a hardware type is “unavailable” when no killswitches of that kind were found on the system and there are no compatible devices.

D-Bus API

The rkfill state is exposed on D-Bus via the following boolean properties of the org.freedesktop.NetworkManager interface on the /org/freedesktop/NetworkManager object:

  • WirelessEnabled (read-write)
  • WirelessHardwareEnabled (read-only)
  • WwanEnabled (read-write)
  • WwanHardwareEnabled (read-only)

‘Hardware’ properties cannot be written as they refer to the hardware-blocked state. The other two properties refer to the software-blocked state.

Since version 1.38, NetworkManager also exposes a RadioFlags property on the same interface. It currently supports two flags:

  • NM_RADIO_FLAG_WLAN_AVAILABLE = 0x1
  • NM_RADIO_FLAG_WWAN_AVAILABLE = 0x2

indicating whether any Wi-fi or WWAN hardware is present in the system.

When WirelessEnabled (or WwanEnabled) gets written, NetworkManager updates the soft-blocked state of all Wi-Fi (or WWAN) killswitches in kernel; in addition, it enables or disables any NetworkManager device of type ‘wifi’ (or ‘gsm’).

The soft-blocked state set via D-Bus is also saved in a persistent state file (/var/lib/NetworkManager/NetworkManager.state) that is reloaded at the next restart.

nmcli

nmcli implements the radio subcommand to control the rfkill state.

$ nmcli radio
WIFI-HW  WIFI      WWAN-HW  WWAN
enabled  disabled  enabled  enabled

For Wi-Fi and WWAN, bot the hardware and software killswitch states are displayed.

The soft-blocked states can be changed via

nmcli radio {all | wifi | wwan} [on | off]

and this basically controls the soft-blocked D-Bus properties as described in the previous section.

Note that since version 1.38 nmcli displays missing in the *-HW column when there are no killswitches or compatible devices.