1rlm_expr(5) FreeRADIUS Module rlm_expr(5)
2
3
4
6 rlm_expr - FreeRADIUS Module
7
9 The rlm_expr module allows the server to perform limited mathematical
10 calculations. This module is not called directly in any section, it is
11 invoked through the dynamic expansion of strings.
12
13 For example, some NAS boxes send a NAS-Port attribute which is a 32-bit
14 number composed of port, card, and interface, all in different bytes.
15 To see these attributes split into pieces, you can have an entry in the
16 'users' file like:
17
18 DEFAULT
19 Vendor-Interface = `%{expr: %{NAS-Port} / (256 * 256)}`,
20 Vendor-Card = `%{expr: (%{NAS-Port} / 256) %% 256}`,
21 Vendor-Port = `%{expr: %{NAS-Port} %% 256}`
22
23 where the attributes Vendor-Interface, Vendor-Card, and Vendor-Port are
24 attributes created by either you or a vendor-supplied dictionary.
25
26 The mathematical operators supported by the expression module are:
27
28 + addition
29
30 - subtraction
31
32 / division
33
34 %% modulo remainder
35
36 * multiplication
37
38 & boolean AND
39
40 | boolean OR
41
42 () grouping of sub-expressions
43
44 NOTE: The modulo remainder operator is '%%', and not '%'. This is due
45 to the '%' character being used as a special character for dynamic
46 translation.
47
48 NOTE: These operators do NOT have precedence. The parsing of the input
49 string, and the calculation of the answer, is done strictly left to
50 right. If you wish to order the expressions, you MUST group them into
51 sub-expression, as shown in the previous example.
52
53 All of the calculations are performed as unsigned 32-bit integers.
54
56 modules {
57 ...
58 expr {
59 }
60 ...
61 }
62 ...
63 instantiate {
64 ...
65 expr
66 ...
67 }
68
70 instantiate
71
73 /etc/raddb/radiusd.conf
74
76 radiusd(8), radiusd.conf(5)
77
79 Chris Parker, cparker@segv.org
80
81
82
83
84 5 February 2004 rlm_expr(5)