Closed Billtopia closed 1 month ago
I have the same issue with my Pi3 running on the internal wifi adapter. If this fixes the issue, well done!! Might not have a chance until this weekend to try it though.
so... I may have found a faster way without all the added code.
1 new line and 1 small change. I am testing it now to see if the changes work (if they don't the other changes will catch the problem and log it)
the change has been running for some time on mine and no logged errors being caught by my previous additions.
I stop hostapd before writing the hostapd.conf file write the file then start (not restart) hostapd
this also has the bonus of shaving like 8 seconds off the time because there is a sleep(8) in the init file for hostapd when you do a restart.
# Write the current zone information to NETWORK_CONFIGURATION.
subprocess.call('sudo service hostapd stop', stdout=open(os.devnull, 'w'),
try:
fo = open(NETWORK_CONFIGURATION, "w")
except IOError:
logger.error('Unable to write the file: ' + NETWORK_CONFIGURATION + '.')
updateStatus('Not Available', 'Not Available', 'PiPass is not running')
logger.info('PiPass has been shutdown with an error.')
exit(1)
conf = "interface=wlan0\nbridge=br0\ndriver=" + HOSTAPD_DRIVER + "\nssid=" + zoneValues[0] + "\nbssid=" + zoneValues[1] + "\nhw_mode=g\nchannel=6\nauth_algs=1\nwpa=0\nmacaddr_acl=" + HOSTAPD_SECURITY + "\naccept_mac_file=/etc/hostapd/mac_accept\nwmm_enabled=0\nignore_broadcast_ssid=0"
fo.write(conf)
fo.close()
# Restart hostapd to ensure NETWORK_CONFIGURATION is used. Restarting hostapd will also ensure that it is running if it is currently off.
# subprocess.call() will wait for the service command to finish before moving on.
subprocess.call('sudo service hostapd start', stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'), shell=True)
So, after 20+ MAC address changes it hasn't triggered the first set of code changes I put in. I think this has solved it.
Hi @Billtopia ,
I apologize for taking so long to get your changes tested on my pi3, life got in the way. :)
After loading up the modified pipass.py changes everything appears to be working great!
Well done!
Glad it is working for you.
I have found that piPass.py doesn't always manage to start hostapd 100% of the time and it also doesn't write out the hostapd.conf file 100% of the time either.
It was causing errors saying my usb wifi driver was not compatible and also that the hardware could not change the MAC so it was incompatible even after piPass had been running for some time.
I modified piPass.py to attempt to start hostapd several times (always seems to restart on the first retry) and the first time the MAC doesn't change (per host change cycle not per script run) I have it rewrite the hostapd.conf file and restart hostapd again and now I get no errors running for hours on end. It would die out on the 3rd/4th point change before.
not sure if there is a better way to do this or not but...