Checkdown for Valid P2 Parameters

Checkdown for Valid P2 Parameters
--if invalid parameters specified by user for P2 WACN, SYSID, and CC (too large) then treat same as missing parameters and skip processing P2 frames that require scrambling.
This commit is contained in:
lwvmobile 2022-09-19 17:33:16 -04:00 committed by GitHub
parent 57d4c7afbe
commit d8cf47b225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 10 deletions

View File

@ -296,7 +296,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
}
if (1 == 1)
if (1 == 1)
{
if (symbol > state->center)
{
@ -631,10 +631,17 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
printFrameSync (opts, state, "+P25p2 SISCH", synctest_pos + 1, modulation);
}
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
fprintf (stderr, " WACN [%05llX] SYS [%03llX] NAC [%03llX] ", state->p2_wacn, state->p2_sysid, state->p2_cc);
}
else if (state->p2_wacn == 0xFFFFF || state->p2_cc == 0xFFF || state->p2_sysid == 0xFFF)
{
fprintf (stderr, "%s", KRED);
fprintf (stderr, " P2 Invalid Parameters ");
fprintf (stderr, "%s", KNRM);
}
else
{
fprintf (stderr, "%s", KRED);
@ -665,11 +672,16 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
printFrameSync (opts, state, "-P25p2 SISCH", synctest_pos + 1, modulation);
}
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
//fprintf (stderr, "%s", KCYN);
fprintf (stderr, " WACN [%05llX] SYS [%03llX] NAC [%03llX] ", state->p2_wacn, state->p2_sysid, state->p2_cc);
//fprintf (stderr, "%s", KNRM);
}
else if (state->p2_wacn == 0xFFFFF || state->p2_cc == 0xFFF || state->p2_sysid == 0xFFF)
{
fprintf (stderr, "%s", KRED);
fprintf (stderr, " P2 Invalid Parameters ");
fprintf (stderr, "%s", KNRM);
}
else
{

View File

@ -1989,6 +1989,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw (" Phase 2 Missing Parameters ");
attron(COLOR_PAIR(3));
}
if (state->p2_wacn == 0xFFFFF || state->p2_sysid == 0xFFF || state->p2_cc == 0xFFF)
{
attron(COLOR_PAIR(2));
printw (" Phase 2 Invalid Parameters ");
attron(COLOR_PAIR(3));
}
}
printw ("\n");

View File

@ -1464,7 +1464,8 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state)
if (duid_decoded == 0)
{
fprintf (stderr, " 4V %d", state->fourv_counter[state->currentslot]+1);
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
process_4V (opts, state);
}
@ -1472,14 +1473,16 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state)
else if (duid_decoded == 6)
{
fprintf (stderr, " 2V");
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
process_2V (opts, state);
}
}
else if (duid_decoded == 3)
{
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
process_SACCHs(opts, state);
}
@ -1494,7 +1497,8 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state)
}
else if (duid_decoded == 9)
{
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
process_FACCHs(opts, state);
}
@ -1512,7 +1516,8 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state)
fprintf (stderr, " LCCH Sc"); //w/ scrambling
// if (state->currentslot == 0) state->dmrburstL = 31;
// else state->dmrburstR = 31;
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0)
if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 &&
state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF)
{
state->p2_is_lcch = 1;
process_SACCHs(opts, state);