plugin: network interface force ignore rules for certain drivers only

The rules to force ignoring certain network ports because the modem is
using some specific drivers should definitely only be applied for the
very known qmi_wwan and cdc_mbim drivers.

If network ports for QMI or MBIM modems are exposed using different
network drivers, don't ignore them.
This commit is contained in:
Aleksander Morgado
2020-10-22 11:09:00 +02:00
parent 5aa7632e88
commit ca0dbd0728

View File

@@ -895,16 +895,19 @@ mm_plugin_create_modem (MMPlugin *self,
MMBaseModem *modem; MMBaseModem *modem;
GList *port_probes = NULL; GList *port_probes = NULL;
const gchar **virtual_ports = NULL; const gchar **virtual_ports = NULL;
const gchar **drivers;
if (!mm_device_is_virtual (device)) if (!mm_device_is_virtual (device))
port_probes = mm_device_peek_port_probe_list (device); port_probes = mm_device_peek_port_probe_list (device);
else else
virtual_ports = mm_device_virtual_peek_ports (device); virtual_ports = mm_device_virtual_peek_ports (device);
drivers = mm_device_get_drivers (device);
/* Let the plugin create the modem from the port probe results */ /* Let the plugin create the modem from the port probe results */
modem = MM_PLUGIN_GET_CLASS (self)->create_modem (MM_PLUGIN (self), modem = MM_PLUGIN_GET_CLASS (self)->create_modem (MM_PLUGIN (self),
mm_device_get_uid (device), mm_device_get_uid (device),
mm_device_get_drivers (device), drivers,
mm_device_get_vendor (device), mm_device_get_vendor (device),
mm_device_get_product (device), mm_device_get_product (device),
port_probes, port_probes,
@@ -957,6 +960,8 @@ mm_plugin_create_modem (MMPlugin *self,
goto grab_port; goto grab_port;
} }
/* Force network ignore rules for devices that use qmi_wwan */
if (drivers && g_strv_contains (drivers, "qmi_wwan")) {
#if defined WITH_QMI #if defined WITH_QMI
if (MM_IS_BROADBAND_MODEM_QMI (modem) && if (MM_IS_BROADBAND_MODEM_QMI (modem) &&
port_type == MM_PORT_TYPE_NET && port_type == MM_PORT_TYPE_NET &&
@@ -984,7 +989,10 @@ mm_plugin_create_modem (MMPlugin *self,
goto grab_port; goto grab_port;
} }
#endif #endif
}
/* Force network ignore rules for devices that use cdc_mbim */
if (drivers && g_strv_contains (drivers, "cdc_mbim")) {
#if defined WITH_MBIM #if defined WITH_MBIM
if (MM_IS_BROADBAND_MODEM_MBIM (modem) && if (MM_IS_BROADBAND_MODEM_MBIM (modem) &&
port_type == MM_PORT_TYPE_NET && port_type == MM_PORT_TYPE_NET &&
@@ -1011,6 +1019,7 @@ mm_plugin_create_modem (MMPlugin *self,
goto grab_port; goto grab_port;
} }
#endif #endif
}
grab_port: grab_port:
if (force_ignored) if (force_ignored)