#
#DEFAULT Huntgroup-Name == "wifi", Acct-Type := sql_log.wifi
#
-#DEFAULT Packet-Src-IP-Address == 10.0.0.1, Acct-Type := sql_log.other
+#DEFAULT Net.Src.IP == 10.0.0.1, Acct-Type := sql_log.other
#
#DEFAULT Acct-Status-Type == Start, Acct-Type := sql_log.start
INSERT INTO ${..cui_table} \
(clientipaddress, callingstationid, username, cui, lastaccounting) \
VALUES \
- ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', \
+ ('%{Net.Src.IP}', '%{Calling-Station-Id}', \
'%{User-Name}', '%{reply.Chargeable-User-Identity}', NULL) \
ON DUPLICATE KEY UPDATE \
lastaccounting='0000-00-00 00:00:00', \
query = "\
UPDATE ${....cui_table} SET \
lastaccounting = CURRENT_TIMESTAMP \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
query ="\
UPDATE ${....cui_table} SET \
lastaccounting = CURRENT_TIMESTAMP \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
stop {
query ="\
DELETE FROM ${....cui_table} \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
INSERT INTO ${..cui_table} \
(clientipaddress, callingstationid, username, cui) \
VALUES \
- ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', \
+ ('%{Net.Src.IP}', '%{Calling-Station-Id}', \
'%{User-Name}', '%{reply.Chargeable-User-Identity}') \
ON CONFLICT ON CONSTRAINT ${..cui_table}_pkey \
DO UPDATE SET cui = EXCLUDED.cui, lastaccounting = '-infinity'::timestamp"
query = "\
UPDATE ${....cui_table} SET \
lastaccounting = now() \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
query ="\
UPDATE ${....cui_table} SET \
lastaccounting = now() \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
stop {
query ="\
DELETE FROM ${....cui_table} \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
INSERT OR REPLACE INTO ${..cui_table} \
(clientipaddress, callingstationid, username, cui, lastaccounting) \
VALUES \
- ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', \
+ ('%{Net.Src.IP}', '%{Calling-Station-Id}', \
'%{User-Name}', '%{reply.Chargeable-User-Identity}', NULL)"
}
query = "\
UPDATE ${....cui_table} SET \
lastaccounting = CURRENT_TIMESTAMP \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
query ="\
UPDATE ${....cui_table} SET \
lastaccounting = CURRENT_TIMESTAMP \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
stop {
query ="\
DELETE FROM ${....cui_table} \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}' \
AND cui = '%{Chargeable-User-Identity}'"
# Using a Class/Session-ID combination is more robust
# than using elements in the Accounting-Request,
# which may be subject to change, such as
- # NAS-IP-Address, Packet-Src-IP-Address and
+ # NAS-IP-Address, Net.Src.IP and
# NAS-Port-ID/NAS-Port.
#
# This policy should ensure that session data is not
# Insert a (hopefully unique) value into class
#
insert_acct_class {
- &reply.Class = "${policy.class_value_prefix}%{md5:%t,%I,%{Packet-Src-Port},%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}},%{NAS-IP-Address},%{Calling-Station-ID},%{User-Name}}"
+ &reply.Class = "${policy.class_value_prefix}%{md5:%t,%I,%{Net.Src.Port},%{Net.Src.IP},%{NAS-IP-Address},%{Calling-Station-ID},%{User-Name}}"
}
#
if (!&Chargeable-User-Identity) {
&request.Chargeable-User-Identity := %{cuisql:\
SELECT cui FROM cui \
- WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
+ WHERE clientipaddress = '%{Net.Src.IP}' \
AND callingstationid = '%{Calling-Station-Id}' \
AND username = '%{User-Name}'}
}
# For Windows 7 boxes
#
#recv Inform {
-# &reply.Packet-Dst-Port = 67
+# &reply.Net.Dst.Port = 67
# &reply.Message-Type = Ack
-# &reply.Server-Identifier = "%{Packet-Dst-IP-Address}"
+# &reply.Server-Identifier = "%{Net.Dst.IP}"
# &reply.Site-specific-28 = 0x0a00
# ok
#}
# Copy the IP address of the client from
# the request just received
&control += {
- &FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
+ &FreeRADIUS-Client-IP-Address = "%{Net.Src.IP}"
# require_message_authenticator
&FreeRADIUS-Client-Require-MA = no
&FreeRADIUS-Client-Secret = "testing123"
# shortname
- &FreeRADIUS-Client-Shortname = "%{Packet-Src-IP-Address}"
+ &FreeRADIUS-Client-Shortname = "%{Net.Src.IP}"
# nas_type
&FreeRADIUS-Client-NAS-Type = "other"