From 5c9a33393d6318cc64e2a7e92d77d186ba0dcc52 Mon Sep 17 00:00:00 2001 From: nhnghia Date: Thu, 9 Sep 2021 11:16:52 +0200 Subject: [PATCH 1/3] remove git version from distribution name --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c22245c..154266c 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ SYS_NAME = $(shell uname -s) SYS_VERSION = $(shell uname -p) #name of package file -ZIP_NAME ?= 5greplay-$(VERSION)_$(GIT_VERSION)_$(SYS_NAME)_$(SYS_VERSION).tar.gz +ZIP_NAME ?= 5greplay-$(VERSION)_$(SYS_NAME)_$(SYS_VERSION).tar.gz DIST_NAME ?= 5greplay-$(VERSION) dist: sample-rules From 410ffda6e9a0c632110f02242d513ace06775652 Mon Sep 17 00:00:00 2001 From: nhnghia Date: Thu, 9 Sep 2021 12:14:19 +0200 Subject: [PATCH 2/3] add "-Xforward.default" to change default action --- docs/docs/guide/quickstart/readme.md | 4 ++-- .../replay-open5gs/{5g-SA.pcap => 5g-sa.pcap} | 0 docs/docs/tutorial/replay-open5gs/readme.md | 7 ++++++- src/engine/configure.h | 1 + src/engine/configure_override.c | 17 +++++++++++++++++ src/engine/configure_override.h | 1 + 6 files changed, 27 insertions(+), 3 deletions(-) rename docs/docs/tutorial/replay-open5gs/{5g-SA.pcap => 5g-sa.pcap} (100%) diff --git a/docs/docs/guide/quickstart/readme.md b/docs/docs/guide/quickstart/readme.md index 024e2ef..3a3b4ac 100644 --- a/docs/docs/guide/quickstart/readme.md +++ b/docs/docs/guide/quickstart/readme.md @@ -12,9 +12,9 @@ The executable versions of 5Greplay are avaiable at [https://github.com/Montimag # Install wget to be able to download 5Greplay sudo apt update && sudo apt install -y wget # Download 5Greplay, version 0.0.1 -wget https://github.com/Montimage/5GReplay/releases/download/v0.0.1/5greplay-0.0.1_03501eb_Linux_x86_64.tar.gz +wget https://github.com/Montimage/5GReplay/releases/download/v0.0.1/5greplay-0.0.1_Linux_x86_64.tar.gz # Decompress 5Greplay -tar -xzf 5greplay-0.0.1_03501eb_Linux_x86_64.tar.gz +tar -xzf 5greplay-0.0.1_Linux_x86_64.tar.gz # View 5Greplay's parameter cd 5greplay-0.0.1 ./5greplay -h diff --git a/docs/docs/tutorial/replay-open5gs/5g-SA.pcap b/docs/docs/tutorial/replay-open5gs/5g-sa.pcap similarity index 100% rename from docs/docs/tutorial/replay-open5gs/5g-SA.pcap rename to docs/docs/tutorial/replay-open5gs/5g-sa.pcap diff --git a/docs/docs/tutorial/replay-open5gs/readme.md b/docs/docs/tutorial/replay-open5gs/readme.md index 926848b..3ab655e 100644 --- a/docs/docs/tutorial/replay-open5gs/readme.md +++ b/docs/docs/tutorial/replay-open5gs/readme.md @@ -7,11 +7,12 @@ In this tutorial, we use executable version of 5Greplay. Further information abo ```bash sudo apt update && sudo apt install -y wget # Download 5Greplay, version 0.0.1 -wget https://github.com/Montimage/5GReplay/releases/download/v0.0.1/5greplay-0.0.1_03501eb_Linux_x86_64.tar.gz +wget https://github.com/Montimage/5GReplay/releases/download/v0.0.1/5greplay-0.0.1_Linux_x86_64.tar.gz # Decompress 5Greplay tar -xzf 5greplay-0.0.1_03501eb_Linux_x86_64.tar.gz # View 5Greplay's parameter cd 5greplay-0.0.1 +./5greplay replay -h ``` # Install open5Gs @@ -29,3 +30,7 @@ sudo apt install open5gs # Replay 5G traffic +```bash +# Download pcap file +wget https://github.com/Montimage/5GReplay/raw/main/docs/docs/tutorial/replay-open5gs/5g-sa.pcap + \ No newline at end of file diff --git a/src/engine/configure.h b/src/engine/configure.h index 5a8e954..16ab577 100644 --- a/src/engine/configure.h +++ b/src/engine/configure.h @@ -146,5 +146,6 @@ size_t conf_parse_list( const char *string, char ***proto_lst ); int conf_validate( config_t *conf ); bool conf_parse_input_mode( int *result, const char *string ); +bool conf_parse_forward_default_action(int *result, const char *value); #endif /* SRC_LIB_CONFIGURE_H_ */ diff --git a/src/engine/configure_override.c b/src/engine/configure_override.c index c4bf04a..2c35c41 100644 --- a/src/engine/configure_override.c +++ b/src/engine/configure_override.c @@ -44,6 +44,14 @@ const char* conf_validate_data_value( const identity_t *ident, const char *data_ return error_reason; } break; + case CONF_ATT__FORWARD__DEFAULT: + if( conf_parse_forward_default_action( &enum_val, data_value ) ) + return NULL; + else{ + snprintf( error_reason, sizeof( error_reason), "Unexpected value [%s] for [%s]", data_value, ident->ident ); + return error_reason; + } + break; //#ifdef SECURITY_MODULE // case CONF_ATT__SECURITY__INGORE_REMAIN_FLOW: // if( conf_parse_security_ignore_mode( &enum_val, data_value ) ) @@ -114,6 +122,15 @@ static inline bool _override_element_by_ident( config_t *conf, const identity_t } log_write( LOG_INFO, "Overridden value of configuration parameter '%s' by '%d'", ident->ident, enum_val ); return true; + case CONF_ATT__FORWARD__DEFAULT: + if( conf_parse_forward_default_action( &enum_val, value_str ) ) + *((int *)field_ptr) = enum_val; + else{ + log_write( LOG_INFO, "Unexpected value [%s] for [%s]", value_str, ident->ident ); + return false; + } + log_write( LOG_INFO, "Overridden value of configuration parameter '%s' by '%d'", ident->ident, enum_val ); + return true; default: break; } diff --git a/src/engine/configure_override.h b/src/engine/configure_override.h index 16a8976..cedef3a 100644 --- a/src/engine/configure_override.h +++ b/src/engine/configure_override.h @@ -140,6 +140,7 @@ DECLARE_CONF_ATT( (CONF_ATT__FORWARD__OUTPUT_NIC,"forward.output-nic", &conf->forward->output_nic, CHAR_STAR), (CONF_ATT__FORWARD__SNAP_LEN, "forward.snap-len", &conf->forward->snap_len, UINT16_T), (CONF_ATT__FORWARD__NB_COPIES, "forward.nb-copies", &conf->forward->nb_copies, UINT32_T), + (CONF_ATT__FORWARD__DEFAULT, "forward.default", &conf->forward->default_action, UINT32_T), (CONF_ATT__FORWARD__PROMISC, "forward.promisc", &conf->forward->promisc, UINT16_T) ) From e8337a390dd4e5d795cd9f35952bc50eb40e1e61 Mon Sep 17 00:00:00 2001 From: nhnghia Date: Thu, 9 Sep 2021 12:17:04 +0200 Subject: [PATCH 3/3] mv example/smc-xx to docs/tutorial --- .../tutorial/smc-message}/mmt-5greplay-sctp.conf | 0 .../tutorial/smc-message}/mmt-5greplay-udp.conf | 0 .../{smc-message.md => smc-message/readme.md} | 0 .../tutorial/smc-message}/ue_authetication.pcapng | Bin examples/example1_ngap_smc/readme.md | 7 ------- 5 files changed, 7 deletions(-) rename {examples/example1_ngap_smc => docs/docs/tutorial/smc-message}/mmt-5greplay-sctp.conf (100%) rename {examples/example1_ngap_smc => docs/docs/tutorial/smc-message}/mmt-5greplay-udp.conf (100%) rename docs/docs/tutorial/{smc-message.md => smc-message/readme.md} (100%) rename {examples/example1_ngap_smc => docs/docs/tutorial/smc-message}/ue_authetication.pcapng (100%) delete mode 100644 examples/example1_ngap_smc/readme.md diff --git a/examples/example1_ngap_smc/mmt-5greplay-sctp.conf b/docs/docs/tutorial/smc-message/mmt-5greplay-sctp.conf similarity index 100% rename from examples/example1_ngap_smc/mmt-5greplay-sctp.conf rename to docs/docs/tutorial/smc-message/mmt-5greplay-sctp.conf diff --git a/examples/example1_ngap_smc/mmt-5greplay-udp.conf b/docs/docs/tutorial/smc-message/mmt-5greplay-udp.conf similarity index 100% rename from examples/example1_ngap_smc/mmt-5greplay-udp.conf rename to docs/docs/tutorial/smc-message/mmt-5greplay-udp.conf diff --git a/docs/docs/tutorial/smc-message.md b/docs/docs/tutorial/smc-message/readme.md similarity index 100% rename from docs/docs/tutorial/smc-message.md rename to docs/docs/tutorial/smc-message/readme.md diff --git a/examples/example1_ngap_smc/ue_authetication.pcapng b/docs/docs/tutorial/smc-message/ue_authetication.pcapng similarity index 100% rename from examples/example1_ngap_smc/ue_authetication.pcapng rename to docs/docs/tutorial/smc-message/ue_authetication.pcapng diff --git a/examples/example1_ngap_smc/readme.md b/examples/example1_ngap_smc/readme.md deleted file mode 100644 index 1580296..0000000 --- a/examples/example1_ngap_smc/readme.md +++ /dev/null @@ -1,7 +0,0 @@ -This repository contains the following files: - -- `mmt-5greplay-udp.conf`: a 5Greplay configuration file to replay the input traffic into a specific UDP port -- `mmt-5greplay-sctp.conf` : a 5Greplay configuration file to replay filter and replay NGAP SMC messages into a running AMF in a specific SCTP port in a specific IP address -- `ue_authetication.pcapng`: a pcap file with 5G traffic to be used as input of 5Greplay - -For more details about how to run this example, please fo to the [documentation](../../docs/example1.md) section.