[OpenSER-Devel] gflags in version 1.3

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Sep 20 14:03:32 CEST 2007


Hi Richard,

T.R. Missner wrote:
> The gflags module is not returning the expected results with is_gflag
> () using the version of Openser we have installed now.  If I set a 
> gflag, for instance 3, when I read back the flags that are set 
> multiple flags are showing up.  Using the example 3, anything that 
> sets bit one or bit two is returned as being true.
>
> For Example:
> gflag 1 is TRUE
> gflag 2 is TRUE
> gflag 3 is TRUE
> gflag 4 is FALSE
> gflag 5 is TRUE
> gflag 6 is TRUE
> gflag 7 is TRUE
> gflag 8 is FALSE
>
> The problem appears to be the logic being used in is_gflag().
>
>    return ( (*gflags) & ((unsigned int)(long)flag)) ? 1 : -1;
the initial value is set via moduel parameter
    modparam("gflags","initial",3)
or it is set via script?

I'm trying to reproduce this scenario. BTW, what is your openser version?

>
> There appear to be other problems in this module in the set flag 
> routine as well.  The documentation states that the argument passed 
> in is the bit position you want set in a 32 bit bitmask.  However, it 
> appears that the code is OR'ing what you pass in with whatever is 
> already there.  Not exactly the same thing at all.
Note that there is a fixup function that converts the script parameter 
to a bitmask and actually the set_gflag function takes as param the bitmask.

regards,
bogdan
>
> It looks like the only way to use these in the current state of the 
> code would be to use the get flags routine and AND that against 
> whatever I am looking for.  Checking individual flags will certainly 
> not work.
>
> Richard



More information about the Devel mailing list