Merge pull request #550

feat(fix_services): add interface name validation helper
This commit is contained in:
Jayofelony
2026-03-24 21:31:03 +01:00
committed by GitHub
@@ -26,6 +26,15 @@ class FixServices(plugins.Plugin):
Automatically disables itself when an external WiFi adapter is detected instead of the onboard brcmfmac chip.
"""
_IFACE_RE = re.compile(r'^[a-zA-Z0-9_-]{1,15}$')
@classmethod
def _validate_iface(cls, name):
"""Validate a Linux network interface name."""
if not cls._IFACE_RE.match(name):
raise ValueError('Invalid interface name: %r' % name)
return name
def __init__(self):
self.options = dict()
self.pattern = re.compile(r'ieee80211 phy0: brcmf_cfg80211_add_iface: iface validation failed: err=-95')
@@ -105,6 +114,7 @@ class FixServices(plugins.Plugin):
if self.is_disabled:
return
try:
self._validate_iface("wlan0mon")
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
logging.debug("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
if ",UP," in str(cmd_output):