fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37795?usp=email )
Change subject: erab_fsm: include Network Instance IE in PDRs and FARs ......................................................................
erab_fsm: include Network Instance IE in PDRs and FARs
Change-Id: I4dbe8e0b1d14eed5fdb3f9f3f2543c44fd543d22 --- M config/sys.config M src/erab_fsm.erl 2 files changed, 20 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified
diff --git a/config/sys.config b/config/sys.config index 993176b..66fbdc9 100644 --- a/config/sys.config +++ b/config/sys.config @@ -16,6 +16,9 @@ {mme_rem_addr, "127.0.2.10"}, %% remote address for outgoing connections to the MME {pfcp_loc_addr, "127.0.1.1"}, %% local address for incoming PFCP PDUs from UPF {pfcp_rem_addr, "127.0.1.2"} %% remote address for outgoing PFCP PDUs to UPF +%% Optional PFCP Network Instance IEs (omitted if not configured) +%% {pfcp_net_inst_core, << 16#09, "core-side" >>}, %% PFCP Network Instance IE value (to core) +%% {pfcp_net_inst_access, << 16#0a, "radio-side" >>} %% PFCP Network Instance IE value (to access) ]}, %% ================================================================================ %% kernel config diff --git a/src/erab_fsm.erl b/src/erab_fsm.erl index 5290b93..753d1bf 100644 --- a/src/erab_fsm.erl +++ b/src/erab_fsm.erl @@ -375,9 +375,20 @@ logger:set_process_metadata(#{prefix => Prefix}).
+-spec net_inst(atom()) -> undefined | binary(). +net_inst(Param) -> + case application:get_env(osmo_s1gw, Param) of + {ok, Val} -> Val; + undefined -> undefined + end. + + -spec session_establish_req(erab_state()) -> pfcp_peer:pfcp_session_rsp(). session_establish_req(#erab_state{seid_loc = F_SEID, %% used as F-SEID u2c = U2C}) -> + %% Network Instance IE values for core/access + NI_Core = net_inst(pfcp_net_inst_core), + NI_Access = net_inst(pfcp_net_inst_access), %% Packet Detection Rules OHR = #outer_header_removal{header = 'GTP-U/UDP/IPv4'}, PDRs = [#{pdr_id => {pdr_id, 1}, %% -- for Core -> Access @@ -386,6 +397,7 @@ outer_header_removal => OHR, pdi => #{f_teid => #f_teid{teid = choose, ipv4 = choose}, + network_instance => NI_Core, source_interface => {source_interface, 'Core'}}}, #{pdr_id => {pdr_id, 2}, %% -- for Access -> Core far_id => {far_id, 2}, %% see FARs below @@ -393,6 +405,7 @@ outer_header_removal => OHR, pdi => #{f_teid => #f_teid{teid = choose, ipv4 = choose}, + network_instance => NI_Access, source_interface => {source_interface, 'Access'}}}], %% Forwarding Action Rules FARs = [#{far_id => {far_id, 1}, %% -- for Core -> Access @@ -403,6 +416,7 @@ apply_action => #{'FORW' => []}, forwarding_parameters => #{outer_header_creation => ohc(U2C), + network_instance => NI_Core, destination_interface => {destination_interface, 'Core'}}}], pfcp_peer:session_establish_req(F_SEID, PDRs, FARs).
@@ -410,6 +424,8 @@ -spec session_modify_req(erab_state()) -> pfcp_peer:pfcp_session_rsp(). session_modify_req(#erab_state{seid_rem = SEID, %% SEID allocated to us u2a = U2A}) -> + %% Network Instance IE value for access + NI_Access = net_inst(pfcp_net_inst_access), %% Forwarding Action Rules FARs = [#{far_id => {far_id, 1}, %% -- for Core -> Access %% Now we know the Access side TEID / GTP-U address, so we modify @@ -417,6 +433,7 @@ apply_action => #{'FORW' => []}, forwarding_parameters => #{outer_header_creation => ohc(U2A), + network_instance => NI_Access, destination_interface => {destination_interface, 'Access'}}}], pfcp_peer:session_modify_req(SEID, [], FARs).