catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
325 stars 78 forks source link

Handle CWs out of cycle #1055

Closed lars18th closed 1 year ago

lars18th commented 1 year ago

This patch handles a very edge case: When you receive a CW with the same parity of the current one.

The standard behavior is to only receive keys for the next parity cycle. However, in some rare cases a key using the same parity can be received. In principle we do not need to discard this key because we will do a check on the next key change. However, in some special case this could generate an error. This potential case appears when during the key change the buffer does not contain any PUSI packets to validate the key AND the packets are mixing both parities. In this special case, the selection of the "new" key for the "old" parity will not work. Therefore, in this case (and only in this case) it is preferable to use the old key that actually was working.

lars18th commented 1 year ago

Hi @catalinii and @Jalle19 ,

Please, test it. I'm using it for some weeks, and warnings appear time to time. And when they appear, I don't see any glitch during the play. So IMO it's safe to merge it.

catalinii commented 1 year ago

I think is a good idea, but the block should be after setting the expiry not before. Otherwise the new key will expire before the old key.

lars18th commented 1 year ago

I think is a good idea, but the block should be after setting the expiry not before. Otherwise the new key will expire before the old key.

Done @catalinii

catalinii commented 1 year ago

Thx @lars18th