Opened 11 years ago

Closed 9 years ago

#3225 closed defect (expired)

newcamd PORT= wrong when using mgclent =1

Reported by: disisdavo Owned by: alno
Priority: minor Component: Webinterface
Severity: medium Keywords:
Cc: Sensitive: no

Description

Revision

Current

Issue Description

if you select

mgclient = 1

you add in your ports to the server section like

3333@0604:000000;0606:000000,000200;602:000000,000000

it works

BUT

if you go to webif under newcamd section only shows

3333@0604:000000

;0606:000000,000200;602:000000,000000 <--- MISSING

If you change ANY other setting via webif it overwrites your setting and removes all other except

3333@0604:000000

it just ignores the rest of the line from the ;

I think some code is missing or broken
if mgclient =1 then the format should be PORT= is 3333@0604:000000;0606:000000,000200;602:000000,000000
port@caid:prid,prid;caid:prid,prid;caid etc etc

it is obviously looking for the next port number, if not then it droped them.

When the issue occurs

All the time

How the issue is reproducable

select mgclient =1 & change your ports to 1 port with multiple CAIDs, Then go to WEBIF and CONFIGURATION then NEWCAMD look at the PORT section will only show the first CAID & port.

If you change ANY settings in here and HIT SAVE your PORT is overwritten with only 1 CAID@PORT:PRID eg..

3333@0604:000000;0606:000000,000200;602:000000,000000

becomes

3333@0604:000000

-->;0606:000000,000200;602:000000,000000<-- are removed

If you untick mgclient & replace the format to
3333@0604:000000;4444@0606:000000,000200;4441@602:000000,000000

and check WEBIF all ports & CAIDs are shown.

<Don't forget to ATTACH (NOT post here as text)
NIL LOG FILE REQUIRED

Attachments (1)

test_fix.diff (2.2 KB ) - added by gf 11 years ago.
This seems to work…

Download all attachments as: .zip

Change History (40)

comment:1 by imperia, 11 years ago

I tried to first discuss it on forums, but nobody paid attention.
http://www.streamboard.tv/wbb2/thread.php?threadid=37456

I believe we are talking for 2 different problems. One with 'port=' syntax and another related to webif reading of oscam.conf. I don't use webif at all, I change oscam.conf manually, but the problem with port= syntax is still there.

by gf, 11 years ago

Attachment: test_fix.diff added

This seems to work...

comment:2 by disisdavo, 11 years ago

compiling now...feedback to come, i had to svn update first..

Last edited 11 years ago by disisdavo (previous) (diff)

comment:3 by disisdavo, 11 years ago

I unticked mgclient
SAVED
RESTARTED OSCAM
All OK.

I ticked mgclient
SAVED
RESTARTED OSCAM
All OK.

I think you have fixed that gf :D

Thanks :D Im happy and hope it fixes imperia's issue for him to.

comment:4 by disisdavo, 11 years ago

Resolution: fixed
Status: newclosed

Set to fixed, waiting adding to svn.

comment:5 by amet, 11 years ago

hm, not to interrupt but when I have

[newcamd]
port                          = 20100@0603:000000;0604:000000
key                           = 4835883366346499466456363444
mgclient                      = 1

I only have below in log, the webIF works as expected though with the patch

2013/03/09 10:59:58 0 s newcamd: initialized (fd=7, port=20100)
2013/03/09 10:59:58 0 s -> CAID: 0603 PROVID: 000000 

comment:6 by disisdavo, 11 years ago

Resolution: fixed
Status: closedreopened

Still needs, work from last update, I didn't double check if all caids were displaying.

comment:7 by disisdavo, 11 years ago

yes i can confirm, in the log, only the first CAID is now being set. so maybe some small error.

now the webif is working correctly, but on init only the first CAID is initalised.
eg..

2013/03/09 10:59:58 0 s newcamd: initialized (fd=7, port=3333)
2013/03/09 10:59:58 0 s -> CAID: 0604 PROVID: 000000

should also have
2013/03/09 10:59:58 0 s -> CAID: 0603 PROVID: 000000
2013/03/09 10:59:58 0 s -> CAID: 0660 PROVID: 000000

nearly right :D

Last edited 11 years ago by disisdavo (previous) (diff)

comment:8 by disisdavo, 11 years ago

UPDATE

Even though its not showing all the CAIDs in the log window on boot up, I am receiving pictures thru the one port from what i can tell, i am doing more tests,

@amet
can you double check if all is working as it should, I think it is bar the log entry to say it is.??

comment:9 by gf, 11 years ago

amet's problem is because at startup filters are checked port by port (only if port is set). And since

20100@0603:000000;0604:000000

doesn't have port set for the second filter it is not shown. Its kind of a mess...

comment:10 by gf, 11 years ago

I think we have bigger problems here. According to the documentation port@ is *required* after ;

http://www.streamboard.tv/wiki/OSCam/en/Config/oscam.conf#port_6

In other words if you want different ports you separate them with ; According to docs the correct syntax is: port[{DES key}]@CAID[:ident][,ident]...[;port[{DES key}]@CAID[:ident][,ident]...]...

So this is the case for single port, with multiple caids and multiple idents per caid:

port1[{des1}]@caid1[:ident1,ident2,ident3],[caid2:ident21,ident22,ident23]
port=3333@0604:000001,000002,000003,0608:000004,000005,000006

On startup this results in:

14:21:30        0 s newcamd: initialized (fd=5, port=3333)
14:21:30        0 s -> CAID: 0604 PROVID: 000001, 000002, 000003
14:21:30        0 s -> CAID: 0608 PROVID: 000000, 000000, 000000

but port make function is busted and generates only "3333@0604:000001,000002,000003" missing second CAID.

The case for multiple ports is the above just twice separated by ;

port1[{des1}]@caid1[:ident1,ident2,ident3];port2[{des2}]@caid2[:ident21,ident22,ident23]
port=3333@0604:000001,000002,000003,0608:000004,000005,000006;4444@0808:0000009,00010,0909:0000A

on startup:

14:23:05        0 s newcamd: initialized (fd=5, port=3333)
14:23:05        0 s -> CAID: 0604 PROVID: 000001, 000002, 000003
14:23:05        0 s -> CAID: 0608 PROVID: 000000, 000000, 000000
14:23:05        0 s newcamd: initialized (fd=7, port=4444)
14:23:05        0 s -> CAID: 0808 PROVID: 000009, 000010
14:23:05        0 s -> CAID: 0909 PROVID: 000000

again make function is busted and generates only "3333@0604:000001,000002,000003;4444@0808:000009,000010" missing second CAID.

In the above examples the patch makes no difference at all. I think we have bug in the generator, along with user configuration bug (using ; to request more ports, when , should be used to request more idents).

More coming in a minute because I'm running out of battery.

in reply to:  10 comment:11 by manu, 11 years ago

Replying to gf:

In other words if you want different ports you separate them with ; According to docs the correct syntax is: port[{DES key}]@CAID[:ident][,ident]...[;port[{DES key}]@CAID[:ident][,ident]...]...

So this is the case for single port, with multiple caids and multiple idents per caid:

port1[{des1}]@caid1[:ident1,ident2,ident3],[caid2:ident21,ident22,ident23]
port=3333@0604:000001,000002,000003,0608:000004,000005,000006

Are you sure about this? I see no possibility to define multiple CAIDs per port in this syntax. Just multiple idents. Every CAID requires a separate port.

Nevertheless I was looking into multi-CAID per port a few weeks ago but ran out of time. Ar far as I've read the source the current behavior for mgclient is:
mgclient=0 ...only one port per CAID
mgclient=1 ...send *all* CAIDs using an additional message + only shown in debug log

For me this is just broken / not really tested and should be rewritten (just like a bunch of other stuff like keepalive message pakets in newcamd).

Add.: I'll probably look into this again. Since I'm using newcamd only I'm at least able to test this stuff right away.

Last edited 11 years ago by manu (previous) (diff)

comment:12 by dropsman, 11 years ago

@ gf:

I think that the documentation is wrong. The syntax '20100@0603:000000;0604:000000' worked in older versions (very old versions 6xxx).

I think if we only separate the entries with "," many people get confused. To separate we should use ';'.

comment:13 by gf, 11 years ago

We should see/decide what the correct syntax is and the if needed, fix the parser and generator /preferably by simplifying the code, because currently its very tangled/.

How does this sound:

  • basic tokens:
    • ident
      • ident *should* contain caid (0000) /at least the first for a port *must*/
      • ident *may* contain one or more provider IDS (000000).
        • if there are no providers ids set, its assumed that the provider_id is 000000
      • ident definition:
        • caid:provider_id | example: 0604:00001
      • Multiple ident definitions are separated by ,
  • port
    • port *must* contain number and *must* contain ident
    • port "may* contain DES key.
    • port definition:
      • port{des_key}@ident | example: 3333@0604:000001 | example2: 3333{1234567890}@0604:000001
    • Multiple port definitions are separated by ;

Parser:

  • split text by ;
    • for each port in text
      • set port (the part before @)
        • if there is no @ symbol, we assume that these idents are for previous port, if port_idx is 0, error in parsing (no port is set).
      • set key if exist (the part between {})
      • for each ident (the text after @ split by ,)
        • get ident (if ident is empty, error, no ident is set for port)
          • split by :
            • set caid or use previous caid (if caid = 0 and no previous caid, error - no caid)
              • remembers caid
            • set provider id or use 000000

comment:14 by amet, 11 years ago

ok, separating it with "," did the trick... now I see

2013/03/09 20:02:01        0 s newcamd: initialized (fd=7, port=20100)
2013/03/09 20:02:01        0 s -> CAID: 0603 PROVID: 000000
2013/03/09 20:02:01        0 s -> CAID: 0604 PROVID: 000000

but connecting from another oscam instance using newcamd protocol results in:

2013/03/09 20:02:52 9C0039A0 p Test [newcamd] connecting to SOME_URL:20100
2013/03/09 20:02:52 9C0039A0 p Newcamd Server: SOME_URL:20100 - UserID: 12
2013/03/09 20:02:52 9C0039A0 p CAID: 0603 - UA: 0000000000000000 - Provider # 1
2013/03/09 20:02:52 9C0039A0 p Provider ID: 000000 - SA: 00000000
2013/03/09 20:02:52 9C0039A0 p Test [newcamd] proxy initialized, server SOME_URL:20100 

should it work on oscam? otherwise I have to get dreambox out to see if I can connect using NewCS or whatever its called.

issue is that my ISP filters newcamd proto and I cant test reliably from here, I need to move it to a friends house to test :(

let me know what I can help/test

amet

in reply to:  13 ; comment:15 by amet, 11 years ago

Replying to gf:

How does this sound:

sounds like a great plan to me..

how would multi port + mgclient work together?

port = 20100@0603:000000;0604:000000;20101@0603;20102@0604

in reply to:  15 comment:16 by gf, 11 years ago

Replying to amet:

Replying to gf:

How does this sound:

sounds like a great plan to me..
how would multi port + mgclient work together?

port = 20100@0603:000000;0604:000000;20101@0603;20102@0604

I think this be parsed as

  • port=20100
    • caid=0603
      • provid=000000
    • caid=0604
      • provid=000000
  • port=20101
    • caid=0603
      • provid=000000
  • port=20102
    • caid=0604
      • provid=000000

comment:17 by amet, 11 years ago

brilliant ...

should testing from another oscam installation be sufficient? should it work or do i need to test with newCS or something else?

comment:18 by disisdavo, 11 years ago

Looks ok to me,

comment:19 by gf, 11 years ago

Please post different port settings so we can check if the algorithm above is working.

comment:20 by disisdavo, 11 years ago

port = 3333@0602:000000,000000;0603:000000,000000,0604:000000

should be CAID 0602 2x ident ,0603 2x ident, 0604 1x ident all on PORT 3333

if we then had a 2nd port eg... 4444 for 0604 we would have

port = 3333@0602:000000,000000;0603:000000,000000,4444@0604:000000

resulting in

should be CAID 0602 2x ident ,0603 2x ident, all on PORT 3333 & 0604 1x ident on port 4444

this is how i see it.

maybe you could use the @ to search for multi port as everytime you want another port you have

CAID@

this still leaving the ; to seperate CAID from ident & using , for ident only?

Davo

comment:21 by amet, 11 years ago

port = 20100@0603:000000,0604:000000;20101@0603:000000;20102@0604:000000

2013/03/09 20:56:43 0 s newcamd: initialized (fd=7, port=20100)
2013/03/09 20:56:43 0 s -> CAID: 0603 PROVID: 000000
2013/03/09 20:56:43 0 s -> CAID: 0604 PROVID: 000000
2013/03/09 20:56:43 0 s newcamd: initialized (fd=8, port=20101)
2013/03/09 20:56:43 0 s -> CAID: 0603 PROVID: 000000
2013/03/09 20:56:43 0 s newcamd: initialized (fd=9, port=20102)
2013/03/09 20:56:43 0 s -> CAID: 0604 PROVID: 000000 

thats shows it as working, CCCam client connecting shows only 0603 on port 20100 and so does oscam client

EDIT: port = 20100@0603:000000;0604:000000;20101@0603;20102@0604 didnt work, needs "," to split multiple CAIDs on one port

Last edited 11 years ago by amet (previous) (diff)

comment:22 by imperia, 11 years ago

looks like

port=44707@5581:000000;44708@4AEE:000000;44702{000102030405060708090A0B0C0D}@5581:000000;44703{000102030405060708090A0B0C0D}@4AEE:000000;55700@5581:000000,4AEE:000000

is working. will test connection later.
i got some warning while compiling:

oscam-conf-chk.c: In function ‘chk_port_tab’:
oscam-conf-chk.c:295:10: warning: variable ‘port’ set but not used [-Wunused-but-set-variable]

that's on raspberry pi if it matters.

comment:23 by disisdavo, 11 years ago


FIRST


I have found this its reporting correctly with the following format

port = 3333@0602:000000,000000,0603:000000,000000,0604:000000

BUT...
using " , " to seperate the multi CAIDs on one POrt is working with ECMs BUT it isnt working as EMMs are not being sent to anything BUT the first set CAID.


SECOND


Using the following format

port = 3333@0602:000000,000000;0603:000000,000000;0604:000000

Does NOT report correctly.. BUT.. works the SAME as FIRST

using " ; " to seperate the multi CAIDs on one POrt is working with ECMs BUT it isnt working as EMMs are not being sent to anything BUT the first set CAID.


THIRD


ONLY if i go back to multi PORTs

port = 3333@0602:000000,000000;4444@0603:000000,000000;5555@0604:000000

works with EMMs on all CAIDs.

Davo

Last edited 11 years ago by disisdavo (previous) (diff)

comment:24 by amet, 11 years ago

@disisdavo

are you seeing all caids on the client side as well with above config?

I see the CAIDs on oscam but when connecting to it I only see first CAID

comment:25 by disisdavo, 11 years ago

Yes
I have tried connecting oscam to oscam & cccam to oscam.

Only Multi ports works properly.

comment:26 by Admin, 11 years ago

The option is called "mgclient". It should only work reliable with mgcamd as a client. OSCam as a newcamd client can't work with multiple caids on one port as far as I remember and I think CCCam is the same here. It is only implemented on server side!

comment:27 by malakudi, 11 years ago

I think it doesn't work in client mode, though it would be nice if it would. Isn't this "mgclient" option actually the chameleon implementation that was introduced from newcs?

comment:28 by amet, 11 years ago

hm, I am not sure I understand... I was under impression that "mgclient" == mgcamd == ext newcamd, if oscam reader can read multiple caids from newcs(or whatever the server is called) shouldnt it get it from another oscam server?

I have tried using a mgcamd as client and it seems to only get one CAID, the first one, but that was before this patch. will see if I can test more

excuse if my terminology is not correct, I am quite new to this :)

comment:29 by Admin, 11 years ago

The option mgclient is under the server section (also in WebIf) and not in the reader section.
chameleon2 is a completely different protocol.

in reply to:  26 comment:30 by amet, 11 years ago

Replying to Admin:

The option is called "mgclient". It should only work reliable with mgcamd as a client. OSCam as a newcamd client can't work with multiple caids on one port as far as I remember and I think CCCam is the same here. It is only implemented on server side!

I have OSCam reader setup as newcamd and it gets multiple caids without issues, or did I misread that?

comment:31 by Admin, 11 years ago

Well you can define it manually - but not by letting the server automatically tell the client which caids/idents it supports. If we receive the indication of the extended mode as a client we just disable filtering by the caid that we received on server ident and rely on the reader configuration to have the proper filter settings been set:

case MSG_SERVER_2_CLIENT_ADDCARD:

if (client->reader) {

client->reader->ncd_disable_server_filt=1;

}

The server functionality is implemented in the function newcamd_report_cards and really does report the cards.

comment:32 by amet, 11 years ago

granted, OSCam as newcamd reader doesnt know what CAIDs it gets, but frankly I never thought about it that way... it was always trial and error for me

comment:33 by Admin, 11 years ago

Furthermore: When I look into this mgclient reporting mechanism to the client ("newcamd extended") then it collects all idents from all readers that are defined and are in the same group as the user (though, this is not correctly built in as it doesn't for example iterate through cccam or gbox cards) and doesn't rely at all on what caid/ident was defined in the server section with the port syntax! I think that in general this is a lot better than defining caids/idents statically as it allows separation by user (though there's a lot of way for improvement here...).

Last edited 11 years ago by Admin (previous) (diff)

comment:34 by drno, 11 years ago

I see another issue if it is not possible to provide multiple CAID with one port:

In the case of assigning more then 1 port to a single user will connect this user multiple times when switching from one CAID to another. This will prevent to enable the "uniq" feature und can only be overcome by defining a separate user for each port

But maybe i am wrong and in this case please excuse my ignorance.

comment:35 by Admin, 11 years ago

You can set the user to be uniq by IP which should normally be enough. Regarding the topic, I would say that the original issue has been resolved, right?

in reply to:  35 comment:36 by amet, 10 years ago

Replying to Admin:

You can set the user to be uniq by IP which should normally be enough. Regarding the topic, I would say that the original issue has been resolved, right?

no, original issue still exists in r8853

comment:37 by CapNCooK, 10 years ago

I think the truth about extended newcamd / mgcamd configuration is this:

Non-Extended:
1000@0963:000000;2000@0100:00006a,00006b,00006c
Which sets one port for each single newcamd-caid, optionally having multiple provid's for each one.

Extended (having mgcamd option set in oscam):
1000@0963:000000
Does same as non-extended, so returning 0963:000000 as 'main' caid:provid, but _also_ allows requests for different caid:provid, like 1702:000000..

This way mgcamd clients will be served at one single port, regardless to what is beeing defined as 'main' caid:provid..

So if you ask me.. This can be closed.. (?)

comment:38 by gf, 10 years ago

If you're right, the documentation and the examples must be changed and then this can be closed.

comment:39 by Deas, 9 years ago

Resolution: expired
Status: reopenedclosed
Note: See TracTickets for help on using tickets.