library/GTPv2_Emulation: Patch SeqNr only on outbound initial messages
Change-Id: I0f13074ccee2bf2d00d2dc2af491b9effc142f22
This commit is contained in:
parent
fa2b384f2a
commit
d7ae2c4eb2
|
@ -340,6 +340,73 @@ function f_gtp2c_extract_imsi(PDU_GTPCv2 gtp) return template (omit) hexstring {
|
|||
return omit;
|
||||
}
|
||||
|
||||
private function f_gtp2c_is_initial_msg(PDU_GTPCv2 msg) return boolean
|
||||
{
|
||||
if (ischosen(msg.gtpcv2_pdu.echoRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.versionNotSupported) or
|
||||
ischosen(msg.gtpcv2_pdu.createSessionRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.createBearerRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.bearerResourceCommand) or
|
||||
ischosen(msg.gtpcv2_pdu.bearerResourceFailureIndication) or
|
||||
ischosen(msg.gtpcv2_pdu.modifyBearerRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.deleteSessionRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.deleteBearerRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.downlinkDataNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.downlinkDataNotificationAcknowledgement) or
|
||||
ischosen(msg.gtpcv2_pdu.downlinkDataNotificationFailureIndication) or
|
||||
ischosen(msg.gtpcv2_pdu.deleteIndirectDataForwardingTunnelRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.modifyBearerCommand) or
|
||||
ischosen(msg.gtpcv2_pdu.modifyBearerFailureIndication) or
|
||||
ischosen(msg.gtpcv2_pdu.updateBearerRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.deleteBearerCommand) or
|
||||
ischosen(msg.gtpcv2_pdu.createIndirectDataForwardingTunnelRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.releaseAccessBearersRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.stopPagingIndication) or
|
||||
ischosen(msg.gtpcv2_pdu.modifyAccessBearersRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.remoteUEReportNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.remoteUEReportAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.forwardRelocationRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.forwardRelocationCompleteNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.forwardRelocationCompleteAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.contextRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.contextAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.identificationRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.forwardAccessContextNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.forwardAccessContextAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.detachNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.detachAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.changeNotificationRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.relocationCancelRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.configurationTransferTunnel) or
|
||||
ischosen(msg.gtpcv2_pdu.rAN_InformationRelay) or
|
||||
ischosen(msg.gtpcv2_pdu.suspendNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.suspendAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.resumeNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.resumeAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.cSPagingIndication) or
|
||||
ischosen(msg.gtpcv2_pdu.createForwardingTunnelRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.deletePDN_ConnectionSetRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.traceSessionActivation) or
|
||||
ischosen(msg.gtpcv2_pdu.traceSessionDeactivation) or
|
||||
ischosen(msg.gtpcv2_pdu.updatePDN_ConnectionSetRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.pGW_RestartNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.pGW_RestartNotificationAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.pGW_DownlinkTriggeringNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.pGW_DownlinkTriggeringAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.alertMMENotification) or
|
||||
ischosen(msg.gtpcv2_pdu.alertMMEAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.uEActivityNotification) or
|
||||
ischosen(msg.gtpcv2_pdu.uEActivityAcknowledge) or
|
||||
ischosen(msg.gtpcv2_pdu.mBMSSessionStartRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.mBMSSessionUpdateRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.mBMSSessionStopRequest) or
|
||||
ischosen(msg.gtpcv2_pdu.iSR_StatusIndication) or
|
||||
ischosen(msg.gtpcv2_pdu.uE_RegistrationQueryRequest)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private template (value) SctpTuple ts_SCTP(template (omit) integer ppid := omit) := {
|
||||
sinfo_stream := omit,
|
||||
sinfo_ppid := ppid,
|
||||
|
@ -507,10 +574,11 @@ function main(Gtp2EmulationCfg cfg) runs on GTPv2_Emulation_CT {
|
|||
}
|
||||
|
||||
[] TEID0.receive(PDU_GTPCv2:?) -> value g2c sender vc_conn {
|
||||
/* patch in the next sequence number */
|
||||
/* FIXME: do this only for outbound requests */
|
||||
g2c.sequenceNumber := int2oct(g_c_seq_nr, 3);
|
||||
g_c_seq_nr := g_c_seq_nr + 1;
|
||||
/* patch in the next sequence number on outbound Initial message */
|
||||
if (f_gtp2c_is_initial_msg(g2c)) {
|
||||
g2c.sequenceNumber := int2oct(g_c_seq_nr, 3);
|
||||
g_c_seq_nr := g_c_seq_nr + 1;
|
||||
}
|
||||
/* build Gtp2cUnitdata */
|
||||
g2c_ud := { peer := g_peer, gtpc := g2c };
|
||||
GTP2C.send(g2c_ud);
|
||||
|
@ -520,10 +588,11 @@ function main(Gtp2EmulationCfg cfg) runs on GTPv2_Emulation_CT {
|
|||
}
|
||||
|
||||
[] CLIENT.receive(PDU_GTPCv2:?) -> value g2c sender vc_conn {
|
||||
/* patch in the next sequence number */
|
||||
/* FIXME: do this only for outbound requests */
|
||||
g2c.sequenceNumber := int2oct(g_c_seq_nr, 3);
|
||||
g_c_seq_nr := g_c_seq_nr + 1;
|
||||
/* patch in the next sequence number on outbound Initial message */
|
||||
if (f_gtp2c_is_initial_msg(g2c)) {
|
||||
g2c.sequenceNumber := int2oct(g_c_seq_nr, 3);
|
||||
g_c_seq_nr := g_c_seq_nr + 1;
|
||||
}
|
||||
/* build Gtp2cUnitdata */
|
||||
g2c_ud := { peer := g_peer, gtpc := g2c };
|
||||
GTP2C.send(g2c_ud);
|
||||
|
|
Loading…
Reference in New Issue