Compare commits
No commits in common. "b0ae4185cd477b2195a28b2b31e6ef38031390c2" and "1106b5ee8e219d222947f97761f74eeb51153273" have entirely different histories.
b0ae4185cd
...
1106b5ee8e
|
|
@ -654,7 +654,7 @@ int8_t cacheex_maxhop_lg(struct s_client *cl, ECM_REQUEST *er)
|
|||
* Check if ECM hop count is within reader's configured maxhop limits
|
||||
* Returns 1 if hop is allowed, 0 if hop exceeds limit
|
||||
*/
|
||||
static int8_t __attribute__((unused)) cacheex_check_maxhop(struct s_client *cl, ECM_REQUEST *er)
|
||||
static int8_t cacheex_check_maxhop(struct s_client *cl, ECM_REQUEST *er)
|
||||
{
|
||||
// Get the hop count from csp_lastnodes list
|
||||
uint8_t hop = er->csp_lastnodes ? ll_count(er->csp_lastnodes) : 0;
|
||||
|
|
@ -1108,7 +1108,6 @@ static int32_t cacheex_add_to_cache_int(struct s_client *cl, ECM_REQUEST *er, in
|
|||
{
|
||||
/* Get learning entry from shared cw_detect_table */
|
||||
extern cw_detect_entry cw_detect_table[];
|
||||
(void)cw_detect_table; /* Table is accessed via cw_detect_get */
|
||||
cw_detect_entry *e = cw_detect_get(er);
|
||||
uint8_t checksum_ok = cw_checksum_ok(er->cw);
|
||||
|
||||
|
|
|
|||
|
|
@ -1105,16 +1105,16 @@ static void camd35_cacheex_push_filter(struct s_client *cl, uint8_t *buf, uint8_
|
|||
static int32_t camd35_cacheex_push_chk(struct s_client *cl, ECM_REQUEST *er)
|
||||
{
|
||||
if(
|
||||
ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl, er) // check max 10 nodes to push
|
||||
ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl) // check max 10 nodes to push
|
||||
#ifdef CS_CACHEEX_AIO
|
||||
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl, er)))) // check maxhop_lg if cw is lg-flagged
|
||||
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl)))) // check maxhop_lg if cw is lg-flagged
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef CS_CACHEEX_AIO
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes(non-lg) or reached %d nodes(lg), no push", cacheex_maxhop(cl, er), cacheex_maxhop_lg(cl, er));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes(non-lg) or reached %d nodes(lg), no push", cacheex_maxhop(cl), cacheex_maxhop_lg(cl));
|
||||
#else
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl, er));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1371,9 +1371,9 @@ static void camd35_cacheex_push_in(struct s_client *cl, uint8_t *buf)
|
|||
|
||||
#ifndef CS_CACHEEX_AIO
|
||||
//check max nodes:
|
||||
if(count > cacheex_maxhop(cl, er))
|
||||
if(count > cacheex_maxhop(cl))
|
||||
{
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", (int32_t)count, cacheex_maxhop(cl, er), username(cl));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", (int32_t)count, cacheex_maxhop(cl), username(cl));
|
||||
NULLFREE(er);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1401,9 +1401,9 @@ static void camd35_cacheex_push_in(struct s_client *cl, uint8_t *buf)
|
|||
cs_log_dbg(D_CACHEEX, "cacheex: received ECM with localgenerated flag %04X@%06X:%04X %s", er->caid, er->prid, er->srvid, username(cl));
|
||||
|
||||
//check max nodes for lg flagged cw:
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop_lg(cl, er))
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop_lg(cl))
|
||||
{
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received (lg) %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop_lg(cl, er), username(cl));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received (lg) %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop_lg(cl), username(cl));
|
||||
free_push_in_ecm(er);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1412,9 +1412,9 @@ static void camd35_cacheex_push_in(struct s_client *cl, uint8_t *buf)
|
|||
else
|
||||
{
|
||||
//check max nodes:
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop(cl, er))
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop(cl))
|
||||
{
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop(cl, er), username(cl));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop(cl), username(cl));
|
||||
free_push_in_ecm(er);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1088,16 +1088,16 @@ static int32_t cc_cacheex_push_chk(struct s_client *cl, struct ecm_request_t *er
|
|||
}
|
||||
|
||||
if(
|
||||
ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl, er) // check max 10 nodes to push
|
||||
ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl) // check max 10 nodes to push
|
||||
#ifdef CS_CACHEEX_AIO
|
||||
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl, er)))) // check maxhop_lg if cw is lg-flagged
|
||||
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl)))) // check maxhop_lg if cw is lg-flagged
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef CS_CACHEEX_AIO
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes(non-lg) or reached %d nodes(lg), no push", cacheex_maxhop(cl, er), cacheex_maxhop_lg(cl, er));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes(non-lg) or reached %d nodes(lg), no push", cacheex_maxhop(cl), cacheex_maxhop_lg(cl));
|
||||
#else
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl, er));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1426,10 +1426,10 @@ void cc_cacheex_push_in(struct s_client *cl, uint8_t *buf)
|
|||
|
||||
#ifndef CS_CACHEEX_AIO
|
||||
// check max nodes
|
||||
if(count > cacheex_maxhop(cl, er))
|
||||
if(count > cacheex_maxhop(cl))
|
||||
{
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s",
|
||||
(int32_t)count, cacheex_maxhop(cl, er), username(cl));
|
||||
(int32_t)count, cacheex_maxhop(cl), username(cl));
|
||||
|
||||
NULLFREE(er);
|
||||
return;
|
||||
|
|
@ -1467,9 +1467,9 @@ void cc_cacheex_push_in(struct s_client *cl, uint8_t *buf)
|
|||
cs_log_dbg(D_CACHEEX, "cacheex: received ECM with localgenerated flag %04X@%06X:%04X %s", er->caid, er->prid, er->srvid, username(cl));
|
||||
|
||||
//check max nodes for lg flagged cw:
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop_lg(cl, er))
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop_lg(cl))
|
||||
{
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received (lg) %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop_lg(cl, er), username(cl));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received (lg) %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop_lg(cl), username(cl));
|
||||
free_push_in_ecm(er);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1478,9 +1478,9 @@ void cc_cacheex_push_in(struct s_client *cl, uint8_t *buf)
|
|||
else
|
||||
{
|
||||
//check max nodes:
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop(cl, er))
|
||||
if(ll_count(er->csp_lastnodes) > cacheex_maxhop(cl))
|
||||
{
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop(cl, er), username(cl));
|
||||
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop(cl), username(cl));
|
||||
free_push_in_ecm(er);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ CW_CACHE_SETTING get_cw_cache(ECM_REQUEST *er)
|
|||
return cw_cache_setting;
|
||||
}
|
||||
|
||||
static bool __attribute__((unused)) cw_cache_check(ECM_REQUEST *er)
|
||||
static bool cw_cache_check(ECM_REQUEST *er)
|
||||
{
|
||||
if(cw_cache_init_done)
|
||||
{
|
||||
|
|
|
|||
12
oscam-ecm.c
12
oscam-ecm.c
|
|
@ -77,7 +77,7 @@ static void entropy_log_ecm(ECM_REQUEST *er, struct s_reader *reader)
|
|||
#endif
|
||||
|
||||
// ADD THIS LINE:
|
||||
int cw_checksum_ok(uint8_t *cw);
|
||||
static int cw_checksum_ok(uint8_t *cw);
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// AUTODETECT STRUCT AND TABLE (ADD THIS HERE)
|
||||
|
|
@ -122,7 +122,7 @@ static cw_detect_entry cw_detect_table[CW_DETECT_MAX];
|
|||
// GET OR CREATE ENTRY
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
cw_detect_entry *cw_detect_get(ECM_REQUEST *er)
|
||||
static cw_detect_entry *cw_detect_get(ECM_REQUEST *er)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ cw_detect_entry *cw_detect_get(ECM_REQUEST *er)
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Check if nodeid is already in list and add if not, return 1 if finalized (5+ unique nodeid) */
|
||||
int cacheex_learn_add_nodeid(uint64_t *nodeid_list, uint8_t *count, uint64_t new_nodeid)
|
||||
static int cacheex_learn_add_nodeid(uint64_t *nodeid_list, uint8_t *count, uint64_t new_nodeid)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ int cacheex_learn_add_nodeid(uint64_t *nodeid_list, uint8_t *count, uint64_t new
|
|||
// CW CHECKSUM FUNCTION (ADD THIS BELOW cw_detect_get)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int cw_checksum_ok(uint8_t *cw)
|
||||
static int cw_checksum_ok(uint8_t *cw)
|
||||
{
|
||||
if(((cw[0]+cw[1]+cw[2])&0xFF)!=cw[3]) return 0;
|
||||
if(((cw[4]+cw[5]+cw[6])&0xFF)!=cw[7]) return 0;
|
||||
|
|
@ -978,13 +978,13 @@ uint8_t checkCWpart(uint8_t *cw, int8_t part)
|
|||
|
||||
static int cw_autodetect_and_block(struct s_reader *reader, ECM_REQUEST *er)
|
||||
{
|
||||
if(!er)
|
||||
if(!er || !er->cw)
|
||||
return 1;
|
||||
|
||||
cw_detect_entry *e = cw_detect_get(er);
|
||||
|
||||
const char *reader_name =
|
||||
reader ? reader->label : "?";
|
||||
(reader && reader->label) ? reader->label : "?";
|
||||
|
||||
int checksum_ok = cw_checksum_ok(er->cw);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user