regexp in attr-rewrite confuses me!

2005-06-24 Thread Tariq Rashid


i'm finding counterintuitive behaviour for the regexp in the searchfor
attr_rewrite. i have the following
attr_rewrite attr_rewrite_post-proxy {
attribute = Framed-Route
searchin = proxy_reply
searchfor = ([0-9./]+) ([0-9.]+) ([0-9]+)(.*)
replacewith = [%{2}]
new_attribute = no
ignore_case = no
max_matches = 1
append = no
  }

so for a Framed-Route of 83.67.67.192/29 83.67.214.161 1 it should give
me:
%{1} = 83.67.67.192/29 83.67.214.161 1
%{2} = 83.67.214.161
%{3} = 1

but instead %{2} contains 83.67.214.161 1.

see the radiusd -X logs:

modcall[post-proxy]: module attr_filter_post-proxy returns updated for
request 0
radius_xlat:  '([0-9./]+) ([0-9.]+) ([0-9]+)(.*)'
radius_xlat:  '[83.67.214.161 1]'
rlm_attr_rewrite: Changed value for attribute Framed-Route from
'83.67.67.192/29 83.67.214.161 1' to '[83.67.214.161 1]'

anywone know why this is?

also the \d for [0-9] don't work!

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


RE: regexp in attr-rewrite confuses me!

2005-06-24 Thread Tariq Rashid

in addition, the following suggests an unsual regex process...

attr_rewrite attr_rewrite_post-proxy {
attribute = Framed-Route
searchin = proxy_reply
searchfor = ([0-9.]+) ([0-9.]+) ([0-9]+)(.*)
replacewith = [%{1}] [%{2}] [%{3}]
new_attribute = no
ignore_case = no
max_matches = 1
append = no
}

gives me the following unusual output:

modcall[post-proxy]: module attr_filter_post-proxy returns updated for
request 0
radius_xlat:  '([0-9.]+) ([0-9.]+) ([0-9]+)(.*)'
radius_xlat:  '[29 83.67.214.16] [83.67.214.161 1] [1]'
rlm_attr_rewrite: Changed value for attribute Framed-Route from
'83.67.67.192/29 83.67.214.161 1' to '83.67.67.192/[29 83.67.214.16]
[83.67.214.161 1] [1]'

that is:
Framed-Route = 83.67.67.192/[29 83.67.214.16] [83.67.214.161 1]
[1]

so spaces appear in the matched items []. as before there is too much in %2
and £3 is puzzling. i'm surprised by the 83.67.67.192/ in the output when
its not in the output template.

i'm obviouslty confused so any light shed on this matter would be great!

tariq

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