Modem filter: ModemManager Reference Manual

## Modem filter

ModemManager will not probe all TTYs, NET and cdc-wdm ports found in the system, as this may end up interfering e.g. with TTYs that have nothing to do with modem devices.

The daemon comes with several predefined filter policies, each of them composed of one or more filter rules.

## Filter rules

The device filter in ModemManager defines the following independent filter rules. The predefined filter policies are based on one or more of these predefined filter rules.

- MM_FILTER_RULE_EXPLICIT_WHITELIST

  This filter allows users to manually tag devices and/or device ports with the ID_MM_DEVICE_PROCESS udev tag. If the filter finds this tag, the device and/or device ports will be automatically accepted and port probing will be allowed.

      $ sudo vim /lib/udev/rules.d/78-mm-whitelist-internal-modem.rules
          ACTION!="add|change|move", GOTO="mm_whitelist_internal_modem_end"
          ATTRS{idVendor}=="1199", ATTRS{idProduct}=="a001", ENV{ID_MM_DEVICE_PROCESS}="1"
          LABEL="mm_whitelist_internal_modem_end"
      // Apply new rules without reboot
      $ sudo udevadm control --reload
      $ sudo udevadm trigger

- MM_FILTER_RULE_VIRTUAL

  This filter will automatically flag as forbidden all ports exposed by virtual devices, like the 'lo' network interface or the tty0, tty1... virtual terminals. There is no reason to disable this filter, except for testing purposes.

- MM_FILTER_RULE_NET

  This filter will automatically flag as allowed all network ports exposed by devices. Unless there is a will to explicitly forbid network ports, this filter should always be enabled.

- MM_FILTER_RULE_CDC_WDM

  This filter will automatically flag as allowed all cdc-wdm ports exposed by devices. Unless there is a will to explicitly forbid the cdc-wdm ports exposed by qmi_wwan, cdc_mbim or huawei-cdc-ncm kernel drivers, this filter should always be enabled.

- MM_FILTER_RULE_TTY, MM_FILTER_RULE_TTY_DEFAULT_ALLOWED and MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN

  If the MM_FILTER_RULE_TTY filter is disabled, no TTY port will be allowed. If this filter is enabled, TTY ports will only be allowed if the TTY-specific filters (defined next) allow it.

  The MM_FILTER_RULE_TTY_DEFAULT_ALLOWED and MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN rules allow defining what happens when a TTY port isn't explicitly forbidden or accepted by any of the TTY-specific filters. When MM_FILTER_RULE_TTY is enabled, one of these other two options must be set.

- MM_FILTER_RULE_TTY_BLACKLIST

  This filter will not allow probing any of the devices flagged as ID_MM_DEVICE_IGNORE, like the ones in the default blacklist shipped by ModemManager.

- MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY

  This filter will not allow automatic probing any of the devices flagged as ID_MM_DEVICE_MANUAL_SCAN_ONLY, like the ones in the default USB serial adapters greylist shipped by ModemManager. Devices flagged like this will only be probed when a manual scan is requested via the ScanDevices method.

- MM_FILTER_RULE_TTY_PLATFORM_DRIVER

  If this filter is enabled, all platform TTY ports not explicitly flagged with the ID_MM_PLATFORM_DRIVER_PROBE will be forbidden. If the flag is found in a platform TTY port, port probing will be allowed directly.

  Note that this filter is obsoleted by the more generic MM_FILTER_RULE_EXPLICIT_WHITELIST filter. It is maintained for backwards compatibility with older ModemManager versions.

- MM_FILTER_RULE_TTY_DRIVER

  If this filter is enabled, all TTY ports managed by modem-specific kernel drivers will be allowed automatically.

- FILTER_RULE_TTY_ACM_INTERFACE

  If this filter is enabled, all TTY ports managed by the cdc-acm kernel driver with class=2/subclass=2/protocol=1 (AT command capable ttyACM port) will be allowed automatically.

- MM_FILTER_RULE_TTY_WITH_NET

  If this filter is enabled, all TTY ports for devices that also expose a network interface port will be allowed automatically.