Permit EAP-Message and State from the home server, so that
[freeradius.git] / raddb / sqlippool.conf
1
2 sqlippool sqlippool {
3
4  #
5  # SQL connection information
6  #
7  sql-instance-name = "sql"
8
9  # lease_duration. fix for lost acc-stop packets
10  lease-duration = 3600
11
12  # Attribute which should be considered unique per NAS
13  pool-key = "%{NAS-Port}"
14  # pool-key = "%{Calling-Station-Id}"
15
16
17  #
18  # This series of queries allocates an IP address
19  #
20  allocate-clear = "UPDATE radippool \
21   SET nasipaddress = '', pool_key = 0, callingstationid = '', \
22   expiry_time = 'now'::timestamp(0) - '1 second'::interval \
23   WHERE pool_key = '%{Calling-Station-Id}'"
24
25  # note the ORDER BY clause of next query, it'll try to allocate IPs
26  # like Cisco internal pools do - it _trys_ to allocate the same IP-address
27  # which user had last session...
28  allocate-find = "SELECT framedipaddress FROM radippool \
29   WHERE pool_name = '%{reply:Pool-Name}' AND expiry_time < 'now'::timestamp(0) \
30   ORDER BY pool_name, (username <> '%{User-Name}'), (callingstationid <> '%{Calling-Station-Id}'), expiry_time \
31   LIMIT 1 \
32   FOR UPDATE"
33
34  allocate-update = "UPDATE radippool \
35   SET nasipaddress = '%{NAS-IP-Address}', pool_key = '%{Calling-Station-Id}', \
36   callingstationid = '%{Calling-Station-Id}', username = '%{User-Name}', \
37   expiry_time = 'now'::timestamp(0) + '${lease-duration} second'::interval \
38   WHERE framedipaddress = '%I'"
39
40
41
42  #
43  # This series of queries frees an IP number when an accounting
44  # START record arrives
45  #
46  start-update = "UPDATE radippool \
47   SET expiry_time = 'now'::timestamp(0) + '%J second'::interval \
48   WHERE nasipaddress = '%n' AND nas_port = '%p' AND pool_name = '%P'"
49
50  #
51  # This series of queries frees an IP number when an accounting
52  # STOP record arrives
53  #
54  stop-clear = "UPDATE radippool \
55   SET nasipaddress = '', pool_key = 0, callingstationid = '', \
56   expiry_time = 'now'::timestamp(0) - '1 second'::interval \
57   WHERE nasipaddress = '%{Nas-IP-Address}' AND pool_key = '${pool-key}' AND username = '%{User-Name}' \
58   AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
59
60
61
62
63  #
64  # This series of queries frees an IP number when an accounting
65  # ALIVE record arrives
66  #
67  alive-update = "UPDATE radippool \
68   SET expiry_time = 'now'::timestamp(0) + '${lease-duration} seconds'::interval \
69   WHERE nasipaddress = '%{Nas-IP-Address}' AND pool_key = '${pool-key}' AND username = '%{User-Name}' \
70   AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
71
72
73  #
74  # This series of queries frees the IP numbers allocate to a
75  # NAS when an accounting ON record arrives
76  #
77  on-clear = "UPDATE radippool \
78   SET nasipaddress = '', pool_key = 0, callingstationid = '', \
79   expiry_time = 'now'::timestamp(0) - '1 second'::interval \
80   WHERE nasipaddress = '%{Nas-IP-Address}' AND username = '%{User-Name}' \
81   AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
82
83  #
84  # This series of queries frees the IP numbers allocate to a
85  # NAS when an accounting OFF record arrives
86  #
87  off-clear = "UPDATE radippool \
88   SET nasipaddress = '', pool_key = 0, callingstationid = '', \
89   expiry_time = 'now'::timestamp(0) - '1 second'::interval \
90   WHERE nasipaddress = '%{Nas-IP-Address}' AND username = '%{User-Name}' \
91   AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
92
93
94 }
95