Skip to content

Commit

Permalink
Bugfix: unmarshal issue with byte slice in packetIn2 message (#60)
Browse files Browse the repository at this point in the history
Use "copy" function to set the byte slice fields in a message.

Signed-off-by: wenyingd <[email protected]>
  • Loading branch information
wenyingd authored Jun 20, 2023
1 parent fb33892 commit c0da85f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.7.2
v0.7.3
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
3 changes: 2 additions & 1 deletion ofctrl/ofSwitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions ofctrl/ofctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit c0da85f

Please sign in to comment.