Commit bd4794bd authored by KARIM's avatar KARIM

fix conflicts

parent ed8a4620
...@@ -193,6 +193,14 @@ class smf_app { ...@@ -193,6 +193,14 @@ class smf_app {
protocol_configuration_options_t& pco_resp, protocol_configuration_options_t& pco_resp,
const pco_protocol_or_container_id_t* const poc_id); const pco_protocol_or_container_id_t* const poc_id);
int process_pco_p_cscf_request(
protocol_configuration_options_t& pco_resp,
const pco_protocol_or_container_id_t* const poc_id);
int process_pco_p_cscf_v6_request(
protocol_configuration_options_t& pco_resp,
const pco_protocol_or_container_id_t* const poc_id);
public: public:
explicit smf_app(const std::string& config_file); explicit smf_app(const std::string& config_file);
smf_app(smf_app const&) = delete; smf_app(smf_app const&) = delete;
......
...@@ -436,12 +436,37 @@ int smf_config::load(const string& config_file) { ...@@ -436,12 +436,37 @@ int smf_config::load(const string& config_file) {
util::trim(astring).c_str(), default_dnsv4, util::trim(astring).c_str(), default_dnsv4,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"); "BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !");
smf_cfg.lookupValue( smf_cfg.lookupValue(
SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS, astring); SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS, astring);
IPV4_STR_ADDR_TO_INADDR( IPV4_STR_ADDR_TO_INADDR(
util::trim(astring).c_str(), default_dns_secv4, util::trim(astring).c_str(), default_dns_secv4,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"); "BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !");
smf_cfg.lookupValue(SMF_CONFIG_STRING_DEFAULT_CSCF_IPV4_ADDRESS, astring);
IPV4_STR_ADDR_TO_INADDR(
util::trim(astring).c_str(), default_cscfv4,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT CSCF !");
smf_cfg.lookupValue(SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS, astring);
if (inet_pton(AF_INET6, util::trim(astring).c_str(), buf_in6_addr) == 1) {
memcpy(&default_cscfv6, buf_in6_addr, sizeof(struct in6_addr));
} else {
Logger::smf_app().error(
"CONFIG : BAD ADDRESS in " SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS
" %s",
astring.c_str());
throw(
"CONFIG : BAD ADDRESS in " SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS
" %s",
astring.c_str());
}
smf_cfg.lookupValue(SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS, astring); smf_cfg.lookupValue(SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS, astring);
if (inet_pton(AF_INET6, util::trim(astring).c_str(), buf_in6_addr) == 1) { if (inet_pton(AF_INET6, util::trim(astring).c_str(), buf_in6_addr) == 1) {
memcpy(&default_dnsv6, buf_in6_addr, sizeof(struct in6_addr)); memcpy(&default_dnsv6, buf_in6_addr, sizeof(struct in6_addr));
...@@ -876,7 +901,20 @@ void smf_config::display() { ...@@ -876,7 +901,20 @@ void smf_config::display() {
n4.thread_rd_sched_params.sched_policy); Logger::smf_app().info( " n4.thread_rd_sched_params.sched_policy); Logger::smf_app().info( "
Scheduling prio .....: %d", n4.thread_rd_sched_params.sched_priority); Scheduling prio .....: %d", n4.thread_rd_sched_params.sched_priority);
<<<<<<< HEAD
Logger::smf_app().info("- ITTI Timer Task Threading:"); Logger::smf_app().info("- ITTI Timer Task Threading:");
=======
Logger::smf_app().info(
" CSCF .........: %s",
inet_ntoa(*((struct in_addr*) &default_cscfv4)));
if (inet_ntop(AF_INET6, &default_cscfv6, str_addr6, sizeof(str_addr6))) {
Logger::smf_app().info(" CSCF v6 ......: %s", str_addr6);
}
Logger::smf_app().info("- " SMF_CONFIG_STRING_DNN_LIST ":");
for (int i = 0; i < num_dnn; i++) {
Logger::smf_app().info(" DNN %d:", i);
>>>>>>> 89b5f827... backup before adding qos rule update
Logger::smf_app().info( Logger::smf_app().info(
" CPU id ..............: %d", itti.itti_timer_sched_params.cpu_id); " CPU id ..............: %d", itti.itti_timer_sched_params.cpu_id);
Logger::smf_app().info( Logger::smf_app().info(
......
...@@ -67,6 +67,9 @@ ...@@ -67,6 +67,9 @@
#define SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER "-" #define SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER "-"
#define SMF_CONFIG_STRING_IPV6_ADDRESS_PREFIX_DELIMITER "/" #define SMF_CONFIG_STRING_IPV6_ADDRESS_PREFIX_DELIMITER "/"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS "DEFAULT_DNS_IPV4_ADDRESS" #define SMF_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS "DEFAULT_DNS_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_CSCF_IPV4_ADDRESS "DEFAULT_CSCF_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_CSCF_IPV6_ADDRESS "DEFAULT_CSCF_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS \ #define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS \
"DEFAULT_DNS_SEC_IPV4_ADDRESS" "DEFAULT_DNS_SEC_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS "DEFAULT_DNS_IPV6_ADDRESS" #define SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS "DEFAULT_DNS_IPV6_ADDRESS"
...@@ -219,10 +222,41 @@ class smf_config { ...@@ -219,10 +222,41 @@ class smf_config {
struct in_addr default_dnsv4; struct in_addr default_dnsv4;
struct in_addr default_dns_secv4; struct in_addr default_dns_secv4;
struct in_addr default_cscfv4;
struct in6_addr default_dnsv6; struct in6_addr default_dnsv6;
struct in6_addr default_dns_secv6; struct in6_addr default_dns_secv6;
<<<<<<< HEAD
std::map<std::string, dnn_t> dnns; std::map<std::string, dnn_t> dnns;
=======
struct in6_addr default_cscfv6;
#define SMF_NUM_DNN_MAX 5
int num_dnn;
struct {
std::string dnn;
std::string dnn_label;
int pool_id_iv4;
int pool_id_iv6;
pdu_session_type_t pdu_session_type;
} dnn[SMF_NUM_DNN_MAX];
int num_ue_pool;
#define SMF_NUM_UE_POOL_MAX 96
struct in_addr ue_pool_range_low[SMF_NUM_UE_POOL_MAX];
struct in_addr ue_pool_range_high[SMF_NUM_UE_POOL_MAX];
struct in_addr ue_pool_network[SMF_NUM_UE_POOL_MAX];
struct in_addr ue_pool_netmask[SMF_NUM_UE_POOL_MAX];
// computed from config, UE IP adresses that matches
// ue_pool_network[]/ue_pool_netmask[] but do not match ue_pool_range_low[] -
// ue_pool_range_high[]
// The problem here is that OpenFlow do not deal with ip ranges but with
// netmasks
std::vector<struct in_addr> ue_pool_excluded[SMF_NUM_UE_POOL_MAX];
int num_paa6_pool;
struct in6_addr paa_pool6_prefix[SMF_NUM_UE_POOL_MAX];
uint8_t paa_pool6_prefix_len[SMF_NUM_UE_POOL_MAX];
>>>>>>> 89b5f827... backup before adding qos rule update
bool force_push_pco; bool force_push_pco;
uint ue_mtu; uint ue_mtu;
......
...@@ -335,6 +335,63 @@ int smf_app::process_pco_link_mtu_request( ...@@ -335,6 +335,63 @@ int smf_app::process_pco_link_mtu_request(
return pco_push_protocol_or_container_id(pco_resp, &poc_id_resp); return pco_push_protocol_or_container_id(pco_resp, &poc_id_resp);
} }
//------------------------------------------------------------------------------
int smf_app::process_pco_p_cscf_request(
protocol_configuration_options_t& pco_resp,
const pco_protocol_or_container_id_t* const poc_id) {
in_addr_t cscf_ipv4_addr = smf_cfg.default_cscfv4.s_addr;
pco_protocol_or_container_id_t poc_id_resp = {0};
uint8_t cscf_array[4];
Logger::smf_app().debug(
"PCO: Protocol identifier P CSCF Request");
poc_id_resp.protocol_id = PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS;
poc_id_resp.length_of_protocol_id_contents = 4;
cscf_array[0] = (uint8_t)(cscf_ipv4_addr & 0x000000FF);
cscf_array[1] = (uint8_t)((cscf_ipv4_addr >> 8) & 0x000000FF);
cscf_array[2] = (uint8_t)((cscf_ipv4_addr >> 16) & 0x000000FF);
cscf_array[3] = (uint8_t)((cscf_ipv4_addr >> 24) & 0x000000FF);
std::string tmp_s((const char*) &cscf_array[0], sizeof(cscf_array));
poc_id_resp.protocol_id_contents = tmp_s;
return pco_push_protocol_or_container_id(pco_resp, &poc_id_resp);
}
//------------------------------------------------------------------------------
int smf_app::process_pco_p_cscf_v6_request(
protocol_configuration_options_t& pco_resp,
const pco_protocol_or_container_id_t* const poc_id) {
in6_addr cscf_ipv6_addr = smf_cfg.default_cscfv6;
pco_protocol_or_container_id_t poc_id_resp = {0};
uint8_t cscfv6_array[16];
Logger::smf_app().debug(
"PCO: Protocol identifier P CSCF v6 Request");
poc_id_resp.protocol_id = PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS;
poc_id_resp.length_of_protocol_id_contents = 16;
char str_addr6[INET6_ADDRSTRLEN];
if (inet_ntop(
AF_INET6, &cscf_ipv6_addr, str_addr6,
sizeof(str_addr6))) {
std::string ipv6_addr_str((char*) str_addr6, INET6_ADDRSTRLEN);
Logger::smf_app().info(" CSCF Ipv6 address....: %s", ipv6_addr_str.c_str());
unsigned char buf_in6_addr[sizeof(struct in6_addr)];
if (inet_pton(AF_INET6, util::trim(ipv6_addr_str).c_str(), buf_in6_addr) ==
1) {
for (int i = 0; i <= 15; i++) cscfv6_array[i] = (uint8_t)(buf_in6_addr[i]);
}
}
std::string tmp_s((const char*) &cscfv6_array[0], sizeof(cscfv6_array));
poc_id_resp.protocol_id_contents = tmp_s;
return pco_push_protocol_or_container_id(pco_resp, &poc_id_resp);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int smf_app::process_pco_request( int smf_app::process_pco_request(
const protocol_configuration_options_t& pco_req, const protocol_configuration_options_t& pco_req,
...@@ -384,6 +441,17 @@ int smf_app::process_pco_request( ...@@ -384,6 +441,17 @@ int smf_app::process_pco_request(
pco_ids.ci_ipv4_link_mtu_request = true; pco_ids.ci_ipv4_link_mtu_request = true;
break; break;
case PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS_REQUEST:
process_pco_p_cscf_v6_request(
pco_resp, &pco_req.protocol_or_container_ids[id]);
pco_ids.ci_ipv6_p_cscf_request = true;
break;
case PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS_REQUEST:
process_pco_p_cscf_request(
pco_resp, &pco_req.protocol_or_container_ids[id]);
pco_ids.ci_ipv4_p_cscf_request = true;
break;
default: default:
Logger::smf_app().warn( Logger::smf_app().warn(
"PCO: Protocol/container identifier 0x%04X not supported now", "PCO: Protocol/container identifier 0x%04X not supported now",
......
...@@ -48,6 +48,8 @@ typedef struct protocol_configuration_options_ids_s { ...@@ -48,6 +48,8 @@ typedef struct protocol_configuration_options_ids_s {
uint8_t ci_ipv4_address_allocation_via_dhcpv4 : 1; uint8_t ci_ipv4_address_allocation_via_dhcpv4 : 1;
uint8_t ci_ipv4_link_mtu_request : 1; uint8_t ci_ipv4_link_mtu_request : 1;
uint8_t ci_dns_server_ipv6_address_request : 1; uint8_t ci_dns_server_ipv6_address_request : 1;
uint8_t ci_ipv6_p_cscf_request : 1;
uint8_t ci_ipv4_p_cscf_request : 1;
} protocol_configuration_options_ids_t; } protocol_configuration_options_ids_t;
#endif #endif
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