[RFE] expose global metered state in nmcli
For each device NM exposes a metered property that indicates whether the connection currently active on the device has some sort of data usage limit or that the traffic incurs in additional costs. The typical use case is to signal applications to not download large amount of data on a cellular connection.
The metered state of a device is displayed by this nmcli command:
$ nmcli -f general.metered device show wlp4s0
GENERAL.METERED: no (guessed)
NM also exposes a global metered property, which corresponds to the metered property of the device with the best default route. At the moment this property is not displayed by nmcli and users have to fetch it from D-Bus:
busctl get-property org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Metered
Using libnm the property can be retrieved with function
nm_client_get_metered()
.
nmcli should print the global metered state in the 'general' subcommand output.
Current output:
$ nmcli general
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
connected full enabled enabled enabled enabled
After the change:
$ nmcli general
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN METERED
connected full enabled enabled enabled enabled no (guessed)