MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _stop_ap_services

Method _stop_ap_services

wifi_manager.py:2791–2836  ·  view source on GitHub ↗

Stop hostapd and dnsmasq services

(self)

Source from the content-addressed store, hash-verified

2789 """
2790 try:
2791 self.ap_logger.debug("Creating dnsmasq configuration file...")
2792
2793 if not captive:
2794 config_content = self._dnsmasq_config_no_internet()
2795 elif dns_enabled:
2796 # Full configuration with DNS for captive portal
2797 config_content = f"""# Interface configuration
2798interface={self.ap_interface}
2799# DHCP range
2800dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
2801# DHCP authoritative
2802dhcp-authoritative
2803# Bind to specific interface only
2804bind-interfaces
2805# Log DHCP activity
2806log-dhcp
2807# Gateway option
2808dhcp-option=3,{self.ap_ip}
2809# DNS option (point to ourselves for captive portal)
2810dhcp-option=6,{self.ap_ip}
2811# Enable DNS on port 53
2812port=53
2813# Listen only on our AP IP
2814listen-address={self.ap_ip}
2815# Don't read system files that might conflict
2816no-resolv
2817no-hosts
2818no-poll
2819# Captive portal - redirect all domains to AP
2820address=/#/{self.ap_ip}
2821# But allow some connectivity test domains to work
2822server=/connectivitycheck.gstatic.com/8.8.8.8
2823server=/www.gstatic.com/8.8.8.8
2824server=/clients3.google.com/8.8.8.8
2825# Fallback DNS servers
2826server=8.8.8.8
2827server=8.8.4.4
2828"""
2829 else:
2830 # Minimal configuration - DHCP only, no DNS conflicts
2831 config_content = f"""# Interface configuration
2832interface={self.ap_interface}
2833# DHCP range
2834dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
2835# DHCP authoritative
2836dhcp-authoritative
2837# Bind to specific interface only
2838bind-interfaces
2839# Log DHCP activity

Callers 2

stop_ap_modeMethod · 0.95
_cleanup_ap_modeMethod · 0.95

Calls 7

infoMethod · 0.80
debugMethod · 0.80
warningMethod · 0.80
killMethod · 0.80
errorMethod · 0.80
waitMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected