Problem decoding S1AP

This commit is contained in:
gauthier
2015-11-13 14:04:00 +01:00
parent 34ab7c374f
commit 757b1940ac
5 changed files with 1035 additions and 93 deletions
@@ -1,11 +1,13 @@
cmake_minimum_required(VERSION 2.8)
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set ( ASN_DEBUG False)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
set ( EMOS False )
set ( EMIT_ASN_DEBUG True )
set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="pdml2html.xsl"?>
<!-- You can find pdml2html.xsl in /usr/share/wireshark or at http://anonsvn.wireshark.org/trunk/wireshark/pdml2html.xsl. -->
<pdml capture_file="./attach_complete.pcapng" creator="wireshark/1.10.6" time="Wed Oct 14 15:33:08 2015" version="0">
<pdml capture_file="./attach_complete.pcapng" creator="wireshark/1.10.6" time="Mon Nov 2 09:22:48 2015" version="0">
<packet>
<proto name="frame" pos="0" showname="Frame 9: 82 bytes on wire (656 bits), 82 bytes captured (656 bits) on interface 0" size="82">
<field name="frame.interface_id" pos="0" show="0" showname="Interface id: 0" size="0"/>
+49 -42
View File
@@ -106,6 +106,7 @@
<xsl:template match="proto[@name='frame']">
<xsl:variable name="time_relative" select="field[@name='frame.time_relative']/@show"/>
<xsl:variable name="frame_number" select="field[@name='frame.number']/@show"/>
<xsl:variable name="ip" select="proto[@name='ip']"/>
<xsl:variable name="ip_src">
<xsl:call-template name="reverse_ip">
@@ -131,16 +132,17 @@
<xsl:for-each select="$ip/proto[@name='sctp']">
<xsl:variable name="sctp_data_sid" select="./field/field[@name='sctp.data_sid']/@show"/>
<!-- TODO resolv problem of 2 SCTP packets in 1 IP packet: src and dst ports are not in the 2nd SCTP packet -->
<xsl:variable name="sctp_srcport" select="./field[@name='sctp.srcport']/@show"/>
<xsl:variable name="sctp_dstport" select="./field[@name='sctp.dstport']/@show"/>
<xsl:variable name="sctp_data_ssn" select="./field/field[@name='sctp.data_ssn']/@show"/>
<xsl:variable name="sctp_data_payload_proto_id" select="./field/field[@name='sctp.data_payload_proto_id']/@show"/>
<!--xsl:variable name="sctp_srcport" select="./field[@name='sctp.srcport']/@show"/-->
<!--xsl:variable name="sctp_dstport" select="./field[@name='sctp.dstport']/@show"/-->
<!--xsl:variable name="sctp_data_ssn" select="./field/field[@name='sctp.data_ssn']/@show"/-->
<!--xsl:variable name="sctp_data_payload_proto_id" select="./field/field[@name='sctp.data_payload_proto_id']/@show"/-->
<xsl:variable name="sctp_chunk_type_str">
<xsl:call-template name="chunktype2str">
<xsl:with-param name="chunk_type" select="./field/field[@name='sctp.chunk_type']/@value"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="sctp_pos_offset" select="./@pos"/>
<xsl:variable name="sctp_node" select="."/>
<xsl:choose>
<xsl:when test="$sctp_chunk_type_str='DATA'">
@@ -148,59 +150,61 @@
<xsl:variable name="s1ap_pos_offset" select="./@pos"/>
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$s1ap_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<sctp.data_ssn value="{$sctp_data_ssn}"/>
<sctp.data_payload_proto_id value="{$sctp_data_payload_proto_id}"/>
<!--sctp.data_sid value="{$sctp_data_sid}"/-->
<!--sctp.srcport value="{$sctp_srcport}"/-->
<!--sctp.dstport value="{$sctp_dstport}"/-->
<!--sctp.data_ssn value="{$sctp_data_ssn}"/-->
<!--sctp.data_payload_proto_id value="{$sctp_data_payload_proto_id}"/-->
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<xsl:copy-of select="node()"/>
<xsl:copy-of select="$sctp_node"/>
</packet>
</xsl:for-each>
</xsl:when>
<xsl:when test="$sctp_chunk_type_str='INIT'">
<xsl:variable name="sctp_init_nr_out_streams" select="./field/field[@name='sctp.init_nr_out_streams']/@show"/>
<xsl:variable name="sctp_init_nr_in_streams" select="./field/field[@name='sctp.init_nr_in_streams']/@show"/>
<xsl:variable name="sctp_init_initial_tsn" select="./field/field[@name='sctp.init_initial_tsn']/@show"/>
<!--xsl:variable name="sctp_init_nr_out_streams" select="./field/field[@name='sctp.init_nr_out_streams']/@show"/-->
<!--xsl:variable name="sctp_init_nr_in_streams" select="./field/field[@name='sctp.init_nr_in_streams']/@show"/-->
<!--xsl:variable name="sctp_init_initial_tsn" select="./field/field[@name='sctp.init_initial_tsn']/@show"/-->
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<sctp.init_nr_in_streams value="{$sctp_init_nr_in_streams}"/>
<sctp.init_nr_out_streams value="{$sctp_init_nr_out_streams}"/>
<sctp.init_initial_tsn value="{$sctp_init_initial_tsn}"/>
<!--sctp.srcport value="{$sctp_srcport}"/-->
<!--sctp.dstport value="{$sctp_dstport}"/-->
<!--sctp.init_nr_in_streams value="{$sctp_init_nr_in_streams}"/-->
<!--sctp.init_nr_out_streams value="{$sctp_init_nr_out_streams}"/-->
<!--sctp.init_initial_tsn value="{$sctp_init_initial_tsn}"/-->
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<!--xsl:copy-of select="node()"/-->
<xsl:copy-of select="$sctp_node"/>
</packet>
</xsl:when>
<xsl:when test="$sctp_chunk_type_str='INIT_ACK'">
<xsl:variable name="sctp_initack_nr_out_streams" select="./field/field[@name='sctp.initack_nr_out_streams']/@show"/>
<xsl:variable name="sctp_initack_nr_in_streams" select="./field/field[@name='sctp.initack_nr_in_streams']/@show"/>
<xsl:variable name="sctp_initack_initial_tsn" select="./field/field[@name='sctp.initack_initial_tsn']/@show"/>
<!--xsl:variable name="sctp_initack_nr_out_streams" select="./field/field[@name='sctp.initack_nr_out_streams']/@show"/-->
<!--xsl:variable name="sctp_initack_nr_in_streams" select="./field/field[@name='sctp.initack_nr_in_streams']/@show"/-->
<!--xsl:variable name="sctp_initack_initial_tsn" select="./field/field[@name='sctp.initack_initial_tsn']/@show"/-->
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<sctp.initack_nr_in_streams value="{$sctp_initack_nr_in_streams}"/>
<sctp.initack_nr_out_streams value="{$sctp_initack_nr_out_streams}"/>
<sctp.initack_initial_tsn value="{$sctp_initack_initial_tsn}"/>
<!--sctp.data_sid value="{$sctp_data_sid}"/-->
<!--sctp.srcport value="{$sctp_srcport}"/-->
<!--sctp.dstport value="{$sctp_dstport}"/-->
<!--sctp.initack_nr_in_streams value="{$sctp_initack_nr_in_streams}"/-->
<!--sctp.initack_nr_out_streams value="{$sctp_initack_nr_out_streams}"/-->
<!--sctp.initack_initial_tsn value="{$sctp_initack_initial_tsn}"/-->
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<!--xsl:copy-of select="node()"/-->
<xsl:copy-of select="$sctp_node"/>
</packet>
</xsl:when>
<!--xsl:when test="$sctp_chunk_type_str='SACK'"> </xsl:when-->
@@ -209,44 +213,47 @@
<xsl:when test="$sctp_chunk_type_str='ABORT'">
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<!--sctp.data_sid value="{$sctp_data_sid}"/-->
<!--sctp.srcport value="{$sctp_srcport}"/-->
<!--sctp.dstport value="{$sctp_dstport}"/-->
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<xsl:copy-of select="node()"/>
<xsl:copy-of select="$sctp_node"/>
</packet>
</xsl:when>
<xsl:when test="$sctp_chunk_type_str='SHUTDOWN'">
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<!--sctp.data_sid value="{$sctp_data_sid}"/-->
<!--sctp.srcport value="{$sctp_srcport}"/-->
<!--sctp.dstport value="{$sctp_dstport}"/-->
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<xsl:copy-of select="node()"/>
<xsl:copy-of select="$sctp_node"/>
</packet>
</xsl:when>
<!--xsl:when test="$sctp_chunk_type_str='SHUTDOWN_ACK'"></xsl:when-->
<xsl:when test="$sctp_chunk_type_str='ERROR'">
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<!--sctp.data_sid value="{$sctp_data_sid}"/-->
<!--sctp.srcport value="{$sctp_srcport}"/-->
<!--sctp.dstport value="{$sctp_dstport}"/-->
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<xsl:copy-of select="node()"/>
<xsl:copy-of select="$sctp_node"/>
</packet>
</xsl:when>
<!--xsl:when test="$sctp_chunk_type_str='COOKIE_ECHO'"> </xsl:when-->
File diff suppressed because it is too large Load Diff
+52 -16
View File
@@ -28,18 +28,22 @@
*******************************************************************************/
/*
generate_scenario.h
play_scenario.h
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
*/
#ifndef GENERATE_SCENARIO_H_
#define GENERATE_SCENARIO_H_
# include <time.h>
# include <stdint.h>
#include <libxml/tree.h>
#ifndef PLAY_SCENARIO_H_
#define PLAY_SCENARIO_H_
# include <time.h>
# include <stdint.h>
# include <libxml/tree.h>
# include <netinet/in.h>
#include "s1ap_ies_defs.h"
/** @defgroup _enb_app ENB APP
* @ingroup _oai2
@@ -83,13 +87,32 @@ typedef enum {
SCTP_CID_ASCONF_ACK = 0x80,
} sctp_cid_t; /* enum */
typedef enum {
TEST_S1AP_PDU_TYPE_START = 0,
TEST_S1AP_PDU_TYPE_UNKNOWN = TEST_S1AP_PDU_TYPE_START,
TEST_S1AP_PDU_TYPE_INITIATING,
TEST_S1AP_PDU_TYPE_SUCCESSFUL_OUTCOME,
TEST_S1AP_PDU_TYPE_UNSUCCESSFUL_OUTCOME,
TEST_S1AP_PDU_TYPE_END
} test_s1ap_pdu_type_t;
typedef struct test_s1ap_s {
//test_s1ap_pdu_type_t pdu_type;
uint16_t binary_stream_pos;
uint16_t binary_stream_allocated_size;
uint8_t *binary_stream;
s1ap_message message;
} test_s1ap_t;
// from kernel source file 3.19/include/linux/sctp.h, Big Endians
typedef struct sctp_datahdr_s {
uint32_t tsn;
uint16_t stream;
uint16_t ssn;
uint32_t ppid;
uint8_t payload[0];
uint32_t tsn;
uint16_t stream;
uint16_t ssn;
uint32_t ppid;
test_s1ap_t payload;
} sctp_datahdr_t;
// from kernel source file 3.19/include/linux/sctp.h, Big Endians
@@ -115,15 +138,28 @@ typedef struct test_sctp_hdr_s {
} u;
} test_sctp_hdr_t;
typedef struct test_ip_s {
unsigned int address_family; // AF_INET, AF_INET6
union {
struct in6_addr ipv6;
in_addr_t ipv4;
}address;
}test_ip_t;
typedef struct test_ip_hdr_s {
test_ip_t src;
test_ip_t dst;
} test_ip_hdr_t;
typedef struct test_packet_s {
test_action_t action;
struct timeval time_relative_to_first_packet;
struct timeval time_relative_to_last_packet;
struct timeval time_relative_to_last_sent_packet;
struct timeval time_relative_to_last_received_packet;
unsigned int original_frame_number;
unsigned int packet_number;
test_ip_hdr_t ip_hdr;
test_sctp_hdr_t sctp_hdr;
uint16_t s1ap_byte_stream_count;
uint8_t *s1ap_byte_stream;
xmlNodePtr *s1ap_node;
struct test_packet_s *next;
}test_packet_t;