diff --git a/src/pyrad3/tools.py b/src/pyrad3/tools.py index 678b40d..a1feffc 100644 --- a/src/pyrad3/tools.py +++ b/src/pyrad3/tools.py @@ -207,7 +207,7 @@ def decode_ipv6_prefix(addr: bytes) -> IPv6Network: def decode_combo_ip(addr: bytes) -> Union[IPv4Address, IPv6Address]: """Decode a RADIUS value of type combo-ip""" - return ip_address(addr).packed + return ip_address(addr) def decode_ascend_binary(string: bytes): diff --git a/tests/test_parse_header.py b/tests/test_parse_header.py index 74ab005..a7c29bf 100644 --- a/tests/test_parse_header.py +++ b/tests/test_parse_header.py @@ -66,6 +66,11 @@ TEST_ATTRIBUTES = [ ), (b"\x0c\x04\x20\x03", IPv6Address("2003::0")), (b"\x0d\x06\x00\x40\x20\x03", IPv6Network("2003::0/64")), + (b"\x0e\x06\xc0\xa8\x01\x08", IPv4Address("192.168.1.8")), + ( + b"\x0e\x12\x20\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + IPv6Address("2003::1"), + ), ] TAGGED_ATTRIBUTES = [ @@ -113,6 +118,13 @@ TAGGED_ATTRIBUTES = [ ), (b"\x70\x05\x01\x20\x03", IPv6Address("2003::0")), (b"\x71\x07\x01\x00\x40\x20\x03", IPv6Network("2003::0/64")), + # combo-ip (v4) + (b"\x72\x07\x01\xc0\xa8\x01\x08", IPv4Address("192.168.1.8")), + # combo-ip (v6) + ( + b"\x72\x13\x01\x20\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + IPv6Address("2003::1"), + ), ] VENDOR_FORMAT_COMBINATIONS = [