-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add data field to the Packet-In message. #136
Conversation
I'll work on updating the tests (in order to pass CI), hopefully tomorrow. |
ofp/packet.go
Outdated
@@ -83,6 +83,9 @@ type PacketIn struct { | |||
|
|||
// Match is used to match the packet. | |||
Match Match | |||
|
|||
// Data represents the original ethernet frame received by the datapath. | |||
Data bytes.Buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of consistency with EchoReply
message, it would be better set type of this field to []byte
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, probably, it's time to migrate EchoReply
to bytes.Buffer
. What's your case and why do you prefer bytes.Buffer
in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason for using bytes.Buffer... I changed to []byte.
ofp/packet.go
Outdated
@@ -109,7 +112,7 @@ func (p *PacketIn) ReadFrom(r io.Reader) (int64, error) { | |||
// Read the packet-in header, then the list of match | |||
// rules, that used to match the processing packet. | |||
return encoding.ReadFrom(r, &p.Buffer, &p.Length, | |||
&p.Reason, &p.Table, &p.Cookie, &p.Match, &defaultPad2) | |||
&p.Reason, &p.Table, &p.Cookie, &p.Match, &defaultPad2, &p.Data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this data should be written as well (in method WriteTo
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course. Realized that while fixing the tests :-)
@costiser , thank you for this PR! |
Done. PTAL. |
Update the Packet-In struct (by adding data field) as per OpenFlow standard for OFPT_PACKET_IN message.