Skip to content

Commit

Permalink
rework Indication flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdamiano committed Mar 1, 2022
1 parent a575ecd commit efa6c7d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
3 changes: 2 additions & 1 deletion priv/ie_gen_v2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ raw_ies() ->
'NSI', 'UASI', 'DTCI', 'BDWI', 'PSCI', 'PCRI', 'AOSI', 'AOPI',
'ROAAI', 'EPCOSI', 'CPOPCI', 'PMTSMI', 'S11TF', 'PNSI', 'UNACCSI', 'WPMSI',
'5GSNN26', 'REPREFI', '5GSIWK', 'EEVRSI', 'LTEMUI', 'LTEMPI', 'ENBCRSI', 'TSPCMI',
'_', '_', '_', 'N5GNMI', '5GCNRS', '5GCNRI', '5SRHOI', 'ETHPDN']}}]},
'CSRMFI', 'MTEDTN', 'MTEDTA', 'N5GNMI', '5GCNRS', '5GCNRI', '5SRHOI', 'ETHPDN',
'_', '_', '_', '_', 'SISSME', 'NSENBI', 'IPFUPF', 'EMCI']}}]},
{78, "v2 Protocol Configuration Options",
[{"Config", protocol_config_opts}]},
{79, "v2 PDN Address Allocation",
Expand Down
14 changes: 9 additions & 5 deletions src/gtp_packet.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3373,8 +3373,10 @@ decode_v2_element(<<M_flags/binary>>, 77, Instance) ->
'PCRI','AOSI','AOPI','ROAAI','EPCOSI','CPOPCI',
'PMTSMI','S11TF','PNSI','UNACCSI','WPMSI',
'5GSNN26','REPREFI','5GSIWK','EEVRSI','LTEMUI',
'LTEMPI','ENBCRSI','TSPCMI','_','_','_',
'N5GNMI','5GCNRS','5GCNRI','5SRHOI','ETHPDN'])};
'LTEMPI','ENBCRSI','TSPCMI', 'CSRMFI', 'MTEDTN',
'MTEDTA', 'N5GNMI', '5GCNRS', '5GCNRI', '5SRHOI',
'ETHPDN', '_', '_', '_', '_', 'SISSME', 'NSENBI',
'IPFUPF', 'EMCI'])};

decode_v2_element(<<M_config/binary>>, 78, Instance) ->
#v2_protocol_configuration_options{instance = Instance,
Expand Down Expand Up @@ -4169,9 +4171,11 @@ encode_v2_element(#v2_indication{
'CPOPCI','EPCOSI','ROAAI','TSPCMI',
'ENBCRSI','LTEMPI','LTEMUI',
'EEVRSI','5GSIWK','REPREFI',
'5GSNN26','ETHPDN','5SRHOI',
'5GCNRI','5GCNRS','N5GNMI','_','_',
'_']), little))/binary>>);
'5GSNN26', 'ETHPDN','5SRHOI',
'5GCNRI','5GCNRS','N5GNMI',
'MTEDTA','MTEDTN', 'CSRMFI', 'EMCI',
'IPFUPF', 'NSENBI', 'SISSME',
'_', '_', '_', '_']), little))/binary>>);

encode_v2_element(#v2_protocol_configuration_options{
instance = Instance,
Expand Down
15 changes: 13 additions & 2 deletions test/gtp_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,29 @@ flags_enc_dec(_Config) ->
gtp_packet:decode(Bin2)),

%% unkown indication flag, make sure it passed through enc/dec
Bin3 = <<72,1,0,22,0,0,0,0,0,0,0,0,77,0,10,0,0,0,0,0,0,0,0,0,0,8>>,
Bin3 = <<72,1,0,23,0,0,0,0,0,0,0,0,77,0,11,0,0,0,0,0,0,0,0,0,0,0,8>>,
Msg3 = #gtp{version = v2,type = echo_request,tei = 0,seq_no = 0,
n_pdu = undefined,ext_hdr = [],
ie = #{{v2_indication,0} =>
#v2_indication{instance = 0,flags = [2048]}}},
?match(<<72,1,0,22,0,0,0,0,0,0,0,0,77,0,10,0,0,0,0,0,0,0,0,0,0,8>>,
?match(<<72,1,0,23,0,0,0,0,0,0,0,0,77,0,11,0,0,0,0,0,0,0,0,0,0,0,8>>,
gtp_packet:encode(Msg3)),
?match(#gtp{version = v2,type = echo_request,tei = 0,seq_no = 0,
n_pdu = undefined,ext_hdr = [],
ie = #{{v2_indication,0} :=
#v2_indication{instance = 0,flags = [2048]}}},
gtp_packet:decode(Bin3)),
Bin4 = <<72,1,0,21,0,0,0,0,0,0,0,0,77,0,9,0,0,0,0,0,0,0,0,0,1>>,
Msg4 = #gtp{version = v2,type = echo_request,tei = 0,seq_no = 0,
n_pdu = undefined,ext_hdr = [],
ie = #{{v2_indication,0} =>
#v2_indication{instance = 0,flags = ['EMCI']}}},
?match(<<72,1,0,21,0,0,0,0,0,0,0,0,77,0,9,0,0,0,0,0,0,0,0,0,1>>, gtp_packet:encode(Msg4)),
?match(#gtp{version = v2,type = echo_request,tei = 0,seq_no = 0,
n_pdu = undefined,ext_hdr = [],
ie = #{{v2_indication,0} :=
#v2_indication{instance = 0,flags = ['EMCI']}}},
gtp_packet:decode(Bin4)),
ok.

msg_enc_dec() ->
Expand Down
6 changes: 5 additions & 1 deletion test/property_test/gtplib_prop.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,11 @@ gen_v2_indication() ->
'CPRAI', 'ARRL', 'PPOF', 'PPON/PPEI', 'PPSI', 'CSFBI', 'CLII', 'CPSR',
'NSI', 'UASI', 'DTCI', 'BDWI', 'PSCI', 'PCRI', 'AOSI', 'AOPI',
'ROAAI', 'EPCOSI', 'CPOPCI', 'PMTSMI', 'S11TF', 'PNSI', 'UNACCSI', 'WPMSI',
'5GSNN26', 'REPREFI', '5GSIWK', 'EEVRSI', 'LTEMUI', 'LTEMPI', 'ENBCRSI', 'TSPCMI'])
'5GSNN26', 'REPREFI', '5GSIWK', 'EEVRSI', 'LTEMUI', 'LTEMPI', 'ENBCRSI', 'TSPCMI',
'CSRMFI', 'MTEDTN', 'MTEDTA', 'N5GNMI', '5GCNRS', '5GCNRI', '5SRHOI', 'ETHPDN',
'SISSME', 'NSENBI', 'IPFUPF', 'EMCI'])


}.

gen_v2_protocol_configuration_options() ->
Expand Down

0 comments on commit efa6c7d

Please sign in to comment.