diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-08-19 11:08:33 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-08-19 14:03:00 +0200 |
commit | 52ba4f6bf49552e8c1fc23335c3918468a336086 (patch) | |
tree | 46fdf53f6b5ad269554d178ae1e65e8c1fabc8cc /src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c | |
parent | b04f40406d57cefe9d1be80a9bb49aa583e4876e (diff) | |
download | strongswan-52ba4f6bf49552e8c1fc23335c3918468a336086.tar.bz2 strongswan-52ba4f6bf49552e8c1fc23335c3918468a336086.tar.xz |
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.
Diffstat (limited to 'src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c')
-rw-r--r-- | src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c index c4e8664f7..32157bbb4 100644 --- a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c +++ b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c @@ -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); |