Skip to content
  • Thomas Haller's avatar
    all: change handling of connection.type for bluetooth NAP and in general · abdf9a36
    Thomas Haller authored
    Branch f9b1bc16 added bluetooth NAP
    support. A NAP connection is of connection.type "bluetooth", but it
    also has a "bridge" setting. Also, it is primarily handled by NMDeviceBridge
    and NMBridgeDeviceFactory (with help from NMBluezManager).
    
    However, don't let nm_connection_get_connection_type() and
    nm_connnection_is_type() lie about what the connection.type is.
    The type is "bluetooth" for most purposes -- at least, as far as
    the client is concerned (and the public API of libnm). This restores
    previous API behavior, where nm_connection_get_connection_type()
    and nm_connection_is_type() would be simple accessors to the
    "connection.type" property.
    
    Only a few places care about the bridge aspect, and those places need special
    treatment. For example NMDeviceBridge needs to be fully aware that it can
    handle bluetooth NAP connection. That is nothing new: if you handle a
    connection of any type, you must know which fields matter and what they
    mean. It's not enough that nm_connection_get_connection_type() for bluetooth
    NAP connectins is claiming to be a bridge.
    
    Counter examples, where the original behavior is right:
    
    src/nm-manager.c-        g_set_error (error,
    src/nm-manager.c-                     NM_MANAGER_ERROR,
    src/nm-manager.c-                     NM_MANAGER_ERROR_FAILED,
    src/nm-manager.c-                     "NetworkManager plugin for '%s' unavailable",
    src/nm-manager.c:                     nm_connection_get_connection_type (connection));
    
    the correct message is: "no bluetooth plugin available", not "bridge".
    
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:   if (   (   nm_connection_is_type (connection, NM_SETTING_WIRED_SETTING_NAME)
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:           && !nm_connection_get_setting_pppoe (connection))
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_WIRELESS_SETTING_NAME)
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME)
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_TEAM_SETTING_NAME)
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c:       || nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME))
    src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c-        return TRUE;
    
    the correct behavior is for ifcfg-rh plugin to reject bluetooth NAP
    connections, not proceed and store it.
    abdf9a36