From fef36e37615873f8f322b7c748c934b57188bce7 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sat, 29 Apr 2023 17:01:16 -0400 Subject: [PATCH] NXDN Tweaks to clear stale key values on keyload; --- src/dmr_flco.c | 1 + src/dsd_main.c | 42 ++++++++++++------------------------------ src/nxdn_deperm.c | 3 ++- src/nxdn_element.c | 4 ++-- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/dmr_flco.c b/src/dmr_flco.c index 2c9c997..eb4215b 100644 --- a/src/dmr_flco.c +++ b/src/dmr_flco.c @@ -907,6 +907,7 @@ void dmr_slco (dsd_opts * opts, dsd_state * state, uint8_t slco_bits[]) { fprintf (stderr, "[%02X]", slco_bytes[i]); } + fprintf (stderr, "\n"); //if its a voice frame, we need the line break } fprintf (stderr, "%s", KNRM); diff --git a/src/dsd_main.c b/src/dsd_main.c index 463aa91..07ba7d6 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -77,36 +77,6 @@ void noCarrier (dsd_opts * opts, dsd_state * state) { - // //experimental conventional frequency scanner mode - // if (opts->scanner_mode == 1) - // { - - // if (state->lcn_freq_roll > state->lcn_freq_count) //with >= we were cutting one short - // { - // state->lcn_freq_roll = 0; //reset to zero - // } - // //check that we have a non zero value first, then tune next frequency - // if (state->trunk_lcn_freq[state->lcn_freq_roll] != 0) - // { - // //rigctl - // if (opts->use_rigctl == 1) - // { - // if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw); - // SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[state->lcn_freq_roll]); - // } - // //rtludp - // if (opts->audio_in_type == 3) - // { - // rtl_udp_tune (opts, state, state->trunk_lcn_freq[state->lcn_freq_roll]); - // } - - // if (state->lastsynctype != -1) fprintf (stderr, "Resume Scanning Mode\n"); - - // } - // state->lcn_freq_roll++; - // } - // //end experimental conventional frequency scanner mode - //experimental conventional frequency scanner mode if (opts->scanner_mode == 1 && ( (time(NULL) - state->last_cc_sync_time) > opts->trunk_hangtime)) { @@ -360,6 +330,18 @@ noCarrier (dsd_opts * opts, dsd_state * state) memset (state->nxdn_alias_block_segment, 0, sizeof(state->nxdn_alias_block_segment)); sprintf (state->nxdn_call_type, "%s", ""); + //unload keys when using keylaoder + if (state->keyloader == 1) + { + state->R = 0; //NXDN + state->K = 0; //BP + state->K1 = 0; //tera 10 char BP + state->H = 0; //shim for above + } + + //forcing key application will re-enable this at the time of voice tx + state->nxdn_cipher_type = 0; + //dmr overaching manufacturer in use for a particular system or radio // state->dmr_mfid = -1; diff --git a/src/nxdn_deperm.c b/src/nxdn_deperm.c index bb7255e..474d23e 100644 --- a/src/nxdn_deperm.c +++ b/src/nxdn_deperm.c @@ -932,7 +932,8 @@ void nxdn_message_type (dsd_opts * opts, dsd_state * state, uint8_t MessageType) memset (state->nxdn_alias_block_segment, 0, sizeof(state->nxdn_alias_block_segment)); state->nxdn_last_rid = 0; state->nxdn_last_tg = 0; - if (state->M == 0) state->nxdn_cipher_type = 0; + state->nxdn_cipher_type = 0; //force will reactivate it if needed during voice tx + if (state->keyloader == 1) state->R = 0; memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc)); memset (state->nxdn_sacch_frame_segment, 1, sizeof(state->nxdn_sacch_frame_segment)); sprintf (state->nxdn_call_type, "%s", ""); diff --git a/src/nxdn_element.c b/src/nxdn_element.c index 9036ab7..47a0f1a 100644 --- a/src/nxdn_element.c +++ b/src/nxdn_element.c @@ -442,11 +442,11 @@ void NXDN_decode_VCALL_ASSGN(dsd_opts * opts, dsd_state * state, uint8_t * Messa if (state->nxdn_rcn == 1) fprintf(stderr, "- DFA Channel [%04X][%05d] ", OFN, OFN); - //test VCALL_ASSGN_DUP, if no voice sync activity in 1-2 seconds, then convert to assgn and allow tuning + //test VCALL_ASSGN_DUP, if no voice sync activity (by trunk_hangtime), then convert to assgn and allow tuning //VCALL_ASSGN_DUP has been seen in the middle of calls, but also on the tail end instead of a TX_REL or DISC if (MessageType == 0x5 && opts->p25_is_tuned == 1 && opts->p25_trunk == 1) { - if ( (time(NULL) - state->last_vc_sync_time) > 1 ) + if ( (time(NULL) - state->last_vc_sync_time) > opts->trunk_hangtime ) { MessageType = 0x04; //convert to VCALL opts->p25_is_tuned = 0; //open tuning back up to tune