sctp
sctp copied to clipboard
PPID (maybe other) fields in SndRcvInfo not converted correctly on SCTPWrite()
Hey folks,
I have observed that if I set the PPID in SndRcvInfo on SCTPConn.SCTPWrite() to some simple value like 46 (a.i. Diameter according to IANA) from an x86 (little-endian), the on-the-wire PPID (supposed to be BigEndian) has the bytes reversed. So before using, I'd have to do something like (or set it to 0x2e000000, you get the gist):
b := make([]byte, 4)
binary.NativeEndian.PutUint32(b, 46)
sndRcvInfo.ppid = binary.BigEndian.Uint32(b)
I saw that toBuf()
uses binary
to write the info data. But could it be that instead of using the nativeEndian it should use always the network-byte-order (aka binary.BigEndian), as things should be on the wire? (or maybe toBuf()
's use there is wrong?)
Cheers, -Dragos