diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index df7fcf7cda..9525a116d8 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -52,7 +52,7 @@ import cls_oaicitest # Helper functions used here and in other classes # (e.g., cls_cluster.py) #----------------------------------------------------------- -IMAGES = ['oai-enb', 'oai-lte-ru', 'oai-lte-ue', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s', 'oai-nr-ue', 'oai-gnb-asan', 'oai-nr-ue-asan', 'oai-nr-cuup-asan', 'oai-gnb-aerial', 'oai-gnb-fhi72'] +IMAGES = ['oai-enb', 'oai-lte-ru', 'oai-lte-ue', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s', 'oai-nr-ue', 'oai-enb-asan', 'oai-gnb-asan', 'oai-lte-ue-asan', 'oai-nr-ue-asan', 'oai-nr-cuup-asan', 'oai-gnb-aerial', 'oai-gnb-fhi72'] def CreateWorkspace(host, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge): if ranCommitID == '': @@ -208,7 +208,9 @@ def WriteEnvFile(ssh, services, wd, tag): ret = ssh.run(f'docker image inspect {checkimg}', reportNonZero=False) if ret.returncode == 0: logging.info(f"detected pulled image {checkimg}") - if "oai-gnb" in image: envs["GNB_IMG"] = "oai-gnb-asan" + if "oai-enb" in image: envs["ENB_IMG"] = "oai-enb-asan" + elif "oai-gnb" in image: envs["GNB_IMG"] = "oai-gnb-asan" + elif "oai-lte-ue" in image: envs["LTEUE_IMG"] = "oai-lte-ue-asan" elif "oai-nr-ue" in image: envs["NRUE_IMG"] = "oai-nr-ue-asan" elif "oai-nr-cuup" in image: envs["NRCUUP_IMG"] = "oai-nr-cuup-asan" else: logging.warning("undetected image format {image}, cannot use asan") @@ -415,7 +417,9 @@ class Containerize(): imageNames.append(('oai-gnb-aerial', 'gNB.aerial', 'oai-gnb-aerial', '')) # Building again the 5G images with Address Sanitizer imageNames.append(('ran-build', 'build', 'ran-build-asan', '--build-arg "BUILD_OPTION=--sanitize"')) + imageNames.append(('oai-enb', 'eNB', 'oai-enb-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('oai-gnb', 'gNB', 'oai-gnb-asan', '--build-arg "BUILD_OPTION=--sanitize"')) + imageNames.append(('oai-lte-ue', 'lteUE', 'oai-lte-ue-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('oai-nr-ue', 'nrUE', 'oai-nr-ue-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('ran-build-fhi72', 'build.fhi72', 'ran-build-fhi72', '')) diff --git a/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf b/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf index 2eb186b542..e266e5df65 100644 --- a/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf +++ b/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf @@ -228,7 +228,7 @@ RUs = ( nb_tx = 1 nb_rx = 1 att_tx = 0 - att_rx = 0; + att_rx = 6; eNB_instances = [0]; } ); diff --git a/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf b/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf index 8b2a689705..f5af22ed0f 100644 --- a/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf +++ b/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf @@ -191,7 +191,7 @@ RUs = ( nb_tx = 1 nb_rx = 1 att_tx = 6 - att_rx = 6; + att_rx = 12; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 125; diff --git a/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf b/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf index 4a8218e1b4..53494afb88 100644 --- a/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf +++ b/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf @@ -191,7 +191,7 @@ RUs = ( nb_tx = 1 nb_rx = 1 att_tx = 6 - att_rx = 6; + att_rx = 12; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 125; diff --git a/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf index bb73349202..aa110bbf95 100644 --- a/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf b/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf index b45b381a89..6bf45bf690 100644 --- a/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf +++ b/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf index 63b96e0249..cc7c74cd35 100644 --- a/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf b/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf index 63b96e0249..cc7c74cd35 100644 --- a/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf +++ b/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf index 991b188092..f55adad153 100644 --- a/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf b/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf index 10430a3785..fb1913498b 100644 --- a/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf +++ b/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml index 3b0b58d8ba..9e8bb1e704 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml @@ -53,7 +53,7 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-enb oai-lte-ue + oai-enb-asan oai-lte-ue-asan diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml index abe07fa1ce..0081f8eab9 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml @@ -44,7 +44,7 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-enb oai-lte-ue + oai-enb-asan oai-lte-ue-asan Create_Workspace diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml index 68879cc622..310f886497 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml @@ -48,7 +48,7 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-enb oai-lte-ue + oai-enb-asan oai-lte-ue-asan Create_Workspace diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml index 5a58cad5f2..357db604a6 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml @@ -48,7 +48,7 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-enb oai-lte-ue + oai-enb-asan oai-lte-ue-asan Create_Workspace diff --git a/ci-scripts/xml_files/container_4g_rfsim_fembms.xml b/ci-scripts/xml_files/container_4g_rfsim_fembms.xml index e63c4fac5e..e1484004e2 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fembms.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fembms.xml @@ -41,7 +41,7 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-enb oai-lte-ue + oai-enb-asan oai-lte-ue-asan Create_Workspace diff --git a/ci-scripts/xml_files/container_4g_rfsim_mbms.xml b/ci-scripts/xml_files/container_4g_rfsim_mbms.xml index c26cb06878..cf154b4476 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_mbms.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_mbms.xml @@ -41,7 +41,7 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-enb oai-lte-ue + oai-enb-asan oai-lte-ue-asan Create_Workspace diff --git a/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml b/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml index c02b009eea..9f40fb856d 100644 --- a/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: l2sim4g-oai-enb network_mode: "host" @@ -210,7 +210,7 @@ services: retries: 5 oai_ue1: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: l2sim4g-oai-lte-ue1 network_mode: "host" @@ -229,7 +229,7 @@ services: retries: 5 oai_ue2: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: l2sim4g-oai-lte-ue2 network_mode: "host" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index 97c4ee82ab..4b110abf74 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml index 2bc0e97a35..9de0f448c3 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml @@ -1,6 +1,6 @@ services: oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -8,6 +8,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/enb.band7.25prb.rfsim.nos1.conf:/opt/oai-enb/etc/enb.conf @@ -18,7 +19,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -28,6 +29,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index c77dfdfd27..1cb0150465 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.50prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 50 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index 25e3d797bb..a0e43a27d2 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.100prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 100 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml index da5399d5e6..5c7f267074 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml @@ -1,6 +1,6 @@ services: oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -8,6 +8,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --eNBs.[0].component_carriers.[0].mbms_dedicated_serving_cell ENABLE --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf @@ -18,7 +19,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -26,6 +27,7 @@ services: ipv4_address: 192.168.61.30 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml index d3a2f02ab2..af913ead24 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml @@ -1,6 +1,6 @@ services: oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -8,6 +8,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf @@ -18,7 +19,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -31,6 +32,7 @@ services: environment: TZ: Europe/Paris HOSTNAME: oai_ue0 + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index a3ce6f4de6..7ebbed861f 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band38.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -T -C 2605000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/executables/lte-enb.c b/executables/lte-enb.c index 29238aa882..24d24da9ea 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -1095,7 +1095,7 @@ void init_transport(PHY_VARS_eNB *eNB) { exit(-1); } else { eNB->dlsch[i][j]->rnti=0; - LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); + LOG_D(PHY, "dlsch[%d][%d] => %p rnti:%x\n", i, j, eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); } } } diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 6b77e75c83..8e05aae489 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -1699,12 +1699,13 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) samplesVoid[i]=(void *)&v; - AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice, - timestamp+2*UE->frame_parms.samples_per_tti, - samplesVoid, - 1, - UE->frame_parms.nb_antennas_tx, - 1),""); + int written = UE->rfdevice.trx_write_func(&UE->rfdevice, + timestamp + 2 * UE->frame_parms.samples_per_tti, + samplesVoid, + 1, + UE->frame_parms.nb_antennas_tx, + TX_BURST_START_AND_END); + AssertFatal(1 == written, "write to SDR failed\n"); } void *UE_thread(void *arg) { diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index b971e5ce67..9c92503186 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -86,14 +86,17 @@ int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { AssertFatal(eNB!=NULL,"eNB is null\n"); for (int i=0; iulsch[i]==NULL) continue; + if (eNB->ulsch[i] == NULL) + continue; if (type == SEARCH_EXIST_RA) { - if (eNB->ulsch[i]->rnti == rnti) return i; + if (eNB->ulsch[i]->rnti == rnti) + return i; } else { - if ((eNB->ulsch[i]->harq_mask >0) && - (eNB->ulsch[i]->rnti==rnti)) return i; - else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; + if (eNB->ulsch[i]->harq_mask > 0 && eNB->ulsch[i]->rnti == rnti) + return i; + else if (eNB->ulsch[i]->harq_mask == 0 && first_free_index == -1) + first_free_index = i; } } @@ -1963,7 +1966,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, if(frame_parms->frame_type == TDD) { UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE); - if(UE_id >=0 || UE_id < NUMBER_OF_ULSCH_MAX) { + if (UE_id >= 0) { eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1; } } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 5099a63439..8541d11771 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -160,8 +160,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, for (i=0; iharq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); - LOG_I(PHY, "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", - MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]); + LOG_D(PHY, + "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", + MAX_DLSCH_PAYLOAD_BYTES / bw_scaling, + bw_scaling, + i, + dlsch->harq_processes[i]); if (dlsch->harq_processes[i]) { bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index b9331a283e..31aff198dd 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -1121,8 +1121,6 @@ void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) { } void clear_ulsch_stats(PHY_VARS_eNB *eNB) { - - for (int i=0;iulsch_stats[i],0,sizeof(eNB->ulsch_stats[i])); + memset(eNB->ulsch_stats, 0, sizeof(eNB->ulsch_stats)); } diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 0e9d72d99d..15208998ae 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1339,9 +1339,20 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { ulsch_harq = ulsch->harq_processes[harq_pid]; - if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d SFN/SF:%04d%d handled:%d]\n", - i, harq_pid, frame,subframe,i,ulsch->rnti, - ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled); + if (ulsch->rnti > 0) + LOG_D(PHY, + "eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d " + "SFN/SF:%04d%d handled:%d]\n", + i, + harq_pid, + frame, + subframe, + i, + ulsch->rnti, + ulsch_harq->status, + ulsch_harq->frame, + ulsch_harq->subframe, + ulsch_harq->handled); if ((ulsch->rnti>0) && (ulsch_harq->status == ACTIVE) && diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 1b9bdefed6..1f165380d4 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -2980,7 +2980,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, ue->dlsch_mch_received_sf[subframe_rx%5][0]=0; } else { ue->dlsch_mch_received[0]+=1; - ue->dlsch_mch_received_sf[subframe_rx][0]=1; + ue->dlsch_mch_received_sf[subframe_rx % 5][0] = 1; } } // decoding sucessful } // pmch_mcs>=0 diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index 180b580916..e4061f5c3d 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -167,7 +167,7 @@ typedef struct as_stmsi_s { /* Dedicated NAS information */ typedef struct as_nas_info_s { uint32_t length; /* Length of the NAS information data */ - Byte_t* data; /* Dedicated NAS information data container */ + Byte_t* nas_data; /* Dedicated NAS information data container */ } as_nas_info_t; /* Radio Access Bearer identity */ diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index 355b8b3e90..ef09d98284 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -57,26 +57,26 @@ MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigura MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req) // UE: NAS -> RRC messages -MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req) -MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req) -MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req) -MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req) -MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, NasDetachReq, nas_detach_req) -MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, NasDeregistrationReq, nas_deregistration_req) +MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, kenb_refresh_req_t, nas_kenb_refresh_req) +MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, cell_info_req_t, nas_cell_selection_req) +MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, nas_establish_req_t, nas_conn_establi_req) +MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, ul_info_transfer_req_t, nas_ul_data_req) +MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, nas_detach_req_t, nas_detach_req) +MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, nas_deregistration_req_t, nas_deregistration_req) -MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, NasRabEstRsp, nas_rab_est_rsp) +MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, rab_establish_rsp_t, nas_rab_est_rsp) -MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, NasOaiTunNsa, nas_oai_tun_nsa) +MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, nas_oai_tun_nsa_t, nas_oai_tun_nsa) // UE: RRC -> NAS messages -MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, NasCellSelectionCnf, nas_cell_selection_cnf) -MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, NasCellSelectionInd, nas_cell_selection_ind) -MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, NasPagingInd, nas_paging_ind) -MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, NasConnEstabCnf, nas_conn_establi_cnf) -MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NasConnReleaseInd, nas_conn_release_ind) +MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, cell_info_cnf_t, nas_cell_selection_cnf) +MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, cell_info_ind_t, nas_cell_selection_ind) +MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, paging_ind_t, nas_paging_ind) +MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, nas_establish_cnf_t, nas_conn_establi_cnf) +MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, nas_release_ind_t, nas_conn_release_ind) MESSAGE_DEF(NR_NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NRNasConnReleaseInd, nr_nas_conn_release_ind) -MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, NasUlDataCnf, nas_ul_data_cnf) -MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd, nas_dl_data_ind) +MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, ul_info_transfer_cnf_t, nas_ul_data_cnf) +MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, dl_info_transfer_ind_t, nas_dl_data_ind) // xNB: realtime -> RRC messages MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ccc2d9f030..15509b1807 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -422,28 +422,7 @@ typedef struct NRDuDlReq_s { rnti_t rnti; uint8_t *buf; uint64_t srb_id; -} NRDuDlReq_t; - -// UE: NAS -> RRC messages -typedef kenb_refresh_req_t NasKenbRefreshReq; -typedef cell_info_req_t NasCellSelectionReq; -typedef nas_establish_req_t NasConnEstabliReq; -typedef ul_info_transfer_req_t NasUlDataReq; -typedef nas_deregistration_req_t NasDeregistrationReq; -typedef nas_detach_req_t NasDetachReq; - -typedef rab_establish_rsp_t NasRabEstRsp; - -typedef nas_oai_tun_nsa_t NasOaiTunNsa; - -// UE: RRC -> NAS messages -typedef cell_info_cnf_t NasCellSelectionCnf; -typedef cell_info_ind_t NasCellSelectionInd; -typedef paging_ind_t NasPagingInd; -typedef nas_establish_cnf_t NasConnEstabCnf; -typedef nas_release_ind_t NasConnReleaseInd; -typedef ul_info_transfer_cnf_t NasUlDataCnf; -typedef dl_info_transfer_ind_t NasDlDataInd; +} NRDuDlReq_t; // eNB: realtime -> RRC messages typedef struct rrc_subframe_process_s { diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 868928e045..1df8f590ef 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -888,30 +888,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, pdcp_remove_UE(&ctxt); } - /* Note: This should not be done in the MAC! */ - /* - for (int ii=0; iiulsch[ii]; - - if((ulsch != NULL) && (ulsch->rnti == rnti)) { - void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); - LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti); - clean_eNb_ulsch(ulsch); - } - } - - for (int ii=0; iidlsch[ii][0]; - - if((dlsch != NULL) && (dlsch->rnti == rnti)) { - void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); - LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); - clean_eNb_dlsch(dlsch); - } - } - */ - - int id; + int id; // clean ULSCH entries for rnti id = find_ulsch(rnti,RC.eNB[module_idP][CC_id],SEARCH_EXIST); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 5ac5a23c4d..375059f315 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -449,7 +449,7 @@ void generate_Msg2(module_id_t module_idP, add_msg3 (module_idP, CC_idP, ra, frameP, subframeP); ra->eRA_state = WAITMSG3; /* DL request */ - LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n", + LOG_I(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n", module_idP, frameP, subframeP); @@ -465,12 +465,13 @@ void generate_Msg2(module_id_t module_idP, } } else { if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { - LOG_D(MAC, - "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %s\n", + LOG_I(MAC, + "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI for rnti %x, state %s\n", module_idP, CC_idP, frameP, subframeP, + ra->RA_rnti, era_text[ra->eRA_state]); // Allocate 4 PRBS starting in RB 0 first_rb = 0; @@ -1227,7 +1228,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, } // Msg4 frame/subframe } // regular LTE case } else { - LOG_D(MAC, + LOG_I(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n", module_idP, CC_idP, frameP, subframeP); ra->eRA_state = IDLE; @@ -1284,7 +1285,7 @@ initiate_ra_proc(module_id_t module_idP, ) { uint8_t i; COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id]; - RA_t *ra = &cc->ra[0]; + RA_t *ra = cc->ra; struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = NULL; LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL; @@ -1451,7 +1452,7 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rnti) { unsigned char i; RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0]; - LOG_D(MAC, + LOG_I(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d Cancelling RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti); @@ -1472,7 +1473,7 @@ void clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP) { RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0]; for (i = 0; i < NB_RA_PROC_MAX; i++) { - LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra[i].rnti); + LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra[i].rnti); ra[i].eRA_state = IDLE; ra[i].timing_offset = 0; ra[i].RRC_timer = 20; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 50c46b16e1..60b5528096 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -3471,7 +3471,7 @@ CCE_allocation_infeasible(int module_idP, if (format_flag != 2) { // DL DCI if (DL_req->number_pdu == MAX_NUM_DL_PDU) { - LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %x\n", subframe, rnti); } else { dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; @@ -3489,7 +3489,7 @@ CCE_allocation_infeasible(int module_idP, } } else { // ue-specific UL DCI if (HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi == MAX_NUM_HI_DCI0_PDU) { - LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %x\n", subframe, rnti); } else { hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG; @@ -3516,7 +3516,7 @@ int CCE_try_allocate_dlsch(int module_id, nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_id]->DL_req[CC_id].dl_config_request_body; if (DL_req->number_pdu >= MAX_NUM_DL_PDU) { - LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %x\n", subframe, rnti); return -1; } @@ -3577,7 +3577,7 @@ int CCE_try_allocate_ulsch(int module_id, nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_id]->HI_DCI0_req[CC_id][subframe].hi_dci0_request_body; if (HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi >= MAX_NUM_HI_DCI0_PDU) { - LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %x\n", subframe, rnti); return -1; } diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 635155b5a2..f10941c3ab 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -506,7 +506,7 @@ typedef struct { /*!\brief RA process state*/ typedef enum { IDLE = 0, MSG2, WAITMSG3, MSG4, WAITMSG4ACK, MSGCRNTI, MSGCRNTI_ACK } eRA_state; -static const char *const era_text[] = {"IDLE", "Ms2", "WAITMSG3", "WAITMSG4ACK", "MSGCRNTI", "MSGCRNTIACK"}; +static const char *const era_text[] = {"IDLE", "Msg2", "WAITMSG3", "WAITMSG4ACK", "MSGCRNTI", "MSGCRNTIACK"}; /*!\brief UE DLSCH scheduling states*/ typedef enum { S_DL_NONE = 0, S_DL_SCHEDULED } UE_DLSCH_STATUS; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index c63487e1ce..218e01fe28 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -557,6 +557,9 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, break; } + if (pdcp_uid == MAX_MOBILES_PER_ENB) + return ret; + LOG_D(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, (int)(rb_idP+rb_offset), current_sn); Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; @@ -1104,16 +1107,17 @@ bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, break; } } - - Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; - Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; - Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); - Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); - - Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number; - Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); - Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn; + if( pdcp_uid < MAX_MOBILES_PER_ENB ) { + Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; + Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; + Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); + Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); + + Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number; + Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); + Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); + Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn; + } free(sdu_buffer_pP); if (ctxt_pP->enb_flag) { @@ -2298,8 +2302,6 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) { if (UE_NAS_USE_TUN) { int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? MAX_MOBILES_PER_ENB : 1; tun_init("oaitun_ue", num_if, id); - if (IS_SOFTMODEM_NOS1) - tun_config(1, "10.0.1.2", NULL, "oaitun_ue"); tun_init_mbms("oaitun_uem", id + 1); tun_config(1, "10.0.2.2", NULL, "oaitun_uem"); LOG_I(PDCP, "UE pdcp will use tun interface\n"); diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index e8e70aec41..88e4761f23 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -97,8 +97,7 @@ void mac_rlc_data_ind ( rb->set_time(rb, rlc_current_time); rb->recv_pdu(rb, buffer_pP, tb_sizeP); } else { - LOG_E(RLC, "%s:%d:%s: fatal: no RB found (rnti %d channel ID %d)\n", - __FILE__, __LINE__, __FUNCTION__, rnti, channel_id); + LOG_E(RLC, "fatal: no RB found (rnti %x channel ID %d)\n", rnti, channel_id); exit(1); } @@ -388,9 +387,7 @@ static void deliver_sdu(void *_ue, rlc_entity_t *entity, char *buf, int size) exit(1); rb_found: - LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d", - __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); - + LOG_D(RLC, "delivering SDU (rnti %x is_srb %d rb_id %d) size %d", ue->rnti, is_srb, rb_id, size); /* unused fields? */ ctx.instance = ue->module_id; @@ -419,9 +416,7 @@ rb_found: } memcpy(memblock, buf, size); if (!pdcp_data_ind(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) { - LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %d)\n", - __FILE__, __LINE__, __FUNCTION__, - is_srb, rb_id, ue->rnti); + LOG_E(RLC, "ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %x)\n", is_srb, rb_id, ue->rnti); /* what to do in case of failure? for the moment: nothing */ } } @@ -623,7 +618,7 @@ static void add_srb(int rnti, int module_id, struct LTE_SRB_ToAddMod *s) poll_pdu, poll_byte, max_retx_threshold); rlc_ue_add_srb_rlc_entity(ue, srb_id, rlc_am); - LOG_D(RLC, "%s:%d:%s: added SRB %d to UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_D(RLC, "added SRB %d to UE RNTI %x\n", srb_id, rnti); } rlc_manager_unlock(rlc_ue_manager); } @@ -944,7 +939,7 @@ rlc_op_status_t rrc_rlc_config_req ( exit(1); } rlc_manager_lock(rlc_ue_manager); - LOG_D(RLC, "%s:%d:%s: remove rb %d (is_srb %d) for UE %ld\n", __FILE__, __LINE__, __FUNCTION__, (int)rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); + LOG_D(RLC, "remove rb %d (is_srb %d) for UE %lx\n", (int)rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); ue = rlc_manager_get_ue(rlc_ue_manager, ctxt_pP->rntiMaybeUEid); if (srb_flagP) { if (ue->srb[rb_idP-1] != NULL) { @@ -976,7 +971,7 @@ rlc_op_status_t rrc_rlc_config_req ( rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) { - LOG_D(RLC, "%s:%d:%s: remove UE %ld\n", __FILE__, __LINE__, __FUNCTION__, x->rntiMaybeUEid); + LOG_D(RLC, "remove UE %lx\n", x->rntiMaybeUEid); rlc_manager_lock(rlc_ue_manager); rlc_manager_remove_ue(rlc_ue_manager, x->rntiMaybeUEid); rlc_manager_unlock(rlc_ue_manager); diff --git a/openair2/LAYER2/rlc_v2/rlc_ue_manager.c b/openair2/LAYER2/rlc_v2/rlc_ue_manager.c index 1fd366fda1..76556295bb 100644 --- a/openair2/LAYER2/rlc_v2/rlc_ue_manager.c +++ b/openair2/LAYER2/rlc_v2/rlc_ue_manager.c @@ -85,7 +85,7 @@ rlc_ue_t *rlc_manager_get_ue(rlc_ue_manager_t *_m, int rnti) if (m->ue_list[i]->rnti == rnti) return m->ue_list[i]; - LOG_D(RLC, "%s:%d:%s: new UE %d\n", __FILE__, __LINE__, __FUNCTION__, rnti); + LOG_D(RLC, "new UE %x\n", rnti); m->ue_count++; m->ue_list = realloc(m->ue_list, sizeof(rlc_ue_t *) * m->ue_count); diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index dfd50c91cf..455deb1eac 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -369,8 +369,7 @@ static void match_crc_rx_pdu(nfapi_nr_rx_data_indication_t *rx_ind, nfapi_nr_crc rx_ind_unmatched->pdu_list = calloc(rx_ind_unmatched->number_of_pdus, sizeof(nfapi_nr_pdu_t)); for (int i = 0; i < rx_ind->number_of_pdus; i++) { if (!crc_ind_has_rnti(crc_ind, rx_ind->pdu_list[i].rnti)) { - LOG_I(NR_MAC, "rx_ind->pdu_list[%d].rnti %d does not match any crc_ind pdu rnti\n", - i, rx_ind->pdu_list[i].rnti); + LOG_I(NR_MAC, "rx_ind->pdu_list[%d].rnti %x does not match any crc_ind pdu rnti\n", i, rx_ind->pdu_list[i].rnti); rx_ind_unmatched->pdu_list[num_unmatched_rxs] = rx_ind->pdu_list[i]; num_unmatched_rxs++; remove_rx_pdu(rx_ind, i); diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 13787f2334..2079b84438 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -536,18 +536,18 @@ rrc_t310_expiration( } //----------------------------------------------------------------------------- -static void rrc_ue_generate_RRCConnectionSetupComplete( - const protocol_ctxt_t *const ctxt_pP, - const uint8_t eNB_index, - const uint8_t Transaction_id, - uint8_t sel_plmn_id) { +static void rrc_ue_generate_RRCConnectionSetupComplete(const protocol_ctxt_t *const ctxt_pP, + const uint8_t eNB_index, + const uint8_t Transaction_id, + uint8_t sel_plmn_id) +{ uint8_t buffer[100]; uint8_t size; const char *nas_msg; int nas_msg_length; if (EPC_MODE_ENABLED) { - nas_msg = (char *) UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; + nas_msg = (char *)UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.nas_data; nas_msg_length = UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; } else { nas_msg = nas_attach_req_imsi; @@ -771,7 +771,7 @@ rrc_ue_establish_drb( "10.0.%d.%d", UE_NAS_USE_TUN ? 1 : (ip_addr_offset3 + ue_mod_idP + 1), ip_addr_offset4 + ue_mod_idP + 1); - oip_ifup = tun_config(ip_addr_offset3 + ue_mod_idP + 1, ip, NULL, "oaitun_oip"); + oip_ifup = tun_config(ip_addr_offset3 + ue_mod_idP + 1, ip, NULL, "oaitun_ue"); if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB LOG_I(OIP,"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n", @@ -1904,14 +1904,13 @@ static bool is_nr_r15_config_present(LTE_RRCConnectionReconfiguration_r8_IEs_t * #undef NCE #undef chk } - -//----------------------------------------------------------------------------- -void -rrc_ue_process_rrcConnectionReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, - uint8_t eNB_index -) +/** \brief process the received rrcConnectionReconfiguration message at UE + \param ctxt_pP Running context + \param *rrcConnectionReconfiguration pointer to the sturcture + \param eNB_index Index of corresponding eNB/CH*/ +static void rrc_ue_process_rrcConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + uint8_t eNB_index) //----------------------------------------------------------------------------- { LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCConnectionReconfiguration (eNB %d)\n", @@ -2035,7 +2034,7 @@ rrc_ue_process_rrcConnectionReconfiguration( msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CONN_ESTABLI_CNF); NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; - NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; + NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.nas_data = pdu_buffer; itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); } LOG_D(RRC, "Sent NAS_CONN_ESTABLI_CNF to NAS layer via itti!\n"); @@ -2185,14 +2184,17 @@ rrc_detach_from_eNB( } //----------------------------------------------------------------------------- -void -rrc_ue_decode_dcch( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const uint8_t *const Buffer, - const uint32_t Buffer_size, - const uint8_t eNB_indexP -) +/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message + \param ctxt_pP Running context + \param Srb_id Index of Srb (1,2) + \param Buffer Pointer to received SDU + \param Buffer_size + \param eNB_indexP Index of corresponding eNB/CH*/ +static void rrc_ue_decode_dcch(const protocol_ctxt_t *const ctxt_pP, + const rb_id_t Srb_id, + const uint8_t *const Buffer, + const uint32_t Buffer_size, + const uint8_t eNB_indexP) //----------------------------------------------------------------------------- { //DL_DCCH_Message_t dldcchmsg; @@ -2247,15 +2249,14 @@ rrc_ue_decode_dcch( /* This message hold a dedicated info NAS payload, forward it to NAS */ struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = &dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType; - uint32_t pdu_length; - uint8_t *pdu_buffer; MessageDef *msg_p; - pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; - pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; + uint32_t pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; + uint8_t *pdu_buffer = malloc(pdu_length); + memcpy(pdu_buffer, dedicatedInfoType->choice.dedicatedInfoNAS.buf, pdu_length); msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_DOWNLINK_DATA_IND); NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length; - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer; + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data = pdu_buffer; itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); } @@ -2918,7 +2919,7 @@ int decode_BCCH_DLSCH_Message( } if (rrc_get_sub_state(ctxt_pP->module_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) { - if ( (UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL) || (!EPC_MODE_ENABLED)) { + if ((UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.nas_data != NULL) || (!EPC_MODE_ENABLED)) { rrc_ue_generate_RRCConnectionRequest(ctxt_pP, 0); rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING ); } @@ -5173,7 +5174,8 @@ void *rrc_ue_task( void *args_p ) { uint8_t *buffer; LOG_D(RRC, "[UE %d] Received %s: UEid %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NAS_UPLINK_DATA_REQ (msg_p).UEid); /* Create message for PDCP (ULInformationTransfer_t) */ - length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data); + length = + do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ(msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ(msg_p).nasMsg.nas_data); /* Transfer data to PDCP */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 9217350891..c26a57cd44 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -98,6 +98,8 @@ #include "SIMULATION/TOOLS/sim.h" // for taus +#include "openair1/PHY/LTE_TRANSPORT/transport_proto.h" + #define ASN_MAX_ENCODE_SIZE 4096 #define NUMBEROF_DRBS_TOBE_ADDED 1 static int encode_CG_ConfigInfo(char *buffer,int buffer_size,rrc_eNB_ue_context_t *const ue_context_pP,int *enc_size); @@ -878,7 +880,7 @@ rrc_eNB_free_UE( void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag) { eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; pthread_mutex_lock(&lock_ue_freelist); - LOG_I(PHY,"add ue %d in free list, context flag: %d\n", rnti, removeFlag); + LOG_I(PHY, "adding ue %x in UE to free list, context flag: %d\n", rnti, removeFlag); int i; for (i=0; i < sizeofArray(eNB_MAC->UE_free_ctrl); i++) if (eNB_MAC->UE_free_ctrl[i].rnti == 0) @@ -891,16 +893,18 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag) { eNB_MAC->UE_free_ctrl[i].rnti = rnti; eNB_MAC->UE_free_ctrl[i].removeContextFlg = removeFlag; eNB_MAC->UE_free_ctrl[i].raFlag = 0; - eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti; - eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++; + if (eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs < NFAPI_RELEASE_MAX_RNTI) { + eNB_MAC->UE_release_req.ue_release_request_body + .ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs] + .rnti = rnti; + eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++; + } else { + LOG_E(PHY, "fapi List of UE to release is full\n"); + } + pthread_mutex_unlock(&lock_ue_freelist); } -extern int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); -extern int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); -extern void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); -extern void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); - void release_UE_in_freeList(module_id_t mod_id) { PHY_VARS_eNB *eNB_PHY = NULL; eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; @@ -918,13 +922,11 @@ void release_UE_in_freeList(module_id_t mod_id) { int id; // clean ULSCH entries for rnti id = find_ulsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST); - if (id >= 0) clean_eNb_ulsch(eNB_PHY->ulsch[id]); // clean DLSCH entries for rnti id = find_dlsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST); - if (id >= 0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]); @@ -3886,7 +3888,11 @@ check_handovers( ue_context_p->ue_context.handover_info->buf, PDCP_TRANSMISSION_MODE_CONTROL); ue_context_p->ue_context.handover_info->state = HO_COMPLETE; - LOG_I(RRC, "RRC Sends RRCConnectionReconfiguration to UE %d at frame %d and subframe %d \n", ue_context_p->ue_context.rnti, ctxt_pP->frame,ctxt_pP->subframe); + LOG_I(RRC, + "RRC Sends RRCConnectionReconfiguration to UE %x at frame %d and subframe %d \n", + ue_context_p->ue_context.rnti, + ctxt_pP->frame, + ctxt_pP->subframe); } /* in the target, UE in HO_ACK mode */ @@ -7568,16 +7574,16 @@ void rrc_eNB_process_ENDC_DC_prep_timeout(module_id_t module_id, x2ap_ENDC_dc_pr ue_context = rrc_eNB_get_ue_context(RC.rrc[module_id], m->rnti); if (ue_context == NULL) { - LOG_E(RRC, "receiving DC prep timeout for unknown UE rnti %d\n", m->rnti); + LOG_E(RRC, "receiving DC prep timeout for unknown UE rnti %x\n", m->rnti); return; } if (ue_context->ue_context.StatusRrc != RRC_NR_NSA) { - LOG_E(RRC, "receiving DC prep timeout for UE rnti %d not in state RRC_NR_NSA\n", m->rnti); + LOG_E(RRC, "receiving DC prep timeout for UE rnti %x not in state RRC_NR_NSA\n", m->rnti); return; } - LOG_I(RRC, "DC prep timeout for UE rnti %d, put back to RRC_RECONFIGURED mode\n", m->rnti); + LOG_I(RRC, "DC prep timeout for UE rnti %x, put back to RRC_RECONFIGURED mode\n", m->rnti); ue_context->ue_context.StatusRrc = RRC_RECONFIGURED; } @@ -7588,7 +7594,7 @@ void rrc_eNB_process_ENDC_sgNB_release_required(module_id_t module_id, x2ap_ENDC ue_context = rrc_eNB_find_ue_context_from_gnb_rnti(RC.rrc[module_id], m->gnb_rnti); if (ue_context == NULL) { - LOG_E(RRC, "receiving ENDC SgNB Release Required for unknown UE (with gNB's rnti %d)\n", m->gnb_rnti); + LOG_E(RRC, "receiving ENDC SgNB Release Required for unknown UE (with gNB's rnti %x)\n", m->gnb_rnti); return; } diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index a5f8463c47..1810fbaed2 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -93,21 +93,6 @@ rrc_rx_tx_ue( \param eNB_index Index of corresponding eNB/CH*/ int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *const Srb_info, const uint8_t eNB_index ); -/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message - \param ctxt_pP Running context - \param Srb_id Index of Srb (1,2) - \param Buffer Pointer to received SDU - \param Buffer_size - \param eNB_indexP Index of corresponding eNB/CH*/ -void -rrc_ue_decode_dcch( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const uint8_t *const Buffer, - const uint32_t Buffer_size, - const uint8_t eNB_indexP -); - int decode_SL_Discovery_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, @@ -123,17 +108,6 @@ rrc_ue_generate_RRCConnectionRequest( const uint8_t eNB_index ); -/** \brief process the received rrcConnectionReconfiguration message at UE - \param ctxt_pP Running context - \param *rrcConnectionReconfiguration pointer to the sturcture - \param eNB_index Index of corresponding eNB/CH*/ -void -rrc_ue_process_rrcConnectionReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, - uint8_t eNB_index -); - /** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly \param module_idP Instance ID of UE \param frameP Frame index diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 64d9ec3354..ceae4703f6 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -391,12 +391,12 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { rrc_gNB_ue_context_t *ue_context; int e_rab; - LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti); + LOG_D(RRC, "calling rrc_remove_nsa_user rnti %x\n", rnti); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, rnti, 0, 0, rrc->module_id); ue_context = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti); if (ue_context == NULL) { - LOG_W(RRC, "rrc_remove_nsa_user: rnti %d not found\n", rnti); + LOG_W(RRC, "rrc_remove_nsa_user: rnti %x not found\n", rnti); return; } @@ -411,7 +411,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { gtpv1u_enb_delete_tunnel_req_t tmp={0}; tmp.rnti=rnti; tmp.from_gnb=1; - LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %d\n", ue_context->ue_context.nb_of_e_rabs, rnti); + LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %x\n", ue_context->ue_context.nb_of_e_rabs, rnti); for (e_rab = 0; e_rab < ue_context->ue_context.nb_of_e_rabs; e_rab++) { tmp.eps_bearer_id[tmp.num_erab++]= ue_context->ue_context.nsa_gtp_ebi[e_rab]; // erase data diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 89d73f1abc..61f8391586 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -189,10 +189,10 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *tmp = ext->dedicatedNAS_MessageList; for (int i = 0; i < tmp->list.count; i++) { MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_CONN_ESTABLI_CNF); - NasConnEstabCnf *msg = &NAS_CONN_ESTABLI_CNF(ittiMsg); + nas_establish_cnf_t *msg = &NAS_CONN_ESTABLI_CNF(ittiMsg); msg->errCode = AS_SUCCESS; msg->nasMsg.length = tmp->list.array[i]->size; - msg->nasMsg.data = tmp->list.array[i]->buf; + msg->nasMsg.nas_data = tmp->list.array[i]->buf; itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); } tmp->list.count = 0; // to prevent the automatic free by ASN1_FREE @@ -998,7 +998,7 @@ static void rrc_ue_generate_RRCSetupComplete(const NR_UE_RRC_INST_t *rrc, const as_nas_info_t initialNasMsg; nr_ue_nas_t *nas = get_ue_nas_info(rrc->ue_id); generateRegistrationRequest(&initialNasMsg, nas); - nas_msg = (char*)initialNasMsg.data; + nas_msg = (char *)initialNasMsg.nas_data; nas_msg_length = initialNasMsg.length; } else { nas_msg = nr_nas_attach_req_imsi_dummy_NSA_case; @@ -1751,10 +1751,11 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc, dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message; MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_DOWNLINK_DATA_IND); - NasDlDataInd *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); + dl_info_transfer_ind_t *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); msg->UEid = rrc->ue_id; msg->nasMsg.length = dedicatedNAS_Message->size; - msg->nasMsg.data = dedicatedNAS_Message->buf; + msg->nasMsg.nas_data = malloc(msg->nasMsg.length); + memcpy(msg->nasMsg.nas_data, dedicatedNAS_Message->buf, msg->nasMsg.length); itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); dedicatedNAS_Message->buf = NULL; // to keep the buffer, up to NAS to free it } @@ -1907,15 +1908,15 @@ void *rrc_nrue(void *notUsed) case NAS_UPLINK_DATA_REQ: { uint32_t length; uint8_t *buffer = NULL; - NasUlDataReq *req = &NAS_UPLINK_DATA_REQ(msg_p); + ul_info_transfer_req_t *req = &NAS_UPLINK_DATA_REQ(msg_p); /* Create message for PDCP (ULInformationTransfer_t) */ - length = do_NR_ULInformationTransfer(&buffer, req->nasMsg.length, req->nasMsg.data); + length = do_NR_ULInformationTransfer(&buffer, req->nasMsg.length, req->nasMsg.nas_data); /* Transfer data to PDCP */ // check if SRB2 is created, if yes request data_req on SRB2 // error: the remote gNB is hardcoded here rb_id_t srb_id = rrc->Srb[2] == RB_ESTABLISHED ? 2 : 1; nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); - free(req->nasMsg.data); + free(req->nasMsg.nas_data); free(buffer); break; } diff --git a/openair3/NAS/COMMON/API/NETWORK/as_message.c b/openair3/NAS/COMMON/API/NETWORK/as_message.c index 1a986ced1f..e1db277bcc 100644 --- a/openair3/NAS/COMMON/API/NETWORK/as_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/as_message.c @@ -80,65 +80,55 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length) { LOG_FUNC_IN; - int bytes; /* pointers to msg fields possibly not aligned because msg points to a packed structure - * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and - * gcc, from v9, now warns about it. fix these warnings by removing the indirection on data - * (in fact i don't understand this code data seems to be useless...) - */ - Byte_t *data = NULL; + * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and + * gcc, from v9, now warns about it. fix these warnings by removing the indirection on data + * (in fact i don't understand this code data seems to be useless...) + */ /* Get the message type */ msg->msgID = *(uint16_t*)(buffer); - bytes = sizeof(uint16_t); + int bytes = 0; switch (msg->msgID) { case AS_NAS_ESTABLISH_REQ: /* NAS signalling connection establish request */ - bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_req.initialNasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_req_t) - sizeof(as_nas_info_t); break; case AS_NAS_ESTABLISH_IND: /* NAS signalling connection establishment indication */ - bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_ind.initialNasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_ind_t) - sizeof(as_nas_info_t); break; case AS_NAS_ESTABLISH_RSP: /* NAS signalling connection establishment response */ - bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_rsp.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_rsp_t) - sizeof(as_nas_info_t); break; case AS_NAS_ESTABLISH_CNF: /* NAS signalling connection establishment confirm */ - bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_cnf.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_cnf_t) - sizeof(as_nas_info_t); break; case AS_UL_INFO_TRANSFER_REQ: /* Uplink L3 data transfer request */ - bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*); - data = msg->msg.ul_info_transfer_req.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(ul_info_transfer_req_t) - sizeof(as_nas_info_t); break; case AS_UL_INFO_TRANSFER_IND: /* Uplink L3 data transfer indication */ - bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*); - data = msg->msg.ul_info_transfer_ind.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(ul_info_transfer_ind_t) - sizeof(as_nas_info_t); break; case AS_DL_INFO_TRANSFER_REQ: /* Downlink L3 data transfer request */ - bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*); - data = msg->msg.dl_info_transfer_req.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(dl_info_transfer_req_t) - sizeof(as_nas_info_t); break; case AS_DL_INFO_TRANSFER_IND: /* Downlink L3 data transfer indication */ - bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*); - data = msg->msg.dl_info_transfer_ind.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(dl_info_transfer_ind_t) - sizeof(as_nas_info_t); break; case AS_BROADCAST_INFO_IND: @@ -169,14 +159,8 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length) } if (bytes > 0) { - if (data) { - /* Set the pointer to dedicated NAS information */ - /* wasn't data already computed above for specific cases here we override ?? */ - data = (Byte_t *)buffer + bytes; - } - /* Decode the message */ - memcpy(msg, (as_message_t*)buffer, bytes); + memcpy(msg, buffer, bytes); LOG_FUNC_RETURN (msg->msgID); } @@ -254,7 +238,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length) /* NAS signalling connection establish indication */ bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); nas_msg = msg->msg.nas_establish_ind.initialNasMsg; - dataptr=(Byte_t *)&(msg->msg.nas_establish_ind.initialNasMsg.data); + dataptr = (Byte_t*)&(msg->msg.nas_establish_ind.initialNasMsg.nas_data); len=msg->msg.nas_establish_ind.initialNasMsg.length; break; @@ -269,7 +253,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length) /* NAS signalling connection establish confirm */ bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); nas_msg = msg->msg.nas_establish_cnf.nasMsg; - dataptr=(Byte_t *)&(msg->msg.nas_establish_cnf.nasMsg.data); + dataptr = (Byte_t*)&(msg->msg.nas_establish_cnf.nasMsg.nas_data); len=msg->msg.nas_establish_ind.initialNasMsg.length; break; @@ -361,10 +345,10 @@ int as_message_encode(char* buffer, as_message_t* msg, int length) if ( (dataptr!=NULL) && (len > 0) ) { /* Copy the NAS message */ - memcpy(buffer + bytes, nas_msg.data, nas_msg.length); + memcpy(buffer + bytes, nas_msg.nas_data, nas_msg.length); bytes += len; /* Release NAS message memory */ - free(nas_msg.data); + free(nas_msg.nas_data); len=0; dataptr = NULL; } diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c index 32454a13e3..80551c5b5c 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c @@ -535,7 +535,8 @@ int nas_message_encode( #endif emm_security_context); /* Set the message authentication code of the NAS message */ - *(uint32_t*)(buffer + sizeof(uint8_t)) = htonl(mac); + uint32_t mac_nl = htonl(mac); + memcpy(buffer + sizeof(uint8_t), &mac_nl, sizeof(mac_nl)); if (emm_security_context) { #ifdef NAS_MME diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.c b/openair3/NAS/COMMON/API/NETWORK/network_api.c index 9f8f2125a6..a2ef101e92 100644 --- a/openair3/NAS/COMMON/API/NETWORK/network_api.c +++ b/openair3/NAS/COMMON/API/NETWORK/network_api.c @@ -91,19 +91,12 @@ static struct { /* * The buffer used to receive data from the network sublayer */ -#define NETWORK_API_RECV_BUFFER_SIZE 4096 -static char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE]; +#define NETWORK_API_RECV_BUFFER_SIZE 4096 /* * The buffer used to send data to the network sublayer */ -#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE -static char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; - -/* - * The decoded data received from the network sublayer - */ -static as_message_t _as_data = {}; /* Access Stratum message */ +#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ @@ -148,6 +141,7 @@ int network_api_initialize(const char* host, const char* port) ((errno < 0) ? gai_strerror(errno) : strerror(errno))); LOG_FUNC_RETURN (RETURNerror); } + char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; gethostname(_network_api_send_buffer, NETWORK_API_SEND_BUFFER_SIZE); LOG_TRACE(INFO, "NET-API - Network's UDP socket %d is BOUND to %s/%s", @@ -177,27 +171,6 @@ int network_api_get_fd(void) LOG_FUNC_RETURN (NETWORK_API_GETFD()); } -/**************************************************************************** - ** ** - ** Name: network_api_get_data() ** - ** ** - ** Description: Get a generic pointer to the network data structure. ** - ** Casting to the proper type is necessary before its usage. ** - ** ** - ** Inputs: None ** - ** Others: _as_data ** - ** ** - ** Outputs: Return: A generic pointer to the network data ** - ** structure ** - ** Others: None ** - ** ** - ***************************************************************************/ -const void* network_api_get_data(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN ((void*)(&_as_data)); -} - /**************************************************************************** ** ** ** Name: network_api_read_data() ** @@ -213,7 +186,7 @@ const void* network_api_get_data(void) ** Others: _network_api_recv_buffer, _network_api_id ** ** ** ***************************************************************************/ -int network_api_read_data(int fd) +int network_api_read_data(int fd, char* _network_api_recv_buffer) { LOG_FUNC_IN; @@ -263,7 +236,7 @@ int network_api_read_data(int fd) ** Others: None ** ** ** ***************************************************************************/ -int network_api_send_data(int fd, int length) +static int network_api_send_data(int fd, int length, char* _network_api_send_buffer) { LOG_FUNC_IN; @@ -346,12 +319,12 @@ void network_api_close(int fd) ** Others: _as_data ** ** ** ***************************************************************************/ -int network_api_decode_data(int length) +int network_api_decode_data(char* _network_api_recv_buffer, int length, as_message_t* _as_data) { LOG_FUNC_IN; /* Decode the Access Stratum message received from the network */ - int as_id = as_message_decode(_network_api_recv_buffer, &_as_data, length); + int as_id = as_message_decode(_network_api_recv_buffer, _as_data, length); if (as_id != RETURNerror) { LOG_TRACE(INFO, "NET-API - AS message id=0x%x successfully decoded", @@ -376,7 +349,7 @@ int network_api_decode_data(int length) ** Others: _network_api_send_buffer ** ** ** ***************************************************************************/ -int network_api_encode_data(void* data) +static int network_api_encode_data(void* data, char* _network_api_send_buffer) { LOG_FUNC_IN; @@ -415,9 +388,10 @@ int as_message_send(as_message_t* as_msg) LOG_TRACE(INFO, "NET-API - Send message 0x%.4x to the Access Stratum " "layer", as_msg->msgID); + char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; /* Encode the AS message */ - bytes = network_api_encode_data(as_msg); + bytes = network_api_encode_data(as_msg, _network_api_send_buffer); if (bytes > 0) { /* Get the network file descriptor */ @@ -425,7 +399,7 @@ int as_message_send(as_message_t* as_msg) if (fd != RETURNerror) { /* Send the AS message to the network */ - bytes = network_api_send_data(fd, bytes); + bytes = network_api_send_data(fd, bytes, _network_api_send_buffer); } } diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.h b/openair3/NAS/COMMON/API/NETWORK/network_api.h index 57abb2c4f6..14106cbcbf 100644 --- a/openair3/NAS/COMMON/API/NETWORK/network_api.h +++ b/openair3/NAS/COMMON/API/NETWORK/network_api.h @@ -55,17 +55,14 @@ Description Implements the API used by the NAS layer to send/receive /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ - +#include "openair2/COMMON/as_message.h" int network_api_initialize(const char* host, const char* port); int network_api_get_fd(void); -const void* network_api_get_data(void); -int network_api_read_data(int fd); -int network_api_send_data(int fd, int length); +int network_api_read_data(int fd, char *_network_api_recv_buffer); void network_api_close(int fd); -int network_api_decode_data(int length); -int network_api_encode_data(void* data); +int network_api_decode_data(char *_network_api_recv_buffer, int length, as_message_t *_as_data); #endif /* __NETWORK_API_H__*/ diff --git a/openair3/NAS/COMMON/UTIL/TLVDecoder.h b/openair3/NAS/COMMON/UTIL/TLVDecoder.h index 5e3210f696..1f93d7a554 100644 --- a/openair3/NAS/COMMON/UTIL/TLVDecoder.h +++ b/openair3/NAS/COMMON/UTIL/TLVDecoder.h @@ -62,8 +62,12 @@ #define IES_DECODE_U8(bUFFER, dECODED, vALUE) \ DECODE_U8(bUFFER + dECODED, vALUE, dECODED) -#define IES_DECODE_U16(bUFFER, dECODED, vALUE) \ - DECODE_U16(bUFFER + dECODED, vALUE, dECODED) +#define IES_DECODE_U16(bUFFER, dECODED, vALUE) \ + do { \ + uint16_t val; \ + memcpy(&val, bUFFER + dECODED, sizeof(val)); \ + DECODE_U16(&val, vALUE, dECODED); \ + } while (0) #define IES_DECODE_U24(bUFFER, dECODED, vALUE) \ DECODE_U24(bUFFER + dECODED, vALUE, dECODED) diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index 8d07ea8455..59d646e3df 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -543,10 +543,10 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas) size += 10; // encode the message - initialNasMsg->data = malloc16_clear(size * sizeof(Byte_t)); - nas->registration_request_buf = initialNasMsg->data; + initialNasMsg->nas_data = malloc16_clear(size * sizeof(Byte_t)); + nas->registration_request_buf = initialNasMsg->nas_data; - initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data), size); + initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size); nas->registration_request_len = initialNasMsg->length; } @@ -575,9 +575,9 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype } // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(size * sizeof(Byte_t)); - initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data), size); + initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size); } static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg, uint8_t *buf) @@ -611,9 +611,9 @@ static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialN mm_msg->fgs_auth_response.authenticationresponseparameter.res = res; size += 18; // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(size * sizeof(Byte_t)); - initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data), size); + initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size); // Free res value after encode free(res.value); } @@ -663,13 +663,13 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia size += (nas->registration_request_len + 2); // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(size * sizeof(Byte_t)); - int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->data), &(nas_msg.header), size); + int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size); initialNasMsg->length = security_header_len - + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data + security_header_len), size - security_header_len); + + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->nas_data + security_header_len), size - security_header_len); /* ciphering */ uint8_t buf[initialNasMsg->length - 7]; @@ -678,7 +678,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -689,7 +689,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; @@ -697,7 +697,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -791,32 +791,32 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas, } // encode the message - initialNasMsg->data = (Byte_t *)malloc(length * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(length * sizeof(Byte_t)); initialNasMsg->length = length; /* Encode the first octet of the header (extended protocol discriminator) */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->header.protocol_discriminator, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->header.protocol_discriminator, size); /* Encode the security header type */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->header.security_header_type, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->header.security_header_type, size); /* Encode the message authentication code */ - ENCODE_U32(initialNasMsg->data + size, sp_msg->header.message_authentication_code, size); + ENCODE_U32(initialNasMsg->nas_data + size, sp_msg->header.message_authentication_code, size); /* Encode the sequence number */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->header.sequence_number, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->header.sequence_number, size); /* Encode the extended protocol discriminator */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->plain.mm_msg.registration_complete.protocoldiscriminator, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->plain.mm_msg.registration_complete.protocoldiscriminator, size); /* Encode the security header type */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->plain.mm_msg.registration_complete.securityheadertype, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->plain.mm_msg.registration_complete.securityheadertype, size); /* Encode the message type */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->plain.mm_msg.registration_complete.messagetype, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->plain.mm_msg.registration_complete.messagetype, size); if (sortransparentcontainer) { - encode_registration_complete(&sp_msg->plain.mm_msg.registration_complete, initialNasMsg->data + size, length - size); + encode_registration_complete(&sp_msg->plain.mm_msg.registration_complete, initialNasMsg->nas_data + size, length - size); } /* ciphering */ @@ -826,7 +826,7 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas, stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -837,14 +837,14 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas, stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_compute_integrity(nas->security_container->integrity_algorithm, &stream_cipher, mac); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -888,12 +888,12 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi size += fill_guti(&dereg_req->fgsmobileidentity, nas->guti); // encode the message - initialNasMsg->data = calloc(size, sizeof(Byte_t)); - int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->data), &nas_msg.header, size); + initialNasMsg->nas_data = calloc(size, sizeof(Byte_t)); + int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &nas_msg.header, size); initialNasMsg->length = security_header_len - + mm_msg_encode(&sp_msg->plain.mm_msg, (uint8_t *)(initialNasMsg->data + security_header_len), size - security_header_len); + + mm_msg_encode(&sp_msg->plain.mm_msg, (uint8_t *)(initialNasMsg->nas_data + security_header_len), size - security_header_len); nas_stream_cipher_t stream_cipher; @@ -904,7 +904,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -915,7 +915,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; uint8_t mac[4]; @@ -923,7 +923,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -996,12 +996,12 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t * size += (1 + 1 + dnnSize + 1); // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); - int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->data), &(nas_msg.header), size); + initialNasMsg->nas_data = (Byte_t *)malloc(size * sizeof(Byte_t)); + int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size); initialNasMsg->length = security_header_len - + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data + security_header_len), size - security_header_len); + + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->nas_data + security_header_len), size - security_header_len); // Free allocated memory after encode free(req_buffer); @@ -1015,7 +1015,7 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t * stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -1026,14 +1026,14 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t * stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_compute_integrity(nas->security_container->integrity_algorithm, &stream_cipher, mac); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -1079,7 +1079,7 @@ static void send_nas_uplink_data_req(nr_ue_nas_t *nas, const as_nas_info_t *init MessageDef *msg = itti_alloc_new_message(TASK_NAS_NRUE, nas->UE_id, NAS_UPLINK_DATA_REQ); ul_info_transfer_req_t *req = &NAS_UPLINK_DATA_REQ(msg); req->UEid = nas->UE_id; - req->nasMsg.data = (uint8_t *)initial_nas_msg->data; + req->nasMsg.nas_data = (uint8_t *)initial_nas_msg->nas_data; req->nasMsg.length = initial_nas_msg->length; itti_send_msg_to_task(TASK_RRC_NRUE, nas->UE_id, msg); } @@ -1312,7 +1312,7 @@ void *nas_nrue(void *args_p) NAS_CONN_ESTABLI_CNF(msg_p).errCode, NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length); - uint8_t *pdu_buffer = NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data; + uint8_t *pdu_buffer = NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.nas_data; int pdu_length = NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length; security_state_t security_state = nas_security_rx_process(nas, pdu_buffer, pdu_length); @@ -1381,10 +1381,10 @@ void *nas_nrue(void *args_p) nas->UE_id, ITTI_MSG_NAME(msg_p), NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length, - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data); as_nas_info_t initialNasMsg = {0}; - uint8_t *pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data; + uint8_t *pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data; int pdu_length = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length; security_state_t security_state = nas_security_rx_process(nas, pdu_buffer, pdu_length); diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c index de6dee4a5e..1c7ba03f70 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_as.c +++ b/openair3/NAS/UE/EMM/SAP/emm_as.c @@ -147,13 +147,11 @@ static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *); * On X86 this is not fatal, as at run time the problem can be fixed (but it's better for perf to avoid). On other * processor as Arm i think it can end in seg fault */ -static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *, - void *ul_info_transfer_req_unaligned); -static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *, - void *nas_establish_req_unaligned); -static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, void *ul_info_transfer_req_unaligned); -static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *, void *ul_info_transfer_req_unaligned); -static int _emm_as_release_req(const emm_as_release_t *, void *nas_release_req_unaligned); +static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *, ul_info_transfer_req_t *as_msg); +static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *, nas_establish_req_t *); +static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, ul_info_transfer_req_t *as_msg); +static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *, ul_info_transfer_req_t *as_msg); +static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *as_msg); /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ @@ -839,22 +837,18 @@ _emm_as_encode( } /* Allocate memory to the NAS information container */ - info->data = (Byte_t *)malloc(length * sizeof(Byte_t)); + info->nas_data = malloc(length * sizeof(Byte_t)); - if (info->data != NULL) { + if (info->nas_data != NULL) { /* Encode the NAS message */ - bytes = nas_message_encode( - (char *)(info->data), - msg, - length, - emm_security_context); + bytes = nas_message_encode((char *)(info->nas_data), msg, length, emm_security_context); if (bytes > 0) { info->length = bytes; } else { - free(info->data); + free(info->nas_data); info->length = 0; - info->data = NULL; + info->nas_data = NULL; } } @@ -895,23 +889,18 @@ _emm_as_encrypt( } /* Allocate memory to the NAS information container */ - info->data = (Byte_t *)malloc(length * sizeof(Byte_t)); + info->nas_data = malloc(length * sizeof(Byte_t)); - if (info->data != NULL) { + if (info->nas_data != NULL) { /* Encrypt the NAS information message */ - bytes = nas_message_encrypt( - msg, - (char *)(info->data), - header, - length, - emm_security_context); + bytes = nas_message_encrypt(msg, (char *)(info->nas_data), header, length, emm_security_context); if (bytes > 0) { info->length = bytes; } else { - free(info->data); + free(info->nas_data); info->length = 0; - info->data = NULL; + info->nas_data = NULL; } } @@ -938,41 +927,38 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) { LOG_FUNC_IN; - as_message_t as_msg; - memset(&as_msg, 0 , sizeof(as_message_t)); + as_message_t as_msg = {0}; switch (msg->primitive) { - case _EMMAS_DATA_REQ: - as_msg.msgID = _emm_as_data_req(user->emm_data, - &msg->u.data, - (void *)(&as_msg.msg.ul_info_transfer_req)); - break; + case _EMMAS_DATA_REQ: { + ul_info_transfer_req_t ul = {0}; + as_msg.msgID = _emm_as_data_req(user->emm_data, &msg->u.data, &ul); + as_msg.msg.ul_info_transfer_req = ul; + } break; - case _EMMAS_STATUS_IND: - as_msg.msgID = _emm_as_status_ind(user->emm_data, - &msg->u.status, - (void *)(&as_msg.msg.ul_info_transfer_req)); - break; + case _EMMAS_STATUS_IND: { + ul_info_transfer_req_t st = {0}; + as_msg.msgID = _emm_as_status_ind(user->emm_data, &msg->u.status, &st); + as_msg.msg.ul_info_transfer_req = st; + } break; - case _EMMAS_RELEASE_REQ: - as_msg.msgID = _emm_as_release_req( - &msg->u.release, - (void *)(&as_msg.msg.nas_release_req)); - break; + case _EMMAS_RELEASE_REQ: { + nas_release_req_t rel = {0}; + as_msg.msgID = _emm_as_release_req(&msg->u.release, &rel); + as_msg.msg.nas_release_req = rel; + } break; + case _EMMAS_SECURITY_RES: { + ul_info_transfer_req_t ul = {0}; + as_msg.msgID = _emm_as_security_res(user->emm_data, &msg->u.security, &ul); + as_msg.msg.ul_info_transfer_req = ul; + } break; - case _EMMAS_SECURITY_RES: - as_msg.msgID = _emm_as_security_res(user->emm_data, - &msg->u.security, - (void *)(&as_msg.msg.ul_info_transfer_req)); - break; - - case _EMMAS_ESTABLISH_REQ: - as_msg.msgID = _emm_as_establish_req(user->emm_data, - &msg->u.establish, - (void *)(&as_msg.msg.nas_establish_req)); - break; - + case _EMMAS_ESTABLISH_REQ: { + nas_establish_req_t nas_establish_req = {0}; + as_msg.msgID = _emm_as_establish_req(user->emm_data, &msg->u.establish, &nas_establish_req); + as_msg.msg.nas_establish_req = nas_establish_req; + } break; case _EMMAS_CELL_INFO_REQ: as_msg.msgID = _emm_as_cell_info_req(&msg->u.cell_info, @@ -1009,24 +995,22 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) break; case AS_NAS_ESTABLISH_REQ: { - nas_itti_nas_establish_req( - as_msg.msg.nas_establish_req.cause, - as_msg.msg.nas_establish_req.type, - as_msg.msg.nas_establish_req.s_tmsi, - as_msg.msg.nas_establish_req.plmnID, - as_msg.msg.nas_establish_req.initialNasMsg.data, - as_msg.msg.nas_establish_req.initialNasMsg.length, - user->ueid); + nas_itti_nas_establish_req(as_msg.msg.nas_establish_req.cause, + as_msg.msg.nas_establish_req.type, + as_msg.msg.nas_establish_req.s_tmsi, + as_msg.msg.nas_establish_req.plmnID, + as_msg.msg.nas_establish_req.initialNasMsg.nas_data, + as_msg.msg.nas_establish_req.initialNasMsg.length, + user->ueid); LOG_FUNC_RETURN (RETURNok); } break; case AS_UL_INFO_TRANSFER_REQ: { - nas_itti_ul_data_req( - as_msg.msg.ul_info_transfer_req.UEid, - as_msg.msg.ul_info_transfer_req.nasMsg.data, - as_msg.msg.ul_info_transfer_req.nasMsg.length, - user->ueid); + nas_itti_ul_data_req(as_msg.msg.ul_info_transfer_req.UEid, + as_msg.msg.ul_info_transfer_req.nasMsg.nas_data, + as_msg.msg.ul_info_transfer_req.nasMsg.length, + user->ueid); LOG_FUNC_RETURN (RETURNok); } break; @@ -1075,11 +1059,9 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, - void *ul_info_transfer_req_unaligned) +static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, ul_info_transfer_req_t *as_msg) { LOG_FUNC_IN; - ul_info_transfer_req_t *as_msg = (ul_info_transfer_req_t *)ul_info_transfer_req_unaligned; int size = 0; bool is_encoded = false; @@ -1171,19 +1153,14 @@ static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *msg, - void *ul_info_transfer_req_unaligned) +static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *msg, ul_info_transfer_req_t *as_msg) { LOG_FUNC_IN; int size = 0; - ul_info_transfer_req_t *as_msg = (ul_info_transfer_req_t *)ul_info_transfer_req_unaligned; LOG_TRACE(INFO, "EMMAS-SAP - Send AS status indication (cause=%d)", msg->emm_cause); - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - /* Setup the AS message */ if (msg->guti) { as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; @@ -1193,6 +1170,7 @@ static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t } /* Setup the NAS security header */ + nas_message_t nas_msg = {0}; EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); /* Setup the NAS information message */ @@ -1245,13 +1223,11 @@ static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_release_req(const emm_as_release_t *msg, - void *nas_release_req_unaligned) +static int _emm_as_release_req(const emm_as_release_t *msg, nas_release_req_t *as_msg) { LOG_FUNC_IN; LOG_TRACE(INFO, "EMMAS-SAP - Send AS release request"); - nas_release_req_t *as_msg = (nas_release_req_t *)nas_release_req_unaligned; /* Setup the AS message */ if (msg->guti) { as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; @@ -1285,18 +1261,13 @@ static int _emm_as_release_req(const emm_as_release_t *msg, ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *msg, - void *ul_info_transfer_req_unaligned) +static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *msg, ul_info_transfer_req_t *as_msg) { LOG_FUNC_IN; - ul_info_transfer_req_t *as_msg=(ul_info_transfer_req_t *)ul_info_transfer_req_unaligned; int size = 0; LOG_TRACE(INFO, "EMMAS-SAP - Send AS security response"); - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - /* Setup the AS message */ if (msg->guti) { as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; @@ -1304,6 +1275,7 @@ static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_securit } /* Setup the NAS security header */ + nas_message_t nas_msg = {0}; EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); /* Setup the NAS security message */ @@ -1379,18 +1351,13 @@ static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_securit ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg, - void *nas_establish_req_unaligned) +static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg, nas_establish_req_t *as_msg) { LOG_FUNC_IN; int size = 0; - nas_establish_req_t *as_msg = (nas_establish_req_t *)nas_establish_req_unaligned; LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish request"); - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - /* Setup the AS message */ as_msg->cause = msg->RRCcause; as_msg->type = msg->RRCtype; @@ -1403,6 +1370,7 @@ static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establ } /* Setup the NAS security header */ + nas_message_t nas_msg = {0}; EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); /* Setup the initial NAS information message */ diff --git a/openair3/NAS/UE/UEprocess.c b/openair3/NAS/UE/UEprocess.c index a3a1c9c79b..1de5db45ab 100644 --- a/openair3/NAS/UE/UEprocess.c +++ b/openair3/NAS/UE/UEprocess.c @@ -253,7 +253,8 @@ static void *_nas_network_mngr(void *args) /* Network receiving loop */ while (true) { /* Read the network data message */ - bytes = network_api_read_data (*fd); + char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE] = {0}; + bytes = network_api_read_data(*fd, _network_api_recv_buffer); if (bytes == RETURNerror) { /* Failed to read data from the network sublayer; @@ -269,7 +270,8 @@ static void *_nas_network_mngr(void *args) } /* Decode the network data message */ - network_message_id = network_api_decode_data (bytes); + as_message_t _as_data = {}; + network_message_id = network_api_decode_data(bytes, &_as_data); if (network_message_id == RETURNerror) { /* Failed to decode data read from the network sublayer */ @@ -277,8 +279,7 @@ static void *_nas_network_mngr(void *args) } /* Process the network data message */ - ret_code = nas_network_process_data (user, network_message_id, - network_api_get_data ()); + ret_code = nas_network_process_data(user, network_message_id, &_as_data); if (ret_code != RETURNok) { /* The network data message has not been successfully diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index 2f9c8114d8..e7707a8ccd 100644 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -118,7 +118,7 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t NAS_CONN_ESTABLI_REQ(message_p).type = type; NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi; NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID; - NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data; + NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.nas_data = data; NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length; return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } @@ -127,7 +127,7 @@ int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_UPLINK_DATA_REQ); NAS_UPLINK_DATA_REQ(message_p).UEid = ue_id; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = data; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.nas_data = data; NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = length; return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } diff --git a/openair3/NAS/UE/nas_network.c b/openair3/NAS/UE/nas_network.c index f6b291bb7b..5a244310c2 100644 --- a/openair3/NAS/UE/nas_network.c +++ b/openair3/NAS/UE/nas_network.c @@ -161,8 +161,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data) if ( (confirm.errCode == AS_SUCCESS) || (confirm.errCode == AS_TERMINATED_NAS) ) { - rc = nas_proc_establish_cnf(user, confirm.nasMsg.data, - confirm.nasMsg.length); + rc = nas_proc_establish_cnf(user, confirm.nasMsg.nas_data, confirm.nasMsg.length); } else { LOG_TRACE(WARNING, "NET-MAIN - " "Initial NAS message not delivered"); @@ -193,8 +192,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data) case AS_DL_INFO_TRANSFER_IND: { const dl_info_transfer_ind_t info = msg->msg.dl_info_transfer_ind; /* Received downlink data transfer indication */ - rc = nas_proc_dl_transfer_ind(user, info.nasMsg.data, - info.nasMsg.length); + rc = nas_proc_dl_transfer_ind(user, info.nasMsg.nas_data, info.nasMsg.length); break; } diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index ac2cc4db16..dfb4a98d4f 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -255,7 +255,7 @@ void *nas_ue_task(void *args_p) if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS) || (NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_TERMINATED_NAS)) { - nas_proc_establish_cnf(user, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); + nas_proc_establish_cnf(user, NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.nas_data, NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length); /* TODO checks if NAS will free the nas message, better to do it there anyway! */ // result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data); @@ -287,13 +287,8 @@ void *nas_ue_task(void *args_p) LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p), NAS_DOWNLINK_DATA_IND (msg_p).UEid, NAS_DOWNLINK_DATA_IND (msg_p).nasMsg.length); - nas_proc_dl_transfer_ind (user, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); - - if (0) { - /* TODO checks if NAS will free the nas message, better to do it there anyway! */ - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } + nas_proc_dl_transfer_ind(user, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); + free(NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data); break;