pespin has uploaded this change for review.

View Change

Add defines for PDP Address Type Nr

The values are the same for GTP and GMM (which in turn are used by
GSUP).

Change-Id: I48e7064f598d6dfb0d4398500fb078b2d5da0226
---
M include/gtp_utils.hrl
M src/aaa_diameter_swx.erl
M src/gsup_server.erl
3 files changed, 25 insertions(+), 5 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/03/35903/1
diff --git a/include/gtp_utils.hrl b/include/gtp_utils.hrl
index 453efb0..4d1efe2 100644
--- a/include/gtp_utils.hrl
+++ b/include/gtp_utils.hrl
@@ -110,4 +110,8 @@
-define(GTP2_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED, 126).
-define(GTP2_CAUSE_REQUEST_REJECTED_DUE_TO_UE_CAPABILITY, 127).
-define(GTP2_CAUSE_S1_U_PATH_FAILURE, 128).
--define(GTP2_CAUSE_5GC_NOT_ALLOWED, 129).
\ No newline at end of file
+-define(GTP2_CAUSE_5GC_NOT_ALLOWED, 129).
+
+-define(GTP_PDP_ADDR_TYPE_NR_IPv4, 16#21).
+-define(GTP_PDP_ADDR_TYPE_NR_IPv6, 16#57).
+-define(GTP_PDP_ADDR_TYPE_NR_IPv4v6, 16#8d).
\ No newline at end of file
diff --git a/src/aaa_diameter_swx.erl b/src/aaa_diameter_swx.erl
index e3ca289..c623b3e 100644
--- a/src/aaa_diameter_swx.erl
+++ b/src/aaa_diameter_swx.erl
@@ -42,6 +42,7 @@

-include_lib("diameter_3gpp_ts29_273_swx.hrl").
-include_lib("diameter/include/diameter_gen_base_rfc6733.hrl").
+-include("gtp_utils.hrl").

%% API Function Exports
-export([start_link/0]).
@@ -191,13 +192,13 @@
% Set only the Reserved=0 byte and Prefix-Length=0
IPv6Dyn = <<16#00:8,16#00:8>>,
case PdpTypeNr of
- 16#21 ->
+ ?GTP_PDP_ADDR_TYPE_NR_IPv4 ->
IPv4Opt = Ipv4Dyn,
IPv6Opt = [];
- 16#57 ->
+ ?GTP_PDP_ADDR_TYPE_NR_IPv6 ->
IPv4Opt = [],
IPv6Opt = IPv6Dyn;
- 16#8d ->
+ ?GTP_PDP_ADDR_TYPE_NR_IPv4v6 ->
IPv4Opt = Ipv4Dyn,
IPv6Opt = IPv6Dyn;
_ ->
diff --git a/src/gsup_server.erl b/src/gsup_server.erl
index 799d6df..229f5db 100644
--- a/src/gsup_server.erl
+++ b/src/gsup_server.erl
@@ -40,6 +40,7 @@
-include_lib("osmo_ss7/include/ipa.hrl").
-include_lib("osmo_gsup/include/gsup_protocol.hrl").
-include_lib("gtplib/include/gtp_packet.hrl").
+-include("gtp_utils.hrl").

-define(SERVER, ?MODULE).

@@ -160,7 +161,9 @@
IEs = CreateSessResp#gtp.ie,
%%#{{v2_bearer_context,0} := BearerMap} = IEs,
#{{v2_pdn_address_allocation,0} := Paa} = IEs,
- PdpAddress = #{pdp_type_org => 1, pdp_type_nr => 16#21, address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}},
+ PdpAddress = #{pdp_type_org => 1,
+ pdp_type_nr => ?GTP_PDP_ADDR_TYPE_NR_IPv4,
+ address => #{ ipv4 => Paa#v2_pdn_address_allocation.address}},
PdpInfo = #{pdp_context_id => 0,
pdp_address => PdpAddress,
access_point_name => "foobar.apn",

To view, visit change 35903. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: erlang/osmo-epdg
Gerrit-Branch: master
Gerrit-Change-Id: I48e7064f598d6dfb0d4398500fb078b2d5da0226
Gerrit-Change-Number: 35903
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange