Frame masking against network frame ordering, not frame numbers
The osmo-e1d code includes functionality to save bandwidth by not transmitting timeslots, which haven't changed since the last frame.
Later in development, the frame_rifo was introduced to combat packet reordering in real-world networks (like DOCSIS).
The code unpacking the timeslots into full E1 frames is currently unpacking against the last frame in the incoming buffer, not the last frame in the RIFO (random in, first out) buffer.
This means that frames will get filled with random data from other frames in the event of a re-ordering.
Unpacking/Unmasking should be done after the RIFO mechanism.
I have written a preliminary patch, which moves the unmasking logic after the RIFO code:
(currently with broken unit tests and probably unclean?)
In my testing, this seems to behave correctly whenever reordering occurs.