Compare commits

...

3 Commits

Author SHA1 Message Date
Cedric Roux
cc1802a635 cleanup logging: log only if ue is in sniffer mode 2025-08-29 12:30:47 +02:00
Cedric Roux
6de93b842a make sniffer work with rfsim 2025-08-29 12:30:47 +02:00
Cedric Roux
46235bd1f0 add a sniffer mode for the ue
some parts are hackish
2025-08-29 12:30:39 +02:00
22 changed files with 739 additions and 2 deletions

View File

@@ -1747,6 +1747,7 @@ add_executable(lte-softmodem
${OPENAIR_DIR}/executables/create_tasks_mbms.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR_DIR}/radio/COMMON/sniffer_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${PHY_INTERFACE_DIR}/queue_t.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
@@ -1776,6 +1777,7 @@ add_executable(oairu
${OPENAIR_DIR}/executables/ru_control.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR_DIR}/radio/COMMON/sniffer_config.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c
${OPENAIR_DIR}/executables/main_ru.c
@@ -1804,6 +1806,7 @@ add_executable(lte-uesoftmodem
${OPENAIR_DIR}/executables/create_tasks_ue.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR_DIR}/radio/COMMON/sniffer_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
@@ -1840,6 +1843,7 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR_DIR}/radio/COMMON/sniffer_config.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${PHY_INTERFACE_DIR}/queue_t.c
@@ -1911,6 +1915,7 @@ add_executable(nr-uesoftmodem
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR_DIR}/radio/COMMON/sniffer_config.c
${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c
${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common_tdd.c
${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c

View File

@@ -590,6 +590,10 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx
nr_fo_compensation(ul_freq_offset, fp->samples_per_subframe, writeTimestamp, txp[i], txp[i], writeBlockSize);
}
extern int sniffer;
if (sniffer) {
memset(txp[0], 0, 4 * writeBlockSize);
}
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags);
AssertFatal(tmp == writeBlockSize, "");
}

View File

@@ -197,6 +197,7 @@ uint64_t set_nrUE_optmask(uint64_t bitmask) {
nrUE_params_t *get_nrUE_params(void) {
return &nrUE_params;
}
int sniffer;
static void get_options(configmodule_interface_t *cfg)
{
paramdef_t cmdline_params[] = CMDLINE_NRUEPARAMS_DESC;

View File

@@ -84,6 +84,7 @@ extern uint16_t ue_id_g;
{"num-ul-actors", CONFIG_HLP_NUM_UL_ACTORS, 0, .iptr=&nrUE_params.num_ul_actors, .defintval=2, TYPE_INT, 0}, \
{"num-dl-actors", CONFIG_HLP_NUM_DL_ACTORS, 0, .iptr=&nrUE_params.num_dl_actors, .defintval=4, TYPE_INT, 0}, \
{"extra-pdu-id", CONFIG_HLP_EXTRA_PDU_ID, 0, .iptr=&nrUE_params.extra_pdu_id, .defintval=-1, TYPE_INT, 0}, \
{"sniffer", "sniffer mode", 0, .iptr=&sniffer, .defintval=0, TYPE_INT, 0}, \
}
// clang-format on

View File

@@ -26,6 +26,7 @@ char *uecap_file;
#include <executables/nr-softmodem.h>
int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;}
sniffer_configuration_t *read_sniffer_configuration(void) { return 0; }
void nfapi_setmode(nfapi_mode_t nfapi_mode) {}
void set_taus_seed(unsigned int seed_init){};
configmodule_interface_t *uniqCfg = NULL;

View File

@@ -746,6 +746,8 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
return;
}
extern int sniffer;
if (sniffer) if (dlsch[0].rnti < 1000) dlsch[0].rnti_type = TYPE_RA_RNTI_;
int harq_pid = dlsch[0].dlsch_config.harq_process_nbr;
int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx;
@@ -773,6 +775,11 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "AbsSubframe %d.%d Start LDPC Decoder for CW0 [harq_pid %d] ? %d \n", frame_rx % 1024, nr_slot_rx, harq_pid, is_cw0_active);
LOG_D(PHY, "AbsSubframe %d.%d Start LDPC Decoder for CW1 [harq_pid %d] ? %d \n", frame_rx % 1024, nr_slot_rx, harq_pid, is_cw1_active);
extern int sniffer;
if (sniffer) {
LOG_E(PHY, "AbsSubframe %d.%d Start LDPC Decoder for CW0 [harq_pid %d] ? %d \n", frame_rx % 1024, nr_slot_rx, harq_pid, is_cw0_active);
LOG_E(PHY, "AbsSubframe %d.%d Start LDPC Decoder for CW1 [harq_pid %d] ? %d \n", frame_rx % 1024, nr_slot_rx, harq_pid, is_cw1_active);
}
// exit dlsch procedures as there are no active dlsch
if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE) {
@@ -809,6 +816,10 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
G[DLSCH_id] = nr_get_G(dlsch_config->number_rbs, nb_symb_sch, nb_re_dmrs, dmrs_len, unav_res, dlsch_config->qamModOrder, dlsch[DLSCH_id].Nl);
start_meas_nr_ue_phy(ue, DLSCH_UNSCRAMBLING_STATS);
extern int sniffer;
if (sniffer) {
LOG_E(NR_MAC, "nr_dlsch_unscrambling scrambling ID %d rnti 0x%4.4x\n", dlsch[DLSCH_id].dlsch_config.dlDataScramblingId, dlsch[DLSCH_id].rnti);
}
nr_dlsch_unscrambling(llr[DLSCH_id], G[DLSCH_id], 0, dlsch[DLSCH_id].dlsch_config.dlDataScramblingId, dlsch[DLSCH_id].rnti);
stop_meas_nr_ue_phy(ue, DLSCH_UNSCRAMBLING_STATS);
@@ -819,17 +830,24 @@ static void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
nr_dlsch_decoding(ue, proc, dlsch, llr, p_b, G, nb_dlsch, DLSCH_ids);
stop_meas_nr_ue_phy(ue, DLSCH_DECODING_STATS);
extern int sniffer;
int ind_type = -1;
switch (dlsch[0].rnti_type) {
case TYPE_RA_RNTI_:
if (sniffer)
LOG_E(NR_MAC, "TYPE_RA_RNTI_\n");
ind_type = FAPI_NR_RX_PDU_TYPE_RAR;
break;
case TYPE_SI_RNTI_:
if (sniffer)
LOG_E(NR_MAC, "TYPE_SI_RNTI_\n");
ind_type = FAPI_NR_RX_PDU_TYPE_SIB;
break;
case TYPE_C_RNTI_:
if (sniffer)
LOG_E(NR_MAC, "TYPE_C_RNTI_\n");
ind_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
break;
@@ -1068,6 +1086,21 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
NR_UE_DLSCH_t *dlsch = &phy_data->dlsch[0];
// do procedures for C-RNTI
extern int sniffer;
if (sniffer)
if (dlsch->dlsch_config.BWPSize) {
LOG_E(NR_MAC, "pdsch_processing: bwpstart %d bwp size %d\n", dlsch->dlsch_config.BWPStart, dlsch->dlsch_config.BWPSize);
LOG_E(NR_MAC, "start_rb %d number_rbs %d start_symbol %d number_symbols %d rb_offset %d mcs %d rv %d TBS %d\n",
dlsch->dlsch_config.start_rb,
dlsch->dlsch_config.number_rbs,
dlsch->dlsch_config.start_symbol,
dlsch->dlsch_config.number_symbols,
dlsch->dlsch_config.rb_offset,
dlsch->dlsch_config.mcs,
dlsch->dlsch_config.rv,
dlsch->dlsch_config.TBS);
}
bool slot_fep_map[14] = {0};
const uint32_t rxdataF_sz = ue->frame_parms.samples_per_slot_wCP;
__attribute__ ((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz];

View File

@@ -1787,6 +1787,10 @@ static void configure_timeAlignmentTimer(NR_timer_t *time_alignment_timer, NR_Ti
void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause)
{
extern int sniffer;
if (sniffer) {
LOG_I(MAC, "nr_rrc_mac_config_req_reset cause %d\n", (int)cause); abort();
}
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret);
@@ -1904,6 +1908,10 @@ static void configure_si_schedulingInfo(NR_UE_MAC_INST_t *mac,
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra)
{
extern int sniffer;
if (sniffer)
LOG_I(MAC, "nr_rrc_mac_config_req_sib1\n");
if (sniffer) can_start_ra = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret);

View File

@@ -104,6 +104,9 @@ NR_ControlResourceSet_t *ue_get_coreset(const NR_BWP_PDCCH_t *config, const int
return coreset;
}
static int rrra_rnti = 0;
int rnti_to_monitor;
static void config_dci_pdu(NR_UE_MAC_INST_t *mac,
fapi_nr_dl_config_request_t *dl_config,
const int rnti_type,
@@ -117,7 +120,9 @@ static void config_dci_pdu(NR_UE_MAC_INST_t *mac,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
const int coreset_id = *ss->controlResourceSetId;
int coreset_id = *ss->controlResourceSetId;
extern int sniffer;
if (sniffer) coreset_id = 0;
NR_ControlResourceSet_t *coreset;
if(coreset_id > 0) {
coreset = ue_get_coreset(pdcch_config, coreset_id);
@@ -261,6 +266,10 @@ static void config_dci_pdu(NR_UE_MAC_INST_t *mac,
sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->ra.ra_rnti;
extern int sniffer;
if (sniffer) {
rel15->rnti = rrra_rnti; //mac->ra.ra_rnti;
}
rel15->SubcarrierSpacing = current_DL_BWP->scs;
break;
case TYPE_MSGB_RNTI_:
@@ -280,6 +289,10 @@ static void config_dci_pdu(NR_UE_MAC_INST_t *mac,
sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->ra.t_crnti;
if (sniffer) {
if (rnti_to_monitor)
rel15->rnti = rnti_to_monitor;
}
rel15->SubcarrierSpacing = current_DL_BWP->scs;
break;
case TYPE_SP_CSI_RNTI_:
@@ -424,6 +437,7 @@ static bool monitor_dci_for_other_SI(NR_UE_MAC_INST_t *mac,
return false;
}
/* this is important function for hacking UE: ue_dci_configuration */
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, const frame_t frame, const int slot)
{
const NR_UE_DL_BWP_t *current_DL_BWP = mac->current_DL_BWP;
@@ -476,8 +490,17 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
}
}
RA_config_t *ra = &mac->ra;
if (mac->state == UE_PERFORMING_RA && ra->ra_state >= nrRA_WAIT_RAR) {
extern int sniffer;
if (sniffer || (mac->state == UE_PERFORMING_RA && ra->ra_state >= nrRA_WAIT_RAR)) {
const NR_SearchSpace_t *ra_SS = get_common_search_space(mac, pdcch_config->ra_SS_id);
if (sniffer) {
rrra_rnti = 0x10b;
config_dci_pdu(mac, dl_config, TYPE_RA_RNTI_, slot, ra_SS);
rrra_rnti = 0x10f;
config_dci_pdu(mac, dl_config, TYPE_RA_RNTI_, slot, ra_SS);
if (rnti_to_monitor)
config_dci_pdu(mac, dl_config, TYPE_TC_RNTI_, slot, ra_SS);
}
// if RA is ongoing use RA search space
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ra_SS)) {
nr_rnti_type_t rnti_type = 0;
@@ -486,6 +509,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
} else {
rnti_type = TYPE_MSGB_RNTI_;
}
if (!sniffer)
config_dci_pdu(mac, dl_config, rnti_type, slot, ra_SS);
}
} else if (mac->state == UE_CONNECTED) {

View File

@@ -205,6 +205,14 @@ int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
const RA_config_t *ra = &mac->ra;
nr_rnti_type_t rnti_type;
extern int sniffer;
extern int rnti_to_monitor;
if (sniffer) {
if (rnti < 1000) return TYPE_RA_RNTI_;
if (rnti_to_monitor) {
return TYPE_TC_RNTI_;
}
}
if (rnti == ra->ra_rnti) {
rnti_type = TYPE_RA_RNTI_;
} else if (rnti == ra->MsgB_rnti && (ra->ra_state == nrRA_WAIT_MSGB || ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION)) {
@@ -218,7 +226,10 @@ int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
} else if (rnti == 0xFFFF) {
rnti_type = TYPE_SI_RNTI_;
} else {
if (!sniffer)
AssertFatal(1 == 0, "Not identified/handled rnti %d \n", rnti);
else
rnti_type = TYPE_RA_RNTI_;
}
LOG_D(MAC, "Returning rnti_type %s \n", rnti_types(rnti_type));
return rnti_type;
@@ -342,8 +353,11 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac,
if(ack_nack) {
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
extern int sniffer;
if (!sniffer) {
if (mac->get_sib1)
mac->get_sib1 = false;
}
for (int i = 0; i < MAX_SI_GROUPS; i++) {
if (mac->get_otherSI[i])
mac->get_otherSI[i] = false;
@@ -759,8 +773,13 @@ static int nr_ue_process_dci_dl_10(NR_UE_MAC_INST_t *mac,
if (nr_timer_is_active(&mac->ra.response_window_timer)) {
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
} else {
extern int sniffer;
if (sniffer) {
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
} else {
// Discard the DCI
return -1;
}
}
} else {
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
@@ -787,9 +806,18 @@ static int nr_ue_process_dci_dl_10(NR_UE_MAC_INST_t *mac,
}
dlsch_pdu->rb_offset = dlsch_pdu->start_rb + dlsch_pdu->BWPStart;
extern int sniffer;
if (sniffer)
LOG_E(NR_MAC, "%s: dlsch_pdu->rb_offset %d dlsch_pdu->start_rb %d dlsch_pdu->BWPStart %d\n", __FUNCTION__, dlsch_pdu->rb_offset, dlsch_pdu->start_rb, dlsch_pdu->BWPStart);
if (sniffer) {
if (rnti_type == TYPE_SI_RNTI_)
if (mac->get_sib1)
dlsch_pdu->rb_offset -= dlsch_pdu->BWPStart;
} else {
if (mac->get_sib1)
dlsch_pdu->rb_offset -= dlsch_pdu->BWPStart;
}
/* TIME_DOM_RESOURCE_ASSIGNMENT */
int dmrs_typeA_pos = mac->dmrs_TypeA_Position;
@@ -1124,6 +1152,9 @@ static int nr_ue_process_dci_dl_11(NR_UE_MAC_INST_t *mac,
return -1;
}
dlsch_pdu->rb_offset = dlsch_pdu->start_rb + dlsch_pdu->BWPStart;
extern int sniffer;
if (sniffer)
LOG_E(NR_MAC, "%s: dlsch_pdu->rb_offset %d dlsch_pdu->start_rb %d dlsch_pdu->BWPStart %d\n", __FUNCTION__, dlsch_pdu->rb_offset, dlsch_pdu->start_rb, dlsch_pdu->BWPStart);
/* TIME_DOM_RESOURCE_ASSIGNMENT */
int dmrs_typeA_pos = mac->dmrs_TypeA_Position;
int mux_pattern = 1;
@@ -1457,6 +1488,16 @@ nr_dci_format_t nr_ue_process_dci_indication_pdu(NR_UE_MAC_INST_t *mac, frame_t
dci->n_CCE,
dci->payloadSize,
*(unsigned long long *)dci->payloadBits);
extern int sniffer;
if (sniffer) {
LOG_I(NR_MAC,
"Received dci indication (rnti %x, dci format %d, n_CCE %d, payloadSize %d, payload %llx)\n",
dci->rnti,
dci->dci_format,
dci->n_CCE,
dci->payloadSize,
*(unsigned long long *)dci->payloadBits);
}
const nr_dci_format_t format =
nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, dci->ss_type, dci->payloadBits, slot);
if (format == NR_DCI_NONE)
@@ -3166,6 +3207,14 @@ static void extract_10_ra_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dc
EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5);
// TB scaling
EXTRACT_DCI_ITEM(dci_pdu_rel15->tb_scaling, 2);
extern int sniffer;
if (sniffer)
LOG_E(NR_MAC_DCI, " FDA %d TDA %d vrb2prb %d mcs %d tb_scaling %d\n",
dci_pdu_rel15->frequency_domain_assignment.val,
dci_pdu_rel15->time_domain_assignment.val,
dci_pdu_rel15->vrb_to_prb_mapping.val,
dci_pdu_rel15->mcs,
dci_pdu_rel15->tb_scaling);
}
static uint8_t extract_10_si_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos, const int N_RB)
@@ -3470,11 +3519,18 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac,
int format_indicator = -1;
int n_RB = 0;
extern int sniffer;
if (sniffer)
LOG_E(NR_MAC_DCI, "nr_extract_dci_00_10 DCI value %lb\n", *(uint64_t *)dci_pdu);
switch (rnti_type) {
case TYPE_RA_RNTI_ :
if (sniffer)
LOG_E(NR_MAC_DCI, "slot %d extract DCI for RA-RNTI\n", slot);
format = NR_DL_DCI_FORMAT_1_0;
dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][format];
n_RB = get_nrb_for_dci(mac, format, ss_type);
if (sniffer)
LOG_E(NR_MAC_DCI, " DCI for RA-RNTI n_RB %d\n", n_RB);
if (n_RB == 0)
return NR_DCI_NONE;
extract_10_ra_rnti(dci_pdu_rel15, dci_pdu, pos, n_RB);
@@ -3494,6 +3550,8 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac,
return NR_DCI_NONE;
break;
case TYPE_C_RNTI_ :
if (sniffer)
LOG_E(NR_MAC_DCI, "slot %d extract DCI for TYPE_C_RNTI_\n", slot);
// Identifier for DCI formats
EXTRACT_DCI_ITEM(format_indicator, 1);
if (format_indicator == 1) {
@@ -3515,6 +3573,8 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac,
break;
case TYPE_TC_RNTI_ :
case TYPE_MSGB_RNTI_:
if (sniffer)
LOG_E(NR_MAC_DCI, "slot %d extract DCI for TYPE_TC_RNTI_\n", slot);
// Identifier for DCI formats
EXTRACT_DCI_ITEM(format_indicator, 1);
if (format_indicator == 1) {
@@ -3547,6 +3607,10 @@ static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
const int slot)
{
LOG_D(NR_MAC_DCI,"nr_extract_dci_info : dci_pdu %lx, size %d, format %d\n", *(uint64_t *)dci_pdu, dci_size, dci_format);
extern int sniffer;
if (sniffer) {
LOG_I(NR_MAC_DCI,"nr_extract_dci_info : dci_pdu %lx, size %d, format %d\n", *(uint64_t *)dci_pdu, dci_size, dci_format);
}
int rnti_type = get_rnti_type(mac, rnti);
int pos = dci_size;
@@ -3755,7 +3819,21 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_
pdu_id,
pdu_len,
dl_info->rx_ind->number_pdus);
extern int sniffer;
if (sniffer)
LOG_I(MAC,
"[%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n",
frameP,
slot,
pdu_id,
pdu_len,
dl_info->rx_ind->number_pdus);
if (sniffer) {
printf("got pdu[%d]:", pdu_len);
for (int i = 0; i < pdu_len; i++) printf(" %2.2x", pduP[i]);
printf("\n"); fflush(stdout);
}
if (ra->ra_type == RA_2_STEP && ra->ra_state == nrRA_WAIT_MSGB) {
int n = nr_ue_validate_successrar(pduP, pdu_len, mac, gNB_index, frameP, slot);
pduP += n;
@@ -3768,6 +3846,9 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_
uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
if (sniffer) {
LOG_E(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
}
bool ret;
switch (rx_lcid) {
// MAC CE
@@ -4215,6 +4296,15 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
break;
}
}
extern int sniffer;
if (sniffer) {
rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
int rnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
LOG_E(NR_MAC, "new c-rnti to monitor %4.4x\n", rnti);
extern int rnti_to_monitor;
rnti_to_monitor = rnti;
}
if (!sniffer)
if (rarh->RAPID == preamble_index) {
// The MAC entity may stop ra-ResponseWindow (and hence monitoring for Random Access Response(s)) after
// successful reception of a Random Access Response containing Random Access Preamble identifiers
@@ -4243,6 +4333,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
break;
}
if (rarh->E == 0) {
if (!sniffer) {
LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] Received RAR preamble (%d) doesn't match the intended RAPID (%d)\n",
mac->ue_id,
frame,
@@ -4251,6 +4342,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
preamble_index);
// resume RAR response window timer if MSG2 decoding failed
nr_timer_suspension(&mac->ra.response_window_timer);
}
break;
} else {
rarh += sizeof(NR_MAC_RAR) + 1;

View File

@@ -385,6 +385,9 @@ static void fill_mib_in_rx_ind(nfapi_nr_dl_tti_request_pdu_t *pdu_list, fapi_nr_
static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu)
{
extern int sniffer;
if (sniffer)
LOG_E(NR_MAC, "is_my_dci rnti %4.4x mac->ra.ra_state %d nrRA_WAIT_RAR %d\n", received_pdu->RNTI, mac->ra.ra_state, nrRA_WAIT_RAR);
/* For multiple UEs, we need to be able to filter the rx'd messages by
the RNTI. The filtering is different between NSA mode and SA mode.
NSA mode has a two step CFRA procedure and SA has a 4 step procedure.
@@ -444,6 +447,11 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
{
LOG_D(NR_PHY, "[%d, %d] PDCCH DCI PDU (Format for incoming PDSCH PDU)\n",
dl_tti_request->SFN, dl_tti_request->Slot);
extern int sniffer;
if (sniffer) {
LOG_E(NR_PHY, "[%d, %d] PDCCH DCI PDU (Format for incoming PDSCH PDU)\n",
dl_tti_request->SFN, dl_tti_request->Slot);
}
uint16_t num_dcis = pdu_list->pdcch_pdu.pdcch_pdu_rel15.numDlDci;
if (num_dcis > 0)
{
@@ -1160,8 +1168,14 @@ static int8_t handle_dlsch(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
update_harq_status(mac,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack);
extern int sniffer;
if (sniffer) {
/* this one sends RAR to MAC layer */
nr_ue_send_sdu(mac, dl_info, pdu_id);
} else {
if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack)
nr_ue_send_sdu(mac, dl_info, pdu_id);
}
return 0;
}

View File

@@ -1407,6 +1407,11 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas,
return;
}
extern int sniffer;
if (sniffer) {
LOG_E(NAS, "sniffer mode: do nothing\n");
return;
}
encode_registration_complete(mm_msg, initialNasMsg->nas_data + encoded, length - encoded);
/* ciphering */
@@ -1716,6 +1721,11 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t *
free(mm_msg->dnn.value);
free(mm_msg->snssai.value);
extern int sniffer;
if (sniffer) {
LOG_E(NAS, "sniffer mode: do nothing\n");
return;
}
/* ciphering */
uint8_t buf[initialNasMsg->length - 7];
stream_cipher.context = nas->security_container->ciphering_context;

View File

@@ -47,3 +47,5 @@ add_boolean_option(OAI_RF_EMULATOR ON "Activate OAI's RF emulator" OFF)
if(OAI_RF_EMULATOR)
add_subdirectory(emulator)
endif()
add_subdirectory(sniffer)

View File

@@ -99,6 +99,7 @@ int load_lib(openair0_device *device,
char *deflibname=OAI_RF_LIBNAME;
openair0_cfg->command_line_sample_advance = get_softmodem_params()->command_line_sample_advance;
openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state));
openair0_cfg->sniffer_conf = read_sniffer_configuration();
if (openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) {
IS_SOFTMODEM_IQRECORDER = true; // softmodem has to know we use the iqrecorder to workaround randomized algorithms
@@ -124,6 +125,11 @@ int load_lib(openair0_device *device,
shlib_fdesc[0].fname="transport_init";
}
if (openair0_cfg->sniffer_conf) {
deflibname = "sniffer";
shlib_fdesc[0].fname = "device_init";
}
char *devname=NULL;
paramdef_t device_params[]=DEVICE_PARAMS_DESC ;
int numparams = sizeofArray(device_params);

View File

@@ -37,6 +37,7 @@
#include <sys/types.h>
#include <openair1/PHY/TOOLS/tools_defs.h>
#include "record_player.h"
#include "sniffer_config.h"
#include "common/utils/threadPool/notified_fifo.h"
/* default name of shared library implementing the radio front end */
@@ -291,6 +292,8 @@ typedef struct openair0_config {
//! record player configuration, definition in record_player.h
uint32_t recplay_mode;
recplay_conf_t *recplay_conf;
//! sniffer file input: configuration
sniffer_configuration_t *sniffer_conf;
//! number of samples per tti
unsigned int samples_per_tti;
//! the sample rate for receive.

View File

@@ -0,0 +1,92 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "sniffer_config.h"
#include "common/utils/LOG/log.h"
#include "common/config/config_userapi.h"
sniffer_configuration_t *read_sniffer_configuration(void)
{
/* nothing to configure if the sniffer mode is not activated */
int do_sniff = 0;
paramdef_t sniffer_enabled_params[] = SNIFFER_ENABLED_PARAMS_DESC;
config_get(config_get_if(), sniffer_enabled_params, sizeofArray(sniffer_enabled_params), NULL);
if (!do_sniff)
return 0;
/* get parameters */
char *filename = 0;
double gain = 1;
int s16 = false;
int resampler_interpolation = -1;
int resampler_decimation = -1;
double frequency_offset = 0;
int delay = 0;
char *trace_filename = 0;
int skip = 0;
paramdef_t sniffer_params[] = SNIFFER_PARAMS_DESC;
config_get(config_get_if(), sniffer_params, sizeofArray(sniffer_params), SNIFFER_SECTION);
/* no configuration if filename is not given
* sniffer works in realtime
*/
if (!filename)
return 0;
if (!s16) gain *= 32767;
LOG_I(HW, "sniffer configuration:\n");
LOG_I(HW, " filename '%s'\n", filename);
LOG_I(HW, " gain %g\n", gain);
LOG_I(HW, " s16 %d\n", s16);
LOG_I(HW, " resampler_interpolation %d\n", resampler_interpolation);
LOG_I(HW, " resampler_decimation %d\n", resampler_decimation);
LOG_I(HW, " frequency_offset %g\n", frequency_offset);
LOG_I(HW, " delay %d\n", delay);
LOG_I(HW, " trace_filename '%s'\n", trace_filename);
LOG_I(HW, " skip %d\n", skip);
AssertFatal((resampler_interpolation == -1 && resampler_decimation == -1)
|| (resampler_interpolation != -1 && resampler_decimation != -1),
"sniffer: both (or none) resampler_interpolation and resampler_decimation must be passed\n");
sniffer_configuration_t *ret = calloc_or_fail(1, sizeof(*ret));
ret->filename = filename;
ret->delay = delay;
ret->gain = gain;
ret->s16 = s16;
ret->do_resample = resampler_interpolation != -1;
ret->resampler_interpolation = resampler_interpolation;
ret->resampler_decimation = resampler_decimation;
ret->do_frequency_offset = frequency_offset != 0;
ret->frequency_offset = frequency_offset;
ret->trace_filename = trace_filename;
ret->skip = skip;
return ret;
}

View File

@@ -0,0 +1,60 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef RADIO_COMMON_SNIFFER_CONFIG_H
#define RADIO_COMMON_SNIFFER_CONFIG_H
#include <stdbool.h>
#define SNIFFER_SECTION "device.sniffer"
#define SNIFFER_ENABLED_PARAMS_DESC { \
{ "sniffer", "use UE as a sniffer\n", PARAMFLAG_BOOL, .iptr = &do_sniff, .defintval = 0, TYPE_INT, 0 } \
}
#define SNIFFER_PARAMS_DESC { \
{ "file", "IQ file to read samples from\n", 0, .strptr = &filename, .defstrval = 0, TYPE_STRING, 0 }, \
{ "gain", "gain to apply to input signal\n", 0, .dblptr = &gain, .defdblval = 1, TYPE_DOUBLE, 0 }, \
{ "s16", "input signal is s16, not float\n", PARAMFLAG_BOOL, .iptr = &s16, .defintval = 0, TYPE_INT, 0 }, \
{ "resampler-interpolation", "resampler interpolation value\n", 0, .iptr = &resampler_interpolation, .defintval = -1, TYPE_INT, 0 }, \
{ "resampler-decimation", "resampler decimation value\n", 0, .iptr = &resampler_decimation, .defintval = -1, TYPE_INT, 0 }, \
{ "frequency-offset", "frequency offset (Hz) to apply to input signal\n", 0, .dblptr = &frequency_offset, .defdblval = 0, TYPE_DOUBLE, 0 }, \
{ "delay", "delay to apply in trx_sniffer_read()\n", 0, .iptr = &delay, .defintval = 0, TYPE_INT, 0 }, \
{ "trace-file", "IQ file to write samples to in trx_sniffer_read()\n", 0, .strptr = &trace_filename, .defstrval = 0, TYPE_STRING, 0 }, \
{ "skip", "number of samples to skip at startup\n", 0, .iptr = &skip, .defintval = 0, TYPE_INT, 0 }, \
}
typedef struct {
char *filename;
int delay; /* delay to apply in trx_sniffer_read(), unit: microsecond */
float gain;
bool s16;
bool do_resample;
int resampler_interpolation;
int resampler_decimation;
bool do_frequency_offset;
float frequency_offset;
char *trace_filename;
int skip;
} sniffer_configuration_t;
sniffer_configuration_t *read_sniffer_configuration(void);
#endif /* RADIO_COMMON_SNIFFER_CONFIG_H */

View File

@@ -0,0 +1,3 @@
add_library(sniffer MODULE sniffer.c frequency_offset.c)
set_target_properties(sniffer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_dependencies(vrtsim generate_T)

1
radio/sniffer/README Normal file
View File

@@ -0,0 +1 @@
This is a fake device to use the UE sniffer with a file.

View File

@@ -0,0 +1,54 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <math.h>
#include <complex.h>
#include "common_lib.h"
float complex *init_frequency_offset(int table_size)
{
float complex *table = malloc_or_fail(table_size * sizeof(float complex));
int i;
for (i = 0; i < table_size; i++)
table[i] = cexpf(I * 2 * M_PI * i / table_size);
return table;
}
/* returns next cur_pos to use */
int frequency_offset(float complex *table, int samplerate,
int cur_pos,
float complex *in, int in_size,
int freq_offset)
{
int i;
for (i = 0; i < in_size; i++) {
in[i] *= table[cur_pos];
cur_pos -= freq_offset;
if (cur_pos < 0) cur_pos += samplerate;
if (cur_pos > samplerate) cur_pos -= samplerate;
}
return cur_pos;
}

View File

@@ -0,0 +1,33 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef RADIO_SNIFFER_FREQUENCY_OFFSET_H
#define RADIO_SNIFFER_FREQUENCY_OFFSET_H
#include <complex.h>
float complex *init_frequency_offset(int table_size);
int frequency_offset(float complex *table, int samplerate,
int cur_pos,
float complex *in, int in_size,
int freq_offset);
#endif /* RADIO_SNIFFER_FREQUENCY_OFFSET_H */

197
radio/sniffer/sniffer.c Normal file
View File

@@ -0,0 +1,197 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "common_lib.h"
#include "common/utils/LOG/log.h"
#include "frequency_offset.h"
typedef struct {
FILE *f;
char *name;
uint64_t next_sample;
int samplerate;
int delay; /* delay to apply in trx_sniffer_read(), unit: microsecond */
float gain;
bool s16;
bool do_resample;
int resampler_interpolation;
int resampler_decimation;
bool do_frequency_offset;
int frequency_offset;
float complex *freq_offset_table;
int freq_offset_pos;
/* for debugging */
FILE *trace;
char *tracename;
} file_replay_t;
static int trx_sniffer_get_stats(openair0_device *device)
{
LOG_I(HW, "trx_sniffer_get_stats() called, not implemented\n");
return 0;
}
static int trx_sniffer_reset_stats(openair0_device *device)
{
LOG_I(HW, "trx_sniffer_reset_stats() called, not implemented\n");
return 0;
}
static int trx_sniffer_stop(openair0_device *device)
{
LOG_I(HW, "trx_sniffer_stop() called, not implemented\n");
return 0;
}
static int trx_sniffer_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
{
LOG_I(HW, "trx_sniffer_set_freq() called, not implemented\n");
return 0;
}
static int trx_sniffer_set_gains(openair0_device *device, openair0_config_t *openair0_cfg)
{
LOG_I(HW, "trx_sniffer_set_gains() called, not implemented\n");
return 0;
}
static int trx_sniffer_start(openair0_device *device)
{
return 0;
}
static void trx_sniffer_end(openair0_device *device)
{
}
static int trx_sniffer_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
{
return nsamps;
}
static int16_t to_short(float f, float gain)
{
/* for srs: 10000, for oai: 60000 */
float v = f * gain;
if (v < -32767) v = 32767;
if (v > 32767) v = 32767;
return v;
}
static int trx_sniffer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
DevAssert(cc == 1);
file_replay_t *r = device->priv;
*ptimestamp = r->next_sample;
r->next_sample += nsamps;
short *out = buff[0];
if (!r->s16) {
float in[nsamps * 2];
memset(in, 0, sizeof(float) * 2 * nsamps);
fread(in, nsamps * 2 * sizeof(float), 1, r->f);
for (int i = 0; i < nsamps * 2; i++) out[i] = to_short(in[i], r->gain);
} else {
memset(out, 0, 2 * 2 * nsamps);
fread(out, nsamps * 2 * 2, 1, r->f);
for (int i = 0; i < nsamps * 2; i++) {
float v = out[i] * r->gain;
if (v < -32767) v = 32767;
if (v > 32767) v = 32767;
out[i] = v;
}
}
if (r->do_frequency_offset) {
float complex in[nsamps];
for (int i = 0; i < nsamps; i++) in[i] = out[i*2] + I * out[i*2+1];
r->freq_offset_pos = frequency_offset(r->freq_offset_table, 3072000, r->freq_offset_pos, in, nsamps, r->frequency_offset);
for (int i = 0; i < nsamps; i++) {
out[i*2] = crealf(in[i]);
out[i*2+1] = cimagf(in[i]);
}
}
if (r->trace) {
fwrite(out, nsamps*4, 1, r->trace);
fflush(r->trace);
}
usleep(r->delay);
return nsamps;
}
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device->openair0_cfg = openair0_cfg;
device->trx_start_func = trx_sniffer_start;
device->trx_get_stats_func = trx_sniffer_get_stats;
device->trx_reset_stats_func = trx_sniffer_reset_stats;
device->trx_end_func = trx_sniffer_end;
device->trx_stop_func = trx_sniffer_stop;
device->trx_set_freq_func = trx_sniffer_set_freq;
device->trx_set_gains_func = trx_sniffer_set_gains;
device->trx_write_func = trx_sniffer_write;
device->trx_read_func = trx_sniffer_read;
device->type = 3; /* USRP N300 */
//recplay_conf_t *c = openair0_cfg->recplay_conf;
file_replay_t *r = calloc_or_fail(1, sizeof(*r));
device->priv = r;
sniffer_configuration_t *s = openair0_cfg->sniffer_conf;
r->name = strdup(s->filename);
DevAssert(r->name);
r->f = fopen(r->name, "r");
if (!r->f) {
LOG_E(HW, "could not open file %s: %s\n", r->name, strerror(errno));
exit(1);
}
r->samplerate = openair0_cfg->sample_rate;
r->delay = s->delay;
r->gain = s->gain;
r->s16 = s->s16;
if (s->trace_filename) {
r->tracename = strdup(s->trace_filename);
DevAssert(r->tracename);
r->trace = fopen(r->tracename, "w");
if (!r->trace) {
LOG_E(HW, "cannot create trace file %s: %s\n", r->tracename, strerror(errno));
exit(1);
}
}
r->do_resample = s->do_resample;
r->resampler_interpolation = s->resampler_interpolation;
r->resampler_decimation = s->resampler_decimation;
r->frequency_offset = s->frequency_offset / r->samplerate * 3072000.;
r->do_frequency_offset = s->do_frequency_offset && r->frequency_offset;
if (s->skip) {
if (r->s16) {
short b[s->skip * 2];
fread(b, s->skip * 2 * sizeof(short), 1, r->f);
} else {
float b[s->skip * 2];
fread(b, s->skip * 2 * sizeof(float), 1, r->f);
}
}
if (r->do_frequency_offset)
r->freq_offset_table = init_frequency_offset(3072000);
return 0;
}
/*@}*/

93
radio/sniffer/ue.conf Normal file
View File

@@ -0,0 +1,93 @@
#generic command line: sudo ip netns exec oai-ue1 ./nr-uesoftmodem --uicc0.imsi 505010000000002 --log_config.nas_log_level debug --log_config.ngap_log_level debug --uicc0.dnn internet --thread-pool N --ue-fo-compensation -O ~/ant0/radio/sniffer/ue.conf
hack = 1
sniffer = 1
######################################################################
# parameters for /tmp/srs-3489420000Hz-23040000sps-sc16.raw
# sib1 decoded, ue traffic decoded
#ssb = 0
#E = 1
#C = 3489420000
#r = 51
#numerology = 1
#band = 78
#device = {
# sniffer = {
# s16 = 1
# gain = 0.04
# file = "/tmp/srs-3489420000Hz-23040000sps-sc16.raw"
# frequency-offset = -7915
# delay = 200
# trace-file = "/tmp/X"
# }
#}
######################################################################
# parameters for /tmp/oai-gnb-b78-106rb-61.44MHz.raw
# sib1 decoded, there is no ue connected so no traffic decoded
#ssb = 516
#E = 0
#C = 3489420000
#r = 106
#numerology = 1
#band = 78
#device = {
# sniffer = {
# s16 = 0
# gain = 10
# file = "/tmp/oai-gnb-b78-106rb-61.44MHz.raw"
# frequency-offset = -4793
# delay = 200
# trace-file = "/tmp/X"
# }
#}
######################################################################
# parameters for /tmp/srsRAN_tdd_n78_samprate_2304_20MHz_scs_30khz.fc32
#note: no SIB1 decoded
#ssb = 186
#E = 1
#C = 3483840000
#r = 51
#numerology = 1
#band = 78
#device = {
# sniffer = {
# s16 = 0
# #gain = 0.0565016
# gain = 0.08
# file = "/tmp/srsRAN_tdd_n78_samprate_2304_20MHz_scs_30khz.fc32"
# frequency-offset = -6981
# delay = 200
# trace-file = "/tmp/X"
# }
#}
#log_config = {
# global_log_level = "debug"
#}
######################################################################
# parameters for /tmp/srsRAN_octoclock_samprate_2304_10MHz_scscommon_15khz_b200_fdd_n71_pci_1_2phones_onevoicecall_oneyoutube_rntis_4601_4602_5seconds.resampled-15360.fc32
#note: MIB decoded, but coreset0 start PRB is -1 => AssertFatal()
ssb = 192
E = 0
C = 627750000
r = 52
numerology = 0
band = 71
device = {
sniffer = {
s16 = 0
#gain = 0.0565016
gain = 0.142262
file = "/tmp/srsRAN_octoclock_samprate_2304_10MHz_scscommon_15khz_b200_fdd_n71_pci_1_2phones_onevoicecall_oneyoutube_rntis_4601_4602_5seconds.resampled-15360.fc32"
frequency-offset = 3728
delay = 200
skip = 10000
trace-file = "/tmp/X"
}
}
log_config = {
global_log_level = "debug"
}