From e88996cb0cbb683897736fae59b519aeaec01d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Aime?= Date: Tue, 19 Jan 2021 17:25:06 +0100 Subject: [PATCH] Predictable Network Interface Names support --- install.sh | 2 +- server/backend/app/classes/config.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 4353807..064298b 100644 --- a/install.sh +++ b/install.sh @@ -307,7 +307,7 @@ check_wlan_interfaces() { # Check if they are recognized by ifconfig, if not unblock them with rfkill. echo -e "\e[39m[+] Checking your wireless interfaces" - for iface in $(ifconfig | grep -oE wlan[0-9]); do ifaces+=("$iface"); done + for iface in $(ifconfig | grep -oE "(wlan[0-9]|wlx[a-f0-9]{12})"; do ifaces+=("$iface"); done for iface in $(rfkill list | grep -oE phy[0-9]); do rfaces+=("$iface"); done if [[ "${#rfaces[@]}" > 1 ]]; then diff --git a/server/backend/app/classes/config.py b/server/backend/app/classes/config.py index 57ce515..cd187dc 100644 --- a/server/backend/app/classes/config.py +++ b/server/backend/app/classes/config.py @@ -55,7 +55,7 @@ class Config(object): # Changes for network interfaces. if cat == "network" and key in ["in", "out"]: - if re.match("^wlan[0-9]{1}$", value): + if re.match("^(wlan[0-9]|wlx[a-f0-9]{12})$", value): if key == "in": self.edit_configuration_files(value) config[cat][key] = value @@ -120,7 +120,7 @@ class Config(object): :return: list of the interfaces """ try: - return [i for i in os.listdir("/sys/class/net/") if i.startswith("wlan")] + return [i for i in os.listdir("/sys/class/net/") if i.startswith(("wlan", "wlx"))] except: return ["Interface not found", "Interface not found"] @@ -130,7 +130,7 @@ class Config(object): :return: nothing. """ try: - if re.match("^wlan[0-9]{1}$", iface): + if re.match("^(wlan[0-9]|wlx[a-f0-9]{12})$", iface): # Edit of DHCPD.conf with open("/etc/dhcpcd.conf", 'r') as file: content = file.readlines()