mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 15:33:45 +00:00
première passe de debug
This commit is contained in:
parent
51e312e4c9
commit
df6de3ef2f
2 changed files with 8 additions and 7 deletions
|
@ -193,14 +193,14 @@ def post_auth(data):
|
|||
sw_name = switch["name"] or "?"
|
||||
room = "Unknown port"
|
||||
if port:
|
||||
room = port.room or "Unknown room"
|
||||
room = port["room"] or "Unknown room"
|
||||
|
||||
out = decide_vlan_switch(data_from_api, mac, nas_port)
|
||||
reason, vlan_id, decision, attributes = out
|
||||
|
||||
if decision:
|
||||
log_message = "(wired) %s -> %s [%s%s]" % (
|
||||
sw_name + ":" + port + "/" + str(room),
|
||||
sw_name + ":" + nas_port + "/" + str(room),
|
||||
mac,
|
||||
vlan_id,
|
||||
(reason and ": " + reason),
|
||||
|
@ -219,8 +219,8 @@ def post_auth(data):
|
|||
(),
|
||||
)
|
||||
else:
|
||||
log_message = "(fil) %s -> %s [Reject %s]" % (
|
||||
sw_name + ":" + port + "/" + str(room),
|
||||
log_message = "(wired) %s -> %s [Reject %s]" % (
|
||||
sw_name + ":" + nas_port + "/" + str(room),
|
||||
mac,
|
||||
(reason and ": " + reason),
|
||||
)
|
||||
|
@ -270,7 +270,7 @@ def check_user_machine_and_register(nas_type, user, user_interface):
|
|||
|
||||
def set_radius_attributes_values(attributes, values):
|
||||
return (
|
||||
(str(attribute.attribute), str(attribute.value % values))
|
||||
(str(attribute["attribute"]), str(attribute["value"] % values))
|
||||
for attribute in attributes
|
||||
)
|
||||
|
||||
|
@ -323,7 +323,7 @@ def decide_vlan_switch(data_from_api, user_mac, nas_port):
|
|||
attributes_kwargs = {
|
||||
"client_mac": str(user_mac),
|
||||
"switch_port": str(nas_port.split(".")[0].split("/")[-1][-2:]),
|
||||
"switch_ip": str(switch.ipv4)
|
||||
"switch_ip": str(switch["ipv4"])
|
||||
}
|
||||
|
||||
# Get port from switch and port number
|
||||
|
@ -424,7 +424,7 @@ def decide_vlan_switch(data_from_api, user_mac, nas_port):
|
|||
# else: user OK, so we check MAC now
|
||||
|
||||
# If we are authenticating with mac, we look for the interfaces and its mac address
|
||||
if port_profile.radius_mode == "COMMON" or port_profile.radius_mode == "STRICT":
|
||||
if port_profile["radius_mode"] == "COMMON" or port_profile["radius_mode"] == "STRICT":
|
||||
# If mac is unknown,
|
||||
if not user_interface:
|
||||
# We try to register mac, if autocapture is enabled
|
||||
|
|
|
@ -70,6 +70,7 @@ class VlanSerializer(Serializer):
|
|||
class PortProfileSerializer(Serializer):
|
||||
vlan_untagged = VlanSerializer()
|
||||
radius_type = serializers.CharField()
|
||||
radius_mode = serializers.CharField()
|
||||
|
||||
|
||||
class SwitchSerializer(Serializer):
|
||||
|
|
Loading…
Reference in a new issue