Skip to content
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

Merged
merged 2 commits into from
Jun 23, 2018

Conversation

costiser
Copy link
Contributor

Update the Packet-In struct (by adding data field) as per OpenFlow standard for OFPT_PACKET_IN message.

@costiser
Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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).

Copy link
Contributor Author

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 :-)

@ybubnov
Copy link
Member

ybubnov commented Jun 22, 2018

@costiser , thank you for this PR!

@costiser
Copy link
Contributor Author

Done. PTAL.

@ybubnov ybubnov merged commit d17ddff into netrack:master Jun 23, 2018
@costiser costiser deleted the add-data-to-packet-in branch June 23, 2018 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants