Open btsimon97 opened 1 year ago
The Linux SCTP API handles the PPID as a big-endian, so do PySCTP. I know it's misleading, but the intention is to stick with the Linux API. Therefore, you need to use ntohl
and htonl
from the socket module for converting the value to your CPU endianness.
You can have a look on the sctp_echo_server
to see how PPID and others parameters are managed:
https://github.com/P1sec/pysctp/blob/modern_api/sctp_echo_srv.py
I think we need a flag to have the ability to switch between big and little endian for the PPID
When trying to use the ppid attribute, the integer value is sent over the wire with the byte order swapped from the correct value for the specified number.
For example, if I were to specify a PPID of 46 (the ppid of Diameter which in hex is 0x0000002e) in Python, the ppid that is sent over the wire is instead 771751936 (which in hex is 0x2e000000).
If I instead specified a ppid of 0x2e000000, the ppid sent over the wire is 46 (0x0000002e). This seems to indicate that a byte-ordering error is occurring between when the integer is specified in python and when it is sent over the wire.