Commit dd53e0c5 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Merge branch 'multiple_upf' into 'develop'

Multiple UPFs

See merge request !42
parents 6eecd52d 7d8b9f2d
......@@ -49,27 +49,21 @@ install_fb_folly_from_source(){
then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \
boost-devel \
libevent-devel \
double-conversion-devel \
glog-devel \
gflags-devel \
snappy-devel \
make \
lz4-devel \
zlib-devel \
binutils-devel \
jemalloc-devel \
openssl-devel \
pkg-config
openssl-devel
ret=$?;[[ $ret -ne 0 ]] && return $ret
elif [[ $OS_DISTRO == "ubuntu" ]]; then
$SUDO $INSTALLER install $OPTION \
g++ \
cmake \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
......@@ -78,12 +72,10 @@ install_fb_folly_from_source(){
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
wget \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
pkg-config
libjemalloc-dev
ret=$?;[[ $ret -ne 0 ]] && return $ret
fi
......@@ -101,7 +93,7 @@ install_fb_folly_from_source(){
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
$CMAKE . && \
$CMAKE . -DBUILD_GMOCK=OFF && \
make && \
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -149,4 +141,3 @@ install_fb_folly_from_source(){
echo_success "End of folly installation"
return 0
}
......@@ -67,6 +67,7 @@ install_fmt() {
fi
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -140,7 +141,11 @@ install_pistache_from_git() {
cd pistache && git checkout e18ed9baeb2145af6f9ea41246cf48054ffd9907
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \
-DPISTACHE_BUILD_EXAMPLES=false \
-DPISTACHE_BUILD_TESTS=false \
-DPISTACHE_BUILD_DOCS=false \
..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -151,9 +156,6 @@ install_pistache_from_git() {
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -274,7 +276,7 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
autoconf
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./configure --enable-asio-lib
./configure --enable-asio-lib --enable-lib-only
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -349,7 +351,6 @@ check_install_smf_deps() {
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Libraries
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
......@@ -378,7 +379,8 @@ check_install_smf_deps() {
nettle-dev \
libcurl4 \
net-tools \
pkg-config"
pkg-config \
libasan2"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
guile-devel \
......@@ -397,7 +399,8 @@ check_install_smf_deps() {
nettle-devel \
libcurl-devel \
python2 \
pkgconfig"
pkgconfig \
libasan"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
......
......@@ -103,6 +103,17 @@ esac
done
# If the repo workspace is shallow, unshallow it
NB_COMMITS=`git log --oneline | wc -l`
if [ $NB_COMMITS -eq 1 ]
then
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" > /dev/null 2>&1
echo "git remote update"
git remote update > /dev/null 2>&1
echo "git fetch --prune --unshallow"
git fetch --prune --unshallow > /dev/null 2>&1
fi
if [[ $TARGET_COMMIT_ID == "latest" ]]
then
TARGET_COMMIT_ID=`git log -n1 --pretty=format:%H origin/$TARGET_BRANCH`
......
......@@ -54,9 +54,8 @@ SMF =
IPV4_LIST = (
{RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.169.0.2 - 192.169.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.170.0.2 - 192.170.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.171.0.2 - 192.171.255.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "10.10.10.2 - 10.10.10.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
);
IPV6_LIST = (
{PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
......@@ -69,9 +68,7 @@ SMF =
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6}
{DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{DNN_NI = "apn2"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{DNN_NI = "apn3"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{DNN_NI = "apn4"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
{DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1}
);
# DNS address communicated to UEs
......@@ -117,12 +114,11 @@ SMF =
LOCAL_CONFIGURATION :
{
USE_LOCAL_CONFIGURATION = "yes";
SESSION_MANAGEMENT_SUBSCRIPTION_LIST = (
{ NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"},
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "carrier.com", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
{ NSSAI_SST = 111; NSSAI_SD = "321", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "10Mbps", SESSION_AMBR_DL = "11Mbps"}
);
......
......@@ -118,7 +118,7 @@ void SMContextsCollectionApi::post_sm_contexts_handler(
} catch (nlohmann::detail::exception& e) {
Logger::smf_api_server().warn(
"Can not parse the json data (error: %s)!", e.what());
"Cannot parse the json data (error: %s)!", e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception& e) {
......
......@@ -80,7 +80,7 @@ void IndividualSMContextApiImpl::release_sm_context(
// Handle the itti_n11_release_sm_context_request message in smf_app
std::shared_ptr<itti_n11_release_sm_context_request> itti_msg =
std::make_shared<itti_n11_release_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smContextRef);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_release_sm_context_request(itti_msg);
......@@ -133,7 +133,7 @@ void IndividualSMContextApiImpl::update_sm_context(
// Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg =
std::make_shared<itti_n11_update_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smContextRef);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
......
......@@ -65,7 +65,7 @@ void NFStatusNotifyApiImpl::receive_nf_status_notification(
// Handle the message in smf_app
std::shared_ptr<itti_sbi_notification_data> itti_msg =
std::make_shared<itti_sbi_notification_data>(TASK_SMF_N11, TASK_SMF_APP);
std::make_shared<itti_sbi_notification_data>(TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->notification_msg = notification_msg;
itti_msg->http_version = 1;
......
......@@ -92,7 +92,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
// Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg =
std::make_shared<itti_n11_create_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id);
TASK_SMF_SBI, TASK_SMF_APP, promise_id);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_create_sm_context_request(itti_msg);
......
......@@ -74,7 +74,7 @@ void SubscriptionsCollectionApiImpl::create_individual_subcription(
// Handle the message in smf_app
std::shared_ptr<itti_sbi_event_exposure_request> itti_msg =
std::make_shared<itti_sbi_event_exposure_request>(
TASK_SMF_N11, TASK_SMF_APP);
TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->event_exposure = event_exposure;
itti_msg->http_version = 1;
......
......@@ -345,7 +345,7 @@ void smf_http2_server::create_sm_contexts_handler(
// Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg =
std::make_shared<itti_n11_create_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id);
TASK_SMF_SBI, TASK_SMF_APP, promise_id);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 2;
m_smf_app->handle_pdu_session_create_sm_context_request(itti_msg);
......@@ -410,7 +410,7 @@ void smf_http2_server::update_sm_context_handler(
// Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg =
std::make_shared<itti_n11_update_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smf_ref);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smf_ref);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 2;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
......@@ -495,7 +495,7 @@ void smf_http2_server::release_sm_context_handler(
"request from AMF.");
std::shared_ptr<itti_n11_release_sm_context_request> itti_msg =
std::make_shared<itti_n11_release_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smf_ref);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smf_ref);
itti_msg->req = sm_context_req_msg;
itti_msg->scid = smf_ref;
itti_msg->http_version = 2;
......
......@@ -34,23 +34,6 @@
#include <string>
#include <vector>
//------------------------------------------------------------------------------
// 10.5.1.3 Location Area Identification
//------------------------------------------------------------------------------
#define LOCATION_AREA_IDENTIFICATION_IE_TYPE 3
#define LOCATION_AREA_IDENTIFICATION_IE_MIN_LENGTH 6
#define LOCATION_AREA_IDENTIFICATION_IE_MAX_LENGTH 6
#define INVALID_LAC_0000 \
(uint16_t) 0x0000 /*!< \brief This LAC can be coded using a full \
hexadecimal representation except for the following \
reserved hexadecimal values: 0000, and FFFE. */
#define INVALID_LAC_FFFE \
(uint16_t) 0xFFFE /*!< \brief This LAC can be coded using a full \
hexadecimal representation except for the following \
reserved hexadecimal values: 0000, and FFFE. */
//------------------------------------------------------------------------------
// 10.5.6.3 Protocol configuration options
//------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -63,8 +63,7 @@ void Logger::_init(
m_smf_n1 = new _Logger("smf_n1 ", m_sinks, ss.str().c_str());
m_smf_n2 = new _Logger("smf_n2 ", m_sinks, ss.str().c_str());
m_smf_n4 = new _Logger("smf_n4 ", m_sinks, ss.str().c_str());
m_smf_n10 = new _Logger("smf_n10", m_sinks, ss.str().c_str());
m_smf_n11 = new _Logger("smf_n11", m_sinks, ss.str().c_str());
m_smf_sbi = new _Logger("smf_sbi", m_sinks, ss.str().c_str());
m_smf_api_server = new _Logger("sbi_srv", m_sinks, ss.str().c_str());
}
......
......@@ -86,8 +86,7 @@ class Logger {
static _Logger& smf_n1() { return *singleton().m_smf_n1; }
static _Logger& smf_n2() { return *singleton().m_smf_n2; }
static _Logger& smf_n4() { return *singleton().m_smf_n4; }
static _Logger& smf_n10() { return *singleton().m_smf_n10; }
static _Logger& smf_n11() { return *singleton().m_smf_n11; }
static _Logger& smf_sbi() { return *singleton().m_smf_sbi; }
static _Logger& smf_api_server() { return *singleton().m_smf_api_server; }
private:
......@@ -116,8 +115,7 @@ class Logger {
_Logger* m_smf_n1;
_Logger* m_smf_n2;
_Logger* m_smf_n4;
_Logger* m_smf_n10;
_Logger* m_smf_n11;
_Logger* m_smf_sbi;
_Logger* m_smf_api_server;
};
......
......@@ -369,6 +369,24 @@ class itti_n4_node_report_response : public itti_n4_msg {
pfcp::pfcp_node_report_response pfcp_ies;
};
//-----------------------------------------------------------------------------
class itti_n4_node_failure : public itti_n4_msg {
public:
itti_n4_node_failure(const task_id_t origin, const task_id_t destination)
: itti_n4_msg(N4_NODE_FAILURE, origin, destination), node_id() {}
itti_n4_node_failure(const itti_n4_node_failure& i) : itti_n4_msg(i) {
node_id = i.node_id;
}
itti_n4_node_failure(
const itti_n4_node_failure& i, const task_id_t orig, const task_id_t dest)
: itti_n4_msg(i, orig, dest) {
node_id = i.node_id;
}
const char* get_msg_name() { return typeid(itti_n4_node_failure).name(); };
pfcp::node_id_t node_id;
};
//-----------------------------------------------------------------------------
class itti_n4_session_set_deletion_request : public itti_n4_msg {
public:
......
......@@ -28,7 +28,7 @@
#ifndef FILE_3GPP_CONVERSIONS_HPP_SEEN
#define FILE_3GPP_CONVERSIONS_HPP_SEEN
#include "3gpp_29.274.h"
#include "3gpp_29.244.h"
#include "3gpp_24.501.h"
#include "endpoint.hpp"
......
......@@ -36,8 +36,7 @@ typedef enum {
TASK_ASYNC_SHELL_CMD,
TASK_SMF_APP,
TASK_SMF_N4,
TASK_SMF_N10,
TASK_SMF_N11,
TASK_SMF_SBI,
TASK_MAX,
TASK_NONE,
TASK_ALL = 255
......@@ -93,6 +92,7 @@ typedef enum {
N4_VERSION_NOT_SUPPORTED_RESPONSE,
N4_NODE_REPORT_REQUEST,
N4_NODE_REPORT_RESPONSE,
N4_NODE_FAILURE,
N4_SESSION_SET_DELETION_REQUEST,
N4_SESSION_SET_DELETION_RESPONSE,
N4_SESSION_ESTABLISHMENT_REQUEST,
......
......@@ -30,9 +30,9 @@
int encode_extended_protocol_configuration_options(
protocol_configuration_options_nas_t extendedprotocolconfigurationoptions,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
// int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ?
......@@ -150,7 +150,7 @@ int decode_extended_protocol_configuration_options(
//------------------------------------------------------------------------------
int decode_protocol_configuration_options(
protocol_configuration_options_nas_t* protocolconfigurationoptions,
const uint8_t* const buffer, const const uint32_t len) {
const uint8_t* const buffer, const uint32_t len) {
int decoded = 0;
int decode_result = 0;
......
......@@ -214,8 +214,8 @@ int decode_qos_rules(
qosrulesie->packetfilterlist.create_modifyandadd_modifyandreplace[j]
.packetfilteridentifier = bitstream & 0x0f;
uint8_t* lenghtofpacketfiltercontents =
(uint8_t*) (*(buffer + decoded) - 1);
uint8_t lenghtofpacketfiltercontents =
*(buffer + decoded) - 1;
decoded++;
DECODE_U8(buffer + decoded, bitstream, decoded);
......@@ -306,8 +306,8 @@ int decode_qos_rules(
.packetfilterlist.create_modifyandadd_modifyandreplace[j]
.packetfilteridentifier = bitstream & 0x0f;
uint8_t* lenghtofpacketfiltercontents =
(uint8_t*) (*(buffer + decoded) - 1);
uint8_t lenghtofpacketfiltercontents =
*(buffer + decoded) - 1;
decoded++;
DECODE_U8(buffer + decoded, bitstream, decoded);
......
......@@ -33,8 +33,8 @@
#include "TLVEncoder.h"
#include "mmData.h"
#include "secu_defs.h"
#include "dynamic_memory_check.h"
/* L O C A L D E F I N I T I O N S */
#define SR_MAC_SIZE_BYTES 2
/* Functions used to decode layer 3 NAS messages */
......@@ -168,9 +168,7 @@ int nas_message_encode(
/*
* Compute the NAS message authentication code
*/
// OAILOG_DEBUG (LOG_NAS, "offset %d = %d - %lu, hdr encode = %d, length =
// %lu bytes = %d\n", offset, size, sizeof (uint8_t), size, length,
// bytes);
uint32_t mac = _nas_message_get_mac(
buffer + offset, bytes + size - offset,
#if TEST_MAC_ENCRYPT_DECRYPT__
......@@ -207,9 +205,6 @@ int nas_message_encode(
fivegmm_security_context->dl_count.overflow += 1;
}
#endif
// OAILOG_DEBUG (LOG_NAS, "Incremented
// fivegmm_security_context.dl_count.seq_num -> %u\n",
// fivegmm_security_context->dl_count.seq_num);
} else {
// OAILOG_DEBUG (LOG_NAS, "Did not increment
// fivegmm_security_context.dl_count.seq_num because no security
......@@ -337,8 +332,6 @@ int nas_message_decode(
return RETURNok;
}
/* L O C A L F U N C T I O N S */
static int _nas_message_header_encode(
unsigned char* buffer, const nas_message_security_header_t* header,
size_t length) {
......@@ -360,8 +353,6 @@ static int _nas_message_header_encode(
#endif
if (header->extended_protocol_discriminator ==
EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES) {
// header->extended_protocol_discriminator ==
// EPD_5GS_SESSION_MANAGEMENT_MESSAGES) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
#if DEBUG_IS_ON
printf("security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
......@@ -448,8 +439,6 @@ static int _nas_message_plain_encode(
/*
* Discard L3 messages with not supported protocol discriminator
*/
// OAILOG_WARNING(LOG_NAS, "NET-API - Extended Protocol discriminator 0x%x
// is " "not supported\n", header->extended_protocol_discriminator);
}
return bytes;
}
......@@ -488,13 +477,7 @@ static int _nas_message_encrypt(
<< 8) |
(fivegmm_security_context->dl_count.seq_num & 0x000000FF);
}
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EEA1 dir %s count.seq_num %u
// count %u\n", (direction == SECU_DIRECTION_UPLINK) ?
// "UPLINK" : "DOWNLINK", (direction ==
// SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num, count);
stream_cipher.key = fivegmm_security_context->knas_enc;
stream_cipher.key_length = AUTH_KNAS_ENC_SIZE;
stream_cipher.count = count;
......@@ -527,13 +510,6 @@ static int _nas_message_encrypt(
(fivegmm_security_context->dl_count.seq_num & 0x000000FF);
}
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EEA2 dir %s count.seq_num %u
// count %u\n", (direction == SECU_DIRECTION_UPLINK) ?
// "UPLINK" : "DOWNLINK", (direction ==
// SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num, count);
stream_cipher.key = fivegmm_security_context->knas_enc;
stream_cipher.key_length = AUTH_KNAS_ENC_SIZE;
stream_cipher.count = count;
......@@ -548,10 +524,6 @@ static int _nas_message_encrypt(
// OAILOG_FUNC_RETURN (LOG_NAS, length);
} break;
case NAS_SECURITY_ALGORITHMS_NEA0: {
// OAILOG_DEBUG (LOG_NAS, "NAS_SECURITY_ALGORITHMS_EEA0 dir %d
// ul_count.seq_num %d dl_count.seq_num %d\n", direction,
// fivegmm_security_context->ul_count.seq_num,
// fivegmm_security_context->dl_count.seq_num);
memcpy(dest, src, length);
// OAILOG_FUNC_RETURN (LOG_NAS, length);
} break;
......@@ -599,12 +571,6 @@ static uint32_t _nas_message_get_mac(
(fivegmm_security_context->dl_count.seq_num & 0x000000FF);
}
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EIA1 dir %s count.seq_num %u count
// %u\n", (direction == SECU_DIRECTION_UPLINK) ? "UPLINK" :
// "DOWNLINK", (direction == SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num, count);
stream_cipher.key = fivegmm_security_context->knas_int;
stream_cipher.key_length = AUTH_KNAS_INT_SIZE;
stream_cipher.count = count;
......@@ -616,10 +582,6 @@ static uint32_t _nas_message_get_mac(
*/
stream_cipher.blength = length << 3;
nas_stream_encrypt_nia1(&stream_cipher, mac);
// OAILOG_DEBUG (LOG_NAS, "NAS_SECURITY_ALGORITHMS_EIA1 returned MAC
// %x.%x.%x.%x(%u) for length %lu direction %d, count %d\n",
// mac[0], mac[1], mac[2], mac[3], *((uint32_t *) & mac), length,
// direction, count);
mac32 = (uint32_t*) &mac;
return ntohl(*mac32);
} break;
......@@ -641,12 +603,6 @@ static uint32_t _nas_message_get_mac(
(fivegmm_security_context->dl_count.seq_num & 0x000000FF);
}
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EIA2 dir %s count.seq_num %u count
// %u\n", (direction == SECU_DIRECTION_UPLINK) ? "UPLINK" :
// "DOWNLINK", (direction == SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num, count);
stream_cipher.key = fivegmm_security_context->knas_int;
stream_cipher.key_length = AUTH_KNAS_INT_SIZE;
stream_cipher.count = count;
......@@ -658,20 +614,10 @@ static uint32_t _nas_message_get_mac(
*/
stream_cipher.blength = length << 3;
// nas_stream_encrypt_nia2 (&stream_cipher, mac);
// OAILOG_DEBUG (LOG_NAS, "NAS_SECURITY_ALGORITHMS_EIA2 returned MAC
// %x.%x.%x.%x(%u) for length %lu direction %d, count %d\n",
// mac[0], mac[1], mac[2], mac[3], *((uint32_t *) & mac), length,
// direction, count);
mac32 = (uint32_t*) &mac;
// OAILOG_FUNC_RETURN (LOG_NAS, ntohl (*mac32));
} break;
case NAS_SECURITY_ALGORITHMS_NIA0: {
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EIA0 dir %s count.seq_num %u\n",
// (direction == SECU_DIRECTION_UPLINK) ? "UPLINK" : "DOWNLINK",
// (direction == SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num);
// OAILOG_FUNC_RETURN (LOG_NAS, 0);
} break;
default:
......@@ -726,9 +672,6 @@ static int _nas_message_header_decode(
/*
* The buffer is not big enough to contain security header
*/
// OAILOG_WARNING(LOG_NAS, "NET-API - The size of the header (%u) "
// "exceeds the buffer length (%lu)\n",
// NAS_MESSAGE_SECURITY_HEADER_SIZE, length);
return RETURNerror;
}
// Decode the message authentication code
......@@ -815,12 +758,6 @@ static int _nas_message_decrypt(
(fivegmm_security_context->dl_count.seq_num & 0x000000FF);
}
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EEA1 dir %s count.seq_num %u count
// %u\n", (direction == SECU_DIRECTION_UPLINK) ? "UPLINK" :
// "DOWNLINK", (direction == SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num, count);
stream_cipher.key = fivegmm_security_context->knas_enc;
stream_cipher.key_length = AUTH_KNAS_ENC_SIZE;
stream_cipher.count = count;
......@@ -869,12 +806,6 @@ static int _nas_message_decrypt(
(fivegmm_security_context->dl_count.seq_num & 0x000000FF);
}
// OAILOG_DEBUG (LOG_NAS,
// "NAS_SECURITY_ALGORITHMS_EEA2 dir %s count.seq_num %u count
// %u\n", (direction == SECU_DIRECTION_UPLINK) ? "UPLINK" :
// "DOWNLINK", (direction == SECU_DIRECTION_UPLINK) ?
// fivegmm_security_context->ul_count.seq_num :
// fivegmm_security_context->dl_count.seq_num, count);
stream_cipher.key = fivegmm_security_context->knas_enc;
stream_cipher.key_length = AUTH_KNAS_ENC_SIZE;
stream_cipher.count = count;
......@@ -888,8 +819,7 @@ static int _nas_message_decrypt(
// nas_stream_encrypt_nea2 (&stream_cipher, (uint8_t*)dest);
/*
* Decode the first octet (security header type or EPS bearer
* identity,
* * * * and protocol discriminator)
* identity, and protocol discriminator)
*/
DECODE_U8(dest, header.extended_protocol_discriminator, size);
DECODE_U8(dest + size, header.security_header_type, size);
......@@ -904,8 +834,7 @@ static int _nas_message_decrypt(
memcpy(dest, src, length);
/*
* Decode the first octet (security header type or EPS bearer
* identity,
* * * * and protocol discriminator)
* identity, and protocol discriminator)
*/
DECODE_U8(dest, header.extended_protocol_discriminator, size);
DECODE_U8(dest + size, header.security_header_type, size);
......@@ -940,6 +869,7 @@ static int _nas_message_decrypt(
// OAILOG_ERROR(LOG_NAS, "Unknown security header type %u",
// security_header_type); OAILOG_FUNC_RETURN (LOG_NAS, 0);
};
return 0;
}