3053 { |
3053 { |
3054 // |
3054 // |
3055 // Local end COOKIE usage has not been implemented yet |
3055 // Local end COOKIE usage has not been implemented yet |
3056 // |
3056 // |
3057 |
3057 |
3058 // |
3058 // |
3059 // Init a new IKE message buffer and copy received COOKIE |
3059 // Init a new IKE message buffer and copy received COOKIE |
3060 // Notify to the first payload. Concatenate then all |
3060 // Notify to the first payload. Concatenate then all |
3061 // payloads from original IKE_SA_INIT request to this new |
3061 // payloads from original IKE_SA_INIT request to this new |
3062 // IKE message (and set next payload field in Notify) |
3062 // IKE message (and set next payload field in Notify) |
3063 // |
3063 // |
3064 DEBUG_LOG1(_L("Cookie received, IKE_SA_INIT repeated: %d"), iState); |
3064 DEBUG_LOG1(_L("Cookie received, IKE_SA_INIT repeated: %d"), iState); |
3065 if ( iCookieReturned ) |
3065 if ( iCookieReturned ) |
3066 { |
3066 { |
3067 // |
3067 // |
3068 // One cookie already returned. Avoid cookie-loop |
3068 // One cookie already returned. Avoid cookie-loop |
3069 // by stopping ongoing IKE_SA_INIT exchange |
3069 // by stopping ongoing IKE_SA_INIT exchange |
3070 // |
3070 // |
3071 DEBUG_LOG(_L("Cookie already returned once, IKE_SA_INIT exchange stopped")); |
3071 DEBUG_LOG(_L("Cookie already returned once, IKE_SA_INIT exchange stopped")); |
3072 return EFalse; |
3072 return EFalse; |
3073 } |
3073 } |
|
3074 |
3074 CIkeV2Message* originalIkeSaInitRequest = iHdr.iLastRequest; |
3075 CIkeV2Message* originalIkeSaInitRequest = iHdr.iLastRequest; |
|
3076 |
3075 const TPtrC8 cookieData(NotifyPayload->NotifData(), NotifyPayload->NotifDataLength()); |
3077 const TPtrC8 cookieData(NotifyPayload->NotifData(), NotifyPayload->NotifDataLength()); |
3076 originalIkeSaInitRequest->PrependCookieNotifyPayloadL(cookieData); |
3078 |
|
3079 // Use protocol id sent by gateway. RFC says id should be zero, but some GWs |
|
3080 // work against the spec. |
|
3081 TUint8 protocolId = NotifyPayload->GetProtocolId(); |
|
3082 |
|
3083 originalIkeSaInitRequest->PrependCookieNotifyPayloadL(protocolId, cookieData); |
3077 iHdr.iLastRequest = NULL; //claims the ownership of the message |
3084 iHdr.iLastRequest = NULL; //claims the ownership of the message |
3078 |
3085 |
3079 SendIkeMsgL(originalIkeSaInitRequest); |
3086 SendIkeMsgL(originalIkeSaInitRequest); |
3080 iTimer->Cancel(); // Reset transmit retry timer |
3087 iTimer->Cancel(); // Reset transmit retry timer |
3081 iTimer->IssueRequest(iSendAttempt); // Start retry timer |
3088 iTimer->IssueRequest(iSendAttempt); // Start retry timer |