Commit ffd4c20e authored by laurent's avatar laurent

fix L2 tracing in wireshark, start security mode comman

parent 3024f578
...@@ -2640,7 +2640,7 @@ target_link_libraries (measurement_display minimal_lib) ...@@ -2640,7 +2640,7 @@ target_link_libraries (measurement_display minimal_lib)
add_executable(test5Gnas add_executable(test5Gnas
${OPENAIR_DIR}/openair3/TEST/test5Gnas.c ${OPENAIR_DIR}/openair3/TEST/test5Gnas.c
) )
target_link_libraries (test5Gnas LIB_5GNAS_GNB CONFIG_LIB minimal_lib ${NETTLE_LIBRARIES}) target_link_libraries (test5Gnas ${NETTLE_LIBRARIES} LIB_5GNAS_GNB CONFIG_LIB minimal_lib )
# lte-softmodem is both eNB and UE implementation # lte-softmodem is both eNB and UE implementation
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#define MAC_LTE_DLT 147 #define MAC_LTE_DLT 147
#define DLT_IPV4 228
/********************************************************/ /********************************************************/
/* Definitions and descriptions come from: /* Definitions and descriptions come from:
http://wiki.wireshark.org/Development/LibpcapFileFormat */ http://wiki.wireshark.org/Development/LibpcapFileFormat */
...@@ -29,20 +30,4 @@ typedef struct pcaprec_hdr_s { ...@@ -29,20 +30,4 @@ typedef struct pcaprec_hdr_s {
unsigned int orig_len; /* actual length of packet */ unsigned int orig_len; /* actual length of packet */
} pcaprec_hdr_t; } pcaprec_hdr_t;
/* Context information for every MAC PDU that will be logged */
typedef struct MAC_Context_Info_t {
unsigned short radioType;
unsigned char direction;
unsigned char rntiType;
unsigned short rnti;
unsigned short ueid;
unsigned char isRetx;
unsigned char crcStatusOK;
unsigned short sysFrameNumber;
unsigned short subFrameNumber;
unsigned int subframesSinceCaptureStart;
} MAC_Context_Info_t;
#endif #endif
...@@ -73,7 +73,7 @@ typedef guint8 gboolean; ...@@ -73,7 +73,7 @@ typedef guint8 gboolean;
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------*/
#define OPT_PARAMS_DESC { \ #define OPT_PARAMS_DESC { \
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \ {"type" , CONFIG_HLP_TYPEMON, 0, strptr:(char**)&in_type, defstrval:"none", TYPE_STRING, 0}, \
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:(char**)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ {"ip" , CONFIG_HLP_L2MONIP, 0, strptr:(char**)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:(char**)&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \ {"path" , CONFIG_HLP_L2MONPATH, 0, strptr:(char**)&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
} }
......
This diff is collapsed.
...@@ -310,7 +310,7 @@ typedef struct __attribute__((packed)) { ...@@ -310,7 +310,7 @@ typedef struct __attribute__((packed)) {
} }
authenticationrequestHeader_t; authenticationrequestHeader_t;
typedef struct { typedef struct __attribute__((packed){
Extendedprotocoldiscriminator_t epd:8; Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8; Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8; SGSmobilitymanagementmessages_t mt:8;
...@@ -321,6 +321,26 @@ typedef struct { ...@@ -321,6 +321,26 @@ typedef struct {
//AUTHENTICATION RESULT //AUTHENTICATION RESULT
typedef struct __attribute__((packed)) {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
unsigned int selectedNASsecurityalgorithms;
unsigned int ngKSI:4; //ngKSI NAS key set identifier 9.11.3.32
unsigned int spare:4;
// LV 3-9 bytes Replayed UE security capabilities UE security capability 9.11.3.54
/* optional
TV (E-, 1 byte) Oprional IMEISV request IMEISV request 9.11.3.28
TV (57, 2 bytes ) Selected EPS NAS security algorithms EPS NAS security algorithms 9.11.3.25
TLV (36, 3 bytes) Additional 5G security information Additional 5G security information 9.11.3.12
TLV-E (78,, 7-1503 bytes) EAP message EAP message 9.11.2.2
TLV (38, 4-n)ABBA ABBA 9.11.3.10
TLV (19, 4-7) Replayed S1 UE security capabilities S1 UE security capability 9.11.3.48A
*/
} securityModeCommand_t;
typedef struct { typedef struct {
uicc_t *uicc; uicc_t *uicc;
......
...@@ -59,6 +59,7 @@ void SGSauthenticationResp(void *msg, NRUEcontext_t *UE) { ...@@ -59,6 +59,7 @@ void SGSauthenticationResp(void *msg, NRUEcontext_t *UE) {
} }
void SGSsecurityModeComplete(void *msg, NRUEcontext_t *UE) { void SGSsecurityModeComplete(void *msg, NRUEcontext_t *UE) {
} }
void SGSregistrationComplete(void *msg, NRUEcontext_t *UE) { void SGSregistrationComplete(void *msg, NRUEcontext_t *UE) {
...@@ -171,5 +172,20 @@ int authenticationRequest(void **msg, NRUEcontext_t *UE) { ...@@ -171,5 +172,20 @@ int authenticationRequest(void **msg, NRUEcontext_t *UE) {
int securityModeCommand(void **msg, NRUEcontext_t *UE) { int securityModeCommand(void **msg, NRUEcontext_t *UE) {
*msg=NULL; *msg=NULL;
myCalloc(req, securityModeCommand_t);
req->epd=SGSmobilitymanagementmessages;
req->sh=0;
req->mt=Securitymodecommand;
// integrity algo from 5G-IA0 (null algo) to 5G-IA7 in first 4 bits
unsigned int ia=0;
// cyphering algo from 5G-EA0 (null algo) to 5G-IA7 in MSB 4 bits
unsigned int ea=0;
// trace from commercial: 5G-IA0 (0) 128-5G-IA2 (2)
req->selectedNASsecurityalgorithms= ea<<4 | ia;
// KSI: N-NAS-int-alg 0x02
req->ngKSI=2;
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment