mirror of
https://github.com/strongswan/strongswan.git
synced 2025-11-22 00:01:45 -05:00
kernel-pfroute: Fix kernel response handling
The condvar is signaled for every handled message received from the kernel not only for replies (this changed with 2a2d7a4dc8). This may cause segfaults because this->reply is not set when the waiting thread is woken due to an IP address change. Since this->reply is only set when it is actually the expected reply (and only one request is sent at a time, thanks to c9a323c1d9) we only have to make sure the reply is there (and clear it once we handled it). Using separate condvars could also be an option in the future.
This commit is contained in:
parent
b04f40406d
commit
52ba4f6bf4
@ -1518,8 +1518,7 @@ retry:
|
||||
{ /* timed out? */
|
||||
break;
|
||||
}
|
||||
if (this->reply->rtm_msglen < sizeof(*this->reply) ||
|
||||
msg.hdr.rtm_seq != this->reply->rtm_seq)
|
||||
if (!this->reply)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1559,6 +1558,8 @@ retry:
|
||||
{
|
||||
failed = TRUE;
|
||||
}
|
||||
free(this->reply);
|
||||
this->reply = NULL;
|
||||
/* signal completion of query to a waiting thread */
|
||||
this->waiting_seq = 0;
|
||||
this->condvar->signal(this->condvar);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user