From ce7ba191239e8c15911012f50b73dc8e45f080aa Mon Sep 17 00:00:00 2001 From: Lionel Gauthier Date: Fri, 5 Dec 2014 13:04:39 +0000 Subject: [PATCH] git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6178 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair-cn/SGW-LITE/sgw_lite_handlers.c | 8 +++++++- openair-cn/SGW-LITE/sgw_lite_task.c | 1 - openair-cn/SGW-LITE/spgw_config.c | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/openair-cn/SGW-LITE/sgw_lite_handlers.c b/openair-cn/SGW-LITE/sgw_lite_handlers.c index f935b0e684..42218c6542 100644 --- a/openair-cn/SGW-LITE/sgw_lite_handlers.c +++ b/openair-cn/SGW-LITE/sgw_lite_handlers.c @@ -611,6 +611,7 @@ sgw_lite_handle_sgi_endpoint_updated( task_id_t to_task; #if defined (ENABLE_USE_GTPU_IN_KERNEL) static uint8_t iptable_uplink_remove_gtpu = FALSE; + char *interface_name_p = NULL; #endif #if defined(ENABLE_STANDALONE_EPC) @@ -696,11 +697,16 @@ sgw_lite_handle_sgi_endpoint_updated( } if (iptable_uplink_remove_gtpu == FALSE) { + if (strncasecmp("tun",sgw_app.sgw_interface_name_for_S1u_S12_S4_up, strlen("tun")) == 0) { + interface_name_p = "lo"; + } else { + interface_name_p = sgw_app.sgw_interface_name_for_S1u_S12_S4_up; + } ret = snprintf(cmd, 256, // no "-p udp --dport 2152" because of fragmented packets "iptables -t raw -I PREROUTING -i %s -s %u.%u.%u.%u -d %u.%u.%u.%u -p udp --dport 2152 -j GTPURH --action remove", - sgw_app.sgw_interface_name_for_S1u_S12_S4_up, + interface_name_p, eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[0], eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[1], eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[2], diff --git a/openair-cn/SGW-LITE/sgw_lite_task.c b/openair-cn/SGW-LITE/sgw_lite_task.c index 6f24cd66b8..f247d4b98a 100644 --- a/openair-cn/SGW-LITE/sgw_lite_task.c +++ b/openair-cn/SGW-LITE/sgw_lite_task.c @@ -150,7 +150,6 @@ int sgw_lite_init(char* config_file_name_pP) spgw_system("insmod $OPENAIRCN_DIR/GTPV1-U/GTPURH/Bin/xt_GTPURH.ko", 1); #endif spgw_config_init(config_file_name_pP, &spgw_config); - spgw_config_process(&spgw_config); pgw_lite_load_pool_ip_addresses(); sgw_app.s11teid2mme_hashtable = hashtable_create (8192, NULL, NULL); diff --git a/openair-cn/SGW-LITE/spgw_config.c b/openair-cn/SGW-LITE/spgw_config.c index abb57aeab3..4613f5f413 100755 --- a/openair-cn/SGW-LITE/spgw_config.c +++ b/openair-cn/SGW-LITE/spgw_config.c @@ -174,8 +174,9 @@ int spgw_config_process(spgw_config_t* config_pP) { } inaddr.s_addr = config_pP->sgw_config.ipv4.sgw_ipv4_address_for_S1u_S12_S4_up; if (snprintf(system_cmd, 256, - "ip -4 addr add %s dev %s", + "ip -4 addr add %s/%d dev %s", inet_ntoa(inaddr), + config_pP->sgw_config.ipv4.sgw_ip_netmask_for_S1u_S12_S4_up, config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) { ret += spgw_system(system_cmd, 1); } else { @@ -479,6 +480,11 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) { } else { SPGW_APP_WARN("CONFIG P-GW / NETWORK INTERFACES not found\n"); } + + //!!!------------------------------------!!! + spgw_config_process(config_pP); + //!!!------------------------------------!!! + subsetting = config_setting_get_member (setting_pgw, PGW_CONFIG_STRING_IP_ADDRESS_POOL); if(subsetting != NULL) { sub2setting = config_setting_get_member (subsetting, PGW_CONFIG_STRING_IPV4_ADDRESS_LIST);