Commit cca5bcd9 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for UPF - FQDN

parent 94d5f4cb
...@@ -97,31 +97,31 @@ bool pfcp_associations::add_association( ...@@ -97,31 +97,31 @@ bool pfcp_associations::add_association(
// Resolve FQDN to get UPF IP address if necessary // Resolve FQDN to get UPF IP address if necessary
if (node_id.node_id_type == pfcp::NODE_ID_TYPE_FQDN) { if (node_id.node_id_type == pfcp::NODE_ID_TYPE_FQDN) {
Logger::smf_app().info("Node ID Type FQDN: %s", node_id.fqdn.c_str()); Logger::smf_app().info("Node ID Type FQDN: %s", node_id.fqdn.c_str());
} struct hostent* record = gethostbyname(node_id.fqdn.c_str());
struct hostent* record = gethostbyname(node_id.fqdn.c_str()); if (record == NULL) {
if (record == NULL) { Logger::smf_app().info(
Logger::smf_app().info( "Add association with node (FQDN) %s: cannot resolve the hostname!",
"Add association with node (FQDN) %s: cannot resolve the hostname!", node_id.fqdn.c_str());
node_id.fqdn.c_str()); return false;
return false; }
}
if (record->h_addrtype == AF_INET) { if (record->h_addrtype == AF_INET) {
in_addr* address = (struct in_addr*) record->h_addr; in_addr* address = (struct in_addr*) record->h_addr;
node_id.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; node_id.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS;
node_id.u1.ipv4_address = *address; node_id.u1.ipv4_address = *address;
Logger::smf_app().info( Logger::smf_app().info(
"Node ID Type FQDN: %s, IPv4 Addr: %s", node_id.fqdn.c_str(), "Node ID Type FQDN: %s, IPv4 Addr: %s", node_id.fqdn.c_str(),
inet_ntoa(*address)); inet_ntoa(*address));
} else if (record->h_addrtype == AF_INET6) { } else if (record->h_addrtype == AF_INET6) {
// TODO // TODO
Logger::smf_app().info( Logger::smf_app().info(
"Node ID Type FQDN: %s. IPv6 Addr, this mode has not been supported " "Node ID Type FQDN: %s. IPv6 Addr, this mode has not been "
"yet!", "supported yet!",
node_id.fqdn.c_str()); node_id.fqdn.c_str());
return false; return false;
} else { } else {
return false; return false;
}
} }
restore_n4_sessions = false; restore_n4_sessions = false;
...@@ -166,30 +166,30 @@ bool pfcp_associations::add_association( ...@@ -166,30 +166,30 @@ bool pfcp_associations::add_association(
} else { } else {
if (node_id.node_id_type == pfcp::NODE_ID_TYPE_FQDN) { if (node_id.node_id_type == pfcp::NODE_ID_TYPE_FQDN) {
Logger::smf_app().info("Node ID Type FQDN: %s", node_id.fqdn.c_str()); Logger::smf_app().info("Node ID Type FQDN: %s", node_id.fqdn.c_str());
} struct hostent* record = gethostbyname(node_id.fqdn.c_str());
struct hostent* record = gethostbyname(node_id.fqdn.c_str()); if (record == NULL) {
if (record == NULL) { Logger::smf_app().info(
Logger::smf_app().info( "Add association with node (FQDN) %s: cannot resolve the hostname!",
"Add association with node (FQDN) %s: cannot resolve the hostname!", node_id.fqdn.c_str());
node_id.fqdn.c_str()); return false;
return false; }
} if (record->h_addrtype == AF_INET) {
if (record->h_addrtype == AF_INET) { in_addr* address = (struct in_addr*) record->h_addr;
in_addr* address = (struct in_addr*) record->h_addr; node_id.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS;
node_id.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; node_id.u1.ipv4_address = *address;
node_id.u1.ipv4_address = *address; Logger::smf_app().info(
Logger::smf_app().info( "Node ID Type FQDN: %s, IPv4 Addr: %s", node_id.fqdn.c_str(),
"Node ID Type FQDN: %s, IPv4 Addr: %s", node_id.fqdn.c_str(), inet_ntoa(*address));
inet_ntoa(*address)); } else if (record->h_addrtype == AF_INET6) {
} else if (record->h_addrtype == AF_INET6) { // TODO
// TODO Logger::smf_app().info(
Logger::smf_app().info( "Node ID Type FQDN: %s. IPv6 Addr, this mode has not been "
"Node ID Type FQDN: %s. IPv6 Addr, this mode has not been supported " "supported yet!",
"yet!", node_id.fqdn.c_str());
node_id.fqdn.c_str()); return false;
return false; } else {
} else { return false;
return false; }
} }
restore_n4_sessions = false; restore_n4_sessions = false;
......
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