[SR-Users] conditional on secfilter seems does not work or how to do it

PICCORO McKAY Lenz mckaygerhard at gmail.com
Tue Aug 11 21:42:30 CEST 2020


I implemented secfilter in a simple way, in first step routing put that
conditional for black list check that already works:

```
        secf_check_ip();
        if ($? == -2) {
                xlog("L_ALERT", "$rm from $si is blacklisted");
                drop();
        }
```



BUT NOW i want to change to whitelick checks, so i reviewed the docs and
"2" is resulting for whitelist, so then i said "if not whitelisted so
block" using "!= 2" as on
https://www.kamailio.org/wiki/cookbooks/5.3.x/core#operators BUT SEEMS DOES
NOT WORK: that is the code:

```
        secf_check_ip();
        if ($? != 2) {
                xlog("L_ALERT", "$rm from $si is not in whitelist, block");
                drop();
        }
```



when i tested all the calls passed not matter if are in the table or not
as whitelist!

I want able to call only if are present and whitelisted the ip address.. so
i also tested with:

```
        secf_check_ip();
        if ($? == 0) {
                xlog("L_ALERT", "$rm from $si is not present, so block");
                drop();
        }
```



to check if the ip address are presented in the table but call also passed
and must not cos i not put never a entry in the table!


Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200811/506371b7/attachment.htm>


More information about the sr-users mailing list