mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 22:30:11 +01:00
device: rework checking for bluetooth NAP connection in nm_device_update_metered()
NAP connections are a bit special, in that they also have a [bridge] setting, but their connection.type is "bluetooth". The canonical way to check whether a bluetooth connection is of NAP type is by calling _nm_connection_get_setting_bluetooth_for_nap(). So, instead of checking for bluetooth.type "pan" or "dun", check the opposite and whether the connection is of NAP type. In practice it's the same, but let'check for NAP consistently via get_setting_bluetooth_for_nap().
This commit is contained in:
parent
599da6fd02
commit
d76cfa3814
1 changed files with 7 additions and 10 deletions
|
|
@ -12368,22 +12368,19 @@ nm_device_update_metered (NMDevice *self)
|
|||
* another device) we set GUESS_YES; for NAP (where we are sharing internet
|
||||
* to another device) we set GUESS_NO. We ignore WiMAX here as it’s no
|
||||
* longer supported by NetworkManager. */
|
||||
if (value == NM_METERED_INVALID &&
|
||||
nm_connection_is_type (connection, NM_SETTING_BLUETOOTH_SETTING_NAME)) {
|
||||
NMSettingBluetooth *bt = nm_connection_get_setting_bluetooth (connection);
|
||||
const gchar *bt_type = (bt != NULL) ? nm_setting_bluetooth_get_connection_type (bt) : NULL;
|
||||
if ( value == NM_METERED_INVALID
|
||||
&& nm_connection_is_type (connection, NM_SETTING_BLUETOOTH_SETTING_NAME)) {
|
||||
|
||||
if ( nm_streq0 (bt_type, NM_SETTING_BLUETOOTH_TYPE_PANU)
|
||||
|| nm_streq0 (bt_type, NM_SETTING_BLUETOOTH_TYPE_DUN))
|
||||
value = NM_METERED_GUESS_YES;
|
||||
else
|
||||
if (_nm_connection_get_setting_bluetooth_for_nap (connection)) {
|
||||
/* NAP types are not metered, but other types are. */
|
||||
value = NM_METERED_GUESS_NO;
|
||||
} else
|
||||
value = NM_METERED_GUESS_YES;
|
||||
}
|
||||
|
||||
if (value == NM_METERED_INVALID) {
|
||||
if ( nm_connection_is_type (connection, NM_SETTING_GSM_SETTING_NAME)
|
||||
|| nm_connection_is_type (connection, NM_SETTING_CDMA_SETTING_NAME)
|
||||
|| nm_connection_is_type (connection, NM_SETTING_BLUETOOTH_SETTING_NAME))
|
||||
|| nm_connection_is_type (connection, NM_SETTING_CDMA_SETTING_NAME))
|
||||
value = NM_METERED_GUESS_YES;
|
||||
else
|
||||
value = NM_METERED_GUESS_NO;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue