Loading ttcn3/EtsiLibrary/LibIpv6/LibSec/LibIpv6_Rfc4306Ikev2_Functions.ttcn +423 −53 Original line number Original line Diff line number Diff line Loading @@ -511,11 +511,11 @@ module LibIpv6_Rfc4306Ikev2_Functions { { { /* /* * @desc Test Node waits for IKE_SA_INIT request * @desc Test Node waits for IKE_SA_INIT request * @param p_src address of IUT * @param p_addrIut address of IUT * @param p_dst address of test node * @param p_addrTn address of test node */ */ function f_waitForIkeSaInitReq( in template Ipv6Address p_src, function f_waitForIkeSaInitReq( in template Ipv6Address p_addrIut, in template Ipv6Address p_dst) in template Ipv6Address p_addrTn) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { var FncRetCode v_ret := e_success; var FncRetCode v_ret := e_success; Loading @@ -531,8 +531,8 @@ module LibIpv6_Rfc4306Ikev2_Functions { tc_wait.start; tc_wait.start; alt { alt { [] ipPort.receive(mw_ikeSaInitReq( p_src, [] ipPort.receive(mw_ikeSaInitReq( p_addrIut, p_dst, p_addrTn, mw_ikeSaInitReqPLL)) -> value v_ipv6Packet mw_ikeSaInitReqPLL)) -> value v_ipv6Packet { { tc_wait.stop; tc_wait.stop; Loading Loading @@ -758,11 +758,11 @@ module LibIpv6_Rfc4306Ikev2_Functions { /* /* * @desc Test Node waits for IKE_AUTH request * @desc Test Node waits for IKE_AUTH request * @param p_src address of IUT * @param p_addrIut address of IUT * @param p_dst address of test node * @param p_addrTn address of test node */ */ function f_waitForIkeAuthReq( in template Ipv6Address p_src, function f_waitForIkeAuthReq( in template Ipv6Address p_addrIut, in template Ipv6Address p_dst, in template Ipv6Address p_addrTn, out UInt8 p_protocolId) out UInt8 p_protocolId) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -773,8 +773,8 @@ module LibIpv6_Rfc4306Ikev2_Functions { tc_wait.start; tc_wait.start; alt { alt { // Transport mode, Notify payload requesting 'UseTransportMode' is included in IKE_AUTH request // Transport mode, Notify payload requesting 'UseTransportMode' is included in IKE_AUTH request [] ipPort.receive(mw_ikeAuthReq( p_src, [] ipPort.receive(mw_ikeAuthReq( p_addrIut, p_dst, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiInitiator, Loading @@ -790,8 +790,8 @@ module LibIpv6_Rfc4306Ikev2_Functions { } } // Tunnel mode, Notify payload requesting 'UseTransportMode' is not included in IKE_AUTH request // Tunnel mode, Notify payload requesting 'UseTransportMode' is not included in IKE_AUTH request [] ipPort.receive(mw_ikeAuthReq( p_src, [] ipPort.receive(mw_ikeAuthReq( p_addrIut, p_dst, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiInitiator, Loading @@ -816,6 +816,230 @@ module LibIpv6_Rfc4306Ikev2_Functions { return v_ret; return v_ret; } // end f_waitForIkeAuthReq } // end f_waitForIkeAuthReq /* * @desc Test Node analyzes CREATE_CHILD_SA request * @param p_ipv6Packet complete IPv6 packet */ function f_analyzeCreateChildSaReq(in template Ipv6Packet p_ipv6Packet, out UInt8 p_protocolId) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; var FncRetCode v_ret_local; var Ipv6Packet v_ipv6Packet := valueof(p_ipv6Packet); // next payload from IKE header var UInt8 v_nextPayload; // list of payloads var IkePayloadList v_ikePayloadList; var IkePayload v_ikePayload; // transform var SaTransform v_saTransform; v_nextPayload := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList[0].encrypted.nextPayload; v_ikePayloadList := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList[0].encrypted.payloadList; // get Identification payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_idInitiatorPL,v_ikePayload); if (v_ret_local == e_success) { vc_ikeSad[0].iDi := v_ikePayload.idInitiator.data; } else { log("**** f_analyzeCreateChildSaReq: ERROR: No Identification payload in payload list **** "); v_ret := e_error;} // get Traffic selector initiator payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_tsInitiatorPL,v_ikePayload); if (v_ret_local == e_success) { vc_sad[c_saIni].trafficSelector := v_ikePayload.tsInitiator.trafficSelectorList[0];} else { log("**** f_analyzeCreateChildSaReq: ERROR: No Traffic selector initiator payload in payload list **** "); v_ret := e_error;} // get Traffic selector responder payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_tsResponderPL,v_ikePayload); if (v_ret_local == e_success) { vc_sad[c_saRes].trafficSelector := v_ikePayload.tsResponder.trafficSelectorList[0];} else { log("**** f_analyzeCreateChildSaReq: ERROR: No Traffic selector responder payload in payload list **** "); v_ret := e_error;} // get Authentication payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_authenticationPL,v_ikePayload); if (v_ret_local == e_error) { log("**** f_analyzeCreateChildSaReq: ERROR: No Authentication payload in payload list **** "); v_ret := e_error;} // get Security Association payload proposal data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_saPL,v_ikePayload); if (v_ret_local == e_success) { p_protocolId := v_ikePayload.securityAssociation.saProposalList[0].protocolId; // put data from first proposal into vc_Sad vc_sad[c_saIni].spi := oct2int(v_ikePayload.securityAssociation.saProposalList[0].spi); if (p_protocolId == c_protocolEsp) { // store encryption algorithm v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeEncr,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].espEncryptionAlgo := v_saTransform.transformId.encryptionAlgo; // store attribute key length, if present if (ispresent(v_saTransform.saTransformAttributeList)) {vc_sad[c_saIni].espEncrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;} } else { log("**** f_analyzeCreateChildSaReq: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** "); v_ret := e_error;} // store optional ESP integrity algorithm, if present v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeInteg,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].espIntegrityAlgo := v_saTransform.transformId.integAlgorithms; // store attribute key length, if present if (ispresent(v_saTransform.saTransformAttributeList)) {vc_sad[c_saIni].espIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;} } else { log("**** f_analyzeCreateChildSaReq: WARNING: No ESP integrity algorithm transform in 1st proposal of Security Association payload **** ") } } if (p_protocolId == c_protocolAh) { // store AH integrity algorithm v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeInteg,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].ahIntegrityAlgo := v_saTransform.transformId.integAlgorithms; // store attribute key length, if present if (ispresent(v_saTransform.saTransformAttributeList)) {vc_sad[c_saIni].ahIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;} } else { log("**** f_analyzeCreateChildSaReq: ERROR: No AH integrity algorithm transform in 1st proposal of Security Association payload **** "); v_ret := e_error;} } // store extended sequence numbers v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeEsn,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].extentedSequenceNumbers := v_saTransform.transformId.extentedSequenceNumbers; } else { log("**** f_analyzeCreateChildSaReq: ERROR: No extended sequence numbers transform in 1st proposal of Security Association payload **** "); v_ret := e_error;} } else { log("**** f_analyzeCreateChildSaReq: ERROR: No Security Association payload in payload list **** "); v_ret := e_error;} return v_ret; } // end f_analyzeCreateChildSaReq /* * @desc Test Node waits for CREATE_CHILD_SA request * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_waitForCreateChildSaReq( in template Ipv6Address p_addrIut, in template Ipv6Address p_addrTn, in UInt1 p_iFlag, out UInt8 p_protocolId) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret; var Ipv6Packet v_ipv6Packet; var UInt8 v_protocolId; tc_wait.start; alt { // Transport mode, Notify payload requesting 'UseTransportMode' is included in CREATE_CHILD_SA request [] ipPort.receive(mw_createChildSaReq( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, vc_ikeSad[0].messageID, p_iFlag, mw_encryptedPLL(mw_createChildSaReqTransportModePLL))) -> value v_ipv6Packet { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; v_ret := f_analyzeIkeAuthReq(v_ipv6Packet,v_protocolId); p_protocolId := v_protocolId; vc_sad[c_saIni].ipSecProtocolMode := e_transportMode; } // Tunnel mode, Notify payload requesting 'UseTransportMode' is not included in CREATE_CHILD_SA request [] ipPort.receive(mw_ikeAuthReq( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, vc_ikeSad[0].messageID, mw_encryptedPLL(mw_createChildSaReqPLL))) -> value v_ipv6Packet { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; v_ret := f_analyzeIkeAuthReq(v_ipv6Packet,v_protocolId); p_protocolId := v_protocolId; vc_sad[c_saIni].ipSecProtocolMode := e_tunnelMode; } [] tc_wait.timeout { v_ret := e_timeout; log("**** f_waitForCreateChildSaReq: ERROR: tc_wait.timeout **** "); } } // end alt return v_ret; } // end f_waitForCreateChildSaReq /* * @desc Test Node waits for INFORMATIONAL request * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag IKEv2 flag IKEv2 header indicating initiator or responder * @param p_IkePayloadList list of payloads to be received */ function f_waitForInformationalReq( template Ipv6Address p_addrIut, template Ipv6Address p_addrTn, UInt1 p_iFlag, template IkePayloadList p_IkePayloadList) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; tc_wait.start; alt { [] ipPort.receive(mw_informationalReq( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, p_iFlag, vc_ikeSad[0].messageID, mw_encryptedPLL(p_IkePayloadList))) { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; } [] tc_wait.timeout { v_ret := e_timeout; log("**** f_waitForInformationalReq: ERROR: tc_wait.timeout **** "); } } // end alt return v_ret; } // end f_waitForInformationalReq } // end group receiveRequests } // end group receiveRequests group receiveResponses group receiveResponses Loading Loading @@ -1252,10 +1476,57 @@ module LibIpv6_Rfc4306Ikev2_Functions { return v_ret; return v_ret; } // end f_waitForIkeAuthRsp } // end f_waitForIkeAuthRsp /* * @desc Test Node waits for INFORMATIONAL responset * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag IKEv2 flag IKEv2 header indicating initiator or responder * @param p_IkePayloadList list of payloads to be received */ function f_waitForInformationalRes( in template Ipv6Address p_addrIut, in template Ipv6Address p_addrTn, UInt1 p_iFlag, in template IkePayloadList p_IkePayloadList) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; tc_wait.start; alt { [] ipPort.receive(mw_informationalRes( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, p_iFlag, vc_ikeSad[0].messageID, mw_encryptedPLL(p_IkePayloadList))) { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; } [] tc_wait.timeout { v_ret := e_timeout; log("**** f_waitForInformationalReq: ERROR: tc_wait.timeout **** "); } } // end alt return v_ret; } // end f_waitForInformationalRes } // end group receiveResponses } // end group receiveResponses group sendRequests { group sendRequests { /* * @desc Test Node builds IKE_SA_INIT request * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendSaInitReq( function f_createAndSendSaInitReq( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut template Ipv6Address p_addrIut Loading Loading @@ -1349,6 +1620,10 @@ group sendRequests { return v_ret; return v_ret; } // end f_createAndSendIkeSaInitReq } // end f_createAndSendIkeSaInitReq /* * @desc Test Node sends IKE_SA_INIT request * @param p_ikeSaInitRequest IKE_SA_INIT request to be sent */ function f_sendIkeSaInitReq(in template IkeSaInitRequest p_ikeSaInitRequest) function f_sendIkeSaInitReq(in template IkeSaInitRequest p_ikeSaInitRequest) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -1374,6 +1649,11 @@ group sendRequests { return e_success; return e_success; } // end f_sendIkeSaInitReq } // end f_sendIkeSaInitReq /* * @desc Test Node builds IKE_AUTH request * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendAuthReq( function f_createAndSendAuthReq( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, template Ipv6Address p_addrIut, Loading Loading @@ -1587,6 +1867,10 @@ group sendRequests { return v_ret ; return v_ret ; } // end f_createAndSendAuthReq } // end f_createAndSendAuthReq /* * @desc Test Node sends IKE_AUTH request * @param p_ikeAuthRequest IKE_AUTH request to be sent */ function f_sendIkeAuthReq(in template IkeAuthRequest p_ikeAuthRequest) function f_sendIkeAuthReq(in template IkeAuthRequest p_ikeAuthRequest) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -1609,10 +1893,19 @@ group sendRequests { return e_success; return e_success; } // end f_sendIkeAuthReq } // end f_sendIkeAuthReq /* * @desc Test Node builds INFORMATIONAL request * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag i flag IKEv2 header indicating initiator or responder * @param p_nextPayload payload type of payload to be sent in INFORMATIONAL request * @param p_payload template of payload to be sent in INFORMATIONAL request */ function f_createAndSendInfoReq( function f_createAndSendInfoReq( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, template Ipv6Address p_addrIut, UInt1 p_iFlag, UInt1 p_iFlag, UInt8 p_nextPayload, template IkePayload p_payload template IkePayload p_payload ) ) runs on LibIpv6Node runs on LibIpv6Node Loading @@ -1620,8 +1913,8 @@ group sendRequests { var FncRetCode v_ret := e_success; var FncRetCode v_ret := e_success; v_ret := f_sendIkeInfoReq ( v_ret := f_sendInformationalReq ( m_ikeInfoReq ( m_informationalReq ( p_addrTn, p_addrTn, p_addrIut, p_addrIut, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpTnPort, Loading @@ -1633,7 +1926,7 @@ group sendRequests { vc_ikeSad[0].messageID, vc_ikeSad[0].messageID, m_ikePlList_1Elem( m_ikePlList_1Elem( m_encryptedPL( m_encryptedPL( c_deletePL, p_nextPayload, m_ikePlList_1Elem(p_payload) m_ikePlList_1Elem(p_payload) ) ) ) ) Loading @@ -1643,14 +1936,18 @@ group sendRequests { return v_ret ; return v_ret ; } // end f_createAndSendInfoReq } // end f_createAndSendInfoReq function f_sendIkeInfoReq(in template InformationalRequest p_ikeInfoRequest) /* * @desc Test Node sends INFORMATIONAL request * @param p_InformationalRequest INFORMATIONAL request to be sent */ function f_sendInformationalReq(in template InformationalRequest p_InformationalRequest) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { var InformationalRequest v_ipPkt; var InformationalRequest v_ipPkt; v_ipPkt := valueof(p_ikeInfoRequest); v_ipPkt := valueof(p_InformationalRequest); if(f_setExtensionHeaders(v_ipPkt) != e_success) { if(f_setExtensionHeaders(v_ipPkt) != e_success) { log(" **** f_sendIkeInfoReq: Error when calculating length ****"); log(" **** f_sendInformationalReq: Error when calculating length ****"); return e_error; return e_error; } } Loading @@ -1663,12 +1960,17 @@ group sendRequests { ipPort.send(v_ipPkt); ipPort.send(v_ipPkt); return e_success; return e_success; } // end f_sendIkeInfoReq } // end f_sendInformationalReq } // end group sendRequests } // end group sendRequests group sendResponses { group sendResponses { /* * @desc Test Node builds IKE_SA_INIT response * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendSaInitRsp( function f_createAndSendSaInitRsp( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut template Ipv6Address p_addrIut Loading Loading @@ -1760,6 +2062,10 @@ group sendResponses { return v_ret; return v_ret; } // end f_createAndSendIkeSaInitRsp } // end f_createAndSendIkeSaInitRsp /* * @desc Test Node sends IKE_SA_INIT response * @param p_ikeSaInitRequest IKE_SA_INIT response to be sent */ function f_sendIkeSaInitRsp(in template IkeSaInitResponse p_IkeSaInitRsp) function f_sendIkeSaInitRsp(in template IkeSaInitResponse p_IkeSaInitRsp) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -1786,6 +2092,11 @@ group sendResponses { return e_success; return e_success; } // end f_sendIkeSaInitRsp } // end f_sendIkeSaInitRsp /* * @desc Test Node builds IKE_AUTH response * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendAuthRsp( function f_createAndSendAuthRsp( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, template Ipv6Address p_addrIut, Loading Loading @@ -1979,6 +2290,10 @@ group sendResponses { return v_ret ; return v_ret ; } // end f_createAndSendAuthRsp } // end f_createAndSendAuthRsp /* * @desc Test Node sends IKE_AUTH response * @param p_IkeAuthRsp IKE_AUTH response to be sent */ function f_sendIkeAuthRsp(in template IkeAuthResponse p_IkeAuthRsp) function f_sendIkeAuthRsp(in template IkeAuthResponse p_IkeAuthRsp) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -2001,6 +2316,75 @@ group sendResponses { return e_success; return e_success; } // end f_sendIkeAuthRsp } // end f_sendIkeAuthRsp /* * @desc Test Node builds INFORMATIONAL response * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag i flag IKEv2 header indicating initiator or responder * @param p_nextPayload payload type of payload to be sent in INFORMATIONAL response * @param p_payload template of payload to be sent in INFORMATIONAL response */ function f_createAndSendInfoRes( template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, UInt1 p_iFlag, UInt8 p_nextPayload, template IkePayload p_payload ) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; v_ret := f_sendInformationalRes ( m_informationalRes ( p_addrTn, p_addrIut, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, p_iFlag, c_encryptedPL, vc_ikeSad[0].messageID, m_ikePlList_1Elem( m_encryptedPL( p_nextPayload, m_ikePlList_1Elem(p_payload) ) ) ) ); return v_ret ; } // end f_createAndSendInfoRes /* * @desc Test Node sends INFORMATIONAL response * @param p_InformationalResponse INFORMATIONAL response to be sent */ function f_sendInformationalRes(in template InformationalResponse p_InformationalResponse) runs on LibIpv6Node return FncRetCode { var InformationalResponse v_ipPkt; v_ipPkt := valueof(p_InformationalResponse); if(f_setExtensionHeaders(v_ipPkt) != e_success) { log(" **** f_sendInformationalRes: Error when calculating length ****"); return e_error; } // fill padding field with '00000000'O for UDP port 4500 if(vc_ikeSad[0].udpTnPort == c_udpPort4500) { v_ipPkt.ipv6Payload.ikeMsg.padding := c_4ZeroBytes; } //send ipPort.send(v_ipPkt); return e_success; } // end f_sendInformationalRes } // end group sendResponses } // end group sendResponses group establishSAFns_active { group establishSAFns_active { Loading Loading @@ -2218,46 +2602,32 @@ group deleteSAFns { runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { var FncRetCode v_ret := e_success; var FncRetCode v_ret := e_success; var UInt1 v_iFlag; v_ret := f_createAndSendInfoReq( v_ret := f_createAndSendInfoReq( p_addrTn, p_addrTn, p_addrIut, p_addrIut, p_iFlag, p_iFlag, c_deletePL, m_delIkeSaPL(c_noNextPL) m_delIkeSaPL(c_noNextPL) ); ); if (v_ret != e_success) { return v_ret;} if (v_ret != e_success) { return v_ret;} tc_wait.start; if (p_iFlag == c_iFlagResponder) alt { {v_iFlag := c_iFlagInitiator;} [] ipPort.receive( else mw_ikeInfoResp ( {v_iFlag := c_iFlagResponder;} p_addrIut, v_ret := f_waitForInformationalRes( p_addrTn, p_addrTn, vc_ikeSad[0].udpIutPort, p_addrIut, vc_ikeSad[0].udpTnPort, v_iFlag, vc_ikeSad[0].spiInitiator, {mw_delIkeSaPL}) vc_ikeSad[0].spiResponder, vc_ikeSad[0].messageID, m_ikePlList_1Elem( mw_encryptedPL( m_ikePlList_1Elem(mw_delIkeSaPL) ) ) ) ) { tc_wait.stop; log("**** f_delIkeSa: IKE SA deleted successfully! **** "); v_ret := e_success; } [] tc_wait.timeout if (v_ret == e_success) { {log("**** f_delIkeSa: IKE SA deleted successfully! **** ");} v_ret := e_timeout; else log("**** f_delIkeSa: ERROR: tc_wait.timeout, IKE SA not deleted! **** "); {log("**** f_delIkeSa: ERROR: IKE SA not deleted! **** ");} v_ret := e_error; } } // end alt return v_ret; return v_ret; Loading ttcn3/EtsiLibrary/LibIpv6/LibSec/LibIpv6_Rfc4306Ikev2_Templates.ttcn +131 −37 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
ttcn3/EtsiLibrary/LibIpv6/LibSec/LibIpv6_Rfc4306Ikev2_Functions.ttcn +423 −53 Original line number Original line Diff line number Diff line Loading @@ -511,11 +511,11 @@ module LibIpv6_Rfc4306Ikev2_Functions { { { /* /* * @desc Test Node waits for IKE_SA_INIT request * @desc Test Node waits for IKE_SA_INIT request * @param p_src address of IUT * @param p_addrIut address of IUT * @param p_dst address of test node * @param p_addrTn address of test node */ */ function f_waitForIkeSaInitReq( in template Ipv6Address p_src, function f_waitForIkeSaInitReq( in template Ipv6Address p_addrIut, in template Ipv6Address p_dst) in template Ipv6Address p_addrTn) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { var FncRetCode v_ret := e_success; var FncRetCode v_ret := e_success; Loading @@ -531,8 +531,8 @@ module LibIpv6_Rfc4306Ikev2_Functions { tc_wait.start; tc_wait.start; alt { alt { [] ipPort.receive(mw_ikeSaInitReq( p_src, [] ipPort.receive(mw_ikeSaInitReq( p_addrIut, p_dst, p_addrTn, mw_ikeSaInitReqPLL)) -> value v_ipv6Packet mw_ikeSaInitReqPLL)) -> value v_ipv6Packet { { tc_wait.stop; tc_wait.stop; Loading Loading @@ -758,11 +758,11 @@ module LibIpv6_Rfc4306Ikev2_Functions { /* /* * @desc Test Node waits for IKE_AUTH request * @desc Test Node waits for IKE_AUTH request * @param p_src address of IUT * @param p_addrIut address of IUT * @param p_dst address of test node * @param p_addrTn address of test node */ */ function f_waitForIkeAuthReq( in template Ipv6Address p_src, function f_waitForIkeAuthReq( in template Ipv6Address p_addrIut, in template Ipv6Address p_dst, in template Ipv6Address p_addrTn, out UInt8 p_protocolId) out UInt8 p_protocolId) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -773,8 +773,8 @@ module LibIpv6_Rfc4306Ikev2_Functions { tc_wait.start; tc_wait.start; alt { alt { // Transport mode, Notify payload requesting 'UseTransportMode' is included in IKE_AUTH request // Transport mode, Notify payload requesting 'UseTransportMode' is included in IKE_AUTH request [] ipPort.receive(mw_ikeAuthReq( p_src, [] ipPort.receive(mw_ikeAuthReq( p_addrIut, p_dst, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiInitiator, Loading @@ -790,8 +790,8 @@ module LibIpv6_Rfc4306Ikev2_Functions { } } // Tunnel mode, Notify payload requesting 'UseTransportMode' is not included in IKE_AUTH request // Tunnel mode, Notify payload requesting 'UseTransportMode' is not included in IKE_AUTH request [] ipPort.receive(mw_ikeAuthReq( p_src, [] ipPort.receive(mw_ikeAuthReq( p_addrIut, p_dst, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiInitiator, Loading @@ -816,6 +816,230 @@ module LibIpv6_Rfc4306Ikev2_Functions { return v_ret; return v_ret; } // end f_waitForIkeAuthReq } // end f_waitForIkeAuthReq /* * @desc Test Node analyzes CREATE_CHILD_SA request * @param p_ipv6Packet complete IPv6 packet */ function f_analyzeCreateChildSaReq(in template Ipv6Packet p_ipv6Packet, out UInt8 p_protocolId) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; var FncRetCode v_ret_local; var Ipv6Packet v_ipv6Packet := valueof(p_ipv6Packet); // next payload from IKE header var UInt8 v_nextPayload; // list of payloads var IkePayloadList v_ikePayloadList; var IkePayload v_ikePayload; // transform var SaTransform v_saTransform; v_nextPayload := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList[0].encrypted.nextPayload; v_ikePayloadList := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList[0].encrypted.payloadList; // get Identification payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_idInitiatorPL,v_ikePayload); if (v_ret_local == e_success) { vc_ikeSad[0].iDi := v_ikePayload.idInitiator.data; } else { log("**** f_analyzeCreateChildSaReq: ERROR: No Identification payload in payload list **** "); v_ret := e_error;} // get Traffic selector initiator payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_tsInitiatorPL,v_ikePayload); if (v_ret_local == e_success) { vc_sad[c_saIni].trafficSelector := v_ikePayload.tsInitiator.trafficSelectorList[0];} else { log("**** f_analyzeCreateChildSaReq: ERROR: No Traffic selector initiator payload in payload list **** "); v_ret := e_error;} // get Traffic selector responder payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_tsResponderPL,v_ikePayload); if (v_ret_local == e_success) { vc_sad[c_saRes].trafficSelector := v_ikePayload.tsResponder.trafficSelectorList[0];} else { log("**** f_analyzeCreateChildSaReq: ERROR: No Traffic selector responder payload in payload list **** "); v_ret := e_error;} // get Authentication payload data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_authenticationPL,v_ikePayload); if (v_ret_local == e_error) { log("**** f_analyzeCreateChildSaReq: ERROR: No Authentication payload in payload list **** "); v_ret := e_error;} // get Security Association payload proposal data v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_saPL,v_ikePayload); if (v_ret_local == e_success) { p_protocolId := v_ikePayload.securityAssociation.saProposalList[0].protocolId; // put data from first proposal into vc_Sad vc_sad[c_saIni].spi := oct2int(v_ikePayload.securityAssociation.saProposalList[0].spi); if (p_protocolId == c_protocolEsp) { // store encryption algorithm v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeEncr,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].espEncryptionAlgo := v_saTransform.transformId.encryptionAlgo; // store attribute key length, if present if (ispresent(v_saTransform.saTransformAttributeList)) {vc_sad[c_saIni].espEncrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;} } else { log("**** f_analyzeCreateChildSaReq: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** "); v_ret := e_error;} // store optional ESP integrity algorithm, if present v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeInteg,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].espIntegrityAlgo := v_saTransform.transformId.integAlgorithms; // store attribute key length, if present if (ispresent(v_saTransform.saTransformAttributeList)) {vc_sad[c_saIni].espIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;} } else { log("**** f_analyzeCreateChildSaReq: WARNING: No ESP integrity algorithm transform in 1st proposal of Security Association payload **** ") } } if (p_protocolId == c_protocolAh) { // store AH integrity algorithm v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeInteg,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].ahIntegrityAlgo := v_saTransform.transformId.integAlgorithms; // store attribute key length, if present if (ispresent(v_saTransform.saTransformAttributeList)) {vc_sad[c_saIni].ahIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;} } else { log("**** f_analyzeCreateChildSaReq: ERROR: No AH integrity algorithm transform in 1st proposal of Security Association payload **** "); v_ret := e_error;} } // store extended sequence numbers v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList, c_transformTypeEsn,v_saTransform); if (v_ret_local == e_success) {vc_sad[c_saIni].extentedSequenceNumbers := v_saTransform.transformId.extentedSequenceNumbers; } else { log("**** f_analyzeCreateChildSaReq: ERROR: No extended sequence numbers transform in 1st proposal of Security Association payload **** "); v_ret := e_error;} } else { log("**** f_analyzeCreateChildSaReq: ERROR: No Security Association payload in payload list **** "); v_ret := e_error;} return v_ret; } // end f_analyzeCreateChildSaReq /* * @desc Test Node waits for CREATE_CHILD_SA request * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_waitForCreateChildSaReq( in template Ipv6Address p_addrIut, in template Ipv6Address p_addrTn, in UInt1 p_iFlag, out UInt8 p_protocolId) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret; var Ipv6Packet v_ipv6Packet; var UInt8 v_protocolId; tc_wait.start; alt { // Transport mode, Notify payload requesting 'UseTransportMode' is included in CREATE_CHILD_SA request [] ipPort.receive(mw_createChildSaReq( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, vc_ikeSad[0].messageID, p_iFlag, mw_encryptedPLL(mw_createChildSaReqTransportModePLL))) -> value v_ipv6Packet { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; v_ret := f_analyzeIkeAuthReq(v_ipv6Packet,v_protocolId); p_protocolId := v_protocolId; vc_sad[c_saIni].ipSecProtocolMode := e_transportMode; } // Tunnel mode, Notify payload requesting 'UseTransportMode' is not included in CREATE_CHILD_SA request [] ipPort.receive(mw_ikeAuthReq( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, vc_ikeSad[0].messageID, mw_encryptedPLL(mw_createChildSaReqPLL))) -> value v_ipv6Packet { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; v_ret := f_analyzeIkeAuthReq(v_ipv6Packet,v_protocolId); p_protocolId := v_protocolId; vc_sad[c_saIni].ipSecProtocolMode := e_tunnelMode; } [] tc_wait.timeout { v_ret := e_timeout; log("**** f_waitForCreateChildSaReq: ERROR: tc_wait.timeout **** "); } } // end alt return v_ret; } // end f_waitForCreateChildSaReq /* * @desc Test Node waits for INFORMATIONAL request * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag IKEv2 flag IKEv2 header indicating initiator or responder * @param p_IkePayloadList list of payloads to be received */ function f_waitForInformationalReq( template Ipv6Address p_addrIut, template Ipv6Address p_addrTn, UInt1 p_iFlag, template IkePayloadList p_IkePayloadList) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; tc_wait.start; alt { [] ipPort.receive(mw_informationalReq( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, p_iFlag, vc_ikeSad[0].messageID, mw_encryptedPLL(p_IkePayloadList))) { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; } [] tc_wait.timeout { v_ret := e_timeout; log("**** f_waitForInformationalReq: ERROR: tc_wait.timeout **** "); } } // end alt return v_ret; } // end f_waitForInformationalReq } // end group receiveRequests } // end group receiveRequests group receiveResponses group receiveResponses Loading Loading @@ -1252,10 +1476,57 @@ module LibIpv6_Rfc4306Ikev2_Functions { return v_ret; return v_ret; } // end f_waitForIkeAuthRsp } // end f_waitForIkeAuthRsp /* * @desc Test Node waits for INFORMATIONAL responset * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag IKEv2 flag IKEv2 header indicating initiator or responder * @param p_IkePayloadList list of payloads to be received */ function f_waitForInformationalRes( in template Ipv6Address p_addrIut, in template Ipv6Address p_addrTn, UInt1 p_iFlag, in template IkePayloadList p_IkePayloadList) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; tc_wait.start; alt { [] ipPort.receive(mw_informationalRes( p_addrIut, p_addrTn, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, p_iFlag, vc_ikeSad[0].messageID, mw_encryptedPLL(p_IkePayloadList))) { tc_wait.stop; vc_ikeSad[0].messageID := vc_ikeSad[0].messageID + 1; } [] tc_wait.timeout { v_ret := e_timeout; log("**** f_waitForInformationalReq: ERROR: tc_wait.timeout **** "); } } // end alt return v_ret; } // end f_waitForInformationalRes } // end group receiveResponses } // end group receiveResponses group sendRequests { group sendRequests { /* * @desc Test Node builds IKE_SA_INIT request * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendSaInitReq( function f_createAndSendSaInitReq( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut template Ipv6Address p_addrIut Loading Loading @@ -1349,6 +1620,10 @@ group sendRequests { return v_ret; return v_ret; } // end f_createAndSendIkeSaInitReq } // end f_createAndSendIkeSaInitReq /* * @desc Test Node sends IKE_SA_INIT request * @param p_ikeSaInitRequest IKE_SA_INIT request to be sent */ function f_sendIkeSaInitReq(in template IkeSaInitRequest p_ikeSaInitRequest) function f_sendIkeSaInitReq(in template IkeSaInitRequest p_ikeSaInitRequest) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -1374,6 +1649,11 @@ group sendRequests { return e_success; return e_success; } // end f_sendIkeSaInitReq } // end f_sendIkeSaInitReq /* * @desc Test Node builds IKE_AUTH request * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendAuthReq( function f_createAndSendAuthReq( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, template Ipv6Address p_addrIut, Loading Loading @@ -1587,6 +1867,10 @@ group sendRequests { return v_ret ; return v_ret ; } // end f_createAndSendAuthReq } // end f_createAndSendAuthReq /* * @desc Test Node sends IKE_AUTH request * @param p_ikeAuthRequest IKE_AUTH request to be sent */ function f_sendIkeAuthReq(in template IkeAuthRequest p_ikeAuthRequest) function f_sendIkeAuthReq(in template IkeAuthRequest p_ikeAuthRequest) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -1609,10 +1893,19 @@ group sendRequests { return e_success; return e_success; } // end f_sendIkeAuthReq } // end f_sendIkeAuthReq /* * @desc Test Node builds INFORMATIONAL request * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag i flag IKEv2 header indicating initiator or responder * @param p_nextPayload payload type of payload to be sent in INFORMATIONAL request * @param p_payload template of payload to be sent in INFORMATIONAL request */ function f_createAndSendInfoReq( function f_createAndSendInfoReq( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, template Ipv6Address p_addrIut, UInt1 p_iFlag, UInt1 p_iFlag, UInt8 p_nextPayload, template IkePayload p_payload template IkePayload p_payload ) ) runs on LibIpv6Node runs on LibIpv6Node Loading @@ -1620,8 +1913,8 @@ group sendRequests { var FncRetCode v_ret := e_success; var FncRetCode v_ret := e_success; v_ret := f_sendIkeInfoReq ( v_ret := f_sendInformationalReq ( m_ikeInfoReq ( m_informationalReq ( p_addrTn, p_addrTn, p_addrIut, p_addrIut, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpTnPort, Loading @@ -1633,7 +1926,7 @@ group sendRequests { vc_ikeSad[0].messageID, vc_ikeSad[0].messageID, m_ikePlList_1Elem( m_ikePlList_1Elem( m_encryptedPL( m_encryptedPL( c_deletePL, p_nextPayload, m_ikePlList_1Elem(p_payload) m_ikePlList_1Elem(p_payload) ) ) ) ) Loading @@ -1643,14 +1936,18 @@ group sendRequests { return v_ret ; return v_ret ; } // end f_createAndSendInfoReq } // end f_createAndSendInfoReq function f_sendIkeInfoReq(in template InformationalRequest p_ikeInfoRequest) /* * @desc Test Node sends INFORMATIONAL request * @param p_InformationalRequest INFORMATIONAL request to be sent */ function f_sendInformationalReq(in template InformationalRequest p_InformationalRequest) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { var InformationalRequest v_ipPkt; var InformationalRequest v_ipPkt; v_ipPkt := valueof(p_ikeInfoRequest); v_ipPkt := valueof(p_InformationalRequest); if(f_setExtensionHeaders(v_ipPkt) != e_success) { if(f_setExtensionHeaders(v_ipPkt) != e_success) { log(" **** f_sendIkeInfoReq: Error when calculating length ****"); log(" **** f_sendInformationalReq: Error when calculating length ****"); return e_error; return e_error; } } Loading @@ -1663,12 +1960,17 @@ group sendRequests { ipPort.send(v_ipPkt); ipPort.send(v_ipPkt); return e_success; return e_success; } // end f_sendIkeInfoReq } // end f_sendInformationalReq } // end group sendRequests } // end group sendRequests group sendResponses { group sendResponses { /* * @desc Test Node builds IKE_SA_INIT response * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendSaInitRsp( function f_createAndSendSaInitRsp( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut template Ipv6Address p_addrIut Loading Loading @@ -1760,6 +2062,10 @@ group sendResponses { return v_ret; return v_ret; } // end f_createAndSendIkeSaInitRsp } // end f_createAndSendIkeSaInitRsp /* * @desc Test Node sends IKE_SA_INIT response * @param p_ikeSaInitRequest IKE_SA_INIT response to be sent */ function f_sendIkeSaInitRsp(in template IkeSaInitResponse p_IkeSaInitRsp) function f_sendIkeSaInitRsp(in template IkeSaInitResponse p_IkeSaInitRsp) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -1786,6 +2092,11 @@ group sendResponses { return e_success; return e_success; } // end f_sendIkeSaInitRsp } // end f_sendIkeSaInitRsp /* * @desc Test Node builds IKE_AUTH response * @param p_addrIut address of IUT * @param p_addrTn address of test node */ function f_createAndSendAuthRsp( function f_createAndSendAuthRsp( template Ipv6Address p_addrTn, template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, template Ipv6Address p_addrIut, Loading Loading @@ -1979,6 +2290,10 @@ group sendResponses { return v_ret ; return v_ret ; } // end f_createAndSendAuthRsp } // end f_createAndSendAuthRsp /* * @desc Test Node sends IKE_AUTH response * @param p_IkeAuthRsp IKE_AUTH response to be sent */ function f_sendIkeAuthRsp(in template IkeAuthResponse p_IkeAuthRsp) function f_sendIkeAuthRsp(in template IkeAuthResponse p_IkeAuthRsp) runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { Loading @@ -2001,6 +2316,75 @@ group sendResponses { return e_success; return e_success; } // end f_sendIkeAuthRsp } // end f_sendIkeAuthRsp /* * @desc Test Node builds INFORMATIONAL response * @param p_addrIut address of IUT * @param p_addrTn address of test node * @param p_iFlag i flag IKEv2 header indicating initiator or responder * @param p_nextPayload payload type of payload to be sent in INFORMATIONAL response * @param p_payload template of payload to be sent in INFORMATIONAL response */ function f_createAndSendInfoRes( template Ipv6Address p_addrTn, template Ipv6Address p_addrIut, UInt1 p_iFlag, UInt8 p_nextPayload, template IkePayload p_payload ) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_success; v_ret := f_sendInformationalRes ( m_informationalRes ( p_addrTn, p_addrIut, vc_ikeSad[0].udpTnPort, vc_ikeSad[0].udpIutPort, vc_ikeSad[0].spiInitiator, vc_ikeSad[0].spiResponder, p_iFlag, c_encryptedPL, vc_ikeSad[0].messageID, m_ikePlList_1Elem( m_encryptedPL( p_nextPayload, m_ikePlList_1Elem(p_payload) ) ) ) ); return v_ret ; } // end f_createAndSendInfoRes /* * @desc Test Node sends INFORMATIONAL response * @param p_InformationalResponse INFORMATIONAL response to be sent */ function f_sendInformationalRes(in template InformationalResponse p_InformationalResponse) runs on LibIpv6Node return FncRetCode { var InformationalResponse v_ipPkt; v_ipPkt := valueof(p_InformationalResponse); if(f_setExtensionHeaders(v_ipPkt) != e_success) { log(" **** f_sendInformationalRes: Error when calculating length ****"); return e_error; } // fill padding field with '00000000'O for UDP port 4500 if(vc_ikeSad[0].udpTnPort == c_udpPort4500) { v_ipPkt.ipv6Payload.ikeMsg.padding := c_4ZeroBytes; } //send ipPort.send(v_ipPkt); return e_success; } // end f_sendInformationalRes } // end group sendResponses } // end group sendResponses group establishSAFns_active { group establishSAFns_active { Loading Loading @@ -2218,46 +2602,32 @@ group deleteSAFns { runs on LibIpv6Node runs on LibIpv6Node return FncRetCode { return FncRetCode { var FncRetCode v_ret := e_success; var FncRetCode v_ret := e_success; var UInt1 v_iFlag; v_ret := f_createAndSendInfoReq( v_ret := f_createAndSendInfoReq( p_addrTn, p_addrTn, p_addrIut, p_addrIut, p_iFlag, p_iFlag, c_deletePL, m_delIkeSaPL(c_noNextPL) m_delIkeSaPL(c_noNextPL) ); ); if (v_ret != e_success) { return v_ret;} if (v_ret != e_success) { return v_ret;} tc_wait.start; if (p_iFlag == c_iFlagResponder) alt { {v_iFlag := c_iFlagInitiator;} [] ipPort.receive( else mw_ikeInfoResp ( {v_iFlag := c_iFlagResponder;} p_addrIut, v_ret := f_waitForInformationalRes( p_addrTn, p_addrTn, vc_ikeSad[0].udpIutPort, p_addrIut, vc_ikeSad[0].udpTnPort, v_iFlag, vc_ikeSad[0].spiInitiator, {mw_delIkeSaPL}) vc_ikeSad[0].spiResponder, vc_ikeSad[0].messageID, m_ikePlList_1Elem( mw_encryptedPL( m_ikePlList_1Elem(mw_delIkeSaPL) ) ) ) ) { tc_wait.stop; log("**** f_delIkeSa: IKE SA deleted successfully! **** "); v_ret := e_success; } [] tc_wait.timeout if (v_ret == e_success) { {log("**** f_delIkeSa: IKE SA deleted successfully! **** ");} v_ret := e_timeout; else log("**** f_delIkeSa: ERROR: tc_wait.timeout, IKE SA not deleted! **** "); {log("**** f_delIkeSa: ERROR: IKE SA not deleted! **** ");} v_ret := e_error; } } // end alt return v_ret; return v_ret; Loading
ttcn3/EtsiLibrary/LibIpv6/LibSec/LibIpv6_Rfc4306Ikev2_Templates.ttcn +131 −37 File changed.Preview size limit exceeded, changes collapsed. Show changes