From 6be4ce2180b66741606246ba6bfdc827a041d4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Osi=C5=84ski?= Date: Thu, 17 Mar 2022 12:11:27 +0100 Subject: [PATCH] Verify cause status for association response (#59) --- pkg/pfcpsim/pfcpsim.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/pfcpsim/pfcpsim.go b/pkg/pfcpsim/pfcpsim.go index 0b6cfe9..b425685 100644 --- a/pkg/pfcpsim/pfcpsim.go +++ b/pkg/pfcpsim/pfcpsim.go @@ -317,7 +317,17 @@ func (c *PFCPClient) SetupAssociation() error { return err } - if _, ok := resp.(*message.AssociationSetupResponse); !ok { + assocResp, ok := resp.(*message.AssociationSetupResponse) + if !ok { + return NewInvalidResponseError() + } + + cause, err := assocResp.Cause.Cause() + if err != nil { + return NewInvalidResponseError(err) + } + + if cause != ieLib.CauseRequestAccepted { return NewInvalidResponseError() }