APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
849a3e2034
commit
043cab7d7a
2 files changed
+182
-38
No files matched your search
@@ -312,7 +312,7 @@ def auth_state():
|
||||
conn = connection_name() if callable(globals().get('connection_name')) else ''
|
||||
eth_list = detect_ethernet_interfaces() if callable(globals().get('detect_ethernet_interfaces')) else []
|
||||
admin_ok = bool(row)
|
||||
wifi_ok = bool(conn)
|
||||
wifi_ok = bool(conn or rows.get('ap_ssid'))
|
||||
return {
|
||||
'configured': admin_ok,
|
||||
'admin_configured': admin_ok,
|
||||
@@ -1410,8 +1410,15 @@ def stats():
|
||||
def connection_name():
|
||||
active = command('nmcli','-t','-g','GENERAL.CONNECTION','device','show',INTERFACE)
|
||||
if active and active != '--': return active
|
||||
try: return open(CONNECTION_FILE, encoding='utf8').read().strip()
|
||||
except OSError: return os.environ.get('AP_CONNECTION', '')
|
||||
try:
|
||||
saved = open(CONNECTION_FILE, encoding='utf8').read().strip()
|
||||
if saved: return saved
|
||||
except OSError: pass
|
||||
pref_con = get_pref('ap_connection_name', '')
|
||||
if pref_con: return pref_con
|
||||
pref_ssid = get_pref('ap_ssid', '')
|
||||
if pref_ssid: return 'AP-' + pref_ssid
|
||||
return os.environ.get('AP_CONNECTION', '')
|
||||
|
||||
def save_connection(name):
|
||||
try: open(CONNECTION_FILE, 'w', encoding='utf8').write(name)
|
||||
@@ -3051,15 +3058,31 @@ def status(force_refresh=False):
|
||||
cached['uptime_seconds'] = ap_uptime()
|
||||
return cached
|
||||
|
||||
name = connection_name(); ssid = command('nmcli','-t','-g','802-11-wireless.ssid','connection','show',name) if name else ''
|
||||
password = command('nmcli','--show-secrets','-t','-g','802-11-wireless-security.psk','connection','show',name) if name else ''
|
||||
name = connection_name()
|
||||
db_ssid = get_pref('ap_ssid', '') or ''
|
||||
db_pass = get_pref('ap_password', '') or ''
|
||||
db_sec = (get_pref('ap_security', '') or '').lower()
|
||||
db_auto = get_pref('ap_autoconnect', None)
|
||||
nm_ssid = command('nmcli','-t','-g','802-11-wireless.ssid','connection','show',name) if name else ''
|
||||
nm_pass = command('nmcli','--show-secrets','-t','-g','802-11-wireless-security.psk','connection','show',name) if name else ''
|
||||
key = command('nmcli','-t','-g','802-11-wireless-security.key-mgmt','connection','show',name).lower() if name else ''
|
||||
proto = command('nmcli','-t','-g','802-11-wireless-security.proto','connection','show',name).lower() if name else ''
|
||||
ssid = nm_ssid or db_ssid
|
||||
password = nm_pass or db_pass
|
||||
if key:
|
||||
sec = 'wpa3' if key == 'sae' else 'wpa1' if proto == 'wpa' else 'wpa2'
|
||||
else:
|
||||
sec = db_sec if db_sec in ('wpa1', 'wpa2', 'wpa3') else 'wpa2'
|
||||
state = command('nmcli','-t','-g','GENERAL.STATE','device','show',INTERFACE)
|
||||
# CORRECTION : "30 (disconnected)" contient "connected" ; seul le code 100 signifie connecté.
|
||||
active = state.startswith('100')
|
||||
auto = command('nmcli','-t','-g','connection.autoconnect','connection','show',name).lower() == 'yes' if name else False
|
||||
nm_auto = command('nmcli','-t','-g','connection.autoconnect','connection','show',name).lower() if name else ''
|
||||
if nm_auto in ('yes', 'no'):
|
||||
auto = (nm_auto == 'yes')
|
||||
elif db_auto is not None:
|
||||
auto = str(db_auto).lower() in ('1', 'true', 'yes', 'oui')
|
||||
else:
|
||||
auto = False
|
||||
if active and uptime_start() is None:
|
||||
mark_ap_started()
|
||||
slave_type = (command('nmcli','-t','-g','connection.slave-type','connection','show',name) or command('nmcli','-t','-g','connection.port-type','connection','show',name)).lower() if name else ''
|
||||
@@ -3067,7 +3090,7 @@ def status(force_refresh=False):
|
||||
mode = current_mode()
|
||||
b_name = master or get_pref('bridge_name', os.environ.get('AP_BRIDGE_NAME', 'br0'))
|
||||
b_eth = get_pref('bridge_eth', os.environ.get('AP_BRIDGE_ETH', ''))
|
||||
res = {'ssid':ssid or 'SSID inconnu','password':password,'security':sec,'autoconnect':auto,'mode':mode,'bridge_name':b_name,'bridge_eth':b_eth,'ethernet_interfaces':detect_ethernet_interfaces(),'interface':INTERFACE,'connection':name,'active':active,'configured':bool(name),'uptime_seconds':ap_uptime() if active else 0,'max_clients':get_max_clients(),'dns':get_dns_servers(),'is_starting':not app_startup_done,'boot_time':SERVER_BOOT_TIME}
|
||||
res = {'ssid':ssid or 'SSID inconnu','password':password,'security':sec,'autoconnect':auto,'mode':mode,'bridge_name':b_name,'bridge_eth':b_eth,'ethernet_interfaces':detect_ethernet_interfaces(),'interface':INTERFACE,'connection':name,'active':active,'configured':bool(name or db_ssid),'uptime_seconds':ap_uptime() if active else 0,'max_clients':get_max_clients(),'dns':get_dns_servers(),'is_starting':not app_startup_done,'boot_time':SERVER_BOOT_TIME}
|
||||
with _status_cache_lock:
|
||||
_status_cache['time'] = now
|
||||
_status_cache['data'] = res
|
||||
@@ -4463,35 +4486,45 @@ def update_logs(items):
|
||||
except Exception: pass
|
||||
last_macs = announced
|
||||
|
||||
def configure_ap(data, initial=False, caller_ip=None):
|
||||
def configure_ap(data, initial=False, caller_ip=None, start_now=True, silent=False):
|
||||
ssid, password = str(data.get('ssid','')).strip(), str(data.get('password',''))
|
||||
sec, key, proto, pmf = security(data.get('security','wpa2'))
|
||||
if not ssid or len(ssid)>32 or not 8<=len(password)<=63: raise ValueError('SSID ou mot de passe Wi-Fi invalide')
|
||||
if 'max_clients' in data:
|
||||
set_max_clients(data.get('max_clients'))
|
||||
|
||||
raw_auto = data.get('autoconnect', True)
|
||||
autoconnect = raw_auto if isinstance(raw_auto, bool) else str(raw_auto).lower() in ('1', 'true', 'yes', 'oui')
|
||||
|
||||
mode = str(data.get('mode', '')).lower()
|
||||
if mode not in ('ap', 'bridge'):
|
||||
mode = get_pref('mode', 'ap').lower()
|
||||
if mode not in ('ap', 'bridge'): mode = 'ap'
|
||||
set_pref('mode', mode)
|
||||
|
||||
bridge_name = str(data.get('bridge_name', '')).strip() or get_pref('bridge_name', os.environ.get('AP_BRIDGE_NAME', 'br0'))
|
||||
set_pref('bridge_name', bridge_name)
|
||||
|
||||
bridge_eth = str(data.get('bridge_eth', '')).strip()
|
||||
if not bridge_eth:
|
||||
bridge_eth = get_pref('bridge_eth', os.environ.get('AP_BRIDGE_ETH', ''))
|
||||
if mode == 'bridge' and not bridge_eth:
|
||||
candidates = detect_ethernet_interfaces()
|
||||
if candidates: bridge_eth = candidates[0]
|
||||
if bridge_eth: set_pref('bridge_eth', bridge_eth)
|
||||
|
||||
print(f"[ap-wifi] Configuration AP: SSID='{ssid}', Sécurité={sec}, Mode={mode}, Autoconnect={'oui' if data.get('autoconnect',True) else 'non'}", flush=True)
|
||||
old_name = connection_name()
|
||||
target_name = 'AP-' + ssid
|
||||
name = target_name
|
||||
|
||||
# Persister l'intégralité de la configuration Wi-Fi en BDD SQLite pour survie au redémarrage du conteneur
|
||||
set_pref('ap_ssid', ssid)
|
||||
set_pref('ap_password', password)
|
||||
set_pref('ap_security', sec)
|
||||
set_pref('ap_autoconnect', '1' if autoconnect else '0')
|
||||
set_pref('mode', mode)
|
||||
set_pref('bridge_name', bridge_name)
|
||||
if bridge_eth: set_pref('bridge_eth', bridge_eth)
|
||||
set_pref('ap_connection_name', name)
|
||||
|
||||
print(f"[ap-wifi] Configuration AP: SSID='{ssid}', Sécurité={sec}, Mode={mode}, Autoconnect={'oui' if autoconnect else 'non'}", flush=True)
|
||||
|
||||
# Arrêter et supprimer proprement toute ancienne connexion pour éviter les conflits d'options slave/master/ipv4
|
||||
to_delete = {n for n in (old_name, target_name) if n}
|
||||
for c in to_delete:
|
||||
@@ -4499,6 +4532,7 @@ def configure_ap(data, initial=False, caller_ip=None):
|
||||
subprocess.run(['nmcli', 'connection', 'delete', c], capture_output=True, text=True)
|
||||
|
||||
if mode == 'bridge':
|
||||
if start_now:
|
||||
setup_bridge(bridge_name, bridge_eth)
|
||||
# Arrêter le dnsmasq interne pour que les clients reçoivent l'IP de la box et non 10.42.0.x
|
||||
subprocess.run(['pkill', '-f', 'dnsmasq.*shared'], text=True, capture_output=True)
|
||||
@@ -4528,7 +4562,7 @@ def configure_ap(data, initial=False, caller_ip=None):
|
||||
'802-11-wireless-security.pmf', pmf,
|
||||
'802-11-wireless.band', AP_BAND,
|
||||
'802-11-wireless.channel', str(AP_CHANNEL),
|
||||
'connection.autoconnect', 'yes' if data.get('autoconnect', True) else 'no'
|
||||
'connection.autoconnect', 'yes' if autoconnect else 'no'
|
||||
]
|
||||
if proto: modify_args += ['802-11-wireless-security.proto', proto]
|
||||
if sec in ('wpa2', 'wpa3'):
|
||||
@@ -4559,7 +4593,7 @@ def configure_ap(data, initial=False, caller_ip=None):
|
||||
'ipv6.method', 'ignore',
|
||||
'802-11-wireless.band', AP_BAND,
|
||||
'802-11-wireless.channel', str(AP_CHANNEL),
|
||||
'connection.autoconnect', 'yes' if data.get('autoconnect', True) else 'no'
|
||||
'connection.autoconnect', 'yes' if autoconnect else 'no'
|
||||
]
|
||||
if proto: modify_args += ['802-11-wireless-security.proto', proto]
|
||||
if sec in ('wpa2', 'wpa3'):
|
||||
@@ -4572,6 +4606,7 @@ def configure_ap(data, initial=False, caller_ip=None):
|
||||
|
||||
ensure_dnsmasq_dns()
|
||||
save_connection(name)
|
||||
if start_now:
|
||||
r = subprocess.run(['nmcli', 'connection', 'up', name], text=True, capture_output=True)
|
||||
if r.returncode:
|
||||
raise RuntimeError(r.stderr.strip() or 'Impossible de démarrer le point d’accès')
|
||||
@@ -4580,11 +4615,119 @@ def configure_ap(data, initial=False, caller_ip=None):
|
||||
else:
|
||||
setup_ap_nat(INTERFACE)
|
||||
mark_ap_started()
|
||||
else:
|
||||
teardown_ap_nat()
|
||||
invalidate_status_cache()
|
||||
if not silent:
|
||||
log('création' if initial else 'enregistrement_modifie', f"Réseau Wi-Fi {ssid} ({'Mode Pont' if mode == 'bridge' else 'Mode AP'})", ip=caller_ip or 'Non attribuée', mac='AP')
|
||||
dispatch_notification('settings_changed', "⚙️ Modification réglages Wi-Fi / AP", f"Les réglages du point d'accès Wi-Fi ont été modifiés.", details={"SSID": ssid, "Mode": "Mode Pont" if mode == 'bridge' else "Mode AP", "Sécurité": sec.upper(), "Date": time.strftime('%d/%m/%Y %H:%M:%S')}, priority=5, level="warning")
|
||||
return name
|
||||
|
||||
def restore_ap_from_db(force_start=False):
|
||||
"""Restaure au redémarrage du conteneur le profil Wi-Fi (SSID, mot de passe, sécurité, mode, démarrage auto) depuis la BDD SQLite."""
|
||||
db_ssid = (get_pref('ap_ssid', '') or '').strip()
|
||||
db_pass = get_pref('ap_password', '') or ''
|
||||
db_sec = (get_pref('ap_security', 'wpa2') or 'wpa2').lower()
|
||||
if db_sec not in ('wpa1', 'wpa2', 'wpa3'):
|
||||
db_sec = 'wpa2'
|
||||
db_mode = (get_pref('mode', 'ap') or 'ap').lower()
|
||||
if db_mode not in ('ap', 'bridge'):
|
||||
db_mode = 'ap'
|
||||
db_auto_raw = get_pref('ap_autoconnect', '1')
|
||||
autoconnect = str(db_auto_raw).lower() in ('1', 'true', 'yes', 'oui')
|
||||
b_name = get_pref('bridge_name', os.environ.get('AP_BRIDGE_NAME', 'br0'))
|
||||
b_eth = get_pref('bridge_eth', os.environ.get('AP_BRIDGE_ETH', ''))
|
||||
|
||||
# Migration transparente : si la BDD n'a pas encore le SSID mais qu'un profil NM existe déjà, le sauvegarder en BDD
|
||||
if not db_ssid:
|
||||
existing = connection_name()
|
||||
if existing:
|
||||
nm_ssid = command('nmcli', '-t', '-g', '802-11-wireless.ssid', 'connection', 'show', existing)
|
||||
nm_pass = command('nmcli', '--show-secrets', '-t', '-g', '802-11-wireless-security.psk', 'connection', 'show', existing)
|
||||
if nm_ssid and nm_pass:
|
||||
nm_key = command('nmcli', '-t', '-g', '802-11-wireless-security.key-mgmt', 'connection', 'show', existing).lower()
|
||||
nm_proto = command('nmcli', '-t', '-g', '802-11-wireless-security.proto', 'connection', 'show', existing).lower()
|
||||
nm_sec = 'wpa3' if nm_key == 'sae' else 'wpa1' if nm_proto == 'wpa' else 'wpa2'
|
||||
nm_auto = command('nmcli', '-t', '-g', 'connection.autoconnect', 'connection', 'show', existing).lower() == 'yes'
|
||||
nm_slave = (command('nmcli', '-t', '-g', 'connection.slave-type', 'connection', 'show', existing) or command('nmcli', '-t', '-g', 'connection.port-type', 'connection', 'show', existing)).lower()
|
||||
nm_mode = 'bridge' if nm_slave == 'bridge' else db_mode
|
||||
set_pref('ap_ssid', nm_ssid)
|
||||
set_pref('ap_password', nm_pass)
|
||||
set_pref('ap_security', nm_sec)
|
||||
set_pref('ap_autoconnect', '1' if nm_auto else '0')
|
||||
set_pref('mode', nm_mode)
|
||||
set_pref('ap_connection_name', existing)
|
||||
db_ssid, db_pass, db_sec, autoconnect, db_mode = nm_ssid, nm_pass, nm_sec, nm_auto, nm_mode
|
||||
print(f"[ap-api] Configuration Wi-Fi existante '{nm_ssid}' migrée dans la BDD SQLite.", flush=True)
|
||||
|
||||
if not db_ssid or not db_pass:
|
||||
# Aucun profil Wi-Fi configuré (setup non effectué) : laisser l'Ethernet hôte libre
|
||||
teardown_bridge(b_name, b_eth)
|
||||
return False
|
||||
|
||||
target_name = get_pref('ap_connection_name', '') or ('AP-' + db_ssid)
|
||||
should_start = bool(force_start or autoconnect)
|
||||
|
||||
# Vérifier si le profil NM existe déjà et correspond exactement à la BDD
|
||||
nm_exists = subprocess.run(['nmcli', 'connection', 'show', target_name], capture_output=True, text=True).returncode == 0
|
||||
needs_rebuild = not nm_exists
|
||||
if nm_exists:
|
||||
nm_ssid = command('nmcli', '-t', '-g', '802-11-wireless.ssid', 'connection', 'show', target_name)
|
||||
nm_pass = command('nmcli', '--show-secrets', '-t', '-g', '802-11-wireless-security.psk', 'connection', 'show', target_name)
|
||||
nm_key = command('nmcli', '-t', '-g', '802-11-wireless-security.key-mgmt', 'connection', 'show', target_name).lower()
|
||||
nm_proto = command('nmcli', '-t', '-g', '802-11-wireless-security.proto', 'connection', 'show', target_name).lower()
|
||||
nm_sec = 'wpa3' if nm_key == 'sae' else 'wpa1' if nm_proto == 'wpa' else 'wpa2'
|
||||
nm_auto = command('nmcli', '-t', '-g', 'connection.autoconnect', 'connection', 'show', target_name).lower() == 'yes'
|
||||
nm_slave = (command('nmcli', '-t', '-g', 'connection.slave-type', 'connection', 'show', target_name) or command('nmcli', '-t', '-g', 'connection.port-type', 'connection', 'show', target_name)).lower()
|
||||
nm_mode = 'bridge' if nm_slave == 'bridge' else 'ap'
|
||||
if (nm_ssid != db_ssid or nm_pass != db_pass or nm_sec != db_sec or nm_auto != autoconnect or nm_mode != db_mode):
|
||||
needs_rebuild = True
|
||||
|
||||
if needs_rebuild:
|
||||
print(f"[ap-api] Reconstruction du profil Wi-Fi '{db_ssid}' depuis la BDD (mode={db_mode}, sécurité={db_sec}, autoconnect={'oui' if autoconnect else 'non'})...", flush=True)
|
||||
try:
|
||||
configure_ap({
|
||||
'ssid': db_ssid,
|
||||
'password': db_pass,
|
||||
'security': db_sec,
|
||||
'mode': db_mode,
|
||||
'autoconnect': autoconnect,
|
||||
'bridge_name': b_name,
|
||||
'bridge_eth': b_eth
|
||||
}, initial=False, start_now=should_start, silent=True)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"[ap-api] Erreur restauration Wi-Fi depuis la BDD : {e}", flush=True)
|
||||
return False
|
||||
|
||||
# Le profil NM existe déjà et correspond à la BDD
|
||||
save_connection(target_name)
|
||||
if should_start:
|
||||
if db_mode == 'bridge':
|
||||
clean_stale_router_leases()
|
||||
setup_bridge(b_name, b_eth)
|
||||
else:
|
||||
teardown_bridge(b_name, b_eth)
|
||||
state = command('nmcli', '-t', '-g', 'GENERAL.STATE', 'device', 'show', INTERFACE)
|
||||
if not state.startswith('100'):
|
||||
print(f"[ap-api] Démarrage automatique du Wi-Fi '{db_ssid}' (mode={db_mode})...", flush=True)
|
||||
r = subprocess.run(['nmcli', 'connection', 'up', target_name], capture_output=True, text=True)
|
||||
if r.returncode != 0:
|
||||
print(f"[ap-api] Erreur démarrage automatique '{target_name}' : {r.stderr.strip()}", flush=True)
|
||||
return False
|
||||
if db_mode == 'bridge':
|
||||
teardown_ap_nat()
|
||||
else:
|
||||
setup_ap_nat(INTERFACE)
|
||||
mark_ap_started()
|
||||
else:
|
||||
print(f"[ap-api] Profil Wi-Fi '{db_ssid}' restauré depuis la BDD (démarrage automatique désactivé).", flush=True)
|
||||
teardown_ap_nat()
|
||||
if db_mode != 'bridge':
|
||||
teardown_bridge(b_name, b_eth)
|
||||
invalidate_status_cache()
|
||||
return True
|
||||
|
||||
# =====================================================================
|
||||
# Module d'analyse réseau avancé & Capture Wireshark (PCAP)
|
||||
# =====================================================================
|
||||
@@ -8032,18 +8175,32 @@ class Handler(BaseHTTPRequestHandler):
|
||||
self.send_json({'ok': True, 'message': 'Paquets de test DNS et ICMP générés'}); return
|
||||
if self.path == '/api/ap/control':
|
||||
action=str(data.get('action','')); name=connection_name()
|
||||
if not name: raise ValueError('Aucune connexion AP configurée')
|
||||
cmd=['nmcli','connection','up' if action=='start' else 'down',name] if action in ('start','stop') else ['nmcli','connection','down',name]
|
||||
r=subprocess.run(cmd,capture_output=True,text=True)
|
||||
if action=='restart': r=subprocess.run(['nmcli','connection','up',name],capture_output=True,text=True)
|
||||
if r.returncode: raise RuntimeError(r.stderr.strip())
|
||||
if not name and not get_pref('ap_ssid', ''): raise ValueError('Aucune connexion AP configurée')
|
||||
if action in ('start', 'restart'):
|
||||
nm_exists = bool(name) and (subprocess.run(['nmcli', 'connection', 'show', name], capture_output=True, text=True).returncode == 0)
|
||||
if not nm_exists and get_pref('ap_ssid', ''):
|
||||
if not restore_ap_from_db(force_start=True):
|
||||
raise RuntimeError('Impossible de restaurer et démarrer la connexion Wi-Fi depuis la BDD')
|
||||
else:
|
||||
if is_bridge_mode():
|
||||
b_name = get_pref('bridge_name', os.environ.get('AP_BRIDGE_NAME', 'br0'))
|
||||
b_eth = get_pref('bridge_eth', os.environ.get('AP_BRIDGE_ETH', ''))
|
||||
clean_stale_router_leases()
|
||||
setup_bridge(b_name, b_eth)
|
||||
if action == 'restart':
|
||||
subprocess.run(['nmcli', 'connection', 'down', name], capture_output=True, text=True)
|
||||
r = subprocess.run(['nmcli', 'connection', 'up', name], capture_output=True, text=True)
|
||||
if r.returncode: raise RuntimeError(r.stderr.strip())
|
||||
if not is_bridge_mode():
|
||||
setup_ap_nat(INTERFACE)
|
||||
else:
|
||||
teardown_ap_nat()
|
||||
mark_ap_started()
|
||||
elif action == 'stop':
|
||||
if name:
|
||||
r = subprocess.run(['nmcli', 'connection', 'down', name], capture_output=True, text=True)
|
||||
if r.returncode and 'not an active connection' not in r.stderr.lower():
|
||||
raise RuntimeError(r.stderr.strip())
|
||||
teardown_ap_nat()
|
||||
try: os.remove(UPTIME_FILE)
|
||||
except OSError: pass
|
||||
@@ -8375,21 +8532,8 @@ if __name__ == '__main__':
|
||||
c.commit(); c.close()
|
||||
except Exception as e_db:
|
||||
print(f"[ap-vpn] Erreur réinitialisation statut VPN : {e_db}", flush=True)
|
||||
b_name = get_pref('bridge_name', os.environ.get('AP_BRIDGE_NAME', 'br0'))
|
||||
b_eth = get_pref('bridge_eth', os.environ.get('AP_BRIDGE_ETH', ''))
|
||||
if not b_eth:
|
||||
candidates = detect_ethernet_interfaces()
|
||||
if candidates: b_eth = candidates[0]
|
||||
|
||||
# Le pont ne doit être configuré que si le setup initial est terminé, le mode est pont et le Wi-Fi actif
|
||||
if is_bridge_mode() and auth_state().get('setup_completed') and is_iface_up(INTERFACE):
|
||||
clean_stale_router_leases()
|
||||
setup_bridge(b_name, b_eth)
|
||||
else:
|
||||
# En mode AP (par défaut) ou tant que le setup n'est pas terminé, s'assurer que l'Ethernet hôte est totalement libre et le pont démonté
|
||||
teardown_bridge(b_name, b_eth)
|
||||
if not is_bridge_mode() and auth_state().get('setup_completed') and is_iface_up(INTERFACE):
|
||||
setup_ap_nat(INTERFACE)
|
||||
# Restaurer le profil Wi-Fi (SSID, mot de passe, sécurité, mode, démarrage automatique) depuis la BDD SQLite
|
||||
restore_ap_from_db()
|
||||
apply_radio_defaults()
|
||||
try: sync_client_bandwidth_and_quotas(force=True)
|
||||
except Exception: pass
|
||||
|
||||
+3
-3
@@ -249,10 +249,10 @@ for _ in $(seq 1 30); do
|
||||
done
|
||||
nmcli -t general status >/dev/null 2>&1 || { log "ERREUR : NetworkManager ne répond pas"; exit 1; }
|
||||
|
||||
# Supprimer uniquement les connexions Wi-Fi AP ou pont résiduelles créées par APmanageur (NE JAMAIS TOUCHER AUX INTERFACES HÔTE COMME br0 OU eth0)
|
||||
# Supprimer uniquement les anciens profils de pont NM résiduels créés par APmanageur (NE JAMAIS TOUCHER AUX INTERFACES HÔTE NI AU PROFIL WI-FI AP-*)
|
||||
for con in $(nmcli -t -g NAME connection show 2>/dev/null || true); do
|
||||
if [[ "$con" =~ ^(ap-bridge-|AP-) ]]; then
|
||||
log "Nettoyage connexion Wi-Fi APmanageur résiduelle : $con"
|
||||
if [[ "$con" =~ ^ap-bridge- ]]; then
|
||||
log "Nettoyage connexion pont APmanageur résiduelle : $con"
|
||||
nmcli connection down "$con" 2>/dev/null || true
|
||||
nmcli connection delete "$con" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user