summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/packet_buffer.go
diff options
context:
space:
mode:
authorNayana Bidari <nybidari@google.com>2020-03-20 12:00:21 -0700
committerNayana Bidari <nybidari@google.com>2020-03-26 12:21:24 -0700
commit92b9069b67b927cef25a1490ebd142ad6d65690d (patch)
tree103b457232172e84fc3f2d6ea6b02ee553740f83 /pkg/tcpip/stack/packet_buffer.go
parent01ac53099fedf7dd5da01a50e60f3dfa2eb17892 (diff)
Support owner matching for iptables.
This feature will match UID and GID of the packet creator, for locally generated packets. This match is only valid in the OUTPUT and POSTROUTING chains. Forwarded packets do not have any socket associated with them. Packets from kernel threads do have a socket, but usually no owner.
Diffstat (limited to 'pkg/tcpip/stack/packet_buffer.go')
-rw-r--r--pkg/tcpip/stack/packet_buffer.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/tcpip/stack/packet_buffer.go b/pkg/tcpip/stack/packet_buffer.go
index 9505a4e92..9367de180 100644
--- a/pkg/tcpip/stack/packet_buffer.go
+++ b/pkg/tcpip/stack/packet_buffer.go
@@ -13,7 +13,10 @@
package stack
-import "gvisor.dev/gvisor/pkg/tcpip/buffer"
+import (
+ "gvisor.dev/gvisor/pkg/tcpip"
+ "gvisor.dev/gvisor/pkg/tcpip/buffer"
+)
// A PacketBuffer contains all the data of a network packet.
//
@@ -59,6 +62,10 @@ type PacketBuffer struct {
// Hash is the transport layer hash of this packet. A value of zero
// indicates no valid hash has been set.
Hash uint32
+
+ // Owner is implemented by task to get the uid and gid.
+ // Only set for locally generated packets.
+ Owner tcpip.PacketOwner
}
// Clone makes a copy of pk. It clones the Data field, which creates a new