Commit 2b304f03 authored by Lionel Gauthier's avatar Lionel Gauthier

test Ok for oaisim with 1Ue,1enB, 1MME/S-P-GW on 1 host

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7209 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 368782c0
......@@ -712,6 +712,42 @@ sgw_lite_handle_sgi_endpoint_updated(
modify_response_p->cause = REQUEST_ACCEPTED;
modify_response_p->trxn = new_bearer_ctxt_info_p->sgw_eps_bearer_context_information.trxn;
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
// if default bearer
#warning "TODO define constant for default eps_bearer id"
//if ((resp_pP->eps_bearer_id == 5) && (spgw_config.pgw_config.pgw_masquerade_SGI == 0)) {
if (resp_pP->eps_bearer_id == 5) {
ret = snprintf(cmd,
256,
"iptables -t mangle -I %s -d %u.%u.%u.%u -m mark --mark 0 -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "INPUT":"POSTROUTING",
eps_bearer_entry_p->paa.ipv4_address[0],
eps_bearer_entry_p->paa.ipv4_address[1],
eps_bearer_entry_p->paa.ipv4_address[2],
eps_bearer_entry_p->paa.ipv4_address[3],
sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x000000FF,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x0000FF00) >> 8,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x00FF0000) >> 16,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0xFF000000) >> 24,
eps_bearer_entry_p->s_gw_teid_for_S1u_S12_S4_up,
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],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[3],
eps_bearer_entry_p->enb_teid_for_S1u
);
if ((ret < 0) || (ret > 256)) {
SPGW_APP_ERROR("ERROR in preparing default downlink tunnel, tune string length\n");
exit (-1);
}
//use API when prototype validated
ret = spgw_system(cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
if (ret < 0) {
SPGW_APP_ERROR("ERROR in setting up default downlink TUNNEL\n");
}
}
//-------------------------
ret = snprintf(cmd,
256,
"iptables -t mangle -I %s -d %u.%u.%u.%u -m mark --mark %u -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
......@@ -745,38 +781,6 @@ sgw_lite_handle_sgi_endpoint_updated(
SPGW_APP_ERROR("ERROR in setting up downlink TUNNEL\n");
}
// if default bearer
#warning "TODO define constant for default eps_bearer id"
if ((resp_pP->eps_bearer_id == 5) && (spgw_config.pgw_config.pgw_masquerade_SGI == 0)) {
ret = snprintf(cmd,
256,
"iptables -t mangle -A %s -d %u.%u.%u.%u -m mark --mark 0 -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "INPUT":"POSTROUTING",
eps_bearer_entry_p->paa.ipv4_address[0],
eps_bearer_entry_p->paa.ipv4_address[1],
eps_bearer_entry_p->paa.ipv4_address[2],
eps_bearer_entry_p->paa.ipv4_address[3],
sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x000000FF,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x0000FF00) >> 8,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x00FF0000) >> 16,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0xFF000000) >> 24,
eps_bearer_entry_p->s_gw_teid_for_S1u_S12_S4_up,
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],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[3],
eps_bearer_entry_p->enb_teid_for_S1u
);
if ((ret < 0) || (ret > 256)) {
SPGW_APP_ERROR("ERROR in preparing downlink tunnel, tune string length\n");
exit (-1);
}
//use API when prototype validated
ret = spgw_system(cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
}
if (iptable_uplink_remove_gtpu == FALSE) {
ret = snprintf(cmd,
......
......@@ -262,17 +262,7 @@ int spgw_config_process(spgw_config_t* config_pP)
ret = -1;
}
if (config_pP->sgw_config.sgw_drop_uplink_traffic) {
if (snprintf(system_cmd, 256,
"iptables -t raw -I PREROUTING -i %s --protocol udp --destination-port 2152 -j DROP",
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) {
SPGW_APP_INFO("Drop uplink traffic: %s\n",system_cmd);
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Drop uplink traffic\n");
ret = -1;
}
}
if (snprintf(system_cmd, 256,
"ethtool -K %s tso off gso off gro off",
......@@ -285,56 +275,43 @@ int spgw_config_process(spgw_config_t* config_pP)
}
// if (config_pP->pgw_config.pgw_masquerade_SGI) {
// inaddr.s_addr = config_pP->pgw_config.ipv4.pgw_ipv4_address_for_SGI;
// if (snprintf(system_cmd, 256,
// "iptables -t nat -I POSTROUTING -o %s ! --protocol sctp -j SNAT --to-source %s",
// config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI,
// inet_ntoa(inaddr)) > 0) {
// SPGW_APP_INFO("Masquerade SGI: %s\n",system_cmd);
// ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
// } else {
// SPGW_APP_ERROR("Masquerade SGI\n");
// ret = -1;
// }
// }
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
if (config_pP->sgw_config.local_to_eNB) {
if (snprintf(system_cmd, 256,
"iptables -I OUTPUT -t mangle -m mark ! --mark 0 ! --protocol sctp -j CONNMARK --save-mark") > 0) {
"iptables -I OUTPUT -t mangle -m mark ! --mark 0 -j CONNMARK --save-mark") > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Save mark\n");
ret = -1;
}
if (snprintf(system_cmd, 256,
"iptables -I INPUT -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Restore mark\n");
ret = -1;
}
} else {
if (snprintf(system_cmd, 256,
"iptables -I POSTROUTING -t mangle -o %s -m mark ! --mark 0 ! --protocol sctp -j CONNMARK --save-mark",
"iptables -I POSTROUTING -t mangle -o %s -m mark ! --mark 0 -j CONNMARK --save-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Save mark\n");
ret = -1;
}
if (snprintf(system_cmd, 256,
"iptables -I PREROUTING -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Restore mark\n");
ret = -1;
}
}
if (snprintf(system_cmd, 256,
"iptables -I INPUT -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Restore mark\n");
ret = -1;
}
if (snprintf(system_cmd, 256,
"iptables -I PREROUTING -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Restore mark\n");
ret = -1;
}
#endif
return ret;
......@@ -617,25 +594,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
SPGW_APP_ERROR("Add route: for %s\n", astring);
}
if (config_pP->sgw_config.sgw_drop_downlink_traffic) {
if (snprintf(system_cmd, 128,
"iptables -t filter -I FORWARD -d %s/%s -j DROP",
astring, atoken2) > 0) {
spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Drop downlink traffic\n");
}
if (snprintf(system_cmd, 128,
"iptables -t filter -I OUTPUT -d %s/%s -j DROP",
astring, atoken2) > 0) {
spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Drop downlink traffic\n");
}
}
#endif
prefix_mask = atoi(atoken2);
......@@ -667,10 +625,11 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
in_addr_var.s_addr = config_pP->pgw_config.ipv4.pgw_ipv4_address_for_SGI;
if (snprintf(system_cmd, 256,
"iptables -t nat -I POSTROUTING -s %s/%s -o %s ! --protocol sctp -j SNAT --to-source %s",
//"iptables -t nat -I POSTROUTING -s %s/%s -o %s ! --protocol sctp -j SNAT --to-source %s",
"iptables -t nat -I POSTROUTING -s %s/%s ! --protocol sctp -j SNAT --to-source %s",
astring,
atoken2,
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI,
//config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI,
inet_ntoa(in_addr_var)) > 0) {
SPGW_APP_INFO("Masquerade SGI: %s\n",system_cmd);
spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
......
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