Help Unlang Freeradius 2.x to 3.x

Olivier CALVANO o.calvano at gmail.com
Thu Jul 2 10:09:17 CEST 2020


Thanks alan,

I will reformulate my question more clearly and put debug.

It's just this condition that seems to have changed, before I wrote it like
this in version 2; x and it worked:

 if ((Tunnel-Server-Endpoint:0[0] != '192.168.1.1') && (User-Name =~
/\\.local/) && (User-Name !~ /network\\.local/) &&
("%{Packet-Src-IP-Address}" == "172.16.100.100")) {


in version 3, I write it like this:

if ((&Tunnel-Server-Endpoint != 192.168.1.1') && (User-Name =~ /\\.local/)
&& (User-Name !~ /network\\.local/) && ("%{Packet-Src-IP-Address}" ==
"172.16.100.100")) {


and he gives me a mistake
(0)     policy Rewrite_FORWARDER {
(0)       if ((&Tunnel-Server-Endpoint != '192.168.1.1') && (User-Name =~
/\\.local/) && (User-Name !~ /network\\.local/) &&
("%{Packet-Src-IP-Address}" == "172.16.100.100")) {
(0)       ERROR: Failed retrieving values required to evaluate condition
(0)       elsif (&Tunnel-Server-Endpoint != '192.168.1.1' && User-Name =~
/\\.local/ && User-Name !~ /network\\.local/ && "%{Packet-Src-IP-Address}"
== "172.16.100.101") {
(0)       ERROR: Failed retrieving values required to evaluate condition
(0)       if ((User-Name =~ /\\.local/) && ("%{Packet-Src-IP-Address}" ==
"172.16.100.100")) {
(0)       EXPAND %{Packet-Src-IP-Address}
(0)          --> 172.16.100.99
(0)       if ((User-Name =~ /\\.local/) && ("%{Packet-Src-IP-Address}" ==
"172.16.100.100"))  -> FALSE
(0)       elsif ((User-Name =~ /\\.local/) && ("%{Packet-Src-IP-Address}"
== "172.16.100.101")) {
(0)       EXPAND %{Packet-Src-IP-Address}
(0)          --> 172.16.100.99
(0)       elsif ((User-Name =~ /\\.local/) && ("%{Packet-Src-IP-Address}"
== "172.16.100.101"))  -> FALSE
(0)     } # policy Rewrite_FORWARDER = noop


so I can't find the right syntax for it to look at the
Tunnel-Server-Endpoint attribute

or maybe it would mark this error because the Tunnel-Server-Endpoint
attribute is not present in the request?

regards


Le sam. 27 juin 2020 à 14:15, Alan DeKok <aland at deployingradius.com> a
écrit :

> On Jun 27, 2020, at 12:33 AM, Olivier CALVANO <o.calvano at gmail.com> wrote:
> > I have this condition which works under Freeradius 2.x:
> >
> > if ((Tunnel-Server-Endpoint: 0 [0]! = '192.168.1.1') && (User-Name = ~
> > /\\.local/) && (User-Name! ~ /network\\.local/) && ("%
> > {Packet-Src-IP-Address}" == "172.16.100.100")) {
>
>   You've re-typed it, instead of copying it exactly from the configuration
> files.  Please just use cut & paste.  It's more correct.
>
> > I can't find the equivalent in Freeradius 3.0.17
>
>   99% of the time you can just use the same "unlang" statements.
>
> > I tried in particular
> >
> > if ((& Tunnel-Server-Endpoint! = '192.168.1.1') && (User-Name = ~
> > /\\.local/) && (User-Name! ~ /network\\.local/) && ("% {
> > Packet-Src-IP-Address} "==" 172.16.100.100 ")) {
> >
> > but that blocks, it is always at the level of the first condition that
> > there is the problem.
>
>   Which is.... what?
>
>   There *is* debug output which can help.
>
>   Read this and follow the instructions:
> http://wiki.freeradius.org/list-help
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list