Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

5G NAS UE policy protocol TS 24.501_UEPOL UPSISublist Len field is not encoded. #252

@maddenj-ie

Description

@maddenj-ie

The 'Len' field of UPSISublist is not encoded when using 'to_bytes'

The issue may be reproduced using the following test

    def test_upsi_sublist_from_obj_to_bytes(self):

        upsi_sublist_obj = UPSISublist(val={
            'PLMN': '27201',
            'Cont': [
                1,
                2
            ]
        })

        show(upsi_sublist_obj)

        upsi_sublist_bytes = upsi_sublist_obj.to_bytes()
        print(upsi_sublist_obj.hex())

        expected_upsi_sublist_bytes = b'\x00\x07\x72\xf2\x10\x00\x01\x00\x02'

        assert upsi_sublist_bytes == expected_upsi_sublist_bytes

There is no 'init' method associated with the UPSISublist class.

class UPSISublist(Envelope):

I've done some experimenting and the addition of the following code, resolves the issue.

    def __init__(self, *args, **kwargs):
        Envelope.__init__(self, *args, **kwargs)
        self[0].set_valauto(lambda: 3 + self[2].get_len())
        self[2].set_blauto(lambda: (self[0].get_val()-3) << 3)

I'm happy to assist with testing.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions