[sr-dev] [kamailio/kamailio] acc: generating duplicates (#1674)

Julien Chavanton notifications at github.com
Fri Oct 12 15:42:04 CEST 2018


Hi Hennig, thanks for the review so far.

Q: "you want to unify the flag manipulation and also fix some bugs this way?"
A: Correct, to fix the bug we need to change inconsitant flag manipulation creating the bug 

Q: This should be identically, according to the definition of isflagset. I don't see any big advantage of one format to the other, or I am wrong?
A: They are not identical :

The first one is expecting an input we the integer contain the bit mask
`if((type==1) && (msg->flags&(e->missed_flag))) {` 
will with with the input of : 1,2,4,8,...,4294967296

The second one is expecting an input where integer contain the bit position
`if((type==1) && isflagset(msg, e->missed_flag) == 1) {`
will do the bit shifting and will work with the input : 1,2,3,..,32

```
int isflagset( struct sip_msg* msg, flag_t flag ) {
        return (msg->flags & (1<<flag)) ? 1 : -1; // << notice the bit shifting
}
```

`resetflag` and `setflag` are also doing the bit shifthing, seems like at one point someone got confused and introduce a mix which endedup doing resetflag on an alredy bit shifted input.
I guess this is also why acc_mod is not doing bit shifting on the module param while acc_diameter, acc_raduis and acc_json are (I am changing this in the patch) 


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1674#issuecomment-429329716
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181012/59bf64b5/attachment-0001.html>


More information about the sr-dev mailing list