Skip to content

Commit

Permalink
Lowercase APN expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferenc Holzhauser committed Jun 2, 2021
1 parent 32bf649 commit 8964931
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/ergw_node_selection.erl
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ expand_apn_plmn(IMSI) when is_binary(IMSI) ->
expand_apn_plmn(_) ->
ergw:get_plmn_id().

expand_apn([H|_] = APN, IMSI)
expand_apn([H|_] = APN0, IMSI)
when is_binary(H) ->
APN = lowercase_apn(APN0),
case lists:reverse(APN) of
[<<"gprs">> | _] -> APN;
[<<"org">>, <<"3gppnetwork">> | _] -> APN;
Expand All @@ -132,7 +133,7 @@ split_apn([H|_] = APN)

apn_to_fqdn([H|_] = APN, IMSI)
when is_binary(H) ->
apn_to_fqdn(expand_apn(lowercase_apn(APN), IMSI)).
apn_to_fqdn(expand_apn(APN, IMSI)).

apn_to_fqdn([H|_] = APN)
when is_binary(H) ->
Expand Down
4 changes: 2 additions & 2 deletions test/pgw_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,7 @@ session_options(Config) ->
'Multi-Session-Id' => '_',
'Diameter-Session-Id' => '_',
'Called-Station-Id' =>
unicode:characters_to_binary(lists:join($., ?'APN-ExAmPlE')),
unicode:characters_to_binary(lists:join($., ?'APN-EXAMPLE')),
'Calling-Station-Id' => ?MSISDN,
'Service-Type' => 'Framed-User',
'Framed-Protocol' => 'GPRS-PDP-Context',
Expand Down Expand Up @@ -3451,7 +3451,7 @@ simple_ocs(Config) ->
%% 'Acct-Interim-Interval' => '?????',
%% 'Bearer-Operation' => '?????',
'Called-Station-Id' =>
unicode:characters_to_binary(lists:join($., ?'APN-ExAmPlE')),
unicode:characters_to_binary(lists:join($., ?'APN-EXAMPLE')),
'Calling-Station-Id' => ?MSISDN,
'Charging-Rule-Base-Name' => <<"m2m0001">>,
'Diameter-Session-Id' => '_',
Expand Down
4 changes: 2 additions & 2 deletions test/saegw_s11_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ session_options(Config) ->
'Multi-Session-Id' => '_',
'Diameter-Session-Id' => '_',
'Called-Station-Id' =>
unicode:characters_to_binary(lists:join($., ?'APN-ExAmPlE')),
unicode:characters_to_binary(lists:join($., ?'APN-EXAMPLE')),
'Calling-Station-Id' => ?MSISDN,
'Service-Type' => 'Framed-User',
'Framed-Protocol' => 'GPRS-PDP-Context',
Expand Down Expand Up @@ -1605,7 +1605,7 @@ simple_ocs(Config) ->
%% 'Acct-Interim-Interval' => '?????',
%% 'Bearer-Operation' => '?????',
'Called-Station-Id' =>
unicode:characters_to_binary(lists:join($., ?'APN-ExAmPlE')),
unicode:characters_to_binary(lists:join($., ?'APN-EXAMPLE')),
'Calling-Station-Id' => ?MSISDN,
'Charging-Rule-Base-Name' => <<"m2m0001">>,
'Diameter-Session-Id' => '_',
Expand Down

0 comments on commit 8964931

Please sign in to comment.