Expression Module Configuration 0. INTRODUCTION The expression module (rlm_expr) allows the server to perform limited mathematical calculations. It is enabled by default in radiusd.conf, so there's nothing special you have to do to use it. 1. USAGE The expression module is used via the dynamic translation of strings. (See 'variables.txt' in this directory for more information). For example, some NAS boxes send a NAS-Port attribute which is a 32-bit number composed of port, card, and interface, all in different bytes. To see these attributes split into pieces, you can do something like: DEFAULT Vendor-Interface-Number = `%{expr: %{NAS-Port} / (256 * 256)}`, Vendor-Card-Number += `%{expr: (%{NAS-Port} / 256) %% 256}`, Vendor-Port-Number += `%{expr: %{NAS-Port} %% 256}` where the attributes Vendor-Interface-Number, Vendor-Card-Number, and Vendor-Port-Number are attributes created by either you or the vendor-supplied dictionary. 2. MATHEMATICAL OPERATORS The methematical operators supported by the expression module are: + addition - subtraction / division %% modulo remainder * multiplication & boolean AND | boolean OR () grouping of sub-expressions. Note that the modulo remainder operator is '%%', and not '%'. This is due to the '%' character being used as a special character for dynamic translation. Note also that these operators do NOT have precedence. The parsing of the input string, and the calculation of the asnwer, is done strictly left to right. If you wish to order the expressions, you MUST group them into sub-expression, as shown in the previous example. All of the calculations are performed as signed 32-bit integers. $Id: rlm_expr,v 1.1 2002/10/01 15:27:02 aland Exp $