From c0da85f904f9ace8d0cfcf0015401697e86aaf19 Mon Sep 17 00:00:00 2001 From: Wenying Dong Date: Mon, 19 Jun 2023 19:20:59 -0700 Subject: [PATCH] Bugfix: unmarshal issue with byte slice in packetIn2 message (#60) Use "copy" function to set the byte slice fields in a message. Signed-off-by: wenyingd --- VERSION | 2 +- go.mod | 2 +- go.sum | 4 ++-- ofctrl/ofSwitch.go | 3 ++- ofctrl/ofctrl.go | 6 ++++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 2c0a9c7b..3d105a6f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.7.2 +v0.7.3 diff --git a/go.mod b/go.mod index daba2064..a317a498 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module antrea.io/ofnet go 1.15 require ( - antrea.io/libOpenflow v0.10.1 + antrea.io/libOpenflow v0.10.3 github.com/Microsoft/go-winio v0.4.14 github.com/cenkalti/hub v1.0.1-0.20140529221144-7be60e186e66 // indirect github.com/cenkalti/rpc2 v0.0.0-20140912135055-44d0d95e4f52 // indirect diff --git a/go.sum b/go.sum index 8f2fe65b..e5b8c7c5 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -antrea.io/libOpenflow v0.10.1 h1:vgc/otHUa0gypvlNiyIfII9icFFJ8cEmzHYaMxOuIl8= -antrea.io/libOpenflow v0.10.1/go.mod h1:drWN5iISj7G2J6MnclrFmgy0jHU1Z684WW0DxcrjNP0= +antrea.io/libOpenflow v0.10.3 h1:ZLqpwss8wqzLzRPXFV3/A2hDMpcfIPRCQKWebZ6oWRI= +antrea.io/libOpenflow v0.10.3/go.mod h1:drWN5iISj7G2J6MnclrFmgy0jHU1Z684WW0DxcrjNP0= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/cenkalti/hub v1.0.1-0.20140529221144-7be60e186e66 h1:mqwgWF7yBJ/zOFlWZk84IRFG/FhMG0f7aZWvcTx/JHA= diff --git a/ofctrl/ofSwitch.go b/ofctrl/ofSwitch.go index 4228dba9..172d1c85 100755 --- a/ofctrl/ofSwitch.go +++ b/ofctrl/ofSwitch.go @@ -582,11 +582,12 @@ func (self *OFSwitch) ResumePacket(pktIn *PacketIn) error { } matchProp.Length = matchProp.Len() continueProp := &openflow15.PacketIn2PropContinuation{ - Continuation: pktIn.Continuation, + Continuation: make([]byte, len(pktIn.Continuation)), PropHeader: &openflow15.PropHeader{ Type: openflow15.NXPINT_CONTINUATION, }, } + copy(continueProp.Continuation, pktIn.Continuation) continueProp.Length = continueProp.Len() resumeProps = append(resumeProps, packetProp, cookieProp, bufferProp, tableProp, reasonProp, matchProp, continueProp) resumeMsg := openflow15.NewResume(resumeProps) diff --git a/ofctrl/ofctrl.go b/ofctrl/ofctrl.go index a1a618b8..f53504ee 100644 --- a/ofctrl/ofctrl.go +++ b/ofctrl/ofctrl.go @@ -62,9 +62,11 @@ func parsePacktInFromNXPacketIn2(pktIn2 *openflow15.PacketIn2) *PacketIn { Fields: v.Fields, } case *openflow15.PacketIn2PropUserdata: - userData = v.Userdata + userData = make([]byte, len(v.Userdata)) + copy(userData, v.Userdata) case *openflow15.PacketIn2PropContinuation: - continuation = v.Continuation + continuation = make([]byte, len(v.Continuation)) + copy(continuation, v.Continuation) } } return &PacketIn{