Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenWrt Boot racecondition #5

Open
jmccrohan opened this issue Apr 22, 2022 · 2 comments
Open

OpenWrt Boot racecondition #5

jmccrohan opened this issue Apr 22, 2022 · 2 comments

Comments

@jmccrohan
Copy link

Hi Adam,

I've noticed that wifi-presence does not start cleanly on boot for me. I suspect the issue is that hostapd hasn't started yet, and there are no control sockets found by wifi-presence when it starts.

root@ap-office:~# logread | grep wifi-presence
Fri Apr 22 17:08:51 2022 daemon.err wifi-presence[2366]: Error: hostapd.socks cannot be blank

Restarting the process manually after boot is fine, so I'm not sure what the best way of resolving this is, whether it be through procd, or through wifi-presence itself.

Cheers,
Jon

@awilliams
Copy link
Owner

awilliams commented Apr 23, 2022

Thanks for the report. I've noticed that too, where wifi-presence fails to start likely because of what you described. In my case though, procd restarts it and eventually it works.

We could consider something like the following in the start_service function.

for i in 1 2 3 4 5 6 7 8 9 10; do
	if [ -d "${hostapdSockDir}" ] && find "${hostapdSockDir}" -type s | grep . >/dev/null; then
		# hostapd socket(s) found
		break
	fi
	# No hostapd socket found, retrying in 1s
	sleep 1
done

The START=95 setting should mean that wifi-presence is started after hostapd (START=19).

@jmccrohan
Copy link
Author

Thanks. Yes, this approach makes sense to me. Do you want to roll the fix for this and #3 into a single PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants