forked from acouzens/open5gs
WebUI PGW IP setting is added
This commit is contained in:
parent
634de8c788
commit
cc762f3c00
|
@ -226,10 +226,7 @@ typedef struct _pdn_t {
|
|||
bitrate_t ambr; /* APN-AMBR */
|
||||
|
||||
paa_t paa;
|
||||
struct {
|
||||
c_uint32_t ipv4_addr;
|
||||
c_uint8_t ipv6_addr[IPV6_LEN];
|
||||
} pgw;
|
||||
ip_t pgw_ip;
|
||||
} pdn_t;
|
||||
|
||||
CORE_DECLARE(c_int16_t) apn_build(c_int8_t *dst, c_int8_t *src, c_int16_t len);
|
||||
|
|
|
@ -13,6 +13,7 @@ extern "C" {
|
|||
#define S6A_AVP_CODE_CONTEXT_IDENTIFIER (1423)
|
||||
#define S6A_AVP_CODE_ALL_APN_CONFIG_INC_IND (1428)
|
||||
#define S6A_AVP_CODE_APN_CONFIGURATION (1430)
|
||||
#define S6A_AVP_CODE_MIP_HOME_AGENT_ADDRESS (334)
|
||||
|
||||
#define S6A_RAT_TYPE_WLAN 0
|
||||
#define S6A_RAT_TYPE_VIRTUAL 1
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "core_debug.h"
|
||||
#include "core_lib.h"
|
||||
#include "core_network.h"
|
||||
|
||||
#include <mongoc.h>
|
||||
#include <yaml.h>
|
||||
|
@ -566,12 +567,32 @@ status_t hss_db_subscription_data(
|
|||
{
|
||||
const char *child3_key =
|
||||
bson_iter_key(&child3_iter);
|
||||
if (!strcmp(child3_key, "ipv4") &&
|
||||
if (!strcmp(child3_key, "addr") &&
|
||||
BSON_ITER_HOLDS_UTF8(&child3_iter))
|
||||
{
|
||||
utf8 = (char *)bson_iter_utf8(
|
||||
&child3_iter, &length);
|
||||
pdn->pgw.ipv4_addr = inet_addr(utf8);
|
||||
ipsubnet_t ipsub;
|
||||
const char *v =
|
||||
bson_iter_utf8(&child3_iter, &length);
|
||||
rv = core_ipsubnet(&ipsub, v, NULL);
|
||||
if (rv == CORE_OK)
|
||||
{
|
||||
pdn->pgw_ip.ipv4 = 1;
|
||||
pdn->pgw_ip.both.addr = ipsub.sub[0];
|
||||
}
|
||||
}
|
||||
else if (!strcmp(child3_key, "addr6") &&
|
||||
BSON_ITER_HOLDS_UTF8(&child3_iter))
|
||||
{
|
||||
ipsubnet_t ipsub;
|
||||
const char *v =
|
||||
bson_iter_utf8(&child3_iter, &length);
|
||||
rv = core_ipsubnet(&ipsub, v, NULL);
|
||||
if (rv == CORE_OK)
|
||||
{
|
||||
pdn->pgw_ip.ipv6 = 1;
|
||||
memcpy(pdn->pgw_ip.both.addr6,
|
||||
ipsub.sub, sizeof(ipsub.sub));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "core_debug.h"
|
||||
#include "core_lib.h"
|
||||
#include "core_sha2.h"
|
||||
#include "core_network.h"
|
||||
|
||||
#include "fd_lib.h"
|
||||
#include "s6a_dict.h"
|
||||
|
@ -205,6 +206,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
c_uint32_t result_code = 0;
|
||||
s6a_subscription_data_t subscription_data;
|
||||
struct sockaddr_in sin;
|
||||
struct sockaddr_in6 sin6;
|
||||
|
||||
d_assert(msg, return EINVAL,);
|
||||
|
||||
|
@ -412,18 +414,35 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||
MSG_BRW_LAST_CHILD, eps_subscribed_qos_profile) );
|
||||
|
||||
/* Set MIP6-Agent-Info */
|
||||
if (pdn->pgw.ipv4_addr)
|
||||
if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6)
|
||||
{
|
||||
CHECK_FCT( fd_msg_avp_new(fd_mip6_agent_info, 0,
|
||||
&mip6_agent_info) );
|
||||
CHECK_FCT( fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
||||
&mip_home_agent_address) );
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = pdn->pgw.ipv4_addr;
|
||||
CHECK_FCT( fd_msg_avp_value_encode (
|
||||
&sin, mip_home_agent_address ) );
|
||||
CHECK_FCT( fd_msg_avp_add(mip6_agent_info,
|
||||
|
||||
if (pdn->pgw_ip.ipv4)
|
||||
{
|
||||
CHECK_FCT( fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
||||
&mip_home_agent_address) );
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = pdn->pgw_ip.both.addr;
|
||||
CHECK_FCT( fd_msg_avp_value_encode (
|
||||
&sin, mip_home_agent_address ) );
|
||||
CHECK_FCT( fd_msg_avp_add(mip6_agent_info,
|
||||
MSG_BRW_LAST_CHILD, mip_home_agent_address) );
|
||||
}
|
||||
|
||||
if (pdn->pgw_ip.ipv6)
|
||||
{
|
||||
CHECK_FCT( fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
||||
&mip_home_agent_address) );
|
||||
sin6.sin6_family = AF_INET6;
|
||||
memcpy(sin6.sin6_addr.s6_addr, pdn->pgw_ip.both.addr6,
|
||||
sizeof pdn->pgw_ip.both.addr6);
|
||||
CHECK_FCT( fd_msg_avp_value_encode (
|
||||
&sin6, mip_home_agent_address ) );
|
||||
CHECK_FCT( fd_msg_avp_add(mip6_agent_info,
|
||||
MSG_BRW_LAST_CHILD, mip_home_agent_address) );
|
||||
}
|
||||
|
||||
CHECK_FCT( fd_msg_avp_add(apn_configuration,
|
||||
MSG_BRW_LAST_CHILD, mip6_agent_info) );
|
||||
|
|
|
@ -744,33 +744,45 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg)
|
|||
fd_mip6_agent_info, &avpch3), return );
|
||||
if (avpch3)
|
||||
{
|
||||
CHECK_FCT_DO( fd_avp_search_avp(avpch3,
|
||||
fd_mip_home_agent_address, &avpch4), return );
|
||||
if (avpch4)
|
||||
CHECK_FCT_DO( fd_msg_browse(avpch3,
|
||||
MSG_BRW_FIRST_CHILD, &avpch4, NULL), return );
|
||||
while(avpch4)
|
||||
{
|
||||
struct sockaddr_storage ss;
|
||||
struct sockaddr_in *sin;
|
||||
CHECK_FCT_DO(
|
||||
fd_msg_avp_hdr(avpch4, &hdr), return );
|
||||
switch(hdr->avp_code)
|
||||
{
|
||||
case S6A_AVP_CODE_MIP_HOME_AGENT_ADDRESS:
|
||||
{
|
||||
c_sockaddr_t addr;
|
||||
|
||||
CHECK_FCT_DO(
|
||||
fd_msg_avp_hdr(avpch4, &hdr), return );
|
||||
CHECK_FCT_DO(
|
||||
fd_msg_avp_value_interpret(avpch4, &ss),
|
||||
return);
|
||||
sin = (struct sockaddr_in *)&ss;
|
||||
d_assert(sin, return, "Null param");
|
||||
if (sin->sin_family == AF_INET)
|
||||
{
|
||||
pdn->pgw.ipv4_addr = sin->sin_addr.s_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_error("Not implemented(%d)",
|
||||
sin->sin_family);
|
||||
CHECK_FCT_DO(
|
||||
fd_msg_avp_value_interpret(avpch4,
|
||||
&addr.sa), return );
|
||||
if (addr.c_sa_family == AF_INET)
|
||||
{
|
||||
pdn->pgw_ip.ipv4 = 1;
|
||||
pdn->pgw_ip.both.addr =
|
||||
addr.sin.sin_addr.s_addr;
|
||||
}
|
||||
else if (addr.c_sa_family == AF_INET6)
|
||||
{
|
||||
pdn->pgw_ip.ipv6 = 1;
|
||||
memcpy(pdn->pgw_ip.both.addr6,
|
||||
addr.sin6.sin6_addr.s6_addr,
|
||||
IPV6_LEN);
|
||||
}
|
||||
else
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
fd_msg_browse(avpch4, MSG_BRW_NEXT,
|
||||
&avpch4, NULL);
|
||||
}
|
||||
else
|
||||
error++;
|
||||
|
||||
}
|
||||
|
||||
CHECK_FCT_DO( fd_avp_search_avp(avpch2, s6a_ambr,
|
||||
|
|
|
@ -78,14 +78,34 @@ status_t mme_s11_build_create_session_request(
|
|||
|
||||
memset(&pgw_s5c_teid, 0, sizeof(gtp_f_teid_t));
|
||||
pgw_s5c_teid.interface_type = GTP_F_TEID_S5_S8_PGW_GTP_C;
|
||||
if (pdn->pgw.ipv4_addr)
|
||||
if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6)
|
||||
{
|
||||
/* FIXME */
|
||||
pgw_s5c_teid.ipv4 = 1;
|
||||
pgw_s5c_teid.addr = pdn->pgw.ipv4_addr;
|
||||
pgw_s5c_teid.ipv4 = pdn->pgw_ip.ipv4;
|
||||
pgw_s5c_teid.ipv6 = pdn->pgw_ip.ipv6;
|
||||
if (pgw_s5c_teid.ipv4 && pgw_s5c_teid.ipv6)
|
||||
{
|
||||
pgw_s5c_teid.both.addr = pdn->pgw_ip.both.addr;
|
||||
memcpy(pgw_s5c_teid.both.addr6, pdn->pgw_ip.both.addr6,
|
||||
sizeof pdn->pgw_ip.both.addr6);
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.len =
|
||||
GTP_F_TEID_IPV4V6_LEN;
|
||||
}
|
||||
else if (pgw_s5c_teid.ipv4)
|
||||
{
|
||||
/* pdn->pgw_ip always uses both ip address memory */
|
||||
pgw_s5c_teid.addr = pdn->pgw_ip.both.addr;
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.len =
|
||||
GTP_F_TEID_IPV4_LEN;
|
||||
}
|
||||
else if (pgw_s5c_teid.ipv6)
|
||||
{
|
||||
/* pdn->pgw_ip always uses both ip address memory */
|
||||
memcpy(pgw_s5c_teid.addr6, pdn->pgw_ip.both.addr6,
|
||||
sizeof pdn->pgw_ip.both.addr6);
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.len =
|
||||
GTP_F_TEID_IPV6_LEN;
|
||||
}
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.presence = 1;
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.len =
|
||||
GTP_F_TEID_IPV4_LEN;
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.data =
|
||||
&pgw_s5c_teid;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ const Profile = new Schema({
|
|||
uplink: Schema.Types.Long
|
||||
},
|
||||
pgw: {
|
||||
ipv4: String
|
||||
addr: String,
|
||||
addr6: String
|
||||
},
|
||||
pcc_rule: [{
|
||||
flow: [{
|
||||
|
|
|
@ -59,7 +59,8 @@ const Subscriber = new Schema({
|
|||
uplink: Schema.Types.Long
|
||||
},
|
||||
pgw: {
|
||||
ipv4: String
|
||||
addr: String,
|
||||
addr6: String
|
||||
},
|
||||
pcc_rule: [{
|
||||
flow: [{
|
||||
|
|
|
@ -145,11 +145,16 @@ const schema = {
|
|||
"type": "object",
|
||||
"title": "",
|
||||
"properties": {
|
||||
"ipv4": {
|
||||
"addr": {
|
||||
"type": "string",
|
||||
"title": "PGW IPv4 Address",
|
||||
"format" : "ipv4"
|
||||
},
|
||||
"addr6": {
|
||||
"type": "string",
|
||||
"title": "PGW IPv6 Address",
|
||||
"format" : "ipv6"
|
||||
},
|
||||
}
|
||||
},
|
||||
"pcc_rule": {
|
||||
|
|
|
@ -142,7 +142,7 @@ const Pdn = styled.div`
|
|||
margin: 0px 32px;
|
||||
|
||||
.small_data {
|
||||
width: 60px;
|
||||
width: 50px;
|
||||
font-size: 12px;
|
||||
margin: 4px;
|
||||
}
|
||||
|
@ -279,7 +279,8 @@ const View = ({ visible, disableOnClickOutside, profile, onEdit, onDelete, onHid
|
|||
</div>
|
||||
}
|
||||
<div className="large_data"></div>
|
||||
<div className="small_data">{(pdn.pgw || {}).ipv4}</div>
|
||||
<div className="small_data">{(pdn.pgw || {}).addr}</div>
|
||||
<div className="small_data">{(pdn.pgw || {}).addr6}</div>
|
||||
</div>
|
||||
{pdn['pcc_rule'] !== undefined &&
|
||||
pdn.pcc_rule.map((pcc_rule, index) =>
|
||||
|
|
|
@ -151,11 +151,16 @@ const schema = {
|
|||
"type": "object",
|
||||
"title": "",
|
||||
"properties": {
|
||||
"ipv4": {
|
||||
"addr": {
|
||||
"type": "string",
|
||||
"title": "PGW IPv4 Address",
|
||||
"format" : "ipv4"
|
||||
},
|
||||
"addr6": {
|
||||
"type": "string",
|
||||
"title": "PGW IPv6 Address",
|
||||
"format" : "ipv6"
|
||||
},
|
||||
}
|
||||
},
|
||||
"pcc_rule": {
|
||||
|
|
|
@ -142,7 +142,7 @@ const Pdn = styled.div`
|
|||
margin: 0px 32px;
|
||||
|
||||
.small_data {
|
||||
width: 60px;
|
||||
width: 50px;
|
||||
font-size: 12px;
|
||||
margin: 4px;
|
||||
}
|
||||
|
@ -278,7 +278,8 @@ const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, on
|
|||
</div>
|
||||
}
|
||||
<div className="large_data"></div>
|
||||
<div className="small_data">{(pdn.pgw || {}).ipv4}</div>
|
||||
<div className="small_data">{(pdn.pgw || {}).addr}</div>
|
||||
<div className="small_data">{(pdn.pgw || {}).addr6}</div>
|
||||
</div>
|
||||
{pdn['pcc_rule'] !== undefined &&
|
||||
pdn.pcc_rule.map((pcc_rule, index) =>
|
||||
|
@ -336,4 +337,4 @@ const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, on
|
|||
)
|
||||
}
|
||||
|
||||
export default View;
|
||||
export default View;
|
||||
|
|
Loading…
Reference in New Issue