[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeradius-users
Subject:    Re: Do not send Accounting-Response
From:       Alan DeKok <aland () deployingradius ! com>
Date:       2021-06-18 12:27:13
Message-ID: 31A62246-12C2-4B0D-85D9-9941EFF5CDB8 () deployingradius ! com
[Download RAW message or body]

On Jun 18, 2021, at 12:22 AM, Strong, Mark <mstrong@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.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic