Opened 10 years ago

Closed 9 years ago

#3904 closed defect (fixed)

OSCam client looses cards from OSCam Proxy using CCCam protocol

Reported by: Lipovitan Owned by:
Priority: minor Component: Protocol - CCCam
Severity: medium Keywords: lost cards
Cc: Sensitive: no

Description

Revision

9847

Issue Description

I have a small setup using 2 oscam servers with local card readers, one oscam "proxy" server connecting to those 2 oscam servers using cccam protocol and then 2 clients connecting to the oscam proxy (also using cccam protocol).

R1: Server with 3 CaIDs (0D05, 1843, 1833)
R2: Server with 2 CaIDs (2x 098C).

P: Proxy-Server, connects to R1 and R2.

C1: Client with AU, connects to P
C2: Client without AU, connects also to P.

The problem is now that from time to time *only* C2 looses some of the cards from the proxy server. If I configure C2 to also have AU it never happens...

I've traced it back to module-cccshare.c at about Line 444, where there is a reference comparison of "if (card == card2)" which I think goes wrong for some reason. I've tried to use the same_card or same_card2 function declared in module-cccam.c - but the result is the same :-(. the client c2 looses the card from time to time (usually after the share-update from the proxy server!).

(see not_working.diff)

I've added a bunch of debug code around that section and found out that for some reason card->id is always different when it get's lost... since I don't have much knowledge of oscam internals I'm using a workaround with an extended compare which might not work as it's supposed to (specifically in larger share networks). But there must be something wrong...

(see kinda_working.diff)

Attachments (3)

debug.log (2.4 KB ) - added by Lipovitan 10 years ago.
not_working.diff (556 bytes ) - added by Lipovitan 10 years ago.
kinda_working.diff (855 bytes ) - added by Lipovitan 10 years ago.

Download all attachments as: .zip

Change History (24)

by Lipovitan, 10 years ago

Attachment: debug.log added

by Lipovitan, 10 years ago

Attachment: not_working.diff added

by Lipovitan, 10 years ago

Attachment: kinda_working.diff added

comment:1 by psych0dad, 9 years ago

I have the same problem here. My setup is similiar to Lipovitan's one:

S: Remote Server with 7 CaIDs running current oscam-modern

P: Local Server with oscam r10653, connected to S via cccam_ext protocol, resharing all cards from S. Two added users C1 and C2: C1 with au permission for S, C2 without an au permission.

C1: oscam r10660, connecting to P via cccam_ext
C2: oscam r10660, connecting to P via cccam_ext

C1 always sees all cards.
C2 is randomly missing some cards

Workaround:

Adding an disabled dummy reader in P and give user C2 au permission for that dummy reader.
Now C2 sees all cards.

Last edited 9 years ago by psych0dad (previous) (diff)

comment:2 by theparasol, 9 years ago

Just stop using that buggy protocol and start using cs357x/cs378x

in reply to:  2 comment:3 by psych0dad, 9 years ago

sorry, your comment is of no help. cccam is a supported protocol of oscam and should work without problems. this issue is clearly a bug in oscam and should be fixed.

comment:4 by Poedel, 9 years ago

Can anyone confirm that the patch from gorgone is the right solution for this problem?

http://www.streamboard.tv/oscam/changeset/10679

comment:5 by psych0dad, 9 years ago

unfortunately this fix does not work. cards are still missing.

comment:6 by Gorgone Impertinence, 9 years ago

please discuss this and explain with logs and pictures

so this fix can reverted or helps a bit ?

comment:7 by psych0dad, 9 years ago

ok i'll try my best. first, the fix has no effect (for me), so it can be reverted. also, the patched code looks not correct to me: memcmp() will return 0 on equal hexserials, but the whole code looks like non-zero is expected in this case. however since i have no knowledge of oscam's inner working this could be intended.

my setup is described in comment1. the server provides 6 cards to the proxy with cccreshare 1. the proxy reshares all cards to the clients. server is running oscam 1.20 modern r1425. proxy now runs r10679, client runs r10680.

first my configs:

proxy config ---------------------

oscam.conf

[cccam]
port                          = 12345
nodeid                        = 179F7F06104B13CA
version                       = 2.3.0
reshare                       = 0
recv_timeout                  = 5000

oscam.server:

[reader]
label                         = server
protocol                      = cccam
device                        = server.net,12345
user                          = bla
password                      = bla
inactivitytimeout             = 30
reconnecttimeout              = 10
group                         = 1
ccckeepalive                  = 1
cccreshare                    = 0

[reader]
label                         = dummy
enable                        = 0
protocol                      = serial
device                        = 
detect                        = cd
group                         = 2

oscam.user:

[account]
user                          = client1
pwd                           = bla
group                         = 1
au                            = 
#au                            = dummy

client1 config ------------------------

oscam.server:

[reader]
label                         = client1
protocol                      = cccam
device                        = proxy.net,12345
user                          = client1
password                      = bla
group                         = 1
ccckeepalive                  = 1

first the log from the proxy connecting to server. proxy has au permission for all cards of server and is connected via cccam_ext protocol.
all 6 cards are detected.

proxy.log:

2015/06/08 22:05:28 55B2C8 p (cccam) cccam: inactivity timeout: 30 seconds, receive timeout: 10 seconds
2015/06/08 22:05:28 55B2C8 p (cccam) cccam: auto build set for version: 2.3.0 build: 3367
2015/06/08 22:05:28 55B2C8 p (cccam) proxy reader: server (server.net:12345) cccam v2.3.0 build 3367, maxhops: 10
2015/06/08 22:05:28 55B2C8 p (cccam) cccam(r) server: login succeeded
2015/06/08 22:05:28 55B2C8 p (cccam) cccam: send client data
2015/06/08 22:05:28 55B2C8 p (cccam) cccam(r) server: sending own version: 2.3.0, build: 3367
2015/06/08 22:05:28 55B2C8 p (reader) server [cccam] proxy initialized, server server.net:12345
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: extended ECM mode
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: extra SID mode
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: sleepsend
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: caid 098C UA: 00000088AE0F0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 000000:0088AE00
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: card added: id 138 remoteid 10000 caid 98C hop 1 reshare 1 originid 138 cardtype 10
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: caid 098C UA: 000000925C3A0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 000000:00925C00
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: card added: id 12E remoteid 20000 caid 98C hop 1 reshare 1 originid 12E cardtype 10
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: caid 09C4 UA: 0000003690480000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 000000:00369000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: card added: id 136 remoteid 60000 caid 9C4 hop 1 reshare 1 originid 136 cardtype 10
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: caid 09AF UA: 00002FC135830000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 000000:2FC13500
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: card added: id 13C remoteid 70000 caid 9AF hop 1 reshare 1 originid 13C cardtype 10
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: caid 1830 UA: 000048EAB9EB0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 003411:48EA0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 000000:48EA0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 008011:48EA0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: card added: id 134 remoteid 30000 caid 1830 hop 1 reshare 1 originid 134 cardtype 10
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: caid 1830 UA: 000048BFE4800000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 003411:48BF0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 000000:48BF0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: au info: provider: 008011:48BF0000
2015/06/08 22:05:29 55B2C8 p (cccam) cccam(r) server: card added: id 132 remoteid 40000 caid 1830 hop 1 reshare 1 originid 132 cardtype 10


now the connect logs from client1 and the proxy if client1 has no au permission. the proxy will not send all cards to client1. its completely random which and how many cards will be missing (between 1 and 6). in this case here 5 cards are missing.

proxy.log:

2015/06/08 22:18:41 545260 c (cccam) cccam: new connection from client1.net
2015/06/08 22:18:41 545260 c (client) encrypted cccam-client client1.net granted (client1, au=off)
2015/06/08 22:18:41 545260 c (cccam) ccc user authenticated client1
2015/06/08 22:18:41 545260 c (cccam) cccam(s) client1: client 'client1' (0DA751B910F814FA) running v2.3.0 (3367)
2015/06/08 22:18:41 545260 c (cccam) ccc send srv_data client1
2015/06/08 22:18:41 545260 c (cccam) cccam: send server data
2015/06/08 22:18:41 545260 c (cccam) cccam: auto build set for version: 2.3.0 build: 3367
2015/06/08 22:18:41 545260 c (cccam) cccam(s) client1: version: 2.3.0, build: 3367 nodeid: 0DA751B910F814FA
2015/06/08 22:18:41 545260 c (cccam) cccam(s) client1: extended ECM mode
2015/06/08 22:18:41 545260 c (cccam) cccam(s) client1: extra SID mode
2015/06/08 22:18:41 545260 c (cccam) cccam(s) client1: sleepsend
2015/06/08 22:18:41 545260 c (cccam) cccam(s) client1: extended sid mode activated
2015/06/08 22:18:41 545260 c (cccam) ccc send cards client1
2015/06/08 22:18:41 545260 c (work) add client job action 28 queue length 1 client1
2015/06/08 22:18:41 545260 c (cccam) reported 1 cards for client1
2015/06/08 22:18:41 545260 c (cccam) ccc connected and waiting for data client1

client1.log:

2015/06/08 22:18:43 59DC88 p (cccam) cccam: inactivity timeout: 240 seconds, receive timeout: 3 seconds
2015/06/08 22:18:43 59DC88 p (cccam) cccam: auto build set for version: 2.3.0 build: 3367
2015/06/08 22:18:43 59DC88 p (cccam) proxy reader: client1 (proxy.net:12345) cccam v2.3.0 build 3367, maxhops: 10
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: login succeeded
2015/06/08 22:18:43 59DC88 p (cccam) cccam: last_s=1433794723, last_g=0
2015/06/08 22:18:43 59DC88 p (cccam) cccam: pfd=21
2015/06/08 22:18:43 59DC88 p (cccam) cccam: send client data
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: sending own version: 2.3.0, build: 3367
2015/06/08 22:18:43 59DC88 p (reader) client1 [cccam] proxy initialized, server proxy.net:12345
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: remove server 179F7F06104B13CA running v2.3.0 (3367)
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: extended ECM mode
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: extra SID mode
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: sleepsend
2015/06/08 22:18:43 59DC88 p (cccam) cccam(r) client1: card added: id 71 remoteid 30000 caid 1830 hop 2 reshare 0 originid 71 cardtype 10


and now the connect logs from client1 and the proxy if client1 has au permission for a (dummy) reader. i use a dummy reader here, because i dont want to give the client au permission for the server.

proxy.log:

2015/06/08 22:33:46 530C60 c (cccam) cccam: new connection from client1.net
2015/06/08 22:33:46 530C60 c (cccam) send ccc checksum
2015/06/08 22:33:46 530C60 c (cccam) receive ccc checksum
2015/06/08 22:33:46 530C60 c (cccam) ccc username received client1
2015/06/08 22:33:46 530C60 c (cccam) ccc passwdhash received client1
2015/06/08 22:33:46 530C60 c (client) encrypted cccam-client client1.net granted (client1, au=on (1 reader))
2015/06/08 22:33:46 530C60 c (cccam) ccc user authenticated client1
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: client 'client1' (0DA751B910F814FA) running v2.3.0 (3367)
2015/06/08 22:33:46 530C60 c (cccam) ccc send srv_data client1
2015/06/08 22:33:46 530C60 c (cccam) cccam: send server data
2015/06/08 22:33:46 530C60 c (cccam) cccam: auto build set for version: 2.3.0 build: 3367
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: version: 2.3.0, build: 3367 nodeid: 0DA751B910F814FA
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: parse_msg=254
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: extended ECM mode
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: extra SID mode
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: sleepsend
2015/06/08 22:33:46 530C60 c (cccam) cccam(s) client1: extended sid mode activated
2015/06/08 22:33:46 530C60 c (cccam) ccc send cards client1
2015/06/08 22:33:46 530C60 c (work) add client job action 28 queue length 1 client1
2015/06/08 22:33:46 530C60 c (work) add client job action 28 queue length 2 client1
2015/06/08 22:33:46 530C60 c (work) add client job action 28 queue length 3 client1
2015/06/08 22:33:46 530C60 c (work) add client job action 28 queue length 4 client1
2015/06/08 22:33:46 530C60 c (work) add client job action 28 queue length 5 client1
2015/06/08 22:33:46 530C60 c (work) add client job action 28 queue length 6 client1
2015/06/08 22:33:46 530C60 c (cccam) reported 6 cards for client1
2015/06/08 22:33:46 530C60 c (cccam) ccc connected and waiting for data client1

client1.log:

2015/06/08 22:33:47 599678 p (cccam) cccam: inactivity timeout: 240 seconds, receive timeout: 3 seconds
2015/06/08 22:33:47 599678 p (cccam) cccam: auto build set for version: 2.3.0 build: 3367
2015/06/08 22:33:47 599678 p (cccam) proxy reader: client1 (proxy.net:12345) cccam v2.3.0 build 3367, maxhops: 10
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: login succeeded
2015/06/08 22:33:47 599678 p (cccam) cccam: last_s=1433795627, last_g=0
2015/06/08 22:33:47 599678 p (cccam) cccam: pfd=16
2015/06/08 22:33:47 599678 p (cccam) cccam: send client data
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: sending own version: 2.3.0, build: 3367
2015/06/08 22:33:47 599678 p (reader) client1 [cccam] proxy initialized, server proxy.net:12345
2015/06/08 22:33:47 599678 p (work) add reader job action 1 queue length 1 client1
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: extended ECM mode
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: extra SID mode
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: sleepsend
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: caid 098C UA: 00000088AE0F0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 000000:0088AE00
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: card added: id 64 remoteid 10000 caid 98C hop 2 reshare 0 originid 64 cardtype 10
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: caid 098C UA: 000000925C3A0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 000000:00925C00
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: card added: id 65 remoteid 20000 caid 98C hop 2 reshare 0 originid 65 cardtype 10
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: caid 09AF UA: 00002FC135830000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 000000:2FC13500
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: card added: id 67 remoteid 70000 caid 9AF hop 2 reshare 0 originid 67 cardtype 10
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: caid 09C4 UA: 0000003690480000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 000000:00369000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: card added: id 66 remoteid 60000 caid 9C4 hop 2 reshare 0 originid 66 cardtype 10
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: caid 1830 UA: 000048EAB9EB0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 003411:48EA0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 000000:48EA0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 008011:48EA0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: card added: id 68 remoteid 30000 caid 1830 hop 2 reshare 0 originid 68 cardtype 10
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: caid 1830 UA: 000048BFE4800000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 003411:48BF0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 000000:48BF0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: au info: provider: 008011:48BF0000
2015/06/08 22:33:47 599678 p (cccam) cccam(r) client1: card added: id 69 remoteid 40000 caid 1830 hop 2 reshare 0 originid 69 cardtype 10

i hope this helps a bit.

comment:8 by Aeon, 9 years ago

I have found part of the problem:
For every reader with AU enabled, oscam creates a copy of it (for non au-clients) with the hex-serial removed.
So for every AU-enabled reader we have the orginal (with hex-serial) for au-enabled clients, and a copy (without hex-serial) for non-au clients.

The problem is, that somehow the copy gets removed at some point.

Because non-au clients cannot see the (original) au readers, they disappear for them.
When you add a dummy reader with au to a client, he will be treated as an "au client" and then will be able to see all au-readers (including their hex-serials).
So the dummy reader does not fix the real problem, that is, disappearing (copy) readers without the hex-serial.

I will continue searching.

Last edited 9 years ago by Aeon (previous) (diff)

comment:9 by AbrahaM, 9 years ago

You are right, I'm confirming your description of issue. I accidently run similar test with same result. I hadn't any problems with disapearing cccam peers until I enabled AU for readers. After that issue was present, in quite annynoing scale.

Last edited 9 years ago by AbrahaM (previous) (diff)

comment:10 by Aeon, 9 years ago

Please test http://www.streamboard.tv/oscam/changeset/10685.

This is a server-side patch, so please update your servers.

Last edited 9 years ago by Aeon (previous) (diff)

comment:11 by Poedel, 9 years ago

There is something strange happening on (original) CCcam 2.3.0 clients when connected / connecting to an OSCam server version 10685 (with this patch, or later). Yesterday suddenly my tv went black, did not change anything at that moment. CCcam was not running anymore..

Figured out that CCcam won't start anymore when there is a C: line connecting to my local OSCam server (running on Ubuntu x86). Went back to CCcam 2.2.1, then no problems. Tested 2.3.0 again, won't start. Commented the C: line out, then CCcam 2.3.0 will start. Reactivated the C: line and restarted CCcam 2.3.0, now it starts, connects and light on the tv...

This morning the exact same thing happened on my other receiver. So it looks like it's not receiver related. Although both (VU+ Duo and Max Digital XP1000) are equiped with OpenPLi.

I don't know what this is, but never seen before I updated OSCam to 10685 on my server.

Maybe CCcam on client expects at some moment something different then what it gets now?

comment:12 by Aeon, 9 years ago

Which oscam version did you use before?

I cannot think of any reason why 10685 would make CCcam 2.3.0 crash.

comment:13 by Poedel, 9 years ago

I used 10680 (and therefor 10660) before I updated to 10698.

I don't understand what triggers that CCcam 2.3.0 stops running and won't start again afterwards. But after it starts once 'clean' without connections, it's also starts again with connections.

There must be a change (maybe other than 10685) what makes this happen. But why CCcam 2.2.1 does not have the same issue, I really don't know!

Last edited 9 years ago by Poedel (previous) (diff)

comment:14 by Aeon, 9 years ago

Has your CCcam 2.3.0 user au enabled?
If yes, try disabling, if no, try enabling, and check whether it helps.

comment:15 by testdrive, 9 years ago

I have the same issue after upgrading server to 10653 (I don't remember what i had before upgrading)
CCcam 2.3.0 stops working sometimes and needs to be restarted.
I have:
SERVER LISTEN PORT : 0
DISABLE EMM : yes

in CCcam config

comment:16 by Poedel, 9 years ago

Restarting CCcam 2.3.0 don't work in my situation, with 10660/10680 I had no problems (although 10680 did not run very long).

CCcam 2.3.0 user has no au enabled. I will try this, but result can be days, while issue appeared just after 36 hours on my second receiver (on my first receiver after about 14 hours).

comment:17 by Poedel, 9 years ago

When it happens again I hopefully can start CCcam 2.3.0 on the client in debug mode (option -d), so I can see what is going wrong.

comment:18 by psych0dad, 9 years ago

This fix works for me, no problems so far. Thank you very much Aeon!

Last edited 9 years ago by psych0dad (previous) (diff)

comment:19 by Poedel, 9 years ago

I think the problem is not OSCam, so far as I can see. Au enabled or disabled does not matter, it happened again. Went also back to build 10660, but doesn't change the issue.

CCcam 2.3.0 stops with 'Bus error'.

Last edited 9 years ago by Poedel (previous) (diff)

in reply to:  10 comment:20 by AbrahaM, 9 years ago

Replying to Aeon:

Please test http://www.streamboard.tv/oscam/changeset/10685.

This is a server-side patch, so please update your servers.


confirmed: r10685 fixed issue between oscams.

comment:21 by Aeon, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.