Skip to content

Commit

Permalink
acc: Fix drop_accounting() (do not be a NOOP!)
Browse files Browse the repository at this point in the history
The bug here was that `drop_accounting()` was building its bitmask as:

    flag_mask = types * flags;

... whereas it should have done the same as in `do_accounting()`:

    flag_mask = types + types * flags;
                -------
		^ the actual acc types to reset were missing!

(cherry picked from commit 211a63c)
  • Loading branch information
liviuchircu committed Jan 6, 2023
1 parent c976f55 commit e2b698a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions modules/acc/acc_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1378,10 +1378,10 @@ int w_do_acc(struct sip_msg* msg, unsigned long long *type,
return 1;
}

int w_drop_acc(struct sip_msg* msg, unsigned long long *type,
int w_drop_acc(struct sip_msg* msg, unsigned long long *types,
unsigned long long *flags)
{
unsigned long long flag_mask;
unsigned long long flag_mask, _types, _flags;

acc_ctx_t* acc_ctx=try_fetch_ctx();

Expand All @@ -1391,9 +1391,10 @@ int w_drop_acc(struct sip_msg* msg, unsigned long long *type,
return -1;
}

flag_mask = (type ? *type : DO_ACC_LOG | DO_ACC_AAA | DO_ACC_DB | DO_ACC_EVI) *
(flags ? *flags : ALL_ACC_FLAGS);
_types = (types ? *types : DO_ACC_LOG|DO_ACC_AAA|DO_ACC_DB|DO_ACC_EVI);
_flags = (flags ? *flags : ALL_ACC_FLAGS);

flag_mask = _types + _types * _flags;
reset_flags(acc_ctx->flags, flag_mask);

return 1;
Expand Down
10 changes: 5 additions & 5 deletions modules/acc/acc_logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include "../tm/t_hooks.h"
#include "../dialog/dlg_cb.h"

#define DO_ACC_NONE (0)
#define DO_ACC_LOG (1<<(0*8))
#define DO_ACC_AAA (1<<(1*8))
#define DO_ACC_DB (1<<(2*8))
#define DO_ACC_EVI ((unsigned long long)1<<(4*8))
#define DO_ACC_NONE (0ULL)
#define DO_ACC_LOG (1ULL<<(0*8))
#define DO_ACC_AAA (1ULL<<(1*8))
#define DO_ACC_DB (1ULL<<(2*8))
#define DO_ACC_EVI (1ULL<<(4*8))
#define DO_ACC_ERR ((unsigned long long)-1)

#define DO_ACC (1<<0) /* generic accouting flag - internal only */
Expand Down

0 comments on commit e2b698a

Please sign in to comment.