mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-02 04:53:37 +00:00
P-CSCF IP address configuration is added in PGW
This commit is contained in:
@@ -246,9 +246,11 @@ CORE_DECLARE(c_int16_t) apn_parse(c_int8_t *dst, c_int8_t *src, c_int16_t len);
|
||||
|
||||
#define PCO_ID_INTERNET_PROTOCOL_CONTROL_PROTOCOL 0x8021
|
||||
#define PCO_ID_CHALLENGE_HANDSHAKE_AUTHENTICATION_PROTOCOL 0xc223
|
||||
#define PCO_ID_P_CSCF_IPV6_ADDRESS_REQUEST 0x0001
|
||||
#define PCO_ID_DNS_SERVER_IPV6_ADDRESS_REQUEST 0x0003
|
||||
#define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d
|
||||
#define PCO_ID_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING 0x000a
|
||||
#define PCO_ID_P_CSCF_IPV4_ADDRESS_REQUEST 0x000c
|
||||
#define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d
|
||||
#define PCO_ID_IPV4_LINK_MTU_REQUEST 0x0010
|
||||
typedef struct _pco_ipcp_options_t {
|
||||
c_uint8_t type;
|
||||
|
||||
@@ -557,7 +557,6 @@ status_t pgw_context_parse_config()
|
||||
}
|
||||
else if (!strcmp(pgw_key, "dns"))
|
||||
{
|
||||
int count = 0;
|
||||
yaml_iter_t dns_iter;
|
||||
yaml_iter_recurse(&pgw_iter, &dns_iter);
|
||||
d_assert(yaml_iter_type(&dns_iter) !=
|
||||
@@ -599,14 +598,59 @@ status_t pgw_context_parse_config()
|
||||
d_warn("Ignore DNS : %s", v);
|
||||
}
|
||||
|
||||
count++;
|
||||
} while(
|
||||
yaml_iter_type(&dns_iter) ==
|
||||
YAML_SEQUENCE_NODE);
|
||||
}
|
||||
else if (!strcmp(pgw_key, "p-cscf"))
|
||||
{
|
||||
yaml_iter_t dns_iter;
|
||||
yaml_iter_recurse(&pgw_iter, &dns_iter);
|
||||
d_assert(yaml_iter_type(&dns_iter) !=
|
||||
YAML_MAPPING_NODE, return CORE_ERROR,);
|
||||
|
||||
self.num_of_p_cscf = 0;
|
||||
self.num_of_p_cscf6 = 0;
|
||||
do
|
||||
{
|
||||
const char *v = NULL;
|
||||
|
||||
if (yaml_iter_type(&dns_iter) ==
|
||||
YAML_SEQUENCE_NODE)
|
||||
{
|
||||
if (!yaml_iter_next(&dns_iter))
|
||||
break;
|
||||
}
|
||||
|
||||
v = yaml_iter_value(&dns_iter);
|
||||
if (v)
|
||||
{
|
||||
ipsubnet_t ipsub;
|
||||
rv = core_ipsubnet(&ipsub, v, NULL);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
||||
if (ipsub.family == AF_INET)
|
||||
{
|
||||
if (self.num_of_p_cscf >= MAX_NUM_OF_P_CSCF)
|
||||
d_warn("Ignore P-CSCF : %s", v);
|
||||
else self.p_cscf[self.num_of_p_cscf++] = v;
|
||||
}
|
||||
else if (ipsub.family == AF_INET6)
|
||||
{
|
||||
if (self.num_of_p_cscf6 >= MAX_NUM_OF_P_CSCF)
|
||||
d_warn("Ignore P-CSCF : %s", v);
|
||||
else self.p_cscf6[self.num_of_p_cscf6++] = v;
|
||||
}
|
||||
else
|
||||
d_warn("Ignore P-CSCF : %s", v);
|
||||
}
|
||||
|
||||
} while(
|
||||
yaml_iter_type(&dns_iter) ==
|
||||
YAML_SEQUENCE_NODE);
|
||||
}
|
||||
else
|
||||
d_warn("unknown key `%s`", pgw_key);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,16 @@ typedef struct _pgw_context_t {
|
||||
tm_service_t tm_service; /* Timer Service */
|
||||
|
||||
#define MAX_NUM_OF_DNS 2
|
||||
const char *dns[MAX_NUM_OF_DNS]; /* Primary/Secondanry */
|
||||
const char *dns6[MAX_NUM_OF_DNS]; /* Primary/Secondanry */
|
||||
const char *dns[MAX_NUM_OF_DNS];
|
||||
const char *dns6[MAX_NUM_OF_DNS];
|
||||
|
||||
#define MAX_NUM_OF_P_CSCF 16
|
||||
const char *p_cscf[MAX_NUM_OF_P_CSCF];
|
||||
int num_of_p_cscf;
|
||||
int p_cscf_index;
|
||||
const char *p_cscf6[MAX_NUM_OF_P_CSCF];
|
||||
int num_of_p_cscf6;
|
||||
int p_cscf6_index;
|
||||
|
||||
list_t sgw_s5c_list; /* SGW GTPC Node List */
|
||||
list_t sgw_s5u_list; /* SGW GTPU Node List */
|
||||
|
||||
@@ -353,6 +353,7 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco)
|
||||
pco_t ue, pgw;
|
||||
pco_ipcp_t pco_ipcp;
|
||||
ipsubnet_t dns_primary, dns_secondary, dns6_primary, dns6_secondary;
|
||||
ipsubnet_t p_cscf, p_cscf6;
|
||||
c_int8_t size = 0;
|
||||
int i = 0;
|
||||
|
||||
@@ -473,6 +474,40 @@ static c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PCO_ID_P_CSCF_IPV4_ADDRESS_REQUEST:
|
||||
{
|
||||
if (pgw_self()->num_of_p_cscf)
|
||||
{
|
||||
rv = core_ipsubnet(&p_cscf,
|
||||
pgw_self()->p_cscf[pgw_self()->p_cscf_index], NULL);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
pgw.ids[pgw.num_of_id].id = ue.ids[i].id;
|
||||
pgw.ids[pgw.num_of_id].len = IPV4_LEN;
|
||||
pgw.ids[pgw.num_of_id].data = p_cscf.sub;
|
||||
pgw.num_of_id++;
|
||||
|
||||
pgw_self()->p_cscf_index++;
|
||||
pgw_self()->p_cscf_index %= pgw_self()->num_of_p_cscf;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PCO_ID_P_CSCF_IPV6_ADDRESS_REQUEST:
|
||||
{
|
||||
if (pgw_self()->num_of_p_cscf6)
|
||||
{
|
||||
rv = core_ipsubnet(&p_cscf6,
|
||||
pgw_self()->p_cscf6[pgw_self()->p_cscf6_index], NULL);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
pgw.ids[pgw.num_of_id].id = ue.ids[i].id;
|
||||
pgw.ids[pgw.num_of_id].len = IPV6_LEN;
|
||||
pgw.ids[pgw.num_of_id].data = p_cscf6.sub;
|
||||
pgw.num_of_id++;
|
||||
|
||||
pgw_self()->p_cscf6_index++;
|
||||
pgw_self()->p_cscf6_index %= pgw_self()->num_of_p_cscf6;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PCO_ID_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING:
|
||||
/* TODO */
|
||||
break;
|
||||
|
||||
@@ -309,5 +309,15 @@ pgw:
|
||||
- 2001:4860:4860::8888
|
||||
- 2001:4860:4860::8844
|
||||
|
||||
#
|
||||
# <P-CSCF>
|
||||
#
|
||||
# o Proxy Call Session Control Function
|
||||
#
|
||||
# p-cscf:
|
||||
# - 127.0.0.1
|
||||
# - ::1
|
||||
#
|
||||
|
||||
pcrf:
|
||||
freeDiameter: "pcrf.conf"
|
||||
|
||||
Reference in New Issue
Block a user