Skip to content

Commit

Permalink
Fix Informational exchange message id error
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen00991 committed Oct 17, 2024
1 parent 18708a1 commit e039b59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/ike/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ func HandleInformational(

if len(message.Payloads) == 0 && !message.IsResponse() {
ikeLog.Tracef("Receive DPD message")
SendN3IWFInformationExchange(n3ueSelf, nil, true)
SendN3IWFInformationExchange(n3ueSelf, nil, true, true, message.MessageID)
} else {
ikeLog.Warnf("Unimplemented informational message")
}
Expand Down
21 changes: 13 additions & 8 deletions pkg/ike/handler/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,26 @@ func SendIKEMessageToN3IWF(
}

func SendN3IWFInformationExchange(
n3ue *context.N3UE, payload ike_message.IKEPayloadContainer, isResponse bool,
n3ue *context.N3UE,
payload *ike_message.IKEPayloadContainer, initiator bool,
response bool, messageID uint32,
) {
ikeSecurityAssociation := n3ue.N3IWFUe.N3IWFIKESecurityAssociation
ikeSA := n3ue.N3IWFUe.N3IWFIKESecurityAssociation

// Build IKE message
responseIKEMessage := ike_message.NewMessage(ikeSecurityAssociation.LocalSPI,
ikeSecurityAssociation.RemoteSPI, ike_message.INFORMATIONAL, isResponse,
true, ikeSecurityAssociation.ResponderMessageID, payload)
responseIKEMessage := ike_message.NewMessage(ikeSA.LocalSPI, ikeSA.RemoteSPI,
ike_message.INFORMATIONAL, response, initiator, messageID, nil)

if payload != nil && len(*payload) > 0 {
responseIKEMessage.Payloads = append(responseIKEMessage.Payloads, *payload...)
}

responseIKEMessage.Payloads = append(responseIKEMessage.Payloads, payload...)
err := SendIKEMessageToN3IWF(n3ue.N3IWFUe.IKEConnection.Conn,
n3ue.N3IWFUe.IKEConnection.UEAddr,
n3ue.N3IWFUe.IKEConnection.N3IWFAddr, responseIKEMessage,
n3ue.N3IWFUe.N3IWFIKESecurityAssociation.IKESAKey)
ikeSA.IKESAKey)
if err != nil {
ikeLog.Errorf("SendN3IWFInformationExchange() : %v", err)
ikeLog.Errorf("SendUEInformationExchange err: %+v", err)
return
}
}

0 comments on commit e039b59

Please sign in to comment.