Hello,

looking at the code, I cannot spot anything wrong with xavp_rm_internal().

Being about C code you wrote, can you double check your code or share the entire function you tested with?

Cheers,
Daniel

On Wed, Jan 20, 2021 at 6:26 PM Chaigneau, Nicolas <nicolas.chaigneau@capgemini.com> wrote:

Hello

 

 

I’m trying to use function xavp_rm_by_index to remove a specific index from a given xavp.

I’m observing an unexpected behaviour, I think it might be a bug :

Instead of just removing the index, the function removes the index and all others before it.

 

E.g : if called with « idx = 1 », it removes indexes 0 and 1.

 

 

Reading the code of xavp_rm_internal (which is called by xavp_rm_by_index), I don’t think it behaves at it should :

 

/* Remove xavps

* idx: <0 remove all xavps with the same name

*      >=0 remove only the specified index xavp

* Returns number of xavps that were deleted

*/

 

 

For example when I do this :

 

LM_ERR("COUNT BEFORE: %d\n", xavp_count(rname, NULL));

int rm_count = xavp_rm_by_index(rname, 1, NULL); // TEST

LM_ERR("REMOVED: %d\n", rm_count);

LM_ERR("COUNT AFTER: %d\n", xavp_count(rname, NULL));

 

 

« rm_count » returned is 1 (which is expected). However, « count after » is decremented by 2.

And when I look at the contents of my xavp, I notice that the first two elements have been removed.

 

Likewise if xavp_rm_by_index is invoked with idx = 2 => the first 3 elements are removed.

 

 

 

So… do you think this is a bug ? or something I didn’t understand ?

 

 

Thanks for your help !

 

 

Regards,

Nicolas.

 

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--