no_ipv4, no_ipv6, prefer_ipv4 is tested

This commit is contained in:
Sukchan Lee 2017-12-06 12:13:56 +09:00
parent 9d3049de00
commit 1c587edff5
8 changed files with 32 additions and 23 deletions

View File

@ -66,19 +66,22 @@ status_t gtp_f_teid_to_sockaddr(
addr->sin.sin_addr.s_addr = f_teid->ip.both.addr;
memcpy(addr6->sin6.sin6_addr.s6_addr, f_teid->ip.both.addr6, IPV6_LEN);
*list = addr;
}
else if (f_teid->ipv4)
{
addr->sin.sin_addr.s_addr = f_teid->ip.addr;
core_free(addr6);
*list = addr;
}
else if (f_teid->ipv6)
{
addr6 = core_calloc(1, sizeof(c_sockaddr_t));
d_assert(addr6, return CORE_ERROR,);
memcpy(addr6->sin6.sin6_addr.s6_addr, f_teid->ip.addr6, IPV6_LEN);
core_free(addr);
*list = addr6;
}
else
{
@ -87,8 +90,6 @@ status_t gtp_f_teid_to_sockaddr(
d_assert(0, return CORE_ERROR,);
}
*list = addr;
return CORE_OK;
}

View File

@ -96,9 +96,9 @@ gtp_node_t *gtp_add_node_by_f_teid(list_t *list, gtp_f_teid_t *f_teid,
rv = gtp_add_node(list, &node, sa_list, no_ipv4, no_ipv6, prefer_ipv4);
d_assert(rv == CORE_OK, return NULL,);
d_assert(node, return NULL,);
if (node)
memcpy(&node->ip, &f_teid->ip, sizeof(ip_t));
memcpy(&node->ip, &f_teid->ip, sizeof(ip_t));
core_freeaddrinfo(sa_list);

View File

@ -436,7 +436,7 @@ status_t mme_context_parse_config()
if (context_self()->parameter.no_ipv6 == 0)
{
rv = sock_add_node(&self.gtpc_list,
rv = sock_add_node(&self.gtpc_list6,
&node, list, AF_INET6);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}

View File

@ -288,7 +288,7 @@ status_t pgw_context_parse_config()
if (context_self()->parameter.no_ipv6 == 0)
{
rv = sock_add_node(&self.gtpc_list,
rv = sock_add_node(&self.gtpc_list6,
&node, list, AF_INET6);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}

View File

@ -56,7 +56,7 @@ status_t pgw_s5c_build_create_session_response(
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
data = &pgw_s5c_teid;
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
len = GTP_F_TEID_IPV4_LEN;
len = len;
/* PDN Address Allocation */
d_assert(sess->ip_pool, return CORE_ERROR, "No IP Pool");

View File

@ -247,7 +247,7 @@ status_t sgw_context_parse_config()
if (context_self()->parameter.no_ipv6 == 0)
{
rv = sock_add_node(&self.gtpc_list,
rv = sock_add_node(&self.gtpc_list6,
&node, list, AF_INET6);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}

View File

@ -95,14 +95,16 @@ mme:
#
# o Specify local addresses the GTP-C server must bind to
#
# o Multiple GTP-C Server(127.0.0.1:2123, [::1]:2123)
# o GTP-C Server(127.0.0.1:2123, [::1]:2123)
# gtpc:
# - addr: 127.0.0.1
# - addr: ::1
# - addr:
# - 127.0.0.1
# - ::1
#
gtpc:
- addr: 127.0.0.1
- addr: ::1
- addr:
- 127.0.0.1
- ::1
#
# <GUMMEI>
@ -180,10 +182,14 @@ sgw:
#
# o Single GTP-C Server(127.0.0.2:2123)
# gtpc:
# addr: 127.0.0.2
# addr:
# - 127.0.0.2
# - fec0::2
#
gtpc:
addr: 127.0.0.2
addr:
- 127.0.0.2
- fec0::2
#
# <GTP-U Server>>
@ -223,7 +229,9 @@ pgw:
# addr: 127.0.0.3
#
gtpc:
addr: 127.0.0.3
addr:
- 127.0.0.3
- fec0::3
#
# <GTP-U Server>>

View File

@ -13,8 +13,8 @@ else
ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
ifconfig lo0 inet6 alias fe80::2 prefixlen 64
ifconfig lo0 inet6 alias fe80::3 prefixlen 64
ifconfig lo0 inet6 alias fe80::4 prefixlen 64
ifconfig lo0 inet6 alias fe80::5 prefixlen 64
ifconfig lo0 inet6 fec0::2 prefixlen 128
ifconfig lo0 inet6 fec0::3 prefixlen 128
ifconfig lo0 inet6 fec0::4 prefixlen 128
ifconfig lo0 inet6 fec0::5 prefixlen 128
fi