Introduce Gn interface (GTPv1C) Support to PGW (#1351)

* [CORE] tlv: Store mode in ogs_tlv_t

This allows specifying the format of the IE for each individual IE,
hence allowing messages containing IEs formatted in different ways.

This is needed in order to support parsing GTPv1-C, since messages
contain IEs with different structure (TLV vs TV). Hence, this is a
preparation patch to add support for parsing TVs in ogs-tlv.c/.h.

* [CORE] tlv: Support parsing msg with both TLV and TV in it

IEs of type TV are sometimes used in GTPv1-C. Current tlv parser/builder
doesn't provide with ways to parse messages which contain TV formatted
IEs. This patch adds the relevant types and ways to encode/decode them.

Furthermore, the current parser/builder allows parsing/building messages
containing the exact same format in all its IEs. A new parser function
is added which allows parsing messages of different types (TV, TLV)
mixed in the same message. In order to be able to do so, it uses the
general msg_mode passed to it in order to know the general TLV format
(in essence, the length of the Tag field, and also the length of the
Length field if applicable each IE).

Looking up the instance in the TLV description is left undone and
hadcoded to 0, since the only user so far requiring this API is GTPv1-C,
which has no instances.

* [CORE] tlv: Support repeated tag+instance parsing TLV message

In GTPv2C, repeated IEs (same tag) are easily differentiated by the
Instance byte, which provides info to match different decoded
structures. In GTPv1C though, there's no Instance byte, and we still
encounter repeated IEs (like GSN Address in Create PDP Context Request).
Hence, the TLV decoder needs to be updated to track count of IEs found
(identified by tag+instance, where instance is always 0 in GTPv1C) and
get the proper description index + offset into the decoded structure.

* [GTP]: Move GTPv2-C specifics to its own libgtp subdir

This will allow adding GTPv1-C code by the side. Most GTPv2 code is left
in this patch as "gtp" instead of renaming it to "gtp2" in order to
avoid massive changes. It can be done at a later stage if wanted.

* [GTP] Support generating GTPv1-C messages

* [SMF] Add Gn interface support

This patch introduces GTPv1C support to open5gs-smfd. With it,
open5gs-becomes a GGSN too, where SGSN can connect to, hence supporting
GERAN and UTRAN networks.
This commit is contained in:
Pau Espin Pedrol 2022-02-18 14:23:45 +01:00 committed by GitHub
parent 3eab4be135
commit 8cc70694db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
146 changed files with 9199 additions and 538 deletions

19
lib/gtp/v2/support/cache/tlv-msg-99.py vendored Normal file
View file

@ -0,0 +1,19 @@
ies = []
ies.append({ "ie_type" : "EBI", "ie_value" : "Linked EPS Bearer ID", "presence" : "C", "instance" : "0", "comment" : "If the request corresponds to the bearer deactivation procedure in case all bearers belonging to a PDN connection shall be released, then this IE shall be included on the S5/S8, S4/S11 and S2a/S2b interfaces to indicate the default bearer associated with the PDN being disconnected.This IE shall be included only when the EPS Bearer ID is not present in the message."})
ies.append({ "ie_type" : "EBI", "ie_value" : "EPS Bearer IDs", "presence" : "C", "instance" : "1", "comment" : "This IE shall be included on S5/S8, S4/S11 and S2a/S2b interfaces for deleting bearers different from the default one, i.e. for dedicated bearers. In this case at least one dedicated bearer shall be included.This IE shall be included only when the Linked EPS Bearer ID is not present in the message.Several IEs with this type and instance values shall be included as necessary to represent a list of Bearers."})
ies.append({ "ie_type" : "Bearer Context", "ie_value" : "Failed Bearer Contexts", "presence" : "O", "instance" : "0", "comment" : "This IE may be included on the S5/S8 and S11 interfaces if the request corresponds to MME initiated bearer deactivation procedure. This IE shall contain the list of failed bearers if partial Bearer Contexts included in the Delete Bearer Command message could not be deleted."})
ies.append({ "ie_type" : "PTI", "ie_value" : "Procedure Transaction Id", "presence" : "C", "instance" : "0", "comment" : "If the request corresponds to UE requested bearer resource modification procedure for an E-UTRAN, this IE shall be included on the S5/S8 and S11 interfaces."})
ies.append({ "ie_type" : "PCO", "ie_value" : "Protocol Configuration Options", "presence" : "C", "instance" : "0", "comment" : "The PGW shall include Protocol Configuration Options (PCO) IE on the S5/S8 interface, if available and if ePCO is not supported by the UE or the network.If SGW receives this IE, SGW shall forward it to SGSN/MME on the S4/S11 interface."})
ies.append({ "ie_type" : "FQ-CSID", "ie_value" : "PGW-FQ-CSID", "presence" : "C", "instance" : "0", "comment" : "This IE shall be included by the PGW on the S5/S8 and S2a/S2b interfaces, and when received from S5/S8 be forwarded by the SGW on the S11 interface according to the requirements in 3GPP TS 23.007 [17]."})
ies.append({ "ie_type" : "FQ-CSID", "ie_value" : "SGW-FQ-CSID", "presence" : "C", "instance" : "1", "comment" : "This IE shall be included by the SGW on the S11 interface according to the requirements in 3GPP TS 23.007 [17]."})
ies.append({ "ie_type" : "Cause", "ie_value" : "Cause", "presence" : "C", "instance" : "0", "comment" : "This IE shall be sent on S5/S8 and S11/S4 interfaces if the message is caused by a handover with or without optimization from 3GPP to non-3GPP (see clause 9.3.2 in 3GPP TS 23.402 [45] and clause 5.4.4.1 in 3GPP TS 23.401 [3], respectively). In this case the Cause value shall be set to RAT changed from 3GPP to Non-3GPP. This IE shall also be sent on S11/S4 interfaces when the SGW requests to delete all bearer contexts for the given UE in an MME or S4-SGSN due to ISR deactivation, and the Cause value shall be set to ISR deactivation. This IE shall be sent on the S2a/S2b interface if the message is caused by handover from non-3GPP to 3GPP. In this case the Cause value shall be set to Access changed from Non-3GPP to 3GPP. "})
ies.append({ "ie_type" : "Indication", "ie_value" : "Indication Flags", "presence" : "CO", "instance" : "0", "comment" : "This IE shall be included if any one of the applicable flags is set to 1.Applicable flags are:Associate OCI with PGW nodes identity: The PGW shall set this flag to 1 on the S5/S8 interface or S2a/S2b interface if it has included the PGWs Overload Control Information and if this information is to be associated with the node identity (i.e. FQDN or the IP address received from the HSS or DNS during the PGW selection) of the serving PGW. The SGW shall set this flag on the S11/S4 interface if it supports the overload control feature and if the flag is set on the S5/S8 interface.Associate OCI with SGW nodes identity: The SGW shall set this flag to 1 on the S11/S4 interface if it has included the SGWs Overload Control Information and if this information is to be associated with the node identity (i.e. FQDN or the IP address received from the DNS during the SGW selection) of the serving SGW."})
ies.append({ "ie_type" : "Load Control Information", "ie_value" : "PGW's node level Load Control Information", "presence" : "O", "instance" : "0", "comment" : "The PGW may include this IE on the S5/S8 or S2a/S2b interface, providing its node level load information, if the load control feature is supported by the PGW and is activated for the PLMN to which the access network node, i.e. MME/S4-SGSN for 3GPP access network, ePDG/TWAN for non-3GPP access network, belongs (see clause 12.2.6)."})
ies.append({ "ie_type" : "Load Control Information", "ie_value" : "PGW's APN level Load Control Information", "presence" : "O", "instance" : "1", "comment" : "The PGW may include this IE on the S5/S8 or S2a/S2b interface, providing APN level load information, if the APN level load control feature is supported by the PGW and is activated for the PLMN to which the access network node, i.e. MME/S4-SGSN for 3GPP access network, ePDG/TWAN for non-3GPP access based network, belongs (see clause 12.2.6).When present, the PGW shall provide one or more instances of this IE, up to maximum of 10, with the same type and instance value, each representing the load information for a list of APN(s).See NOTE 3, NOTE 5."})
ies.append({ "ie_type" : "Load Control Information", "ie_value" : "SGW's node level Load Control Information", "presence" : "O", "instance" : "2", "comment" : "The SGW may include this IE, over the S11/S4 interface if the load control feature is supported by the SGW and is activated in the network (see clause 12.2.6).When present, the SGW shall provide only one instance of this IE, representing its node level load information."})
ies.append({ "ie_type" : "Overload Control Information", "ie_value" : "PGW's Overload Control Information", "presence" : "O", "instance" : "0", "comment" : "During an overload condition, the PGW may include this IE on the S5/S8 or S2a/S2b interface, if the overload control feature is supported by the PGW and is activated for the PLMN to which the access network node, i.e. MME/S4-SGSN for 3GPP access based network, ePDG/TWAN for non-3GPP access based network, belongs (see clause 12.3.11).When present, the PGW shall provide node level overload control, in one instance of this IE; and/orAPN level overload control, in one or more instances of this IE, up to maximum of 10, with the same type and instance value, each representing the overload information for a list of APN(s).See NOTE 4, NOTE 6."})
ies.append({ "ie_type" : "Overload Control Information", "ie_value" : "SGW's Overload Control Information", "presence" : "O", "instance" : "1", "comment" : "During an overload condition, the SGW may include this IE over the S11/S4 interface if the overload control feature is supported by the SGW and is activated in the network (see clause 12.3.11).When present, the SGW shall provide only one instance of this IE, representing its overload information."})
ies.append({ "ie_type" : "F-Container", "ie_value" : "NBIFOM Container", "presence" : "CO", "instance" : "0", "comment" : "This IE shall be included on the S5/S8 and S2a/S2b interfaces if the PGW needs to send NBIFOM information as specified in 3GPP TS 23.161 [71]. The Container Type shall be set to 4."})
ies.append({ "ie_type" : "APN Rate Control Status", "ie_value" : "APN RATE Control Status", "presence" : "CO", "instance" : "0", "comment" : "If APN RATE Control Status is available in PGW and the delete bearer request is for the default Bearer, APN RATE Control Status shall be transfered on the S5/S8 interface.The SGW shall include the APN RATE Control Status IE on the S11/S4 interface, if received from the PGW."})
ies.append({ "ie_type" : "ePCO", "ie_value" : "Extended Protocol Configuration Options", "presence" : "CO", "instance" : "0", "comment" : "The PGW shall include Extended Protocol Configuration Options (ePCO) IE on the S5/S8 interface, if available and if the UE and the network support ePCO.If the SGW receives this IE, the SGW shall forward it to the MME on the S11 interface."})
msg_list[key]["ies"] = ies