Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF-Simple
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-SMF-Simple
Commits
b8865508
Commit
b8865508
authored
Feb 22, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warning at building time
parent
02871149
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
102 deletions
+11
-102
src/api-server/api/SMContextsCollectionApi.cpp
src/api-server/api/SMContextsCollectionApi.cpp
+1
-1
src/common/3gpp_24.008.h
src/common/3gpp_24.008.h
+0
-17
src/nas/ies/QOSRules.c
src/nas/ies/QOSRules.c
+4
-4
src/nas/nas_message.c
src/nas/nas_message.c
+4
-76
src/nas/nas_message.h
src/nas/nas_message.h
+0
-1
src/oai_smf/main.cpp
src/oai_smf/main.cpp
+1
-2
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+1
-1
No files found.
src/api-server/api/SMContextsCollectionApi.cpp
View file @
b8865508
...
...
@@ -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
)
{
...
...
src/common/3gpp_24.008.h
View file @
b8865508
...
...
@@ -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
//------------------------------------------------------------------------------
...
...
src/nas/ies/QOSRules.c
View file @
b8865508
...
...
@@ -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
);
...
...
src/nas/nas_message.c
View file @
b8865508
...
...
@@ -35,7 +35,6 @@
#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 */
...
...
@@ -169,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__
...
...
@@ -208,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
...
...
@@ -338,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
)
{
...
...
@@ -361,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
"
);
...
...
@@ -449,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
;
}
...
...
@@ -489,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
;
...
...
@@ -528,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
;
...
...
@@ -549,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
;
...
...
@@ -600,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
;
...
...
@@ -617,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
;
...
...
@@ -642,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
;
...
...
@@ -659,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:
...
...
@@ -727,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
...
...
@@ -816,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
;
...
...
@@ -870,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
;
...
...
@@ -889,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
);
...
...
@@ -905,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
);
...
...
src/nas/nas_message.h
View file @
b8865508
...
...
@@ -34,7 +34,6 @@
#include "sm_msg.h"
#include "common_types.h"
// test mac and encrypt/decrypt
#define DIRECTION__ 1 // SECU_DIRECTION_DOWNLINK
#define TEST_MAC_ENCRYPT_DECRYPT__ 0
#define NAS_MESSAGE_SECURITY_HEADER_SIZE 7
...
...
src/oai_smf/main.cpp
View file @
b8865508
...
...
@@ -102,7 +102,6 @@ int main(int argc, char** argv) {
// Logger
Logger
::
init
(
"smf"
,
Options
::
getlogStdout
(),
Options
::
getlogRotFilelog
());
Logger
::
smf_app
().
startup
(
"Options parsed"
);
struct
sigaction
sigIntHandler
;
...
...
@@ -115,7 +114,7 @@ int main(int argc, char** argv) {
smf_cfg
.
load
(
Options
::
getlibconfigConfig
());
smf_cfg
.
display
();
// Inter
task Interface
// Inter
-
task Interface
itti_inst
=
new
itti_mw
();
itti_inst
->
start
(
smf_cfg
.
itti
.
itti_timer_sched_params
);
...
...
src/smf_app/smf_context.cpp
View file @
b8865508
...
...
@@ -77,7 +77,7 @@ void smf_qos_flow::mark_as_released() {
std
::
string
smf_qos_flow
::
toString
()
const
{
std
::
string
s
=
{};
s
.
append
(
"QoS Flow:
\n
"
);
s
.
append
(
"
\t
FQ
I:
\t\t\t\t
"
)
s
.
append
(
"
\t
QF
I:
\t\t\t\t
"
)
.
append
(
std
::
to_string
((
uint8_t
)
qfi
.
qfi
))
.
append
(
"
\n
"
);
s
.
append
(
"
\t
UL FTEID:
\t\t
"
).
append
(
ul_fteid
.
toString
()).
append
(
"
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment