BUG/MINOR: freq: fix infinite loop on freq_ctr_period.
Using peers or stick table we could update an freq_ctr
using a tick value with the first bit set but this
bit is reserved for lock since multithreading support.
diff --git a/src/peers.c b/src/peers.c
index 9419afe..4819937 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1312,7 +1312,12 @@
case STD_T_FRQP: {
struct freq_ctr_period data;
- data.curr_tick = tick_add(now_ms, -intdecode(&msg_cur, msg_end));
+ /* First bit is reserved for the freq_ctr_period lock
+ Note: here we're still protected by the stksess lock
+ so we don't need to update the update the freq_ctr_period
+ using its internal lock */
+
+ data.curr_tick = tick_add(now_ms, -intdecode(&msg_cur, msg_end)) & ~0x1;
if (!msg_cur) {
/* malformed message */
RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
diff --git a/src/stick_table.c b/src/stick_table.c
index 55a1fff..0e84102 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -2968,7 +2968,11 @@
* push measures without having to update them too often.
*/
frqp = &stktable_data_cast(ptr, std_t_frqp);
- frqp->curr_tick = now_ms;
+ /* First bit is reserved for the freq_ctr_period lock
+ Note: here we're still protected by the stksess lock
+ so we don't need to update the update the freq_ctr_period
+ using its internal lock */
+ frqp->curr_tick = now_ms & ~0x1;
frqp->prev_ctr = 0;
frqp->curr_ctr = value;
break;