Commit dc294603 authored by yangjian's avatar yangjian

Fix bug: handover error -> The count does not match

parent 044ed83d
...@@ -666,6 +666,7 @@ void amf_n1::service_request_handle(bool isNasSig, ...@@ -666,6 +666,7 @@ void amf_n1::service_request_handle(bool isNasSig,
} }
set_amf_ue_ngap_id_2_nas_context(amf_ue_ngap_id, nc); set_amf_ue_ngap_id_2_nas_context(amf_ue_ngap_id, nc);
nc.get()->ran_ue_ngap_id = ran_ue_ngap_id;
nas_secu_ctx *secu = nc.get()->security_ctx; nas_secu_ctx *secu = nc.get()->security_ctx;
ServiceRequest *serReq = new ServiceRequest(); ServiceRequest *serReq = new ServiceRequest();
serReq->decodefrombuffer(nullptr, (uint8_t *)bdata(nas), blength(nas)); serReq->decodefrombuffer(nullptr, (uint8_t *)bdata(nas), blength(nas));
...@@ -2194,7 +2195,6 @@ int amf_n1::security_select_algorithms(uint8_t nea, uint8_t nia, ...@@ -2194,7 +2195,6 @@ int amf_n1::security_select_algorithms(uint8_t nea, uint8_t nia,
} }
return 0; return 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
long amf_ue_ngap_id, long amf_ue_ngap_id,
...@@ -2353,9 +2353,9 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, ...@@ -2353,9 +2353,9 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
protectedNas); protectedNas);
uint8_t *kamf = nc.get()->kamf[secu->vector_pointer]; uint8_t *kamf = nc.get()->kamf[secu->vector_pointer];
uint8_t kgnb[32]; uint8_t kgnb[32];
uint32_t ulcount = secu->ul_count.seq_num | (secu->ul_count.overflow << 8); // uint32_t ulcount = secu->ul_count.seq_num | (secu->ul_count.overflow << 8);
Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb); Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb);
ncc = 1; // ncc = 1;
print_buffer("amf_n1", "kamf", kamf, 32); print_buffer("amf_n1", "kamf", kamf, 32);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb); // Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring kgnb_bs = blk2bstr(kgnb, 32); bstring kgnb_bs = blk2bstr(kgnb, 32);
...@@ -3055,8 +3055,11 @@ void amf_n1::run_mobility_registration_update_procedure( ...@@ -3055,8 +3055,11 @@ void amf_n1::run_mobility_registration_update_procedure(
itti_msg->kgnb = kgnb_bs; itti_msg->kgnb = kgnb_bs;
itti_msg->nas = protectedNas; itti_msg->nas = protectedNas;
itti_msg->is_sr = true; // service request indicator itti_msg->is_sr = true; // service request indicator
itti_msg->pdu_session_id = psc.get()->pdu_session_id; if(psc.get() != nullptr)
itti_msg->n2sm = psc.get()->n2sm; {
itti_msg->pdu_session_id = psc.get()->pdu_session_id;
itti_msg->n2sm = psc.get()->n2sm;
}
std::shared_ptr<itti_initial_context_setup_request> i = std::shared_ptr<itti_initial_context_setup_request> i =
std::shared_ptr<itti_initial_context_setup_request>(itti_msg); std::shared_ptr<itti_initial_context_setup_request>(itti_msg);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
......
...@@ -199,9 +199,12 @@ void amf_n11::handle_itti_message( ...@@ -199,9 +199,12 @@ void amf_n11::handle_itti_message(
Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str()); Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str());
nlohmann::json pdu_session_update_request = {}; nlohmann::json pdu_session_update_request = {};
// if (itti_msg.is_n2sm_set){
pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type; pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type;
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg"; pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg";
if(!itti_msg.ho_state.compare("COMPLETED"))
{
pdu_session_update_request["hoState"] = itti_msg.ho_state;
}
std::string json_part = pdu_session_update_request.dump(); std::string json_part = pdu_session_update_request.dump();
std::string n2SmMsg; std::string n2SmMsg;
octet_stream_2_hex_stream( octet_stream_2_hex_stream(
......
This diff is collapsed.
...@@ -70,6 +70,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 { ...@@ -70,6 +70,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
} }
public: public:
std::string ho_state;
std::string supi; std::string supi;
uint8_t pdu_session_id; uint8_t pdu_session_id;
bstring n2sm; bstring n2sm;
......
...@@ -21,16 +21,16 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18( ...@@ -21,16 +21,16 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t* countvalue) { Ngap_COUNTValueForPDCP_SN18_t* countvalue) {
countvalue->pDCP_SN18 = pdcp; countvalue->pDCP_SN18 = pdcp;
countvalue->hFN_PDCP_SN18 = hfn_pdcp; countvalue->hFN_PDCP_SN18 = hfn_pdcp;
cout << "the encode pdcp_sn18 is" << countvalue->pDCP_SN18 << endl; // cout << "the encode pdcp_sn18 is" << countvalue->pDCP_SN18 << endl;
cout << "the encode hfn_pdcp_sn18 is" << countvalue->hFN_PDCP_SN18 << endl; // cout << "the encode hfn_pdcp_sn18 is" << countvalue->hFN_PDCP_SN18 << endl;
return true; return true;
} }
bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18( bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t& countValue) { Ngap_COUNTValueForPDCP_SN18_t& countValue) {
pdcp = countValue.pDCP_SN18; pdcp = countValue.pDCP_SN18;
hfn_pdcp = countValue.hFN_PDCP_SN18; hfn_pdcp = countValue.hFN_PDCP_SN18;
cout << "the decode pdcp_sn18 is" << countValue.pDCP_SN18 << endl; // cout << "the decode pdcp_sn18 is" << countValue.pDCP_SN18 << endl;
cout << "the decode hfn_pdcp_sn18 is" << countValue.hFN_PDCP_SN18 << endl; // cout << "the decode hfn_pdcp_sn18 is" << countValue.hFN_PDCP_SN18 << endl;
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -32,17 +32,17 @@ void PDUSessionResourceHandoverCommandTransfer::setQosFlowToBeForwardedList( ...@@ -32,17 +32,17 @@ void PDUSessionResourceHandoverCommandTransfer::setQosFlowToBeForwardedList(
qosFlowToBeForwardedList->setQosFlowToBeForwardedItem(m_item, list.size()); qosFlowToBeForwardedList->setQosFlowToBeForwardedItem(m_item, list.size());
int ret = qosFlowToBeForwardedList->encodeQosFlowToBeForwardedList( int ret = qosFlowToBeForwardedList->encodeQosFlowToBeForwardedList(
handovercommandtransferIE->qosFlowToBeForwardedList); handovercommandtransferIE->qosFlowToBeForwardedList);
cout << "QFI in list " // cout << "QFI in list "
<< handovercommandtransferIE->qosFlowToBeForwardedList->list.count // << handovercommandtransferIE->qosFlowToBeForwardedList->list.count
<< endl; // << endl;
if (handovercommandtransferIE->qosFlowToBeForwardedList->list.array) { if (handovercommandtransferIE->qosFlowToBeForwardedList->list.array) {
cout << "array OK" << endl; // cout << "array OK" << endl;
if (handovercommandtransferIE->qosFlowToBeForwardedList->list.array[0]) { if (handovercommandtransferIE->qosFlowToBeForwardedList->list.array[0]) {
cout << "QFI in list " // cout << "QFI in list "
<< handovercommandtransferIE->qosFlowToBeForwardedList->list // << handovercommandtransferIE->qosFlowToBeForwardedList->list
.array[0] // .array[0]
->qosFlowIdentifier // ->qosFlowIdentifier
<< endl; // << endl;
} else { } else {
cout << "error1" << endl; cout << "error1" << endl;
} }
......
...@@ -61,11 +61,11 @@ bool PDUSessionResourceHandoverRequestAckTransfer:: ...@@ -61,11 +61,11 @@ bool PDUSessionResourceHandoverRequestAckTransfer::
cout << "More data expected, call again" << endl; cout << "More data expected, call again" << endl;
return false; return false;
} else { } else {
cout << "Failure to decode handoverRequestAcknowledegTransfer data" << endl; cout << "Warn: Failure to decode handoverRequestAcknowledegTransfer data" << endl;
// return false; // return false;
} }
cout << "rc.consumed to decode = " << rc.consumed << endl; // cout << "rc.consumed to decode = " << rc.consumed << endl;
cout << endl; // cout << endl;
dLForwardingUP_TNLInformation = new UpTransportLayerInformation(); dLForwardingUP_TNLInformation = new UpTransportLayerInformation();
if (!dLForwardingUP_TNLInformation->decodefromUpTransportLayerInformation( if (!dLForwardingUP_TNLInformation->decodefromUpTransportLayerInformation(
*handoverRequestAcknowledegTransferIEs *handoverRequestAcknowledegTransferIEs
...@@ -102,10 +102,7 @@ bool PDUSessionResourceHandoverRequestAckTransfer::getqosFlowSetupResponseList( ...@@ -102,10 +102,7 @@ bool PDUSessionResourceHandoverRequestAckTransfer::getqosFlowSetupResponseList(
if (!QosFlowSetupResponseList) return false; if (!QosFlowSetupResponseList) return false;
QosFlowItemWithDataForWarding* m_qosflowitemwithdataforwarding; QosFlowItemWithDataForWarding* m_qosflowitemwithdataforwarding;
int num = 0; int num = 0;
if (QosFlowSetupResponseList->getQosFlowListWithDataForwarding( QosFlowSetupResponseList->getQosFlowListWithDataForwarding(m_qosflowitemwithdataforwarding, num);
m_qosflowitemwithdataforwarding, num)) {
cout << "successful decode QosFlowList" << endl;
}
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
QosFlowLItemWithDataForwarding_t response; QosFlowLItemWithDataForwarding_t response;
m_qosflowitemwithdataforwarding[i].getQosFlowItemWithDataForWarding( m_qosflowitemwithdataforwarding[i].getQosFlowItemWithDataForWarding(
......
...@@ -17,7 +17,7 @@ bool QosFlowToBeForwardedList::encodeQosFlowToBeForwardedList( ...@@ -17,7 +17,7 @@ bool QosFlowToBeForwardedList::encodeQosFlowToBeForwardedList(
m_ngap_qosflowtobeforwardedlist = (Ngap_QosFlowToBeForwardedList_t*) calloc( m_ngap_qosflowtobeforwardedlist = (Ngap_QosFlowToBeForwardedList_t*) calloc(
1, sizeof(Ngap_QosFlowToBeForwardedList_t)); 1, sizeof(Ngap_QosFlowToBeForwardedList_t));
for (int i = 0; i < numofqosflowtobeforwardeditem; i++) { for (int i = 0; i < numofqosflowtobeforwardeditem; i++) {
cout << "encoding list..." << endl; // cout << "encoding list..." << endl;
Ngap_QosFlowToBeForwardedItem_t* response = Ngap_QosFlowToBeForwardedItem_t* response =
(Ngap_QosFlowToBeForwardedItem_t*) calloc( (Ngap_QosFlowToBeForwardedItem_t*) calloc(
1, sizeof(Ngap_QosFlowToBeForwardedItem_t)); 1, sizeof(Ngap_QosFlowToBeForwardedItem_t));
...@@ -26,7 +26,7 @@ bool QosFlowToBeForwardedList::encodeQosFlowToBeForwardedList( ...@@ -26,7 +26,7 @@ bool QosFlowToBeForwardedList::encodeQosFlowToBeForwardedList(
cout << "encode QosFlowTowardedItem error" << endl; cout << "encode QosFlowTowardedItem error" << endl;
return false; return false;
} }
cout << "QFI is " << response->qosFlowIdentifier << endl; // cout << "QFI is " << response->qosFlowIdentifier << endl;
if (ASN_SEQUENCE_ADD(&m_ngap_qosflowtobeforwardedlist->list, response) != if (ASN_SEQUENCE_ADD(&m_ngap_qosflowtobeforwardedlist->list, response) !=
0) { 0) {
cout << "encode QosFlowTowardedList error" << endl; cout << "encode QosFlowTowardedList error" << endl;
......
...@@ -48,7 +48,7 @@ bool dRBStatusDL::encodedRBStatusDL(Ngap_DRBStatusDL_t* dL) { ...@@ -48,7 +48,7 @@ bool dRBStatusDL::encodedRBStatusDL(Ngap_DRBStatusDL_t* dL) {
cout << "encodedRBStatusDL error" << endl; cout << "encodedRBStatusDL error" << endl;
return false; return false;
} }
cout << "encodedRBStatusDL successfully" << endl; // cout << "encodedRBStatusDL successfully" << endl;
return true; return true;
} }
bool dRBStatusDL::decodedRBStatusDL(Ngap_DRBStatusDL_t* dL) { bool dRBStatusDL::decodedRBStatusDL(Ngap_DRBStatusDL_t* dL) {
...@@ -57,7 +57,7 @@ bool dRBStatusDL::decodedRBStatusDL(Ngap_DRBStatusDL_t* dL) { ...@@ -57,7 +57,7 @@ bool dRBStatusDL::decodedRBStatusDL(Ngap_DRBStatusDL_t* dL) {
cout << "decodedRBStatusDL error" << endl; cout << "decodedRBStatusDL error" << endl;
return false; return false;
} }
cout << "decodedRBStatusDL successfully" << endl; // cout << "decodedRBStatusDL successfully" << endl;
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -49,7 +49,7 @@ bool dRBStatusUL::encodedRBStatusUL(Ngap_DRBStatusUL_t* uL) { ...@@ -49,7 +49,7 @@ bool dRBStatusUL::encodedRBStatusUL(Ngap_DRBStatusUL_t* uL) {
cout << "encodeddRBStatusUL18 error" << endl; cout << "encodeddRBStatusUL18 error" << endl;
return false; return false;
} }
cout << "encodedRBStatusUL successfully" << endl; // cout << "encodedRBStatusUL successfully" << endl;
return true; return true;
} }
bool dRBStatusUL::decodedRBStatusUL(Ngap_DRBStatusUL_t* uL) { bool dRBStatusUL::decodedRBStatusUL(Ngap_DRBStatusUL_t* uL) {
...@@ -58,7 +58,7 @@ bool dRBStatusUL::decodedRBStatusUL(Ngap_DRBStatusUL_t* uL) { ...@@ -58,7 +58,7 @@ bool dRBStatusUL::decodedRBStatusUL(Ngap_DRBStatusUL_t* uL) {
cout << "decodeddRBStatusUL18 error" << endl; cout << "decodeddRBStatusUL18 error" << endl;
return false; return false;
} }
cout << "decodedRBStatusUL successfully" << endl; // cout << "decodedRBStatusUL successfully" << endl;
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -27,7 +27,7 @@ bool dRBSubjectItem::decodefromdRBSubjectItem( ...@@ -27,7 +27,7 @@ bool dRBSubjectItem::decodefromdRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) { Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (dRB_item->dRB_ID) { if (dRB_item->dRB_ID) {
drb_id = &dRB_item->dRB_ID; drb_id = &dRB_item->dRB_ID;
cout << "the decode drb_id is" << *drb_id << endl; // cout << "the decode drb_id is" << *drb_id << endl;
} }
drb_ul = new dRBStatusUL(); drb_ul = new dRBStatusUL();
if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) { if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) {
...@@ -39,14 +39,14 @@ bool dRBSubjectItem::decodefromdRBSubjectItem( ...@@ -39,14 +39,14 @@ bool dRBSubjectItem::decodefromdRBSubjectItem(
cout << "decode from dRBSubjectItem dRBStatusDL error" << endl; cout << "decode from dRBSubjectItem dRBStatusDL error" << endl;
return false; return false;
} }
cout << "decode from dRBSubjectItem successfully" << endl; // cout << "decode from dRBSubjectItem successfully" << endl;
return true; return true;
} }
bool dRBSubjectItem::encodedRBSubjectItem( bool dRBSubjectItem::encodedRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) { Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (drb_id) { if (drb_id) {
dRB_item->dRB_ID = *drb_id; dRB_item->dRB_ID = *drb_id;
cout << "the encode drb_id is" << *drb_id << endl; // cout << "the encode drb_id is" << *drb_id << endl;
} }
if (!drb_ul->encodedRBStatusUL(&dRB_item->dRBStatusUL)) { if (!drb_ul->encodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "encode from dRBSubjectItem dRBStatusUL error" << endl; cout << "encode from dRBSubjectItem dRBStatusUL error" << endl;
...@@ -56,7 +56,7 @@ bool dRBSubjectItem::encodedRBSubjectItem( ...@@ -56,7 +56,7 @@ bool dRBSubjectItem::encodedRBSubjectItem(
cout << "encode from dRBSubjectItem dRBStatusDL error" << endl; cout << "encode from dRBSubjectItem dRBStatusDL error" << endl;
return false; return false;
} }
cout << "encode from dRBSubjectItem successfully" << endl; // cout << "encode from dRBSubjectItem successfully" << endl;
return true; return true;
} }
} // namespace ngap } // namespace ngap
\ No newline at end of file
...@@ -34,7 +34,7 @@ bool dRBSubjectList::encodefromdRBSubjectlist( ...@@ -34,7 +34,7 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
return false; return false;
} }
} }
cout << "encodefromdRBSubjectlist successfully" << endl; // cout << "encodefromdRBSubjectlist successfully" << endl;
return true; return true;
} }
bool dRBSubjectList::decodefromdRBSubjectlist( bool dRBSubjectList::decodefromdRBSubjectlist(
...@@ -48,7 +48,7 @@ bool dRBSubjectList::decodefromdRBSubjectlist( ...@@ -48,7 +48,7 @@ bool dRBSubjectList::decodefromdRBSubjectlist(
return false; return false;
} }
} }
cout << "decodefromdRBSubjectlist successfully" << endl; // cout << "decodefromdRBSubjectlist successfully" << endl;
return true; return true;
} }
} // namespace ngap } // namespace ngap
\ No newline at end of file
...@@ -128,8 +128,8 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -128,8 +128,8 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
<< endl; << endl;
return false; return false;
} }
cout << "can get the buffer of RANStatusTransfer_TransparentContainer" // cout << "can get the buffer of RANStatusTransfer_TransparentContainer"
<< endl; // << endl;
} else { } else {
cout << "cann't get the buffer of " cout << "cann't get the buffer of "
"RANStatusTransfer_TransparentContainer" "RANStatusTransfer_TransparentContainer"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment