best way to split by "," and interate?

Jorge Pereira jpereiran at gmail.com
Wed Sep 16 19:21:29 CEST 2015


Ah! perfect, but i can't use Tmp-String with explode?

Wed Sep 16 17:13:27 2015 : Debug: rlm_redis (redis_conf): Released
connection (1)
Wed Sep 16 17:13:27 2015 : Debug: (0)           EXPAND %{redis_conf:HGET
"radius-configurations" Develop_MacAddress}
Wed Sep 16 17:13:27 2015 : Debug: (0)              -->
ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
*Wed Sep 16 17:13:27 2015 : Debug: (0)           &control:Tmp-String-1 :=
ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff*
Wed Sep 16 17:13:27 2015 : Debug: (0)         } # update = noop
Wed Sep 16 17:13:27 2015 : Debug: (0)         if (&control:Tmp-String-0 &&
&control:Tmp-String-1) {
Wed Sep 16 17:13:27 2015 : Debug: (0)         if (&control:Tmp-String-0 &&
&control:Tmp-String-1)  -> TRUE
Wed Sep 16 17:13:27 2015 : Debug: (0)         if (&control:Tmp-String-0 &&
&control:Tmp-String-1)  {
*Wed Sep 16 17:13:27 2015 : Debug: %{explode: &control:Tmp-String-1 ,}*
Wed Sep 16 17:13:27 2015 : Debug: Parsed xlat tree:
Wed Sep 16 17:13:27 2015 : Debug: xlat --> explode
Wed Sep 16 17:13:27 2015 : Debug: {
Wed Sep 16 17:13:27 2015 : Debug:       literal -->  &control:Tmp-String-1 ,
Wed Sep 16 17:13:27 2015 : Debug: }
*Wed Sep 16 17:13:27 2015 : ERROR: (0)           Invalid attribute name*
Wed Sep 16 17:13:27 2015 : Debug: (0)           EXPAND %{explode:
&control:Tmp-String-1 ,}
Wed Sep 16 17:13:27 2015 : Debug: (0)              -->
Wed Sep 16 17:13:27 2015 : Debug: (0)           foreach
&control:Tmp-String-1
Wed Sep 16 17:13:27 2015 : Debug: (0)             if (&My-Mac-Address ==
"%{Foreach-Variable-0}") {
Wed Sep 16 17:13:27 2015 : Debug: (0)             EXPAND TMPL XLAT STRUCT
Wed Sep 16 17:13:27 2015 : Debug: (0)             EXPAND Foreach-Variable-0
Wed Sep 16 17:13:27 2015 : Debug: (0)                -->
ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
Wed Sep 16 17:13:27 2015 : Debug: (0)             EXPAND
%{Foreach-Variable-0}
Wed Sep 16 17:13:27 2015 : Debug: (0)                -->
ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
Wed Sep 16 17:13:27 2015 : Debug: (0)             if (&My-Mac-Address ==
"%{Foreach-Variable-0}")  -> FALSE
Wed Sep 16 17:13:27 2015 : Debug: (0)           } # foreach
&control:Tmp-String-1 = noop
Wed Sep 16 17:13:27 2015 : Debug: (0)         } # if (&control:Tmp-String-0
&& &control:Tmp-String-1)  = noop

--
Jorge Pereira

On Wed, Sep 16, 2015 at 1:54 PM, Arran Cudbard-Bell <
a.cudbardb at freeradius.org> wrote:

>
> > On 16 Sep 2015, at 17:39, Jorge Pereira <jpereiran at gmail.com> wrote:
> >
> > Hi,
> >
> >    I have a list
> >
> > update control {
> >    &Tmp-String-0 =
> "aa:bb:cc:dd:ee:ff,00:11:22:33:44:55,ff:ee:dd:cc:bb:aa"
> > }
> >
> > And I would like to know about the best approach to split by "," and
> check
> > if match with my ${Called-Station-Id}
> > someone have a idea?
>
> "%{explode:&Called-Station-ID ,}"
>
> foreach &Called-Station-ID {
>         if ("%{Foreach-Variable-0}" =~ /expr/) {
>                 <stuff>
>         }
> }
>
> Arran Cudbard-Bell <a.cudbardb at freeradius.org>
> FreeRADIUS development team
>
> FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>


More information about the Freeradius-Users mailing list