Skip to content

Commit

Permalink
[SMF] Handle APCO IE in S2b GTPv2C CreateSessionRequest/Response
Browse files Browse the repository at this point in the history
This IE is used by UEs registering through S2b interface (ePDG) to
obtain DNS and P-CSCF server address information.
  • Loading branch information
pespin committed Feb 26, 2024
1 parent 9a515e9 commit d6ab5ed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/smf/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ typedef struct smf_sess_s {
struct {
uint8_t version; /* GTPC version */
ogs_tlv_octet_t ue_pco;
ogs_tlv_octet_t ue_apco;
ogs_tlv_octet_t ue_epco;
ogs_tlv_octet_t user_location_information;
ogs_tlv_octet_t ue_timezone;
Expand Down
13 changes: 13 additions & 0 deletions src/smf/s5c-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
int len;
uint8_t pco_buf[OGS_MAX_PCO_LEN];
int16_t pco_len;
uint8_t apco_buf[OGS_MAX_PCO_LEN];
int16_t apco_len;
uint8_t *epco_buf = NULL;
int16_t epco_len;

Expand Down Expand Up @@ -145,6 +147,17 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
rsp->protocol_configuration_options.len = pco_len;
}

/* APCO */
if (sess->gtp.ue_apco.presence &&
sess->gtp.ue_apco.len && sess->gtp.ue_apco.data) {
apco_len = smf_pco_build(
apco_buf, sess->gtp.ue_apco.data, sess->gtp.ue_apco.len);
ogs_assert(apco_len > 0);
rsp->additional_protocol_configuration_options.presence = 1;
rsp->additional_protocol_configuration_options.data = apco_buf;
rsp->additional_protocol_configuration_options.len = apco_len;
}

/* ePCO */
if (sess->gtp.ue_epco.presence &&
sess->gtp.ue_epco.len && sess->gtp.ue_epco.data) {
Expand Down
8 changes: 8 additions & 0 deletions src/smf/s5c-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ uint8_t smf_s5c_handle_create_session_request(
&req->protocol_configuration_options);
}

/* APCO */
if (req->additional_protocol_configuration_options.presence) {
OGS_TLV_STORE_DATA(&sess->gtp.ue_apco,
&req->additional_protocol_configuration_options);
}

/* Set User Location Information */
if (req->user_location_information.presence) {
OGS_TLV_STORE_DATA(&sess->gtp.user_location_information,
Expand Down Expand Up @@ -452,6 +458,8 @@ uint8_t smf_s5c_handle_delete_session_request(
OGS_TLV_CLEAR_DATA(&sess->gtp.ue_pco);
}

/* APCO not present in Session deletion procedure, hence no need to clear it here. */

if (req->extended_protocol_configuration_options.presence) {
OGS_TLV_STORE_DATA(&sess->gtp.ue_epco,
&req->extended_protocol_configuration_options);
Expand Down

0 comments on commit d6ab5ed

Please sign in to comment.