-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Package Name
openconnect
Maintainer
OpenWrt Version
SNAPSHOT
OpenWrt Target/Subtarget
all
Steps to Reproduce
packages/net/openconnect/files/openconnect.sh
Lines 89 to 92 in cd5f13e
| while resolveip -t 10 "$server" > "$tmpfile" && [ "$trials" -gt 0 ]; do | |
| sleep 5 | |
| trials=$((trials - 1)) | |
| done |
This took me a really long time to finally understand. But there's a subtle error hiding in plain sight here, that needlessly delays the startup of openconnect (i.e. all tries are exhausted on a system with a working connection).
The issue is that while-loop continues to run if resolveip -t 10 "$server" succeeds (i.e. it returns with 0). But it should stop once it was successful resolving the IP address.
I found that I also suck at explaining things. So please entertain this reproducer example:
while resolveip google.com; do echo repeat; sleep 1;done
We expect that on a system connected to the internet, this should not print "repeat" even once.
But when testing, it will endlessly repeat "repeat" unless it can't resolve the address:
142.251.36.174
repeat
142.251.36.174
repeat
142.251.36.174
repeat
...
whereas adding the "!" in front of resolveip:
while ! resolveip google.com; do echo repeat; sleep 1;done
Will do just what we all want in the same circumstance described above.
The problem here is that this now "looks odd".
From what I can tell, this issue came about in commit:
20ea726
But it's already really late, so sorry for not providing the fix myself at this moment.
Actual Behaviour
Not delay openconnects startup.
Confirmation Checklist
- The package is maintained in this repository.
- I understand that issues related to the base OpenWrt repository or LuCI repository will be closed.
- I am reporting an issue for OpenWrt, not an unsupported fork.