]> git.ipfire.org Git - thirdparty/strongswan.git/commit
dhcp: Fix retransmission timeouts
authorTobias Brunner <tobias@strongswan.org>
Wed, 20 Jul 2022 13:13:39 +0000 (15:13 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 22 Jul 2022 05:20:30 +0000 (07:20 +0200)
commit77553bfee686e64abc958b27600cbc24978ada43
treeef1b0e1622239be831b35d799b3a61912712ad09
parent44ab5533b00cff1efacbb638bea0460f8c8b4027
dhcp: Fix retransmission timeouts

The previous code did not ensure that there was a delay of at least
`try` seconds after each sent request.  Instead, whenever the condvar was
signaled, which could be due to retransmitted responses or messages for
unrelated transactions (there could even be spurious wakeups), the counter
was increased and a retransmit sent.  So instead of actually waiting for
15 seconds for a response (and sending 4 retransmits over that timespan),
it could happen that all five messages were sent within a second without
enough time to actually receive a response.

Using an absolute timeout that we reuse as long as there was no timeout
and the condvar was signaled for something unrelated, should ensure we
wait at least the intended delay after each sent message.

Closes strongswan/strongswan#1154
src/libcharon/plugins/dhcp/dhcp_socket.c