catalinii / minisatip

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

Support new elements, most importantly "Critical Security Update Version" #1151

Closed Jalle19 closed 3 months ago

Jalle19 commented 3 months ago

Should fix:

[30/12 20:01:53.761 AD2]: req element 49
[30/12 20:01:53.761 AD2]: element_get: invalid id
[30/12 20:01:53.761 AD2]: can not get element 49
[30/12 20:01:53.761 AD2]: cannot get element 49
[30/12 20:01:53.761 AD2]: cannot req data

@Delitants can you try your CAM again with this change?

Fixes #1029, fixes #1090, fixes #1134

Delitants commented 3 months ago

Should fix:

[30/12 20:01:53.761 AD2]: req element 49
[30/12 20:01:53.761 AD2]: element_get: invalid id
[30/12 20:01:53.761 AD2]: can not get element 49
[30/12 20:01:53.761 AD2]: cannot get element 49
[30/12 20:01:53.761 AD2]: cannot req data

@Delitants can you try your CAM again with this change?

Zero effect, same errors

[25/06 10:34:57.041 AD2]: RECV ciplus cc msg CAM2, session_num 6, tag 9f9007 len 40 dt_id 0 [25/06 10:34:57.041 AD2]: auth ok! [25/06 10:34:57.041 AD2]: serial sac data req: 4 [25/06 10:34:57.041 AD2]: req element 49 [25/06 10:34:57.041 AD2]: element_get: invalid id [25/06 10:34:57.041 AD2]: can not get element 49 [25/06 10:34:57.041 AD2]: cannot get element 49 [25/06 10:34:57.041 AD2]: cannot req data [25/06 10:34:58.097 AD2]: READ TPDU: :

Jalle19 commented 3 months ago

That is not possible, please make doubly sure you re-compile minisatip from the correct branch

Delitants commented 3 months ago

That is not possible, please make doubly sure you re-compile minisatip from the correct branch

I've literally went to my folder, applied the changes, did make clean, configure make and restarted. No effect:

[25/06 10:42:50.261 AD2]: RECV ciplus cc msg CAM2, session_num 6, tag 9f9007 len 40 dt_id 0 [25/06 10:42:50.261 AD2]: auth ok! [25/06 10:42:50.261 AD2]: serial sac data req: 4 [25/06 10:42:50.261 AD2]: req element 49 [25/06 10:42:50.261 AD2]: element_get_buf: datatype 49 not valid [25/06 10:42:50.261 AD2]: can not get element 49 [25/06 10:42:50.261 AD2]: cannot get element 49 [25/06 10:42:50.261 AD2]: cannot req data [25/06 10:42:51.308 AD2]: READ TPDU: : 0000 00 01 80 02 01 80

Jalle19 commented 3 months ago

This time you applied the change, not last time. There's a different message now.

Jalle19 commented 3 months ago

Try removing the .bin file for your CAM from /var/cache/minisatip and try again

Delitants commented 3 months ago

Try removing the .bin file for your CAM from /var/cache/minisatip and try again

No changes:

[25/06 10:52:53.261 AD2]: RECV ciplus cc msg CAM2, session_num 6, tag 9f9007 len 40 dt_id 0 [25/06 10:52:53.261 AD2]: auth ok! [25/06 10:52:53.261 AD2]: serial sac data req: 4 [25/06 10:52:53.261 AD2]: req element 49 [25/06 10:52:53.261 AD2]: element_get_buf: datatype 49 not valid [25/06 10:52:53.261 AD2]: can not get element 49 [25/06 10:52:53.261 AD2]: cannot get element 49 [25/06 10:52:53.261 AD2]: cannot req data [25/06 10:52:54.301 AD2]: READ TPDU: : 0000 00 01 80 02 01 80

Jalle19 commented 3 months ago

@Delitants I pushed another commit, can you apply it and try again? I would remove the .bin file one more time just in case.

Delitants commented 3 months ago

@Delitants I pushed another commit, can you apply it and try again? I would remove the .bin file one more time just in case.

Thanks. Message has changed to: [26/06 03:54:35.708 AD2]: RECV ciplus cc msg CAM2, session_num 6, tag 9f9007 len 88 dt_id 0 [26/06 03:54:35.708 AD2]: auth ok! [26/06 03:54:35.708 AD2]: serial sac data req: 2 [26/06 03:54:35.708 AD2]: set element(dt_id) 6 dt_len = 8 [26/06 03:54:35.708 AD2]: _elementset stored 6 with len 8 [26/06 03:54:35.708 AD2]: not need to be handled id 6 [26/06 03:54:35.708 AD2]: set element(dt_id) 12 dt_len = 32 [26/06 03:54:35.708 AD2]: _elementset stored 12 with len 32 [26/06 03:54:35.708 AD2]: not need to be handled id 12 [26/06 03:54:35.708 AD2]: set element(dt_id) 28 dt_len = 1 [26/06 03:54:35.708 AD2]: _elementset stored 28 with len 1 [26/06 03:54:35.708 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 0 [26/06 03:54:35.708 AD2]: received from CI+ CAM 2: KEY: ** IV: ***

What are those keys it started to print in the log? Are they usable in oscam so I can get rid of this module and use the card alone?

Jalle19 commented 3 months ago

No, those have been printed all this time. Can you post a complete log?

Jalle19 commented 3 months ago

~Added improved support for operator profiles, hoping that it will shed some light on what needs to be done to make this CAM work. @Delitants please try this branch again at some point. Make sure you actually apply all the changes, I force pushed to the branch so you'll need to remove it and clone again.~

Edit: dropped the operator profile related changes from this PR, let's focus on getting the key exchange working

Jalle19 commented 3 months ago

I'm cautiously optimistic that the problem here is that we fail to send element 49 when the CAM requests it, after which it gives up and never sends any further elements. This means we don't get the odd register key later on when needed.

Delitants commented 3 months ago

No, those have been printed all this time. Can you post a complete log?

Please see the log with these changes. It did not fail in first 15 minutes yet. minisatip2.log

Jalle19 commented 3 months ago

Element is correctly sent to the CAM now:

$ cat minisatip2\(7\).log | grep 'stored 49\|element 49'
[26/06 21:16:24.634 AD2]: _element_set_ stored 49 with len 1
[26/06 21:16:32.829 AD2]: req element 49

and as if by magic, the CAM now sends the key for the other register roughly 10 seconds before a parity change:

$ cat minisatip2\(7\).log | grep descrambler_set_key
[26/06 21:16:30.485 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 0
[26/06 21:26:22.236 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 1

Fuck me, I think it works now :pray:

Delitants commented 3 months ago

Element is correctly sent to the CAM now:

$ cat minisatip2\(7\).log | grep 'stored 49\|element 49'
[26/06 21:16:24.634 AD2]: _element_set_ stored 49 with len 1
[26/06 21:16:32.829 AD2]: req element 49

and as if by magic, the CAM now sends the key for the other register roughly 10 seconds before a parity change:

$ cat minisatip2\(7\).log | grep descrambler_set_key
[26/06 21:16:30.485 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 0
[26/06 21:26:22.236 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 1

Fuck me, I think it works now 🙏

Awesome. Does that mean it will also resolve an issue that I needed to tune to a different channel after one month to re-activate the cam?

Jalle19 commented 3 months ago

Probably not

Delitants commented 3 months ago

Element is correctly sent to the CAM now:

$ cat minisatip2\(7\).log | grep 'stored 49\|element 49'
[26/06 21:16:24.634 AD2]: _element_set_ stored 49 with len 1
[26/06 21:16:32.829 AD2]: req element 49

and as if by magic, the CAM now sends the key for the other register roughly 10 seconds before a parity change:

$ cat minisatip2\(7\).log | grep descrambler_set_key
[26/06 21:16:30.485 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 0
[26/06 21:26:22.236 AD2]: === descrambler_set_key === adapter = CA2 key regiser (0-even, 1-odd) = 1

Fuck me, I think it works now 🙏

Not fixed. Fails during decoding, just with longer intervals now (hours instead of 5-10 minutes). minisatip2.log.zip

Jalle19 commented 3 months ago

Please use a version of minisatip that actually contains this fix image

[27/06 21:52:47.252 main]: minisatip version 1.3.~11468f2, compiled on Jun 26 2024 23:53:05, with s2api version: 050B
[27/06 21:53:03.809 AD2]: req element 49
[27/06 21:53:03.809 AD2]: element_get: invalid id
[27/06 21:53:03.809 AD2]: can not get element 49
[27/06 21:53:03.809 AD2]: cannot get element 49
[27/06 21:53:03.809 AD2]: cannot req data