mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-hnbgw.git
synced 2025-11-02 04:53:21 +00:00
pfcp: implement sending Network Instance IEs
Allow configuring specific Network Instance names for the Core and
Access sides, to send to the UPF, to allow the UPF to pick the proper
network interface to create GTP tunnels on.
Add VTY cfg 'hnbgw' / 'pfcp' / 'netinst (access|core) NAME' to allow
configuring Network Interface values to send in PFCP. These are "dotted"
domain name strings, as in APN.
Add these Network Interface names to the PFCP messages' detection as
well as forwarding rules, each one indicating the side that it is
detecting on or forwarding to.
This helps lift osmo-hnbgw's PFCP support out of lab situations to a
proper production scenario, where the core and access networks are in
separate subnets, with osmo-hnbgw + UPF as the gateway.
For example, in osmo-hnbgw, configure
hnbgw
pfcp
netinst access my-ran
netinst core my-core
and in osmo-upf, configure
netinst
add my-ran 10.9.8.7
add my-core 1.2.3.4
In effect, all GTP tunnel endpoints towards the Access side will be
bound on 10.9.8.7, and all GTP tunnel endpoints towards the Core side
will be bound on 1.2.3.4.
Related: SYS#5895
Change-Id: Ief53dbfacf1645c32a07847d590c4884d4c8ca56
This commit is contained in:
@@ -265,6 +265,10 @@ struct hnbgw {
|
||||
uint16_t local_port;
|
||||
char *remote_addr;
|
||||
uint16_t remote_port;
|
||||
struct {
|
||||
char *access;
|
||||
char *core;
|
||||
} netinst;
|
||||
} pfcp;
|
||||
} config;
|
||||
/*! SCTP listen socket for incoming connections */
|
||||
|
||||
@@ -842,6 +842,27 @@ DEFUN(cfg_pfcp_local_port, cfg_pfcp_local_port_cmd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_pfcp_netinst, cfg_pfcp_netinst_cmd,
|
||||
"netinst (access|core) NAME",
|
||||
"Add a Network Instance IE to all outgoing PFCP rule sets,"
|
||||
" so that the UPF may choose the correct interface to open GTP tunnels on.\n"
|
||||
"Set the Network Instance name for the access side (towards RAN).\n"
|
||||
"Set the Network Instance name for the core side.\n"
|
||||
"The Network Instance name as a dotted string, typically a domain name like 'ran23.example.com'."
|
||||
" A matching osmo-upf.cfg could be: 'netinst' / 'add ran23.example.com 10.0.0.23'."
|
||||
" See 3GPP TS 29.244 8.2.4.\n")
|
||||
{
|
||||
const char *access_or_core = argv[0];
|
||||
char **str;
|
||||
if (!strcmp(access_or_core, "access"))
|
||||
str = &g_hnbgw->config.pfcp.netinst.access;
|
||||
else
|
||||
str = &g_hnbgw->config.pfcp.netinst.core;
|
||||
osmo_talloc_replace_string(g_hnbgw, str, argv[1]);
|
||||
LOGP(DLPFCP, LOGL_NOTICE, "cfg: pfcp netinst %s %s\n", access_or_core, *str);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_PFCP */
|
||||
|
||||
DEFUN_DEPRECATED(cfg_hnbgw_timer_ps, cfg_hnbgw_timer_ps_cmd,
|
||||
@@ -949,6 +970,12 @@ static int config_write_hnbgw_pfcp(struct vty *vty)
|
||||
vty_out(vty, " local-port %u%s", g_hnbgw->config.pfcp.local_port, VTY_NEWLINE);
|
||||
if (g_hnbgw->config.pfcp.remote_addr)
|
||||
vty_out(vty, " remote-addr %s%s", g_hnbgw->config.pfcp.remote_addr, VTY_NEWLINE);
|
||||
if (g_hnbgw->config.pfcp.netinst.access
|
||||
&& *g_hnbgw->config.pfcp.netinst.access)
|
||||
vty_out(vty, " netinst access %s%s", g_hnbgw->config.pfcp.netinst.access, VTY_NEWLINE);
|
||||
if (g_hnbgw->config.pfcp.netinst.core
|
||||
&& *g_hnbgw->config.pfcp.netinst.core)
|
||||
vty_out(vty, " netinst core %s%s", g_hnbgw->config.pfcp.netinst.core, VTY_NEWLINE);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@@ -1019,6 +1046,7 @@ void hnbgw_vty_init(void)
|
||||
install_element(PFCP_NODE, &cfg_pfcp_local_addr_cmd);
|
||||
install_element(PFCP_NODE, &cfg_pfcp_local_port_cmd);
|
||||
install_element(PFCP_NODE, &cfg_pfcp_remote_addr_cmd);
|
||||
install_element(PFCP_NODE, &cfg_pfcp_netinst_cmd);
|
||||
#endif
|
||||
|
||||
osmo_tdef_vty_groups_init(HNBGW_NODE, hnbgw_tdef_group);
|
||||
|
||||
@@ -199,6 +199,13 @@ struct ps_rab *ps_rab_start(struct hnbgw_context_map *map, uint8_t rab_id,
|
||||
return rab;
|
||||
}
|
||||
|
||||
#define set_netinst(NETINST_MEMBER, STRING) do { \
|
||||
if ((STRING) && *(STRING)) { \
|
||||
NETINST_MEMBER##_present = true; \
|
||||
OSMO_STRLCPY_ARRAY(NETINST_MEMBER.str, STRING); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Add two PDR and two FAR to the PFCP Session Establishment Request message, according to the information found in rab.
|
||||
*/
|
||||
static int rab_to_pfcp_session_est_req(struct osmo_pfcp_msg_session_est_req *ser, struct ps_rab *rab)
|
||||
@@ -234,6 +241,7 @@ static int rab_to_pfcp_session_est_req(struct osmo_pfcp_msg_session_est_req *ser
|
||||
.far_id_present = true,
|
||||
.far_id = ID_CORE_TO_ACCESS,
|
||||
};
|
||||
set_netinst(ser->create_pdr[ser->create_pdr_count].pdi.network_inst, g_hnbgw->config.pfcp.netinst.core);
|
||||
ser->create_pdr_count++;
|
||||
|
||||
ser->create_far[ser->create_far_count] = (struct osmo_pfcp_ie_create_far){
|
||||
@@ -268,6 +276,7 @@ static int rab_to_pfcp_session_est_req(struct osmo_pfcp_msg_session_est_req *ser
|
||||
.far_id_present = true,
|
||||
.far_id = ID_ACCESS_TO_CORE,
|
||||
};
|
||||
set_netinst(ser->create_pdr[ser->create_pdr_count].pdi.network_inst, g_hnbgw->config.pfcp.netinst.access);
|
||||
ser->create_pdr_count++;
|
||||
|
||||
ser->create_far[ser->create_far_count] = (struct osmo_pfcp_ie_create_far){
|
||||
@@ -288,6 +297,7 @@ static int rab_to_pfcp_session_est_req(struct osmo_pfcp_msg_session_est_req *ser
|
||||
OSMO_PFCP_OUTER_HEADER_CREATION_GTP_U_UDP_IPV4, true);
|
||||
osmo_pfcp_bits_set(ser->create_far[ser->create_far_count].apply_action.bits,
|
||||
OSMO_PFCP_APPLY_ACTION_FORW, true);
|
||||
set_netinst(ser->create_far[ser->create_far_count].forw_params.network_inst, g_hnbgw->config.pfcp.netinst.core);
|
||||
ser->create_far_count++;
|
||||
|
||||
return 0;
|
||||
@@ -484,7 +494,8 @@ static void ps_rab_fsm_wait_access_remote_f_teid(struct osmo_fsm_inst *fi, uint3
|
||||
|
||||
/* Add an Update FAR to the PFCP Session Modification Request message, updating a remote F-TEID. */
|
||||
static int rab_to_pfcp_session_mod_req_upd_far(struct osmo_pfcp_msg_session_mod_req *smr,
|
||||
uint32_t far_id, const struct addr_teid *remote_f_teid)
|
||||
uint32_t far_id, const struct addr_teid *remote_f_teid,
|
||||
const char *far_netinst)
|
||||
{
|
||||
if (smr->upd_far_count + 1 > ARRAY_SIZE(smr->upd_far))
|
||||
return -1;
|
||||
@@ -509,6 +520,7 @@ static int rab_to_pfcp_session_mod_req_upd_far(struct osmo_pfcp_msg_session_mod_
|
||||
OSMO_PFCP_APPLY_ACTION_FORW, true);
|
||||
osmo_pfcp_bits_set(smr->upd_far[smr->upd_far_count].upd_forw_params.outer_header_creation.desc_bits,
|
||||
OSMO_PFCP_OUTER_HEADER_CREATION_GTP_U_UDP_IPV4, true);
|
||||
set_netinst(smr->upd_far[smr->upd_far_count].upd_forw_params.network_inst, far_netinst);
|
||||
smr->upd_far_count++;
|
||||
|
||||
return 0;
|
||||
@@ -532,7 +544,8 @@ static void ps_rab_fsm_wait_pfcp_mod_resp_onenter(struct osmo_fsm_inst *fi, uint
|
||||
|
||||
m = ps_rab_new_pfcp_msg_req(rab, OSMO_PFCP_MSGT_SESSION_MOD_REQ);
|
||||
|
||||
if (rab_to_pfcp_session_mod_req_upd_far(&m->ies.session_mod_req, ID_CORE_TO_ACCESS, &rab->access.remote)) {
|
||||
if (rab_to_pfcp_session_mod_req_upd_far(&m->ies.session_mod_req, ID_CORE_TO_ACCESS, &rab->access.remote,
|
||||
g_hnbgw->config.pfcp.netinst.access)) {
|
||||
LOG_PS_RAB(rab, LOGL_ERROR, "error composing Update FAR IE in PFCP msg\n");
|
||||
ps_rab_failure(rab);
|
||||
return;
|
||||
|
||||
@@ -15,6 +15,7 @@ OsmoHNBGW(config-hnbgw-pfcp)# list
|
||||
local-addr IP_ADDR
|
||||
local-port <1-65535>
|
||||
remote-addr IP_ADDR
|
||||
netinst (access|core) NAME
|
||||
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# local-addr?
|
||||
local-addr Local address for PFCP
|
||||
@@ -31,6 +32,15 @@ OsmoHNBGW(config-hnbgw-pfcp)# remote-addr?
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# remote-addr ?
|
||||
IP_ADDR IP address
|
||||
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# netinst?
|
||||
netinst Add a Network Instance IE to all outgoing PFCP rule sets, so that the UPF may choose the correct interface to open GTP tunnels on.
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# netinst ?
|
||||
access Set the Network Instance name for the access side (towards RAN).
|
||||
core Set the Network Instance name for the core side.
|
||||
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# netinst access ?
|
||||
NAME The Network Instance name as a dotted string, typically a domain name like 'ran23.example.com'. A matching osmo-upf.cfg could be: 'netinst' / 'add ran23.example.com 10.0.0.23'. See 3GPP TS 29.244 8.2.4.
|
||||
|
||||
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# show running-config
|
||||
...
|
||||
@@ -43,6 +53,8 @@ msc 0
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# remote-addr 127.0.0.2
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# local-addr 127.0.0.1
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# local-port 8805
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# netinst access ran.net
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# netinst core core.net
|
||||
|
||||
OsmoHNBGW(config-hnbgw-pfcp)# show running-config
|
||||
...
|
||||
@@ -52,5 +64,7 @@ hnbgw
|
||||
local-addr 127.0.0.1
|
||||
local-port 8805
|
||||
remote-addr 127.0.0.2
|
||||
netinst access ran.net
|
||||
netinst core core.net
|
||||
msc 0
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user