00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "pana_paa.h"
00035 #include "pana_serial_num.h"
00036 #include "pana_config_manager.h"
00037 #include "pana_cookie.h"
00038
00039 void PANA_Paa::ReceiveDiscover()
00040 {
00041 PANA_Message &msg = *(m_RxMessageQueue.front());
00042 m_RxMessageQueue.pop_front();
00043
00044 m_PeerDeviceId.clone(msg.srcDevices());
00045 m_PeerPort = msg.srcPort();
00046
00047 if (PANA_CONFIG_AUTHAGENT().eap_piggyback_) {
00048 static_cast<PANA_PaaEventInterface&>(m_Event).EapStart
00049 (m_SeparateAuth);
00050 m_InStatefulDiscovery = true;
00051 }
00052 else {
00053 SendStartRequest(NULL);
00054 }
00055 delete &msg;
00056 }
00057
00058 void PANA_Paa::Receive2ndEapStart()
00059 {
00060 PANA_Message &msg = *(m_RxMessageQueue.front());
00061 m_RxMessageQueue.pop_front();
00062
00063
00064 m_Timer.Cancel(PANA_TID_PBR_RETRY);
00065 m_RtQueue.ClearFront();
00066
00067 static_cast<PANA_PaaEventInterface&>(m_Event).EapStart
00068 (m_SeparateAuth);
00069 delete &msg;
00070 }
00071
00072 void PANA_Paa::ReceiveEapReAuth()
00073 {
00074 if (! m_RxMessageQueue.empty()) {
00075 PANA_Message *msg = m_RxMessageQueue.front();
00076 if (msg) {
00077 m_RxMessageQueue.pop_front();
00078 delete msg;
00079 }
00080 }
00081
00082 BindResultReset();
00083 ReAuthenticate(PANA_REAUTH_EAP);
00084 }
00085
00086 void PANA_Paa::ReceiveStartAnswer()
00087 {
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 PANA_Message &msg = *(m_RxMessageQueue.front());
00128 m_RxMessageQueue.pop_front();
00129
00130 ACE_DEBUG((LM_INFO, "(%P|%t) RECV: Start answer [session], S-flag %d, tseq=%d, rseq=%d\n",
00131 msg.flags().separate, msg.tseq(), msg.rseq()));
00132
00133 AAAAvpContainer* c_sessionId = msg.avpList().search("Session-Id");
00134 if (c_sessionId == NULL) {
00135 throw (PANA_Exception(PANA_Exception::ENTRY_NOT_FOUND,
00136 "Session Id AVP not found in packet, discarding message"));
00137 }
00138 diameter_utf8string_t &sessionId = (*c_sessionId)
00139 [0]->dataRef(Type2Type<diameter_utf8string_t>());
00140
00141
00142 m_SessionId = sessionId;
00143 m_InitialPaaTsec = msg.rseq();
00144 m_InitialPacTsec = msg.tseq();
00145 m_LastTransmittedTsec = m_InitialPaaTsec;
00146 m_LastReceivedTsec = msg.tseq();
00147 m_LastReceivedRsec = msg.rseq();
00148 m_PeerPort = msg.srcPort();
00149 m_LastPayload = NULL;
00150 m_SessionLifetime = PANA_CONFIG_AUTHAGENT().sessionLifetime_;
00151 m_SeparateAuth = (PANA_CONFIG_AUTHAGENT().s_flag_) ?
00152 msg.flags().separate : 0;
00153 m_ReqDeviceId = PANA_DeviceId::TYPE(PANA_CONFIG_AUTHAGENT().request_dev_id_);
00154 m_PeerDeviceId.clone(msg.srcDevices());
00155 m_BindCount = 0;
00156
00157
00158 if (AAAAvpContainer *c_ispInfo = msg.avpList().search("ISP-Information")) {
00159
00160 diameter_grouped_t &ispList = (*c_ispInfo)[0]->dataRef(Type2Type<diameter_grouped_t>());
00161
00162 if (AAAAvpContainer *c_name = ispList.search("Provider-Name")) {
00163 m_PreferedISP.name_ = (*c_name)[0]->dataRef(Type2Type<diameter_utf8string_t>());
00164 ACE_DEBUG((LM_INFO, "(%P|%t) Provider name = %s\n", m_PreferedISP.name_.data()));
00165 }
00166
00167 if (AAAAvpContainer *c_id = ispList.search("Provider-Identifier")) {
00168 m_PreferedISP.id_ = (*c_id)[0]->dataRef(Type2Type<diameter_unsigned32_t>());
00169 ACE_DEBUG((LM_INFO, "(%P|%t) Provider id = %d\n", m_PreferedISP.id_));
00170 }
00171
00172 ACE_DEBUG((LM_INFO, "(%P|%t) Pac ISP preference: %s [ID: %d]\n",
00173 m_PreferedISP.name_.data(), m_PreferedISP.id_));
00174 }
00175
00176 if (PANA_CONFIG_AUTHAGENT().use_cookie_ ||
00177 (! PANA_CONFIG_AUTHAGENT().eap_piggyback_)) {
00178 static_cast<PANA_PaaEventInterface&>(m_Event).EapStart(m_SeparateAuth);
00179 }
00180 else {
00181 AAAAvpContainer* c_eapPayload = msg.avpList().search("EAP-Payload");
00182 if (c_eapPayload == NULL) {
00183 throw (PANA_Exception(PANA_Exception::INVALID_MESSAGE,
00184 "No EAP payload found in PSA during piggyback"));
00185 }
00186
00187 diameter_octetstring_t &eapPayload = (*c_eapPayload)[0]->
00188 dataRef(Type2Type<diameter_octetstring_t>());
00189
00190 AAAMessageBlock *block = AAAMessageBlock::Acquire
00191 ((char*)eapPayload.data(), eapPayload.size());
00192 static_cast<PANA_PaaEventInterface&>(m_Event).EapResponse
00193 (block, m_SeparateAuth);
00194 block->Release();
00195 }
00196 delete &msg;
00197 }
00198
00199 void PANA_Paa::SendStartRequest(AAAMessageBlock *request, PANA_PINFO type)
00200 {
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 AAAAvpContainerManager cm;
00223 AAAAvpContainerEntryManager em;
00224 AAAAvpContainerEntry *e;
00225 PANA_Message *msg;
00226
00227 ACE_NEW_NORETURN(msg, PANA_Message);
00228 if (msg == NULL) {
00229 throw (PANA_Exception(PANA_Exception::NO_MEMORY,
00230 "Failed to allocate msg message"));
00231 }
00232
00233
00234 PANA_MsgHeader::Flags flg = { 1, 0, 0, 0 };
00235 msg->flags(flg);
00236 msg->type(PANA_MTYPE_START);
00237 msg->tseq(PANA_SerialNumber::generateIsn());
00238 msg->rseq(0);
00239
00240
00241 msg->flags().separate = PANA_CONFIG_AUTHAGENT().s_flag_;
00242
00243
00244 if (request) {
00245 AAAAvpContainer *c_eapPayload = cm.acquire("EAP-Payload");
00246
00247 e = em.acquire(AAA_AVP_STRING_TYPE);
00248 diameter_octetstring_t &eapPayload = e->dataRef(Type2Type<diameter_octetstring_t>());
00249 c_eapPayload->add(e);
00250
00251
00252 msg->avpList().add(c_eapPayload);
00253
00254
00255
00256
00257
00258
00259
00260
00261 eapPayload.assign(request->base(), request->size());
00262 }
00263
00264
00265 PANA_ProviderInfoTool infoTool;
00266 PANA_CfgProviderInfo *pInfo = &PANA_CONFIG_AUTHAGENT().nap_info_;
00267 if (pInfo->name_.length() > 0) {
00268
00269
00270 AAAAvpContainer *c_napInfo = cm.acquire("NAP-Information");
00271 e = em.acquire(AAA_AVP_GROUPED_TYPE);
00272 diameter_grouped_t &napInfo = e->dataRef(Type2Type<diameter_grouped_t>());
00273 c_napInfo->add(e);
00274
00275
00276 msg->avpList().add(c_napInfo);
00277 infoTool.Add(napInfo, *pInfo);
00278 }
00279
00280
00281 PANA_CfgProviderList &ispList = PANA_CONFIG_AUTHAGENT().isp_info_;
00282 if (ispList.size() > 0) {
00283
00284
00285 AAAAvpContainer *c_ispInfo = cm.acquire("ISP-Information");
00286 msg->avpList().add(c_ispInfo);
00287
00288 PANA_CfgProviderList::iterator i;
00289 for (i = ispList.begin(); i != ispList.end(); i ++) {
00290
00291 pInfo = (*i);
00292
00293
00294 e = em.acquire(AAA_AVP_GROUPED_TYPE);
00295 diameter_grouped_t &ispInfo = e->dataRef(Type2Type<diameter_grouped_t>());
00296 c_ispInfo->add(e);
00297
00298
00299 PANA_ProviderInfoTool info;
00300 info.Add(ispInfo, *pInfo);
00301 }
00302 }
00303
00304
00305 m_InStatefulDiscovery = false;
00306
00307
00308 DestinationAddressFormatting(*msg);
00309 m_TxChannel.Send(*this, *msg);
00310
00311 ACE_DEBUG((LM_INFO, "(%P|%t) SEND: Start-Request, tseq=%d, rseq=%d\n",
00312 msg->tseq(), msg->rseq()));
00313 }
00314
00315 void PANA_Paa::SendEapRequest(AAAMessageBlock *request, PANA_PINFO type)
00316 {
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 AAAAvpContainerManager cm;
00349 AAAAvpContainerEntryManager em;
00350 PANA_Message *msg;
00351
00352 ACE_NEW_NORETURN(msg, PANA_Message);
00353 if (msg == NULL) {
00354 throw (PANA_Exception(PANA_Exception::NO_MEMORY,
00355 "Failed to allocate msg message"));
00356 }
00357
00358
00359 PANA_MsgHeader::Flags flg = { 1, 0, 0, 0 };
00360 msg->flags(flg);
00361 msg->type(PANA_MTYPE_AUTH);
00362 msg->tseq(++ m_LastTransmittedTsec);
00363 msg->rseq(m_LastReceivedTsec);
00364
00365
00366 AAAAvpContainerEntry *e;
00367 AAAAvpContainer *c_sessionId = cm.acquire("Session-Id");
00368 AAAAvpContainer *c_eapPayload = cm.acquire("EAP-Payload");
00369
00370
00371 e = em.acquire(AAA_AVP_UTF8_STRING_TYPE);
00372 diameter_utf8string_t &sessionId = e->dataRef(Type2Type<diameter_utf8string_t>());
00373 c_sessionId->add(e);
00374
00375 e = em.acquire(AAA_AVP_STRING_TYPE);
00376 diameter_octetstring_t &eapPayload = e->dataRef(Type2Type<diameter_octetstring_t>());
00377 c_eapPayload->add(e);
00378
00379
00380 msg->avpList().add(c_sessionId);
00381 msg->avpList().add(c_eapPayload);
00382
00383
00384
00385
00386
00387
00388
00389
00390 sessionId.assign(m_SessionId.data(), m_SessionId.size());
00391 eapPayload.assign(request->base(), request->size());
00392
00393 if (m_SeparateAuth) {
00394
00395 ACE_DEBUG((LM_INFO, "(%P|%t) Separate NAP/ISP authentication supported\n"));
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417 PANA_CfgProviderInfo *pInfo = NULL;
00418 AAAAvpContainer *c_pInfo = NULL;
00419
00420 switch (type) {
00421 case PANA_PINFO_ISP:
00422 pInfo = &m_PreferedISP;
00423 c_pInfo = cm.acquire("ISP-Information");
00424 break;
00425
00426 case PANA_PINFO_NAP:
00427 pInfo = &PANA_CONFIG_AUTHAGENT().nap_info_;
00428 c_pInfo = cm.acquire("NAP-Information");
00429 break;
00430
00431 default:
00432 break;
00433 }
00434
00435 if (pInfo && pInfo->name_.length() > 0) {
00436
00437
00438 e = em.acquire(AAA_AVP_GROUPED_TYPE);
00439 diameter_grouped_t &group = e->dataRef(Type2Type<diameter_grouped_t>());
00440 c_pInfo->add(e);
00441
00442
00443 msg->avpList().add(c_pInfo);
00444 PANA_ProviderInfoTool infoTool;
00445 infoTool.Add(group, *pInfo);
00446 }
00447 }
00448
00449
00450 DestinationAddressFormatting(*msg);
00451 m_TxChannel.Send(*this, *msg);
00452
00453 ACE_DEBUG((LM_INFO, "(%P|%t) SEND: EAP-Request, tseq=%d, rseq=%d\n",
00454 msg->tseq(), msg->rseq()));
00455 }
00456
00457 void PANA_Paa::SendBindRequest(AAAMessageBlock *request, ACE_UINT32 rCode)
00458 {
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491 AAAAvpContainerManager cm;
00492 AAAAvpContainerEntryManager em;
00493 PANA_Message *msg;
00494
00495 ACE_NEW_NORETURN(msg, PANA_Message);
00496 if (msg == NULL) {
00497 throw (PANA_Exception(PANA_Exception::NO_MEMORY,
00498 "Failed to allocate msg message"));
00499 }
00500
00501
00502 PANA_MsgHeader::Flags flg = { 1, 0, 0, 0 };
00503 msg->flags(flg);
00504 msg->type(PANA_MTYPE_BIND);
00505 msg->tseq(++ m_LastTransmittedTsec);
00506 msg->rseq(m_LastReceivedTsec);
00507
00508
00509 AAAAvpContainerEntry *e;
00510 AAAAvpContainer *c_sessionId = cm.acquire("Session-Id");
00511 AAAAvpContainer *c_deviceId = cm.acquire("Device-Id");
00512 AAAAvpContainer *c_eapPayload = cm.acquire("EAP-Payload");
00513 AAAAvpContainer *c_resultCode = cm.acquire("Result-Code");
00514
00515
00516 e = em.acquire(AAA_AVP_UTF8_STRING_TYPE);
00517 diameter_utf8string_t &sessionId = e->dataRef(Type2Type<diameter_utf8string_t>());
00518 c_sessionId->add(e);
00519
00520 e = em.acquire(AAA_AVPDataType(AAA_AVP_DEVICEID_TYPE));
00521 PANA_TVData_t &deviceId = e->dataRef(Type2Type<PANA_TVData_t>());
00522 c_deviceId->add(e);
00523
00524 e = em.acquire(AAA_AVP_STRING_TYPE);
00525 diameter_octetstring_t &eapPayload = e->dataRef(Type2Type<diameter_octetstring_t>());
00526 c_eapPayload->add(e);
00527
00528 e = em.acquire(AAA_AVP_UINTEGER32_TYPE);
00529 diameter_unsigned32_t &resultCode = e->dataRef(Type2Type<diameter_unsigned32_t>());
00530 c_resultCode->add(e);
00531
00532
00533 msg->avpList().add(c_sessionId);
00534 msg->avpList().add(c_deviceId);
00535 msg->avpList().add(c_eapPayload);
00536 msg->avpList().add(c_resultCode);
00537
00538
00539 resultCode = rCode;
00540 sessionId.assign(m_SessionId.data(), m_SessionId.size());
00541 eapPayload.assign(request->base(), request->size());
00542
00543 switch (BindResult()) {
00544 case PANA_BIND_SUCCESS_FINAL: {
00545 diameter_unsigned32_t lifetime =
00546 PANA_CONFIG_AUTHAGENT().sessionLifetime_ +
00547 PANA_CONFIG_AUTHAGENT().gracePeriod_;
00548 if (lifetime > 0) {
00549 AAAAvpContainer *c_sessionLifetime = cm.acquire("Session-Lifetime");
00550
00551 e = em.acquire(AAA_AVP_UINTEGER32_TYPE);
00552 diameter_unsigned32_t &sessionLifetime = e->dataRef
00553 (Type2Type<diameter_unsigned32_t>());
00554 c_sessionLifetime->add(e);
00555
00556 sessionLifetime = lifetime;
00557 msg->avpList().add(c_sessionLifetime);
00558 }
00559 }
00560
00561 case PANA_BIND_INTERIM: {
00562 diameter_unsigned32_t protectionCap = PANA_PCAP_UNKNOWN;
00563 if (PANA_CONFIG_GENERAL().protection_capability_ > 0) {
00564 AAAAvpContainer *c_protectionCap = cm.acquire
00565 ("Protection-Capability");
00566
00567 e = em.acquire(AAA_AVP_UINTEGER32_TYPE);
00568 protectionCap = e->dataRef(Type2Type<diameter_unsigned32_t>());
00569 c_protectionCap->add(e);
00570
00571 protectionCap = PANA_CONFIG_GENERAL().protection_capability_;
00572 msg->avpList().add(c_protectionCap);
00573 }
00574
00575 if (m_SA.MSK().length() > 0) {
00576 AAAAvpContainer *c_keyId = cm.acquire("Key-Id");
00577 e = em.acquire(AAA_AVP_INTEGER32_TYPE);
00578 diameter_integer32_t &keyId = e->dataRef
00579 (Type2Type<diameter_integer32_t>());
00580 c_keyId->add(e);
00581
00582 msg->avpList().add(c_keyId);
00583 keyId = m_SA.KeyId();
00584 }
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605 if (((protectionCap == PANA_PCAP_L2) ||
00606 (protectionCap == PANA_PCAP_IPSEC)) &&
00607 (! PANA_CONFIG_AUTHAGENT().ep_id_.empty())) {
00608
00609 AAAAvpContainer *c_epDeviceId = cm.acquire("EP-Device-Id");
00610 msg->avpList().add(c_epDeviceId);
00611
00612 PANA_DeviceIdIterator i = PANA_CONFIG_AUTHAGENT().ep_id_.begin();
00613 for (;i != PANA_CONFIG_AUTHAGENT().ep_id_.end(); i++) {
00614
00615 PANA_DeviceId *id = (*i);
00616
00617
00618 e = em.acquire(AAA_AVPDataType(AAA_AVP_DEVICEID_TYPE));
00619 PANA_TVData_t &deviceId = e->dataRef(Type2Type<PANA_TVData_t>());
00620 c_epDeviceId->add(e);
00621
00622 deviceId.type = id->type();
00623 std::string &value = const_cast<std::string&>(id->id());
00624 deviceId.value.assign(value.data(), value.size());
00625 }
00626 }
00627 }
00628 break;
00629 case PANA_BIND_SUCCESS_INITIAL:
00630 case PANA_BIND_FAILED:
00631 default:
00632 break;
00633 }
00634
00635
00636
00637
00638
00639
00640
00641
00642 PANA_DeviceIdContainer srcDevices;
00643 m_TxChannel.GetLocalAddress(srcDevices);
00644
00645 PANA_DeviceId *id = srcDevices.search(m_ReqDeviceId);
00646 if (id == NULL) {
00647
00648 id = srcDevices.search(PANA_DeviceId::IPV4_ADDRESS);
00649 if (id == NULL) {
00650 throw (PANA_Exception(PANA_Exception::FAILED,
00651 "No IPV4/MAC address given in the peer device list"));
00652 }
00653 m_ReqDeviceId = PANA_DeviceId::IPV4_ADDRESS;
00654 }
00655 deviceId.type = id->type();
00656 deviceId.value.assign(id->id().data(), id->id().size());
00657
00658
00659 DestinationAddressFormatting(*msg, request);
00660 m_TxChannel.Send(*this, *msg);
00661
00662 ACE_DEBUG((LM_INFO, "(%P|%t) SEND: Bind-Request, tseq=%d, rseq=%d, keyId=%d\n",
00663 msg->tseq(), msg->rseq(), m_SA.KeyId()));
00664
00665 PANA_RtQueueMsgBlockDataWithRcode data(request, rCode);
00666 if (m_RtQueue.Schedule(data)) {
00667 m_Timer.Schedule(PANA_TID_PBR_RETRY, data.Timeout());
00668 }
00669 }
00670
00671 void PANA_Paa::RetryBindRequest()
00672 {
00673 m_Timer.Cancel(PANA_TID_PBR_RETRY);
00674
00675 PANA_RtQueueData *data = NULL;
00676 if (m_RtQueue.ReSchedule(data)) {
00677 SendBindRequest(static_cast<PANA_RtQueueMsgBlockDataWithRcode*>(data)->MsgBlock(),
00678 static_cast<PANA_RtQueueMsgBlockDataWithRcode*>(data)->RCode());
00679 m_Timer.Schedule(PANA_TID_PBR_RETRY, data->Timeout());
00680 }
00681 else {
00682 m_Timer.Schedule(PANA_TID_DISCONNECT, 0);
00683 }
00684 }
00685
00686 void PANA_Paa::ReceiveBindAnswer()
00687 {
00688 PANA_Message &msg = *(m_RxMessageQueue.front());
00689 m_RxMessageQueue.pop_front();
00690
00691 AAAAvpContainer* c_deviceId = msg.avpList().search("Device-Id");
00692 if (c_deviceId) {
00693 PANA_TVData_t &deviceId = (*c_deviceId)[0]->dataRef(Type2Type<PANA_TVData_t>());
00694 if (m_ReqDeviceId == deviceId.type) {
00695 PANA_DeviceId id(PANA_DeviceId::TYPE(deviceId.type), deviceId.value);
00696 PANA_DeviceId *knownId = m_PeerDeviceId.search(PANA_DeviceId::TYPE(deviceId.type));
00697 if (knownId && !(*knownId == id)) {
00698 throw (PANA_Exception(PANA_Exception::INVALID_MESSAGE,
00699 "Device id type in bind answer does not match known peer id"));
00700 }
00701 else if (! knownId) {
00702 m_PeerDeviceId.clone(id);
00703 }
00704 m_Event.AuthorizePeer(id, false);
00705 }
00706 else {
00707 throw (PANA_Exception(PANA_Exception::INVALID_MESSAGE,
00708 "Device id type in bind answer does not match request"));
00709 }
00710 }
00711
00712
00713 m_Timer.Cancel(PANA_TID_PBR_RETRY);
00714 m_RtQueue.ClearFront();
00715 delete &msg;
00716 }
00717
00718 void PANA_Paa::ReceiveEapResponse()
00719 {
00720 PANA_Message &msg = *(m_RxMessageQueue.front());
00721 m_RxMessageQueue.pop_front();
00722
00723 ACE_DEBUG((LM_INFO, "(%P|%t) RECV: Auth answer, S-flag %d, tseq=%d, rseq=%d\n",
00724 msg.flags().separate, msg.tseq(), msg.rseq()));
00725
00726 AAAAvpContainer* c_eapPayload = msg.avpList().search("EAP-Payload");
00727 if (c_eapPayload == NULL) {
00728 throw (PANA_Exception(PANA_Exception::ENTRY_NOT_FOUND,
00729 "EAP-Payload AVP not found in packet, discarding message"));
00730 }
00731
00732 diameter_octetstring_t &eapPDU = (*c_eapPayload)
00733 [0]->dataRef(Type2Type<diameter_octetstring_t>());
00734 AAAMessageBlock *eapBlock = AAAMessageBlock::Acquire((char*)eapPDU.data(), eapPDU.size());
00735 static_cast<PANA_PaaEventInterface&>(m_Event).EapResponse(eapBlock, m_SeparateAuth);
00736 eapBlock->Release();
00737 delete &msg;
00738 }
00739
00740 void PANA_Paa::DestinationAddressFormatting(PANA_Message &msg,
00741 AAAMessageBlock *eapPayload)
00742 {
00743
00744 if (eapPayload) {
00745 if (m_LastPayload) {
00746 m_LastPayload->Release();
00747 }
00748 m_LastPayload = AAAMessageBlock::Acquire(eapPayload);
00749 }
00750
00751 msg.srcPort(m_PeerPort);
00752 msg.srcDevices().clone(m_PeerDeviceId);
00753 }
00754
00755 void PANA_Paa::ValidateCookie(PANA_Message &psa) throw(PANA_Exception)
00756 {
00757
00758 AAAAvpContainer *c_cookie = psa.avpList().search("Cookie");
00759 if (c_cookie == NULL) {
00760 throw (PANA_Exception(PANA_Exception::INVALID_MESSAGE,
00761 "Missing cookie AVP in start answer message"));
00762 }
00763 diameter_octetstring_t &cookie = (*c_cookie)[0]->dataRef(Type2Type<diameter_octetstring_t>());
00764
00765
00766 PANA_DeviceIdContainer &cntr = psa.srcDevices();
00767 PANA_DeviceId *ipId = cntr.search(PANA_DeviceId::IPV4_ADDRESS);
00768 PANA_DeviceId *hwId = cntr.search(PANA_DeviceId::LL_ADDRESS);
00769
00770 ACE_DEBUG((LM_INFO, "(%P|%t) Validating cookie\n"));
00771
00772
00773 if ((PANA_COOKIE_VERIFY(const_cast<std::string&>(ipId->id()), cookie) == false)) {
00774
00775 if (PANA_COOKIE_VERIFY(const_cast<std::string&>(hwId->id()), cookie) == false) {
00776 throw (PANA_Exception(PANA_Exception::FAILED,
00777 "Received start answer with invalid cookie"));
00778 }
00779 }
00780 }
00781