summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/packet_buffer.go
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2020-01-10 18:07:15 -0800
committerKevin Krakauer <krakauer@google.com>2020-01-10 18:07:15 -0800
commitd793677cd424fef10ac0b080871d181db0bcdec0 (patch)
tree697f86dac1fc3ac7015582a9588684a74bb95d1d /pkg/tcpip/packet_buffer.go
parentff719159befaee7d2abcfeb88905a7486cd34845 (diff)
I think INPUT works with protocol
Diffstat (limited to 'pkg/tcpip/packet_buffer.go')
-rw-r--r--pkg/tcpip/packet_buffer.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/pkg/tcpip/packet_buffer.go b/pkg/tcpip/packet_buffer.go
index ab24372e7..7a036b93c 100644
--- a/pkg/tcpip/packet_buffer.go
+++ b/pkg/tcpip/packet_buffer.go
@@ -13,7 +13,9 @@
package tcpip
-import "gvisor.dev/gvisor/pkg/tcpip/buffer"
+import (
+ "gvisor.dev/gvisor/pkg/tcpip/buffer"
+)
// A PacketBuffer contains all the data of a network packet.
//
@@ -65,3 +67,24 @@ func (pk PacketBuffer) Clone() PacketBuffer {
pk.Data = pk.Data.Clone(nil)
return pk
}
+
+//// TransportProtocol returns the transport protocol of pk.
+////
+//// Precondition: pk.NetworkHeader is set.
+//func (pk PacketBuffer) TransportProtocolIPv4() uint16 {
+// if pk.NetworkHeader == nil {
+// panic("This should only be called when pk.NetworkHeader is set.")
+// }
+// return header.IPv4(pk.NetworkHeader).TransportProtocol()
+//}
+
+// func (pk Packet) findNetHeader() header.IPv4 {
+// // Inbound:
+// // Data holds everything, but may have had some headers shaved off.
+// // Figure out whether it's set or still somewhere in data and return
+// // appropriately.
+
+// // Outbound:
+// // NetworkHeader will be set if we've added one. Otherwise there's no
+// // header.
+// }