filter: simplify CDC_WDM rule to a subsystem-only USBMISC check

This is not just a rename of the rule, we also now avoid doing an
explicit check on the port name as well, and we rely on subsystem
checks only; i.e. the same logic applied for net ports.

The port candidate rules already do a 'cdc-wdm*' device name check
so it shouldn't be a big deal.
This commit is contained in:
Aleksander Morgado
2020-11-06 12:14:49 +01:00
parent 5265c0bd7c
commit 5df9ddac18
3 changed files with 17 additions and 18 deletions

View File

@@ -193,10 +193,9 @@ mm_filter_port (MMFilter *self,
}
/* If this is a cdc-wdm device, we always allow it */
if ((self->priv->enabled_rules & MM_FILTER_RULE_CDC_WDM) &&
(g_strcmp0 (subsystem, "usb") == 0 || g_strcmp0 (subsystem, "usbmisc") == 0) &&
(name && g_str_has_prefix (name, "cdc-wdm"))) {
mm_obj_dbg (self, "(%s/%s) port allowed: cdc-wdm device", subsystem, name);
if ((self->priv->enabled_rules & MM_FILTER_RULE_USBMISC) &&
(g_strcmp0 (subsystem, "usb") == 0 || g_strcmp0 (subsystem, "usbmisc") == 0)) {
mm_obj_dbg (self, "(%s/%s) port allowed: usbmisc device", subsystem, name);
return TRUE;
}
@@ -449,7 +448,7 @@ mm_filter_new (MMFilterRule enabled_rules,
mm_obj_dbg (self, " plugin whitelist: %s", RULE_ENABLED_STR (MM_FILTER_RULE_PLUGIN_WHITELIST));
mm_obj_dbg (self, " virtual devices forbidden: %s", RULE_ENABLED_STR (MM_FILTER_RULE_VIRTUAL));
mm_obj_dbg (self, " net devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_NET));
mm_obj_dbg (self, " cdc-wdm devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_CDC_WDM));
mm_obj_dbg (self, " usbmisc devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_USBMISC));
if (self->priv->enabled_rules & MM_FILTER_RULE_TTY) {
mm_obj_dbg (self, " tty devices:");
mm_obj_dbg (self, " blacklist applied: %s", RULE_ENABLED_STR (MM_FILTER_RULE_TTY_BLACKLIST));