filter: remove support for TTY blacklist, TTY greylist and TTY default allowed

These lists were used in the corresponding TTY_BLACKLIST and
TTY_MANUAL_SCAN_ONLY filter rules, in the LEGACY and PARANOID filter
types, which are no longer supported.

The DEFAULT_ALLOWED filter rule made sense only in the LEGACY filter
type, and therefore it is also now removed, leaving the
DEFAULT_FORBIDDEN fallback rule exclusively. In other words, there is
now no way to ask ModemManager to implicitly allow TTY ports; the only
way to do that is by explicit making the TTY ports fall in one filter
rule that would allow them.
This commit is contained in:
Aleksander Morgado
2021-06-16 10:18:33 +02:00
parent 00c1bbfd57
commit 9639e52726
8 changed files with 41 additions and 365 deletions

View File

@@ -197,37 +197,12 @@ $ sudo udevadm trigger
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY, MM_FILTER_RULE_TTY_DEFAULT_ALLOWED and MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN</emphasis></para>
<para><emphasis>MM_FILTER_RULE_TTY</emphasis></para>
<para>
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.
</para>
<para>
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.
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY_BLACKLIST</emphasis></para>
<para>
This filter will not allow probing any of the devices flagged as
<emphasis>ID_MM_TTY_BLACKLIST</emphasis>, like the ones in the default blacklist
shipped by ModemManager.
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY</emphasis></para>
<para>
This filter will not allow automatic probing any of the devices flagged as
<emphasis>ID_MM_TTY_MANUAL_SCAN_ONLY</emphasis>, 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
<link linkend="gdbus-method-org-freedesktop-ModemManager1.ScanDevices">ScanDevices</link>
method.
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY_PLATFORM_DRIVER</emphasis></para>
@@ -257,6 +232,13 @@ $ sudo udevadm trigger
interface port will be allowed automatically.
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN</emphasis></para>
<para>
This rule is the implicit one defining what happens when a TTY port isn't explicitly
accepted by any of the TTY-specific filters; i.e. the TTY port will be forbidden.
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_WWAN</emphasis></para>
<para>
@@ -270,6 +252,24 @@ $ sudo udevadm trigger
</listitem>
</itemizedlist>
</para>
<para>
The following filter rules have been deprecated and are no longer used.
<itemizedlist>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY_BLACKLIST</emphasis></para>
<para>
Deprecated in 1.18.0.
</para>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY</emphasis></para>
<para>
Deprecated in 1.18.0.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section>

View File

@@ -200,8 +200,6 @@ ID_MM_PHYSDEV_UID
ID_MM_DEVICE_PROCESS
ID_MM_DEVICE_IGNORE
ID_MM_PORT_IGNORE
ID_MM_TTY_BLACKLIST
ID_MM_TTY_MANUAL_SCAN_ONLY
ID_MM_PORT_TYPE_AT_PPP
ID_MM_PORT_TYPE_AT_PRIMARY
ID_MM_PORT_TYPE_AT_SECONDARY
@@ -212,4 +210,7 @@ ID_MM_PORT_TYPE_QMI
ID_MM_PORT_TYPE_MBIM
ID_MM_TTY_BAUDRATE
ID_MM_TTY_FLOW_CONTROL
<SUBSECTION Deprecated>
ID_MM_TTY_BLACKLIST
ID_MM_TTY_MANUAL_SCAN_ONLY
</SECTION>

View File

@@ -1,9 +0,0 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move|bind", GOTO="mm_pcmcia_device_blacklist_end"
SUBSYSTEM!="pcmcia", GOTO="mm_pcmcia_device_blacklist_end"
# Gemplus Serial Port smartcard adapter
ATTRS{prod_id1}=="Gemplus", ATTRS{prod_id2}=="SerialPort", ATTRS{prod_id3}=="GemPC Card", ENV{ID_MM_TTY_BLACKLIST}="1"
LABEL="mm_pcmcia_device_blacklist_end"

View File

@@ -1,213 +0,0 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move|bind", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
# APC UPS devices
ATTRS{idVendor}=="051d", ENV{ID_MM_TTY_BLACKLIST}="1"
# Sweex 1000VA
ATTRS{idVendor}=="0925", ATTRS{idProduct}=="1234", ENV{ID_MM_TTY_BLACKLIST}="1"
# Agiler UPS
ATTRS{idVendor}=="05b8", ATTRS{idProduct}=="0000", ENV{ID_MM_TTY_BLACKLIST}="1"
# Krauler UP-M500VA
ATTRS{idVendor}=="0001", ATTRS{idProduct}=="0000", ENV{ID_MM_TTY_BLACKLIST}="1"
# Ablerex 625L USB
ATTRS{idVendor}=="ffff", ATTRS{idProduct}=="0000", ENV{ID_MM_TTY_BLACKLIST}="1"
# Belkin F6C1200-UNV
ATTRS{idVendor}=="0665", ATTRS{idProduct}=="5161", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various Liebert and Phoenixtec Power devices
ATTRS{idVendor}=="06da", ENV{ID_MM_TTY_BLACKLIST}="1"
# Unitek Alpha 1200Sx
ATTRS{idVendor}=="0f03", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various Tripplite devices
ATTRS{idVendor}=="09ae", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various MGE Office Protection Systems devices
ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{ID_MM_TTY_BLACKLIST}="1"
# CyberPower 900AVR/BC900D
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{ID_MM_TTY_BLACKLIST}="1"
# CyberPower CP1200AVR/BC1200D
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various Belkin devices
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{ID_MM_TTY_BLACKLIST}="1"
# HP R/T 2200 INTL (like SMART2200RMXL2U)
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{ID_MM_TTY_BLACKLIST}="1"
# Powerware devices
ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0002", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm Treo 700/900/etc
# Shouldn't be probed themselves, but you can install programs like
# "MobileStream USB Modem" which changes the USB PID of the device to something
# that isn't blacklisted.
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0061", ENV{ID_MM_TTY_BLACKLIST}="1"
# GlobalScaleTechnologies SheevaPlug
ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", ENV{ID_MM_TTY_BLACKLIST}="1"
# Atmel Corp at91sam SAMBA bootloader
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from the Swiss Federal Institute of Technology
ATTRS{idVendor}=="0617", ENV{ID_MM_TTY_BLACKLIST}="1"
# West Mountain Radio devices
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814a", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814b", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="2405", ATTRS{idProduct}=="0003", ENV{ID_MM_TTY_BLACKLIST}="1"
# Arduinos
ATTRS{idVendor}=="2341", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="2a03", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9208", ENV{ID_MM_TTY_BLACKLIST}="1"
# Chinese clone of Arduino nano with a LGT8F328P MCU
ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="b534", ENV{ID_MM_TTY_BLACKLIST}="1"
# Adafruit Flora
ATTRS{idVendor}=="239a", ATTRS{idProduct}=="0004", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="239a", ATTRS{idProduct}=="8004", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from Pololu Corporation
# except some possible future products.
ATTRS{idVendor}=="1ffb", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ad", ENV{ID_MM_TTY_BLACKLIST}="0"
ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ae", ENV{ID_MM_TTY_BLACKLIST}="0"
# Altair U-Boot device
ATTRS{idVendor}=="0216", ATTRS{idProduct}=="0051", ENV{ID_MM_TTY_BLACKLIST}="1"
# Bluegiga BLE112B
ATTRS{idVendor}=="2458", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
# MediaTek GPS chip (HOLUX M-1200E, GlobalTop Gms-d1, etc)
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="3329", ENV{ID_MM_TTY_BLACKLIST}="1"
# MediaTek MT65xx preloader
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="2000", ENV{ID_MM_TTY_BLACKLIST}="1"
# PS-360 OEM (GPS sold with MS Street and Trips 2005)
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="aaa0", ENV{ID_MM_TTY_BLACKLIST}="1"
# Garmin GPS devices
DRIVERS=="garmin_gps", ENV{ID_MM_TTY_BLACKLIST}="1"
# Garmin ANT+ stick
ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1009", ENV{ID_MM_TTY_BLACKLIST}="1"
# Cypress M8-based GPS devices, UPSes, and serial converters
DRIVERS=="cypress_m8", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices in the Openmoko vendor ID, except usb hubs
ATTRS{idVendor}=="1d50", ATTRS{bDeviceClass}!="09", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from 3D Robotics
ATTRS{idVendor}=="26ac", ENV{ID_MM_TTY_BLACKLIST}="1"
# empiriKit science lab controller device
ATTRS{idVendor}=="0425", ATTRS{idProduct}=="0408", ENV{ID_MM_TTY_BLACKLIST}="1"
# Infineon Flashloader used by Intel XMM modem bootloader
ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0716", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0801", ENV{ID_MM_TTY_BLACKLIST}="1"
# Intel coredump downloader device
ATTRS{idVendor}=="1519", ATTRS{idProduct}=="f000", ENV{ID_MM_TTY_BLACKLIST}="1"
# GW Instek AFG-2225 arbitrary function generator
ATTRS{idVendor}=="2184", ATTRS{idProduct}=="001c", ENV{ID_MM_TTY_BLACKLIST}="1"
# PalmOS devices - even though some are phones, they are so old they most
# likely are not being used anymore
DRIVERS=="visor", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palmconnect
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0080", ENV{ID_MM_TTY_BLACKLIST}="1"
# IMC flashing device
ATTRS{idVendor}=="058b", ATTRS{idProduct}=="0041", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from the Access Interfacing Solutions (Access Ltd)
# Access IS do not produce modems and are unlikely to do so in future
ATTRS{idVendor}=="0db5", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm M500
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm M505
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0002", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm M515
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0003", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from POSNET POLSKA S.A.
# POSNET POLSKA S.A. do not produce modems and are unlikely to do so in future
ATTRS{idVendor}=="1424", ENV{ID_MM_TTY_BLACKLIST}="1"
# proxmark3
ATTRS{manufacturer}=="proxmark.org", ENV{ID_MM_TTY_BLACKLIST}="1"
# Sigma Sport Docking Station TOPLINE 2009
ATTRS{idVendor}=="1d9d", ATTRS{idProduct}=="1010", ENV{ID_MM_TTY_BLACKLIST}="1"
# Sigma Sport Docking Station TOPLINE 2012
ATTRS{idVendor}=="1d9d", ATTRS{idProduct}=="1011", ENV{ID_MM_TTY_BLACKLIST}="1"
# Telit LE866 flashing device
ATTRS{idVendor}=="216f", ATTRS{idProduct}=="0051", ENV{ID_MM_TTY_BLACKLIST}="1"
# Analog Devices ADALM-PLUTO (PlutoSDR)
ATTRS{idVendor}=="0456", ATTRS{idProduct}=="b673", ENV{ID_MM_TTY_BLACKLIST}="1"
# Renesas development and promotion boards
ATTRS{idVendor}=="045B", ATTRS{idProduct}=="0212", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="0409", ATTRS{idProduct}=="0063", ENV{ID_MM_TTY_BLACKLIST}="1"
# Analog Devices EVAL-ADXL362Z-DB
ATTRS{idVendor}=="064B", ATTRS{idProduct}=="7825", ENV{ID_MM_TTY_BLACKLIST}="1"
# keyboard.io devices
ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2300", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2301", ENV{ID_MM_TTY_BLACKLIST}="1"
# Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a7", ENV{ID_MM_TTY_BLACKLIST}="1"
# Silicon Labs Telegesis ETRX USB Zigbee dongle
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="000f", ENV{ID_MM_TTY_BLACKLIST}="1"
# Devices using Microchip's VID
# Dangerous Prototypes Bus Pirate v4
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fb00", ENV{ID_MM_TTY_BLACKLIST}="1"
# Pycom Pysense
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f012", ENV{ID_MM_TTY_BLACKLIST}="1"
# Pycom Pytrack
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f013", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from Prusa Research
ATTRS{idVendor}=="2c99", ENV{ID_MM_TTY_BLACKLIST}="1"
# USB-CEC adapters
ATTRS{idVendor}=="2548", ATTRS{idProduct}=="1001", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="2548", ATTRS{idProduct}=="1002", ENV{ID_MM_TTY_BLACKLIST}="1"
LABEL="mm_usb_device_blacklist_end"

View File

@@ -1,50 +0,0 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move|bind", GOTO="mm_usb_serial_adapters_greylist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_serial_adapters_greylist_end"
# Belkin F5U183 Serial Adapter
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0103", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# FTDI-based serial adapters
# FTDI does USB to serial converter ICs; and it's very likely that they'll
# never do modems themselves, so it should be safe to add a rule only based
# on the vendor Id.
ATTRS{idVendor}=="0403", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Devices using Microchip's VID
ATTRS{idVendor}=="04d8", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# ATEN Intl UC-232A (Prolific)
ATTRS{idVendor}=="0557", ATTRS{idProduct}=="2008", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Prolific USB to Serial adapter
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Magic Control Technology Corp adapters
ATTRS{idVendor}=="0711", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Cygnal Integrated Products, Inc. CP210x
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea71", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# QinHeng Electronics HL-340
ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Atmel Corp. LUFA USB to Serial Adapter Project (Arduino)
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a7", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
# Cypress Serial-USB devices
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0002", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0003", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0004", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0005", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0006", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0007", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="0009", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
ATTRS{idVendor}=="04B4", ATTRS{idProduct}=="000A", ENV{ID_MM_TTY_MANUAL_SCAN_ONLY}="1"
LABEL="mm_usb_serial_adapters_greylist_end"

View File

@@ -64,9 +64,6 @@ endif
udevrulesdir = $(UDEV_BASE_DIR)/rules.d
udevrules_DATA = \
77-mm-usb-device-blacklist.rules \
77-mm-pcmcia-device-blacklist.rules \
77-mm-usb-serial-adapters-greylist.rules \
80-mm-candidate.rules \
$(NULL)

View File

@@ -228,23 +228,6 @@ mm_filter_port (MMFilter *self,
const gchar *physdev_subsystem;
const gchar *driver;
/* Blacklist rules first */
/* Ignore blacklisted tty devices. */
if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_BLACKLIST) &&
(mm_kernel_device_get_global_property_as_boolean (port, ID_MM_TTY_BLACKLIST))) {
mm_obj_dbg (self, "(%s/%s): port filtered: tty is blacklisted", subsystem, name);
return FALSE;
}
/* Is the device in the manual-only greylist? If so, return if this is an
* automatic scan. */
if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY) &&
(!manual_scan && mm_kernel_device_get_global_property_as_boolean (port, ID_MM_TTY_MANUAL_SCAN_ONLY))) {
mm_obj_dbg (self, "(%s/%s): port filtered: tty probed only in manual scan", subsystem, name);
return FALSE;
}
/* Mixed blacklist/whitelist rules */
/* If the physdev is a 'platform' or 'pnp' device that's not whitelisted, ignore it */
@@ -258,12 +241,6 @@ mm_filter_port (MMFilter *self,
return FALSE;
}
/* Default allowed? */
if (self->priv->enabled_rules & MM_FILTER_RULE_TTY_DEFAULT_ALLOWED) {
mm_obj_dbg (self, "(%s/%s) port allowed", subsystem, name);
return TRUE;
}
/* Whitelist rules last */
/* If the TTY kernel driver is one expected modem kernel driver, allow it */
@@ -437,11 +414,8 @@ log_object_build_id (MMLogObject *_self)
/*****************************************************************************/
/* If TTY rule enabled, either DEFAULT_ALLOWED or DEFAULT_FORBIDDEN must be set. */
#define VALIDATE_RULE_TTY(rules) (!(rules & MM_FILTER_RULE_TTY) || \
((rules & (MM_FILTER_RULE_TTY_DEFAULT_ALLOWED | MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN)) && \
((rules & (MM_FILTER_RULE_TTY_DEFAULT_ALLOWED | MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN)) != \
(MM_FILTER_RULE_TTY_DEFAULT_ALLOWED | MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN))))
/* If TTY rule enabled, DEFAULT_FORBIDDEN must be set. */
#define VALIDATE_RULE_TTY(rules) (!(rules & MM_FILTER_RULE_TTY) || (rules & (MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN)))
MMFilter *
mm_filter_new (MMFilterRule enabled_rules,
@@ -477,15 +451,11 @@ mm_filter_new (MMFilterRule enabled_rules,
mm_obj_dbg (self, " wwan devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_WWAN));
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));
mm_obj_dbg (self, " manual scan only applied: %s", RULE_ENABLED_STR (MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY));
mm_obj_dbg (self, " platform driver check: %s", RULE_ENABLED_STR (MM_FILTER_RULE_TTY_PLATFORM_DRIVER));
mm_obj_dbg (self, " driver check: %s", RULE_ENABLED_STR (MM_FILTER_RULE_TTY_DRIVER));
mm_obj_dbg (self, " cdc-acm interface check: %s", RULE_ENABLED_STR (MM_FILTER_RULE_TTY_ACM_INTERFACE));
mm_obj_dbg (self, " with net check: %s", RULE_ENABLED_STR (MM_FILTER_RULE_TTY_WITH_NET));
if (self->priv->enabled_rules & MM_FILTER_RULE_TTY_DEFAULT_ALLOWED)
mm_obj_dbg (self, " default: allowed");
else if (self->priv->enabled_rules & MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN)
if (self->priv->enabled_rules & MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN)
mm_obj_dbg (self, " default: forbidden");
else
g_assert_not_reached ();

View File

@@ -56,37 +56,14 @@ typedef enum { /*< underscore_name=mm_filter_rule >*/
MM_FILTER_RULE_USBMISC = 1 << 6,
MM_FILTER_RULE_RPMSG = 1 << 7,
MM_FILTER_RULE_TTY = 1 << 8,
MM_FILTER_RULE_TTY_BLACKLIST = 1 << 9,
MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY = 1 << 10,
MM_FILTER_RULE_TTY_PLATFORM_DRIVER = 1 << 11,
MM_FILTER_RULE_TTY_DEFAULT_ALLOWED = 1 << 12,
MM_FILTER_RULE_TTY_DRIVER = 1 << 13,
MM_FILTER_RULE_TTY_ACM_INTERFACE = 1 << 14,
MM_FILTER_RULE_TTY_WITH_NET = 1 << 15,
MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN = 1 << 16,
MM_FILTER_RULE_WWAN = 1 << 17,
MM_FILTER_RULE_TTY_PLATFORM_DRIVER = 1 << 9,
MM_FILTER_RULE_TTY_DRIVER = 1 << 10,
MM_FILTER_RULE_TTY_ACM_INTERFACE = 1 << 11,
MM_FILTER_RULE_TTY_WITH_NET = 1 << 12,
MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN = 1 << 13,
MM_FILTER_RULE_WWAN = 1 << 14,
} MMFilterRule;
#define MM_FILTER_RULE_ALL \
(MM_FILTER_RULE_EXPLICIT_WHITELIST | \
MM_FILTER_RULE_EXPLICIT_BLACKLIST | \
MM_FILTER_RULE_PLUGIN_WHITELIST | \
MM_FILTER_RULE_QRTR | \
MM_FILTER_RULE_VIRTUAL | \
MM_FILTER_RULE_NET | \
MM_FILTER_RULE_USBMISC | \
MM_FILTER_RULE_RPMSG | \
MM_FILTER_RULE_TTY | \
MM_FILTER_RULE_TTY_BLACKLIST | \
MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY | \
MM_FILTER_RULE_TTY_PLATFORM_DRIVER | \
MM_FILTER_RULE_TTY_DEFAULT_ALLOWED | \
MM_FILTER_RULE_TTY_DRIVER | \
MM_FILTER_RULE_TTY_ACM_INTERFACE | \
MM_FILTER_RULE_TTY_WITH_NET | \
MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN | \
MM_FILTER_RULE_WWAN)
/* This is a stricter policy which will only automatically probe device ports
* if they are allowed by any of the automatic whitelist rules. */
#define MM_FILTER_POLICY_STRICT \
@@ -110,6 +87,9 @@ typedef enum { /*< underscore_name=mm_filter_rule >*/
* udev rules. i.e. ModemManager won't do any kind of automatic probing. */
#define MM_FILTER_POLICY_WHITELIST_ONLY MM_FILTER_RULE_EXPLICIT_WHITELIST
/* The strict policy has all supported rules */
#define MM_FILTER_RULE_ALL MM_FILTER_POLICY_STRICT
MMFilter *mm_filter_new (MMFilterRule enabled_rules,
GError **error);