Do not send Accounting-Response

Alan DeKok aland at deployingradius.com
Fri Jun 18 14:27:13 CEST 2021


On Jun 18, 2021, at 12:22 AM, Strong, Mark <mstrong at tnsi.com> wrote:
> I did that, got it working.
> 
>        if ((NAS-IP-Address == "1.1.1.1") || (NAS-IP-Address == "1.1.1.2")) {

  There is no need to quote IP addresses.

>                if ("%{Called-Station-Id}" != "apn3") {

  I'm not clear why many people use string expansions for things which are already strings.  I ended up putting in hacks to the unlang compiler to catch this, and fix it.

  You can just do:

	if (Called-Station-Id != "apn3") {

> However I was trying a pattern match prior that wouldn't work, something like;
> 
>        if ((NAS-IP-Address == "1.1.1.1") || (NAS-IP-Address == "1.1.1.2")) {
>                if ("%{Called-Station-Id}"  =~ /apn1|apn2|apn4|apn5/) {
>                        do_not_respond
>                }
>        }
> 
> Assuming Called-Station-Id = "apn3", I was hoping it would evaluate to false, but it was true (said radiusd -X)

  Regular expressions work.  We have tests which verify this on every code commit.

> Is there someway to do something like find string1 inside string2, I had a read thru the unlang doc and googled some examples, didn't find anything like that.

  Regular expressions.

  Post the debug output here, and let someone else see what's up.

  Alan DeKok.




More information about the Freeradius-Users mailing list