Compare commits

..

2 Commits

Author SHA1 Message Date
b0ae4185cd Merge pull request 'fix-make-error' (#22) from feat-fix-make-error into main
Reviewed-on: #22
2026-02-24 22:13:58 +00:00
5cd9788f0d fix-make-error 2026-02-24 22:12:28 +00:00
5 changed files with 29 additions and 28 deletions

View File

@ -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 cacheex_check_maxhop(struct s_client *cl, ECM_REQUEST *er)
static int8_t __attribute__((unused)) 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,6 +1108,7 @@ 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);

View File

@ -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) // check max 10 nodes to push
ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl, er) // check max 10 nodes to push
#ifdef CS_CACHEEX_AIO
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl)))) // check maxhop_lg if cw is lg-flagged
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl, er)))) // 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), cacheex_maxhop_lg(cl));
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));
#else
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl));
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl, er));
#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))
if(count > cacheex_maxhop(cl, er))
{
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", (int32_t)count, cacheex_maxhop(cl), username(cl));
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", (int32_t)count, cacheex_maxhop(cl, er), 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))
if(ll_count(er->csp_lastnodes) > cacheex_maxhop_lg(cl, er))
{
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));
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));
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))
if(ll_count(er->csp_lastnodes) > cacheex_maxhop(cl, er))
{
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop(cl), username(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));
free_push_in_ecm(er);
return;
}

View File

@ -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) // check max 10 nodes to push
ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl, er) // check max 10 nodes to push
#ifdef CS_CACHEEX_AIO
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl)))) // check maxhop_lg if cw is lg-flagged
&& (!er->localgenerated || (er->localgenerated && (ll_count(er->csp_lastnodes) >= cacheex_maxhop_lg(cl, er)))) // 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), cacheex_maxhop_lg(cl));
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));
#else
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl));
cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl, er));
#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))
if(count > cacheex_maxhop(cl, er))
{
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s",
(int32_t)count, cacheex_maxhop(cl), username(cl));
(int32_t)count, cacheex_maxhop(cl, er), 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))
if(ll_count(er->csp_lastnodes) > cacheex_maxhop_lg(cl, er))
{
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));
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));
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))
if(ll_count(er->csp_lastnodes) > cacheex_maxhop(cl, er))
{
cs_log_dbg(D_CACHEEX, "cacheex: received %d nodes (max=%d), ignored! %s", ll_count(er->csp_lastnodes), cacheex_maxhop(cl), username(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));
free_push_in_ecm(er);
return;
}

View File

@ -549,7 +549,7 @@ CW_CACHE_SETTING get_cw_cache(ECM_REQUEST *er)
return cw_cache_setting;
}
static bool cw_cache_check(ECM_REQUEST *er)
static bool __attribute__((unused)) cw_cache_check(ECM_REQUEST *er)
{
if(cw_cache_init_done)
{

View File

@ -77,7 +77,7 @@ static void entropy_log_ecm(ECM_REQUEST *er, struct s_reader *reader)
#endif
// ADD THIS LINE:
static int cw_checksum_ok(uint8_t *cw);
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
//////////////////////////////////////////////////////////////////////////////////////////////////////
static cw_detect_entry *cw_detect_get(ECM_REQUEST *er)
cw_detect_entry *cw_detect_get(ECM_REQUEST *er)
{
int i;
@ -172,7 +172,7 @@ static 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) */
static int cacheex_learn_add_nodeid(uint64_t *nodeid_list, uint8_t *count, uint64_t new_nodeid)
int cacheex_learn_add_nodeid(uint64_t *nodeid_list, uint8_t *count, uint64_t new_nodeid)
{
int i;
@ -201,7 +201,7 @@ static int cacheex_learn_add_nodeid(uint64_t *nodeid_list, uint8_t *count, uint6
// CW CHECKSUM FUNCTION (ADD THIS BELOW cw_detect_get)
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static int cw_checksum_ok(uint8_t *cw)
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 || !er->cw)
if(!er)
return 1;
cw_detect_entry *e = cw_detect_get(er);
const char *reader_name =
(reader && reader->label) ? reader->label : "?";
reader ? reader->label : "?";
int checksum_ok = cw_checksum_ok(er->cw);