From e22ad3bc3c7ac92b6c1d908e9379a57f22ec2773 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Mon, 10 Mar 2014 10:59:48 +0000
Subject: [PATCH] Can disable SGI interface
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5132 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
openair-cn/SGI/sgi_task.c | 49 +++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 22 deletions(-)
diff --git a/openair-cn/SGI/sgi_task.c b/openair-cn/SGI/sgi_task.c
index 7e6fce6afe..5e8dc1464f 100644
--- a/openair-cn/SGI/sgi_task.c
+++ b/openair-cn/SGI/sgi_task.c
@@ -246,13 +246,16 @@ int sgi_init(const pgw_config_t *pgw_config_p)
sgi_data_p->interface_name[len] = '\0';
sgi_data_p->ipv4_addr = pgw_config_p->ipv4.pgw_ipv4_address_for_SGI;
- sgi_data_p->interface_index = if_nametoindex(sgi_data_p->interface_name);
+ if (strcmp(sgi_data_p->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
+ sgi_data_p->interface_index = if_nametoindex(sgi_data_p->interface_name);
-
- if (sgi_create_sockets(sgi_data_p) < 0) {
- SGI_IF_ERROR("Could not create socket, leaving thread %s\n", __FUNCTION__);
- free(sgi_data_p);
- return -1;
+ if (sgi_create_sockets(sgi_data_p) < 0) {
+ SGI_IF_ERROR("Could not create socket, leaving thread %s\n", __FUNCTION__);
+ free(sgi_data_p);
+ return -1;
+ }
+ } else {
+ SGI_IF_WARNING("SGI interface disabled by config file\n");
}
if (pthread_create(&fw_2_sgi_task_thread, NULL, &sgi_task_thread, (void *)sgi_data_p) < 0) {
@@ -260,29 +263,31 @@ int sgi_init(const pgw_config_t *pgw_config_p)
return -1;
}
+ if (strcmp(sgi_data_p->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
#ifdef ENABLE_USE_PCAP_FOR_SGI
- if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_pcap_fw_2_gtpv1u_thread, (void *)sgi_data_p) < 0) {
- SGI_IF_ERROR("sgi_pcap_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
- return -1;
- }
+ if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_pcap_fw_2_gtpv1u_thread, (void *)sgi_data_p) < 0) {
+ SGI_IF_ERROR("sgi_pcap_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
+ return -1;
+ }
#endif
#ifdef ENABLE_USE_NETFILTER_FOR_SGI
- if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_nf_fw_2_gtpv1u_thread, (void *)sgi_data_p) < 0) {
- SGI_IF_ERROR("sgi_nf_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
- return -1;
- }
+ if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_nf_fw_2_gtpv1u_thread, (void *)sgi_data_p) < 0) {
+ SGI_IF_ERROR("sgi_nf_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
+ return -1;
+ }
#endif
#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
- for (i=0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
- sgi_read_thread_args_t *args_p = malloc(sizeof(sgi_read_thread_args_t));
- args_p->sgi_data = sgi_data_p;
- args_p->socket_index = i;
- if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_sock_raw_fw_2_gtpv1u_thread, (void *)args_p) < 0) {
- SGI_IF_ERROR("sgi_sock_raw_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
- return -1;
+ for (i=0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
+ sgi_read_thread_args_t *args_p = malloc(sizeof(sgi_read_thread_args_t));
+ args_p->sgi_data = sgi_data_p;
+ args_p->socket_index = i;
+ if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_sock_raw_fw_2_gtpv1u_thread, (void *)args_p) < 0) {
+ SGI_IF_ERROR("sgi_sock_raw_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
+ return -1;
+ }
}
- }
#endif
+ }
while (sgi_data_p->thread_started != SGI_MAX_EPS_BEARERS_PER_USER ) {
usleep(1000);
--
GitLab