Skip to content

Commit

Permalink
Move more Packet-* to Net.*
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Sep 3, 2023
1 parent a428fc9 commit 008e368
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion raddb/mods-config/files/accounting
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
#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

Expand Down
8 changes: 4 additions & 4 deletions raddb/mods-config/sql/cui/mysql/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ post-auth {
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', \
Expand All @@ -24,7 +24,7 @@ accounting {
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}'"
Expand All @@ -33,15 +33,15 @@ accounting {
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}'"
Expand Down
8 changes: 4 additions & 4 deletions raddb/mods-config/sql/cui/postgresql/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ post-auth {
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"
Expand All @@ -26,7 +26,7 @@ accounting {
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}'"
Expand All @@ -35,15 +35,15 @@ accounting {
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}'"
Expand Down
8 changes: 4 additions & 4 deletions raddb/mods-config/sql/cui/sqlite/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ post-auth {
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)"

}
Expand All @@ -21,7 +21,7 @@ accounting {
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}'"
Expand All @@ -30,15 +30,15 @@ accounting {
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}'"
Expand Down
4 changes: 2 additions & 2 deletions raddb/policy.d/accounting
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ acct_unique {
# 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
Expand Down Expand Up @@ -75,7 +75,7 @@ acct_unique {
# 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}}"
}

#
Expand Down
2 changes: 1 addition & 1 deletion raddb/policy.d/cui
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ cui.accounting {
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}'}
}
Expand Down
4 changes: 2 additions & 2 deletions raddb/sites-available/dhcp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ recv Inform {
# 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
#}
Expand Down
4 changes: 2 additions & 2 deletions raddb/sites-available/dynamic-clients
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ server dynamic_clients {
# 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"
Expand Down

0 comments on commit 008e368

Please sign in to comment.