Changeset 11456


Ignore:
Timestamp:
Jan 10, 2019, 6:49:25 PM (6 months ago)
Author:
felixka
Message:

[gbx] - fix oscam crash when enable ccc to gbx share

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/module-gbox.c

    r11446 r11456  
    391391                          {
    392392
    393                            if(card->type == GBOX_CARD_TYPE_GBOX || card->type == GBOX_CARD_TYPE_CCCAM)
     393                           if(card->type == GBOX_CARD_TYPE_GBOX)
    394394                             {
    395                                 //cs_log_dbg(D_READER,"send peer card %04X - level=%d crd-owner=%04X", card->caprovid >> 16, card->lvl, card->id.peer);                                                             
     395                               // cs_log_dbg(D_READER,"send to peer gbox-card %04X - level=%d crd-owner=%04X", card->caprovid >> 16, card->lvl, card->id.peer);
    396396                                *(++ptr) = card->caprovid >> 24;
    397397                                *(++ptr) = card->caprovid >> 16;
     
    402402                                *(++ptr) = ((card->lvl - 1) << 4) + card->dist + 1;
    403403                            }
     404                           else if(card->type == GBOX_CARD_TYPE_CCCAM)
     405                             {
     406                              if(proxy->reader->gbox_cccam_reshare > proxy->reader->gbox_reshare)
     407                                { proxy->reader->gbox_cccam_reshare = proxy->reader->gbox_reshare; }
     408                               // cs_log_dbg(D_READER,"send to peer ccc-card %04X - level=%d crd-owner=%04X", card->caprovid >> 16, proxy->reader->gbox_cccam_reshare, card->id.peer);
     409                                *(++ptr) = card->caprovid >> 24;
     410                                *(++ptr) = card->caprovid >> 16;
     411                                *(++ptr) = card->caprovid >> 8;
     412                                *(++ptr) = card->caprovid & 0xff;
     413                                *(++ptr) = 1;
     414                                *(++ptr) = card->id.slot;
     415                                *(++ptr) = ((proxy->reader->gbox_cccam_reshare - 1) << 4) + card->dist + 1;
     416                            }
    404417                           else if(proxy->reader->gbox_reshare > 0)
    405418                            {
    406                                 //cs_log_dbg(D_READER,"send local crd %04X reshare=%d crd-owner=%04X", card->caprovid >> 16, proxy->reader->gbox_reshare, card->id.peer); 
     419                                //cs_log_dbg(D_READER,"send local crd %04X reshare=%d crd-owner=%04X", card->caprovid >> 16, proxy->reader->gbox_reshare, card->id.peer);
    407420                                *(++ptr) = card->caprovid >> 24;
    408421                                *(++ptr) = card->caprovid >> 16;
     
    11411154    struct cc_provider *provider;
    11421155    uint8_t *node1 = NULL;
    1143     uint8_t min_reshare = 0;
    11441156    gbox_delete_cards(GBOX_DELETE_WITH_TYPE, GBOX_CARD_TYPE_CCCAM);
    11451157#endif 
     
    11711183        }   //end local readers
    11721184#ifdef MODULE_CCCAM
    1173         if((cfg.ccc_reshare) && (cfg.cc_reshare > -1) && (cl->reader->gbox_cccam_reshare) && cl->typ == 'p' && cl->reader && cl->reader->typ == R_CCCAM && cl->cc)
     1185        if((cfg.ccc_reshare) && (cfg.cc_reshare > -1) && cl->typ == 'p' && cl->reader && cl->reader->typ == R_CCCAM && cl->cc)
    11741186        {
    11751187            cc = cl->cc;
     
    11791191                //calculate gbox id from cc node
    11801192                node1 = ll_has_elements(card->remote_nodes);
    1181                 checksum = ((node1[0] ^ node1[7]) << 8) |
    1182                         ((node1[1] ^ node1[6]) << 24) |
    1183                         (node1[2] ^ node1[5]) |
    1184                         ((node1[3] ^ node1[4]) << 16);
    1185                 cc_peer_id = ((((checksum >> 24) & 0xFF) ^((checksum >> 8) & 0xFF)) << 8 |
    1186                               (((checksum >> 16) & 0xFF) ^(checksum & 0xFF)));
    1187                 slot = gbox_next_free_slot(cc_peer_id);
    1188                 min_reshare = cfg.cc_reshare;
    1189                 if (card->reshare < min_reshare)
    1190                     { min_reshare = card->reshare; }               
    1191                 min_reshare++; //strange CCCam logic. 0 means direct peers
    1192                 if (cl->reader->gbox_cccam_reshare < min_reshare)
    1193                     { min_reshare = cl->reader->gbox_cccam_reshare; }
     1193                checksum = ((node1[0] ^ node1[7]) << 8) | ((node1[1] ^ node1[6]) << 24) | (node1[2] ^ node1[5]) | ((node1[3] ^ node1[4]) << 16);
     1194                cc_peer_id = ((((checksum >> 24) & 0xFF) ^((checksum >> 8) & 0xFF)) << 8 | (((checksum >> 16) & 0xFF) ^(checksum & 0xFF)));
     1195
     1196                slot = gbox_next_free_slot(cc_peer_id);
    11941197                if(caid_is_seca(card->caid) || caid_is_viaccess(card->caid) || caid_is_cryptoworks(card->caid))
    11951198                {
    11961199                    it2 = ll_iter_create(card->providers);
    11971200                    while((provider = ll_iter_next(&it2)))
    1198                         { gbox_add_card(cc_peer_id, gbox_get_caprovid(card->caid, provider->prov), slot, min_reshare, card->hop, GBOX_CARD_TYPE_CCCAM, NULL); }
     1201                        { gbox_add_card(cc_peer_id, gbox_get_caprovid(card->caid, provider->prov), slot, DEFAULT_CCC_GBOX_RESHARE, card->hop, GBOX_CARD_TYPE_CCCAM, NULL); }
    11991202                }
    12001203                else
    1201                     { gbox_add_card(cc_peer_id, gbox_get_caprovid(card->caid, 0), slot, min_reshare, card->hop, GBOX_CARD_TYPE_CCCAM, NULL); }
     1204                    { gbox_add_card(cc_peer_id, gbox_get_caprovid(card->caid, 0), slot, DEFAULT_CCC_GBOX_RESHARE, card->hop, GBOX_CARD_TYPE_CCCAM, NULL); }
    12021205            }
    12031206        }   //end cccam
  • trunk/module-gbox.h

    r11446 r11456  
    44#ifdef MODULE_GBOX
    55
    6 #define NO_GBOX_ID          0
    7 #define GBOX_MAXHOPS            5
     6#define NO_GBOX_ID      0
     7#define GBOX_MAXHOPS        5
    88#define DEFAULT_GBOX_MAX_DIST       2
    99#define DEFAULT_GBOX_MAX_ECM_SEND   3
    1010#define DEFAULT_GBOX_RESHARE        2
     11#define DEFAULT_CCC_GBOX_RESHARE        1
    1112#define DEFAULT_GBOX_RECONNECT      180
    1213#define GBOX_MIN_RECONNECT      60
  • trunk/oscam-config-reader.c

    r11441 r11456  
    10801080    DEF_OPT_UINT8("gbox_max_ecm_send"   , OFS(gbox_maxecmsend),         DEFAULT_GBOX_MAX_ECM_SEND),
    10811081    DEF_OPT_UINT8("gbox_reshare"        , OFS(gbox_reshare),            DEFAULT_GBOX_RESHARE),
    1082     DEF_OPT_UINT8("cccam_reshare"       , OFS(gbox_cccam_reshare),      DEFAULT_GBOX_RESHARE),
     1082    DEF_OPT_UINT8("cccam_reshare"       , OFS(gbox_cccam_reshare),      DEFAULT_CCC_GBOX_RESHARE),
    10831083#endif
    10841084    DEF_OPT_STR("readnano"              , OFS(emmfile),                 NULL),
  • trunk/webif/config/cccreshare.html

    r11441 r11456  
    11<!--    gbox part. not displayed when cccam not compiled in -->
    2 <TR><TD><A>CCcam reshare:</A></TD><TD><input name="ccc_reshare" type="hidden" value="0"><input name="ccc_reshare" type="checkbox" value="1" ##GBOXCCCRESHARE##><label>reshare cards cccam -> gbox</label></TD></TR>
     2<TR><TD><A>CCcam reshare:</A></TD><TD><input name="ccc_reshare" type="hidden" value="0"><input name="ccc_reshare" type="checkbox" value="1" ##GBOXCCCRESHARE##><label>enable reshare cards cccam -> gbox</label></TD></TR>
  • trunk/webif/readerconfig/readerconfig_gboxcccresharebit.html

    r11441 r11456  
    11<!-- gbox part. below not shown when ccc not compiled in oscam -->
    2 <TR><TD><A>CCcam reshare:</A></TD><TD><input name="cccam_reshare" class="short" type="text" maxlength="1" value="##GBOXCCCAMRESHARE##"> hops - share cards cccam -> gbox</TD></TR>
     2<TR><TD><A>CCcam reshare:</A></TD><TD><input name="cccam_reshare" class="short" type="text" maxlength="1" value="##GBOXCCCAMRESHARE##"> level to share cards cccam -> gbox. &nbsp;&nbsp; Upper Limit is value of 'Locals reshare'</TD></TR>
Note: See TracChangeset for help on using the changeset viewer.