summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-06-24 06:37:35 +0000
committergVisor bot <gvisor-bot@google.com>2020-06-24 06:37:35 +0000
commit9183888b520beeee8609170819a28bea89202909 (patch)
tree3cdcfa4de9ced4c539ab7c57e4cf58ffea980f6c /pkg/tcpip
parentcab13958a54419262aba2a0cd7f1075ed02c8ee0 (diff)
parent364ac92baf83f2352f78b718090472639bd92a76 (diff)
Merge release-20200608.0-119-g364ac92ba (automated)
Diffstat (limited to 'pkg/tcpip')
-rw-r--r--pkg/tcpip/buffer/buffer_state_autogen.go27
-rw-r--r--pkg/tcpip/header/header_state_autogen.go64
-rw-r--r--pkg/tcpip/link/channel/channel_state_autogen.go22
-rw-r--r--pkg/tcpip/link/tun/tun_state_autogen.go36
-rw-r--r--pkg/tcpip/network/fragmentation/fragmentation_state_autogen.go54
-rw-r--r--pkg/tcpip/network/fragmentation/reassembler_list.go6
-rw-r--r--pkg/tcpip/ports/ports_state_autogen.go32
-rw-r--r--pkg/tcpip/stack/linkaddrentry_list.go6
-rw-r--r--pkg/tcpip/stack/packet_buffer_list.go6
-rw-r--r--pkg/tcpip/stack/stack_state_autogen.go291
-rw-r--r--pkg/tcpip/tcpip_state_autogen.go131
-rw-r--r--pkg/tcpip/tcpip_unsafe_state_autogen.go16
-rw-r--r--pkg/tcpip/transport/icmp/icmp_packet_list.go6
-rw-r--r--pkg/tcpip/transport/icmp/icmp_state_autogen.go175
-rw-r--r--pkg/tcpip/transport/packet/packet_list.go6
-rw-r--r--pkg/tcpip/transport/packet/packet_state_autogen.go165
-rw-r--r--pkg/tcpip/transport/raw/raw_packet_list.go6
-rw-r--r--pkg/tcpip/transport/raw/raw_state_autogen.go175
-rw-r--r--pkg/tcpip/transport/tcp/tcp_endpoint_list.go6
-rw-r--r--pkg/tcpip/transport/tcp/tcp_segment_list.go6
-rw-r--r--pkg/tcpip/transport/tcp/tcp_state_autogen.go1165
-rw-r--r--pkg/tcpip/transport/udp/udp_packet_list.go6
-rw-r--r--pkg/tcpip/transport/udp/udp_state_autogen.go307
23 files changed, 1827 insertions, 887 deletions
diff --git a/pkg/tcpip/buffer/buffer_state_autogen.go b/pkg/tcpip/buffer/buffer_state_autogen.go
index 954487771..67db6f4d9 100644
--- a/pkg/tcpip/buffer/buffer_state_autogen.go
+++ b/pkg/tcpip/buffer/buffer_state_autogen.go
@@ -6,19 +6,32 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *VectorisedView) StateTypeName() string {
+ return "pkg/tcpip/buffer.VectorisedView"
+}
+
+func (x *VectorisedView) StateFields() []string {
+ return []string{
+ "views",
+ "size",
+ }
+}
+
func (x *VectorisedView) beforeSave() {}
-func (x *VectorisedView) save(m state.Map) {
+
+func (x *VectorisedView) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("views", &x.views)
- m.Save("size", &x.size)
+ m.Save(0, &x.views)
+ m.Save(1, &x.size)
}
func (x *VectorisedView) afterLoad() {}
-func (x *VectorisedView) load(m state.Map) {
- m.Load("views", &x.views)
- m.Load("size", &x.size)
+
+func (x *VectorisedView) StateLoad(m state.Source) {
+ m.Load(0, &x.views)
+ m.Load(1, &x.size)
}
func init() {
- state.Register("pkg/tcpip/buffer.VectorisedView", (*VectorisedView)(nil), state.Fns{Save: (*VectorisedView).save, Load: (*VectorisedView).load})
+ state.Register((*VectorisedView)(nil))
}
diff --git a/pkg/tcpip/header/header_state_autogen.go b/pkg/tcpip/header/header_state_autogen.go
index 015d7e12a..7efd361fb 100644
--- a/pkg/tcpip/header/header_state_autogen.go
+++ b/pkg/tcpip/header/header_state_autogen.go
@@ -6,37 +6,65 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *SACKBlock) StateTypeName() string {
+ return "pkg/tcpip/header.SACKBlock"
+}
+
+func (x *SACKBlock) StateFields() []string {
+ return []string{
+ "Start",
+ "End",
+ }
+}
+
func (x *SACKBlock) beforeSave() {}
-func (x *SACKBlock) save(m state.Map) {
+
+func (x *SACKBlock) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("Start", &x.Start)
- m.Save("End", &x.End)
+ m.Save(0, &x.Start)
+ m.Save(1, &x.End)
}
func (x *SACKBlock) afterLoad() {}
-func (x *SACKBlock) load(m state.Map) {
- m.Load("Start", &x.Start)
- m.Load("End", &x.End)
+
+func (x *SACKBlock) StateLoad(m state.Source) {
+ m.Load(0, &x.Start)
+ m.Load(1, &x.End)
+}
+
+func (x *TCPOptions) StateTypeName() string {
+ return "pkg/tcpip/header.TCPOptions"
+}
+
+func (x *TCPOptions) StateFields() []string {
+ return []string{
+ "TS",
+ "TSVal",
+ "TSEcr",
+ "SACKBlocks",
+ }
}
func (x *TCPOptions) beforeSave() {}
-func (x *TCPOptions) save(m state.Map) {
+
+func (x *TCPOptions) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("TS", &x.TS)
- m.Save("TSVal", &x.TSVal)
- m.Save("TSEcr", &x.TSEcr)
- m.Save("SACKBlocks", &x.SACKBlocks)
+ m.Save(0, &x.TS)
+ m.Save(1, &x.TSVal)
+ m.Save(2, &x.TSEcr)
+ m.Save(3, &x.SACKBlocks)
}
func (x *TCPOptions) afterLoad() {}
-func (x *TCPOptions) load(m state.Map) {
- m.Load("TS", &x.TS)
- m.Load("TSVal", &x.TSVal)
- m.Load("TSEcr", &x.TSEcr)
- m.Load("SACKBlocks", &x.SACKBlocks)
+
+func (x *TCPOptions) StateLoad(m state.Source) {
+ m.Load(0, &x.TS)
+ m.Load(1, &x.TSVal)
+ m.Load(2, &x.TSEcr)
+ m.Load(3, &x.SACKBlocks)
}
func init() {
- state.Register("pkg/tcpip/header.SACKBlock", (*SACKBlock)(nil), state.Fns{Save: (*SACKBlock).save, Load: (*SACKBlock).load})
- state.Register("pkg/tcpip/header.TCPOptions", (*TCPOptions)(nil), state.Fns{Save: (*TCPOptions).save, Load: (*TCPOptions).load})
+ state.Register((*SACKBlock)(nil))
+ state.Register((*TCPOptions)(nil))
}
diff --git a/pkg/tcpip/link/channel/channel_state_autogen.go b/pkg/tcpip/link/channel/channel_state_autogen.go
index ce52482a2..d00c11cb2 100644
--- a/pkg/tcpip/link/channel/channel_state_autogen.go
+++ b/pkg/tcpip/link/channel/channel_state_autogen.go
@@ -6,17 +6,29 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *NotificationHandle) StateTypeName() string {
+ return "pkg/tcpip/link/channel.NotificationHandle"
+}
+
+func (x *NotificationHandle) StateFields() []string {
+ return []string{
+ "n",
+ }
+}
+
func (x *NotificationHandle) beforeSave() {}
-func (x *NotificationHandle) save(m state.Map) {
+
+func (x *NotificationHandle) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("n", &x.n)
+ m.Save(0, &x.n)
}
func (x *NotificationHandle) afterLoad() {}
-func (x *NotificationHandle) load(m state.Map) {
- m.Load("n", &x.n)
+
+func (x *NotificationHandle) StateLoad(m state.Source) {
+ m.Load(0, &x.n)
}
func init() {
- state.Register("pkg/tcpip/link/channel.NotificationHandle", (*NotificationHandle)(nil), state.Fns{Save: (*NotificationHandle).save, Load: (*NotificationHandle).load})
+ state.Register((*NotificationHandle)(nil))
}
diff --git a/pkg/tcpip/link/tun/tun_state_autogen.go b/pkg/tcpip/link/tun/tun_state_autogen.go
index 4b70647af..7f75aef19 100644
--- a/pkg/tcpip/link/tun/tun_state_autogen.go
+++ b/pkg/tcpip/link/tun/tun_state_autogen.go
@@ -6,22 +6,36 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
-func (x *Device) save(m state.Map) {
+func (x *Device) StateTypeName() string {
+ return "pkg/tcpip/link/tun.Device"
+}
+
+func (x *Device) StateFields() []string {
+ return []string{
+ "Queue",
+ "endpoint",
+ "notifyHandle",
+ "flags",
+ }
+}
+
+func (x *Device) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("Queue", &x.Queue)
- m.Save("endpoint", &x.endpoint)
- m.Save("notifyHandle", &x.notifyHandle)
- m.Save("flags", &x.flags)
+ m.Save(0, &x.Queue)
+ m.Save(1, &x.endpoint)
+ m.Save(2, &x.notifyHandle)
+ m.Save(3, &x.flags)
}
func (x *Device) afterLoad() {}
-func (x *Device) load(m state.Map) {
- m.Load("Queue", &x.Queue)
- m.Load("endpoint", &x.endpoint)
- m.Load("notifyHandle", &x.notifyHandle)
- m.Load("flags", &x.flags)
+
+func (x *Device) StateLoad(m state.Source) {
+ m.Load(0, &x.Queue)
+ m.Load(1, &x.endpoint)
+ m.Load(2, &x.notifyHandle)
+ m.Load(3, &x.flags)
}
func init() {
- state.Register("pkg/tcpip/link/tun.Device", (*Device)(nil), state.Fns{Save: (*Device).save, Load: (*Device).load})
+ state.Register((*Device)(nil))
}
diff --git a/pkg/tcpip/network/fragmentation/fragmentation_state_autogen.go b/pkg/tcpip/network/fragmentation/fragmentation_state_autogen.go
index cbaecdaa7..780ddfdc3 100644
--- a/pkg/tcpip/network/fragmentation/fragmentation_state_autogen.go
+++ b/pkg/tcpip/network/fragmentation/fragmentation_state_autogen.go
@@ -6,33 +6,59 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *reassemblerList) StateTypeName() string {
+ return "pkg/tcpip/network/fragmentation.reassemblerList"
+}
+
+func (x *reassemblerList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
+}
+
func (x *reassemblerList) beforeSave() {}
-func (x *reassemblerList) save(m state.Map) {
+
+func (x *reassemblerList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *reassemblerList) afterLoad() {}
-func (x *reassemblerList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *reassemblerList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *reassemblerEntry) StateTypeName() string {
+ return "pkg/tcpip/network/fragmentation.reassemblerEntry"
+}
+
+func (x *reassemblerEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *reassemblerEntry) beforeSave() {}
-func (x *reassemblerEntry) save(m state.Map) {
+
+func (x *reassemblerEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *reassemblerEntry) afterLoad() {}
-func (x *reassemblerEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *reassemblerEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/tcpip/network/fragmentation.reassemblerList", (*reassemblerList)(nil), state.Fns{Save: (*reassemblerList).save, Load: (*reassemblerList).load})
- state.Register("pkg/tcpip/network/fragmentation.reassemblerEntry", (*reassemblerEntry)(nil), state.Fns{Save: (*reassemblerEntry).save, Load: (*reassemblerEntry).load})
+ state.Register((*reassemblerList)(nil))
+ state.Register((*reassemblerEntry)(nil))
}
diff --git a/pkg/tcpip/network/fragmentation/reassembler_list.go b/pkg/tcpip/network/fragmentation/reassembler_list.go
index b5d40bd25..bb5bd75c4 100644
--- a/pkg/tcpip/network/fragmentation/reassembler_list.go
+++ b/pkg/tcpip/network/fragmentation/reassembler_list.go
@@ -56,7 +56,7 @@ func (l *reassemblerList) Back() *reassembler {
//
// NOTE: This is an O(n) operation.
func (l *reassemblerList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (reassemblerElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *reassemblerList) Remove(e *reassembler) {
if prev != nil {
reassemblerElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
reassemblerElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/ports/ports_state_autogen.go b/pkg/tcpip/ports/ports_state_autogen.go
index 40d094060..54db0b8f9 100644
--- a/pkg/tcpip/ports/ports_state_autogen.go
+++ b/pkg/tcpip/ports/ports_state_autogen.go
@@ -6,21 +6,35 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *Flags) StateTypeName() string {
+ return "pkg/tcpip/ports.Flags"
+}
+
+func (x *Flags) StateFields() []string {
+ return []string{
+ "MostRecent",
+ "LoadBalanced",
+ "TupleOnly",
+ }
+}
+
func (x *Flags) beforeSave() {}
-func (x *Flags) save(m state.Map) {
+
+func (x *Flags) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("MostRecent", &x.MostRecent)
- m.Save("LoadBalanced", &x.LoadBalanced)
- m.Save("TupleOnly", &x.TupleOnly)
+ m.Save(0, &x.MostRecent)
+ m.Save(1, &x.LoadBalanced)
+ m.Save(2, &x.TupleOnly)
}
func (x *Flags) afterLoad() {}
-func (x *Flags) load(m state.Map) {
- m.Load("MostRecent", &x.MostRecent)
- m.Load("LoadBalanced", &x.LoadBalanced)
- m.Load("TupleOnly", &x.TupleOnly)
+
+func (x *Flags) StateLoad(m state.Source) {
+ m.Load(0, &x.MostRecent)
+ m.Load(1, &x.LoadBalanced)
+ m.Load(2, &x.TupleOnly)
}
func init() {
- state.Register("pkg/tcpip/ports.Flags", (*Flags)(nil), state.Fns{Save: (*Flags).save, Load: (*Flags).load})
+ state.Register((*Flags)(nil))
}
diff --git a/pkg/tcpip/stack/linkaddrentry_list.go b/pkg/tcpip/stack/linkaddrentry_list.go
index 43022f9b3..1250b89f8 100644
--- a/pkg/tcpip/stack/linkaddrentry_list.go
+++ b/pkg/tcpip/stack/linkaddrentry_list.go
@@ -56,7 +56,7 @@ func (l *linkAddrEntryList) Back() *linkAddrEntry {
//
// NOTE: This is an O(n) operation.
func (l *linkAddrEntryList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (linkAddrEntryElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *linkAddrEntryList) Remove(e *linkAddrEntry) {
if prev != nil {
linkAddrEntryElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
linkAddrEntryElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/stack/packet_buffer_list.go b/pkg/tcpip/stack/packet_buffer_list.go
index 460c74c5a..27f15cb15 100644
--- a/pkg/tcpip/stack/packet_buffer_list.go
+++ b/pkg/tcpip/stack/packet_buffer_list.go
@@ -56,7 +56,7 @@ func (l *PacketBufferList) Back() *PacketBuffer {
//
// NOTE: This is an O(n) operation.
func (l *PacketBufferList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (PacketBufferElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *PacketBufferList) Remove(e *PacketBuffer) {
if prev != nil {
PacketBufferElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
PacketBufferElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/stack/stack_state_autogen.go b/pkg/tcpip/stack/stack_state_autogen.go
index 32d310c2f..6efa9a773 100644
--- a/pkg/tcpip/stack/stack_state_autogen.go
+++ b/pkg/tcpip/stack/stack_state_autogen.go
@@ -6,152 +6,269 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *linkAddrEntryList) StateTypeName() string {
+ return "pkg/tcpip/stack.linkAddrEntryList"
+}
+
+func (x *linkAddrEntryList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
+}
+
func (x *linkAddrEntryList) beforeSave() {}
-func (x *linkAddrEntryList) save(m state.Map) {
+
+func (x *linkAddrEntryList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *linkAddrEntryList) afterLoad() {}
-func (x *linkAddrEntryList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *linkAddrEntryList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *linkAddrEntryEntry) StateTypeName() string {
+ return "pkg/tcpip/stack.linkAddrEntryEntry"
+}
+
+func (x *linkAddrEntryEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *linkAddrEntryEntry) beforeSave() {}
-func (x *linkAddrEntryEntry) save(m state.Map) {
+
+func (x *linkAddrEntryEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *linkAddrEntryEntry) afterLoad() {}
-func (x *linkAddrEntryEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *linkAddrEntryEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
+}
+
+func (x *PacketBufferList) StateTypeName() string {
+ return "pkg/tcpip/stack.PacketBufferList"
+}
+
+func (x *PacketBufferList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
}
func (x *PacketBufferList) beforeSave() {}
-func (x *PacketBufferList) save(m state.Map) {
+
+func (x *PacketBufferList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *PacketBufferList) afterLoad() {}
-func (x *PacketBufferList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *PacketBufferList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *PacketBufferEntry) StateTypeName() string {
+ return "pkg/tcpip/stack.PacketBufferEntry"
+}
+
+func (x *PacketBufferEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *PacketBufferEntry) beforeSave() {}
-func (x *PacketBufferEntry) save(m state.Map) {
+
+func (x *PacketBufferEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *PacketBufferEntry) afterLoad() {}
-func (x *PacketBufferEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *PacketBufferEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
+}
+
+func (x *TransportEndpointID) StateTypeName() string {
+ return "pkg/tcpip/stack.TransportEndpointID"
+}
+
+func (x *TransportEndpointID) StateFields() []string {
+ return []string{
+ "LocalPort",
+ "LocalAddress",
+ "RemotePort",
+ "RemoteAddress",
+ }
}
func (x *TransportEndpointID) beforeSave() {}
-func (x *TransportEndpointID) save(m state.Map) {
+
+func (x *TransportEndpointID) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("LocalPort", &x.LocalPort)
- m.Save("LocalAddress", &x.LocalAddress)
- m.Save("RemotePort", &x.RemotePort)
- m.Save("RemoteAddress", &x.RemoteAddress)
+ m.Save(0, &x.LocalPort)
+ m.Save(1, &x.LocalAddress)
+ m.Save(2, &x.RemotePort)
+ m.Save(3, &x.RemoteAddress)
}
func (x *TransportEndpointID) afterLoad() {}
-func (x *TransportEndpointID) load(m state.Map) {
- m.Load("LocalPort", &x.LocalPort)
- m.Load("LocalAddress", &x.LocalAddress)
- m.Load("RemotePort", &x.RemotePort)
- m.Load("RemoteAddress", &x.RemoteAddress)
+
+func (x *TransportEndpointID) StateLoad(m state.Source) {
+ m.Load(0, &x.LocalPort)
+ m.Load(1, &x.LocalAddress)
+ m.Load(2, &x.RemotePort)
+ m.Load(3, &x.RemoteAddress)
}
-func (x *GSOType) save(m state.Map) {
- m.SaveValue("", (int)(*x))
+func (x *GSOType) StateTypeName() string {
+ return "pkg/tcpip/stack.GSOType"
}
-func (x *GSOType) load(m state.Map) {
- m.LoadValue("", new(int), func(y interface{}) { *x = (GSOType)(y.(int)) })
+func (x *GSOType) StateFields() []string {
+ return nil
+}
+
+func (x *GSO) StateTypeName() string {
+ return "pkg/tcpip/stack.GSO"
+}
+
+func (x *GSO) StateFields() []string {
+ return []string{
+ "Type",
+ "NeedsCsum",
+ "CsumOffset",
+ "MSS",
+ "L3HdrLen",
+ "MaxSize",
+ }
}
func (x *GSO) beforeSave() {}
-func (x *GSO) save(m state.Map) {
+
+func (x *GSO) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("Type", &x.Type)
- m.Save("NeedsCsum", &x.NeedsCsum)
- m.Save("CsumOffset", &x.CsumOffset)
- m.Save("MSS", &x.MSS)
- m.Save("L3HdrLen", &x.L3HdrLen)
- m.Save("MaxSize", &x.MaxSize)
+ m.Save(0, &x.Type)
+ m.Save(1, &x.NeedsCsum)
+ m.Save(2, &x.CsumOffset)
+ m.Save(3, &x.MSS)
+ m.Save(4, &x.L3HdrLen)
+ m.Save(5, &x.MaxSize)
}
func (x *GSO) afterLoad() {}
-func (x *GSO) load(m state.Map) {
- m.Load("Type", &x.Type)
- m.Load("NeedsCsum", &x.NeedsCsum)
- m.Load("CsumOffset", &x.CsumOffset)
- m.Load("MSS", &x.MSS)
- m.Load("L3HdrLen", &x.L3HdrLen)
- m.Load("MaxSize", &x.MaxSize)
+
+func (x *GSO) StateLoad(m state.Source) {
+ m.Load(0, &x.Type)
+ m.Load(1, &x.NeedsCsum)
+ m.Load(2, &x.CsumOffset)
+ m.Load(3, &x.MSS)
+ m.Load(4, &x.L3HdrLen)
+ m.Load(5, &x.MaxSize)
+}
+
+func (x *TransportEndpointInfo) StateTypeName() string {
+ return "pkg/tcpip/stack.TransportEndpointInfo"
+}
+
+func (x *TransportEndpointInfo) StateFields() []string {
+ return []string{
+ "NetProto",
+ "TransProto",
+ "ID",
+ "BindNICID",
+ "BindAddr",
+ "RegisterNICID",
+ }
}
func (x *TransportEndpointInfo) beforeSave() {}
-func (x *TransportEndpointInfo) save(m state.Map) {
+
+func (x *TransportEndpointInfo) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("NetProto", &x.NetProto)
- m.Save("TransProto", &x.TransProto)
- m.Save("ID", &x.ID)
- m.Save("BindNICID", &x.BindNICID)
- m.Save("BindAddr", &x.BindAddr)
- m.Save("RegisterNICID", &x.RegisterNICID)
+ m.Save(0, &x.NetProto)
+ m.Save(1, &x.TransProto)
+ m.Save(2, &x.ID)
+ m.Save(3, &x.BindNICID)
+ m.Save(4, &x.BindAddr)
+ m.Save(5, &x.RegisterNICID)
}
func (x *TransportEndpointInfo) afterLoad() {}
-func (x *TransportEndpointInfo) load(m state.Map) {
- m.Load("NetProto", &x.NetProto)
- m.Load("TransProto", &x.TransProto)
- m.Load("ID", &x.ID)
- m.Load("BindNICID", &x.BindNICID)
- m.Load("BindAddr", &x.BindAddr)
- m.Load("RegisterNICID", &x.RegisterNICID)
+
+func (x *TransportEndpointInfo) StateLoad(m state.Source) {
+ m.Load(0, &x.NetProto)
+ m.Load(1, &x.TransProto)
+ m.Load(2, &x.ID)
+ m.Load(3, &x.BindNICID)
+ m.Load(4, &x.BindAddr)
+ m.Load(5, &x.RegisterNICID)
+}
+
+func (x *multiPortEndpoint) StateTypeName() string {
+ return "pkg/tcpip/stack.multiPortEndpoint"
+}
+
+func (x *multiPortEndpoint) StateFields() []string {
+ return []string{
+ "demux",
+ "netProto",
+ "transProto",
+ "endpoints",
+ "flags",
+ }
}
func (x *multiPortEndpoint) beforeSave() {}
-func (x *multiPortEndpoint) save(m state.Map) {
+
+func (x *multiPortEndpoint) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("demux", &x.demux)
- m.Save("netProto", &x.netProto)
- m.Save("transProto", &x.transProto)
- m.Save("endpoints", &x.endpoints)
- m.Save("flags", &x.flags)
+ m.Save(0, &x.demux)
+ m.Save(1, &x.netProto)
+ m.Save(2, &x.transProto)
+ m.Save(3, &x.endpoints)
+ m.Save(4, &x.flags)
}
func (x *multiPortEndpoint) afterLoad() {}
-func (x *multiPortEndpoint) load(m state.Map) {
- m.Load("demux", &x.demux)
- m.Load("netProto", &x.netProto)
- m.Load("transProto", &x.transProto)
- m.Load("endpoints", &x.endpoints)
- m.Load("flags", &x.flags)
+
+func (x *multiPortEndpoint) StateLoad(m state.Source) {
+ m.Load(0, &x.demux)
+ m.Load(1, &x.netProto)
+ m.Load(2, &x.transProto)
+ m.Load(3, &x.endpoints)
+ m.Load(4, &x.flags)
}
func init() {
- state.Register("pkg/tcpip/stack.linkAddrEntryList", (*linkAddrEntryList)(nil), state.Fns{Save: (*linkAddrEntryList).save, Load: (*linkAddrEntryList).load})
- state.Register("pkg/tcpip/stack.linkAddrEntryEntry", (*linkAddrEntryEntry)(nil), state.Fns{Save: (*linkAddrEntryEntry).save, Load: (*linkAddrEntryEntry).load})
- state.Register("pkg/tcpip/stack.PacketBufferList", (*PacketBufferList)(nil), state.Fns{Save: (*PacketBufferList).save, Load: (*PacketBufferList).load})
- state.Register("pkg/tcpip/stack.PacketBufferEntry", (*PacketBufferEntry)(nil), state.Fns{Save: (*PacketBufferEntry).save, Load: (*PacketBufferEntry).load})
- state.Register("pkg/tcpip/stack.TransportEndpointID", (*TransportEndpointID)(nil), state.Fns{Save: (*TransportEndpointID).save, Load: (*TransportEndpointID).load})
- state.Register("pkg/tcpip/stack.GSOType", (*GSOType)(nil), state.Fns{Save: (*GSOType).save, Load: (*GSOType).load})
- state.Register("pkg/tcpip/stack.GSO", (*GSO)(nil), state.Fns{Save: (*GSO).save, Load: (*GSO).load})
- state.Register("pkg/tcpip/stack.TransportEndpointInfo", (*TransportEndpointInfo)(nil), state.Fns{Save: (*TransportEndpointInfo).save, Load: (*TransportEndpointInfo).load})
- state.Register("pkg/tcpip/stack.multiPortEndpoint", (*multiPortEndpoint)(nil), state.Fns{Save: (*multiPortEndpoint).save, Load: (*multiPortEndpoint).load})
+ state.Register((*linkAddrEntryList)(nil))
+ state.Register((*linkAddrEntryEntry)(nil))
+ state.Register((*PacketBufferList)(nil))
+ state.Register((*PacketBufferEntry)(nil))
+ state.Register((*TransportEndpointID)(nil))
+ state.Register((*GSOType)(nil))
+ state.Register((*GSO)(nil))
+ state.Register((*TransportEndpointInfo)(nil))
+ state.Register((*multiPortEndpoint)(nil))
}
diff --git a/pkg/tcpip/tcpip_state_autogen.go b/pkg/tcpip/tcpip_state_autogen.go
index 8ea900688..28d5ae82b 100644
--- a/pkg/tcpip/tcpip_state_autogen.go
+++ b/pkg/tcpip/tcpip_state_autogen.go
@@ -6,67 +6,116 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *FullAddress) StateTypeName() string {
+ return "pkg/tcpip.FullAddress"
+}
+
+func (x *FullAddress) StateFields() []string {
+ return []string{
+ "NIC",
+ "Addr",
+ "Port",
+ }
+}
+
func (x *FullAddress) beforeSave() {}
-func (x *FullAddress) save(m state.Map) {
+
+func (x *FullAddress) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("NIC", &x.NIC)
- m.Save("Addr", &x.Addr)
- m.Save("Port", &x.Port)
+ m.Save(0, &x.NIC)
+ m.Save(1, &x.Addr)
+ m.Save(2, &x.Port)
}
func (x *FullAddress) afterLoad() {}
-func (x *FullAddress) load(m state.Map) {
- m.Load("NIC", &x.NIC)
- m.Load("Addr", &x.Addr)
- m.Load("Port", &x.Port)
+
+func (x *FullAddress) StateLoad(m state.Source) {
+ m.Load(0, &x.NIC)
+ m.Load(1, &x.Addr)
+ m.Load(2, &x.Port)
+}
+
+func (x *ControlMessages) StateTypeName() string {
+ return "pkg/tcpip.ControlMessages"
+}
+
+func (x *ControlMessages) StateFields() []string {
+ return []string{
+ "HasTimestamp",
+ "Timestamp",
+ "HasInq",
+ "Inq",
+ "HasTOS",
+ "TOS",
+ "HasTClass",
+ "TClass",
+ "HasIPPacketInfo",
+ "PacketInfo",
+ }
}
func (x *ControlMessages) beforeSave() {}
-func (x *ControlMessages) save(m state.Map) {
+
+func (x *ControlMessages) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("HasTimestamp", &x.HasTimestamp)
- m.Save("Timestamp", &x.Timestamp)
- m.Save("HasInq", &x.HasInq)
- m.Save("Inq", &x.Inq)
- m.Save("HasTOS", &x.HasTOS)
- m.Save("TOS", &x.TOS)
- m.Save("HasTClass", &x.HasTClass)
- m.Save("TClass", &x.TClass)
- m.Save("HasIPPacketInfo", &x.HasIPPacketInfo)
- m.Save("PacketInfo", &x.PacketInfo)
+ m.Save(0, &x.HasTimestamp)
+ m.Save(1, &x.Timestamp)
+ m.Save(2, &x.HasInq)
+ m.Save(3, &x.Inq)
+ m.Save(4, &x.HasTOS)
+ m.Save(5, &x.TOS)
+ m.Save(6, &x.HasTClass)
+ m.Save(7, &x.TClass)
+ m.Save(8, &x.HasIPPacketInfo)
+ m.Save(9, &x.PacketInfo)
}
func (x *ControlMessages) afterLoad() {}
-func (x *ControlMessages) load(m state.Map) {
- m.Load("HasTimestamp", &x.HasTimestamp)
- m.Load("Timestamp", &x.Timestamp)
- m.Load("HasInq", &x.HasInq)
- m.Load("Inq", &x.Inq)
- m.Load("HasTOS", &x.HasTOS)
- m.Load("TOS", &x.TOS)
- m.Load("HasTClass", &x.HasTClass)
- m.Load("TClass", &x.TClass)
- m.Load("HasIPPacketInfo", &x.HasIPPacketInfo)
- m.Load("PacketInfo", &x.PacketInfo)
+
+func (x *ControlMessages) StateLoad(m state.Source) {
+ m.Load(0, &x.HasTimestamp)
+ m.Load(1, &x.Timestamp)
+ m.Load(2, &x.HasInq)
+ m.Load(3, &x.Inq)
+ m.Load(4, &x.HasTOS)
+ m.Load(5, &x.TOS)
+ m.Load(6, &x.HasTClass)
+ m.Load(7, &x.TClass)
+ m.Load(8, &x.HasIPPacketInfo)
+ m.Load(9, &x.PacketInfo)
+}
+
+func (x *IPPacketInfo) StateTypeName() string {
+ return "pkg/tcpip.IPPacketInfo"
+}
+
+func (x *IPPacketInfo) StateFields() []string {
+ return []string{
+ "NIC",
+ "LocalAddr",
+ "DestinationAddr",
+ }
}
func (x *IPPacketInfo) beforeSave() {}
-func (x *IPPacketInfo) save(m state.Map) {
+
+func (x *IPPacketInfo) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("NIC", &x.NIC)
- m.Save("LocalAddr", &x.LocalAddr)
- m.Save("DestinationAddr", &x.DestinationAddr)
+ m.Save(0, &x.NIC)
+ m.Save(1, &x.LocalAddr)
+ m.Save(2, &x.DestinationAddr)
}
func (x *IPPacketInfo) afterLoad() {}
-func (x *IPPacketInfo) load(m state.Map) {
- m.Load("NIC", &x.NIC)
- m.Load("LocalAddr", &x.LocalAddr)
- m.Load("DestinationAddr", &x.DestinationAddr)
+
+func (x *IPPacketInfo) StateLoad(m state.Source) {
+ m.Load(0, &x.NIC)
+ m.Load(1, &x.LocalAddr)
+ m.Load(2, &x.DestinationAddr)
}
func init() {
- state.Register("pkg/tcpip.FullAddress", (*FullAddress)(nil), state.Fns{Save: (*FullAddress).save, Load: (*FullAddress).load})
- state.Register("pkg/tcpip.ControlMessages", (*ControlMessages)(nil), state.Fns{Save: (*ControlMessages).save, Load: (*ControlMessages).load})
- state.Register("pkg/tcpip.IPPacketInfo", (*IPPacketInfo)(nil), state.Fns{Save: (*IPPacketInfo).save, Load: (*IPPacketInfo).load})
+ state.Register((*FullAddress)(nil))
+ state.Register((*ControlMessages)(nil))
+ state.Register((*IPPacketInfo)(nil))
}
diff --git a/pkg/tcpip/tcpip_unsafe_state_autogen.go b/pkg/tcpip/tcpip_unsafe_state_autogen.go
index 9423c098b..ae5ab873a 100644
--- a/pkg/tcpip/tcpip_unsafe_state_autogen.go
+++ b/pkg/tcpip/tcpip_unsafe_state_autogen.go
@@ -9,15 +9,25 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *StdClock) StateTypeName() string {
+ return "pkg/tcpip.StdClock"
+}
+
+func (x *StdClock) StateFields() []string {
+ return []string{}
+}
+
func (x *StdClock) beforeSave() {}
-func (x *StdClock) save(m state.Map) {
+
+func (x *StdClock) StateSave(m state.Sink) {
x.beforeSave()
}
func (x *StdClock) afterLoad() {}
-func (x *StdClock) load(m state.Map) {
+
+func (x *StdClock) StateLoad(m state.Source) {
}
func init() {
- state.Register("pkg/tcpip.StdClock", (*StdClock)(nil), state.Fns{Save: (*StdClock).save, Load: (*StdClock).load})
+ state.Register((*StdClock)(nil))
}
diff --git a/pkg/tcpip/transport/icmp/icmp_packet_list.go b/pkg/tcpip/transport/icmp/icmp_packet_list.go
index 42d63f976..f69543bda 100644
--- a/pkg/tcpip/transport/icmp/icmp_packet_list.go
+++ b/pkg/tcpip/transport/icmp/icmp_packet_list.go
@@ -56,7 +56,7 @@ func (l *icmpPacketList) Back() *icmpPacket {
//
// NOTE: This is an O(n) operation.
func (l *icmpPacketList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (icmpPacketElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *icmpPacketList) Remove(e *icmpPacket) {
if prev != nil {
icmpPacketElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
icmpPacketElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/transport/icmp/icmp_state_autogen.go b/pkg/tcpip/transport/icmp/icmp_state_autogen.go
index c26460a4b..c6b278677 100644
--- a/pkg/tcpip/transport/icmp/icmp_state_autogen.go
+++ b/pkg/tcpip/transport/icmp/icmp_state_autogen.go
@@ -7,88 +7,151 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/buffer"
)
+func (x *icmpPacket) StateTypeName() string {
+ return "pkg/tcpip/transport/icmp.icmpPacket"
+}
+
+func (x *icmpPacket) StateFields() []string {
+ return []string{
+ "icmpPacketEntry",
+ "senderAddress",
+ "data",
+ "timestamp",
+ }
+}
+
func (x *icmpPacket) beforeSave() {}
-func (x *icmpPacket) save(m state.Map) {
+
+func (x *icmpPacket) StateSave(m state.Sink) {
x.beforeSave()
var data buffer.VectorisedView = x.saveData()
- m.SaveValue("data", data)
- m.Save("icmpPacketEntry", &x.icmpPacketEntry)
- m.Save("senderAddress", &x.senderAddress)
- m.Save("timestamp", &x.timestamp)
+ m.SaveValue(2, data)
+ m.Save(0, &x.icmpPacketEntry)
+ m.Save(1, &x.senderAddress)
+ m.Save(3, &x.timestamp)
}
func (x *icmpPacket) afterLoad() {}
-func (x *icmpPacket) load(m state.Map) {
- m.Load("icmpPacketEntry", &x.icmpPacketEntry)
- m.Load("senderAddress", &x.senderAddress)
- m.Load("timestamp", &x.timestamp)
- m.LoadValue("data", new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
+
+func (x *icmpPacket) StateLoad(m state.Source) {
+ m.Load(0, &x.icmpPacketEntry)
+ m.Load(1, &x.senderAddress)
+ m.Load(3, &x.timestamp)
+ m.LoadValue(2, new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
}
-func (x *endpoint) save(m state.Map) {
+func (x *endpoint) StateTypeName() string {
+ return "pkg/tcpip/transport/icmp.endpoint"
+}
+
+func (x *endpoint) StateFields() []string {
+ return []string{
+ "TransportEndpointInfo",
+ "waiterQueue",
+ "uniqueID",
+ "rcvReady",
+ "rcvList",
+ "rcvBufSizeMax",
+ "rcvBufSize",
+ "rcvClosed",
+ "sndBufSize",
+ "shutdownFlags",
+ "state",
+ "ttl",
+ "owner",
+ }
+}
+
+func (x *endpoint) StateSave(m state.Sink) {
x.beforeSave()
var rcvBufSizeMax int = x.saveRcvBufSizeMax()
- m.SaveValue("rcvBufSizeMax", rcvBufSizeMax)
- m.Save("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Save("waiterQueue", &x.waiterQueue)
- m.Save("uniqueID", &x.uniqueID)
- m.Save("rcvReady", &x.rcvReady)
- m.Save("rcvList", &x.rcvList)
- m.Save("rcvBufSize", &x.rcvBufSize)
- m.Save("rcvClosed", &x.rcvClosed)
- m.Save("sndBufSize", &x.sndBufSize)
- m.Save("shutdownFlags", &x.shutdownFlags)
- m.Save("state", &x.state)
- m.Save("ttl", &x.ttl)
- m.Save("owner", &x.owner)
-}
-
-func (x *endpoint) load(m state.Map) {
- m.Load("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Load("waiterQueue", &x.waiterQueue)
- m.Load("uniqueID", &x.uniqueID)
- m.Load("rcvReady", &x.rcvReady)
- m.Load("rcvList", &x.rcvList)
- m.Load("rcvBufSize", &x.rcvBufSize)
- m.Load("rcvClosed", &x.rcvClosed)
- m.Load("sndBufSize", &x.sndBufSize)
- m.Load("shutdownFlags", &x.shutdownFlags)
- m.Load("state", &x.state)
- m.Load("ttl", &x.ttl)
- m.Load("owner", &x.owner)
- m.LoadValue("rcvBufSizeMax", new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
+ m.SaveValue(5, rcvBufSizeMax)
+ m.Save(0, &x.TransportEndpointInfo)
+ m.Save(1, &x.waiterQueue)
+ m.Save(2, &x.uniqueID)
+ m.Save(3, &x.rcvReady)
+ m.Save(4, &x.rcvList)
+ m.Save(6, &x.rcvBufSize)
+ m.Save(7, &x.rcvClosed)
+ m.Save(8, &x.sndBufSize)
+ m.Save(9, &x.shutdownFlags)
+ m.Save(10, &x.state)
+ m.Save(11, &x.ttl)
+ m.Save(12, &x.owner)
+}
+
+func (x *endpoint) StateLoad(m state.Source) {
+ m.Load(0, &x.TransportEndpointInfo)
+ m.Load(1, &x.waiterQueue)
+ m.Load(2, &x.uniqueID)
+ m.Load(3, &x.rcvReady)
+ m.Load(4, &x.rcvList)
+ m.Load(6, &x.rcvBufSize)
+ m.Load(7, &x.rcvClosed)
+ m.Load(8, &x.sndBufSize)
+ m.Load(9, &x.shutdownFlags)
+ m.Load(10, &x.state)
+ m.Load(11, &x.ttl)
+ m.Load(12, &x.owner)
+ m.LoadValue(5, new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
m.AfterLoad(x.afterLoad)
}
+func (x *icmpPacketList) StateTypeName() string {
+ return "pkg/tcpip/transport/icmp.icmpPacketList"
+}
+
+func (x *icmpPacketList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
+}
+
func (x *icmpPacketList) beforeSave() {}
-func (x *icmpPacketList) save(m state.Map) {
+
+func (x *icmpPacketList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *icmpPacketList) afterLoad() {}
-func (x *icmpPacketList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *icmpPacketList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *icmpPacketEntry) StateTypeName() string {
+ return "pkg/tcpip/transport/icmp.icmpPacketEntry"
+}
+
+func (x *icmpPacketEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *icmpPacketEntry) beforeSave() {}
-func (x *icmpPacketEntry) save(m state.Map) {
+
+func (x *icmpPacketEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *icmpPacketEntry) afterLoad() {}
-func (x *icmpPacketEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *icmpPacketEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/tcpip/transport/icmp.icmpPacket", (*icmpPacket)(nil), state.Fns{Save: (*icmpPacket).save, Load: (*icmpPacket).load})
- state.Register("pkg/tcpip/transport/icmp.endpoint", (*endpoint)(nil), state.Fns{Save: (*endpoint).save, Load: (*endpoint).load})
- state.Register("pkg/tcpip/transport/icmp.icmpPacketList", (*icmpPacketList)(nil), state.Fns{Save: (*icmpPacketList).save, Load: (*icmpPacketList).load})
- state.Register("pkg/tcpip/transport/icmp.icmpPacketEntry", (*icmpPacketEntry)(nil), state.Fns{Save: (*icmpPacketEntry).save, Load: (*icmpPacketEntry).load})
+ state.Register((*icmpPacket)(nil))
+ state.Register((*endpoint)(nil))
+ state.Register((*icmpPacketList)(nil))
+ state.Register((*icmpPacketEntry)(nil))
}
diff --git a/pkg/tcpip/transport/packet/packet_list.go b/pkg/tcpip/transport/packet/packet_list.go
index 5231b066f..22a41872a 100644
--- a/pkg/tcpip/transport/packet/packet_list.go
+++ b/pkg/tcpip/transport/packet/packet_list.go
@@ -56,7 +56,7 @@ func (l *packetList) Back() *packet {
//
// NOTE: This is an O(n) operation.
func (l *packetList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (packetElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *packetList) Remove(e *packet) {
if prev != nil {
packetElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
packetElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/transport/packet/packet_state_autogen.go b/pkg/tcpip/transport/packet/packet_state_autogen.go
index 8ff339e08..209b6dcb0 100644
--- a/pkg/tcpip/transport/packet/packet_state_autogen.go
+++ b/pkg/tcpip/transport/packet/packet_state_autogen.go
@@ -7,84 +7,145 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/buffer"
)
+func (x *packet) StateTypeName() string {
+ return "pkg/tcpip/transport/packet.packet"
+}
+
+func (x *packet) StateFields() []string {
+ return []string{
+ "packetEntry",
+ "data",
+ "timestampNS",
+ "senderAddr",
+ }
+}
+
func (x *packet) beforeSave() {}
-func (x *packet) save(m state.Map) {
+
+func (x *packet) StateSave(m state.Sink) {
x.beforeSave()
var data buffer.VectorisedView = x.saveData()
- m.SaveValue("data", data)
- m.Save("packetEntry", &x.packetEntry)
- m.Save("timestampNS", &x.timestampNS)
- m.Save("senderAddr", &x.senderAddr)
+ m.SaveValue(1, data)
+ m.Save(0, &x.packetEntry)
+ m.Save(2, &x.timestampNS)
+ m.Save(3, &x.senderAddr)
}
func (x *packet) afterLoad() {}
-func (x *packet) load(m state.Map) {
- m.Load("packetEntry", &x.packetEntry)
- m.Load("timestampNS", &x.timestampNS)
- m.Load("senderAddr", &x.senderAddr)
- m.LoadValue("data", new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
+
+func (x *packet) StateLoad(m state.Source) {
+ m.Load(0, &x.packetEntry)
+ m.Load(2, &x.timestampNS)
+ m.Load(3, &x.senderAddr)
+ m.LoadValue(1, new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
}
-func (x *endpoint) save(m state.Map) {
+func (x *endpoint) StateTypeName() string {
+ return "pkg/tcpip/transport/packet.endpoint"
+}
+
+func (x *endpoint) StateFields() []string {
+ return []string{
+ "TransportEndpointInfo",
+ "netProto",
+ "waiterQueue",
+ "cooked",
+ "rcvList",
+ "rcvBufSizeMax",
+ "rcvBufSize",
+ "rcvClosed",
+ "sndBufSize",
+ "closed",
+ "bound",
+ }
+}
+
+func (x *endpoint) StateSave(m state.Sink) {
x.beforeSave()
var rcvBufSizeMax int = x.saveRcvBufSizeMax()
- m.SaveValue("rcvBufSizeMax", rcvBufSizeMax)
- m.Save("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Save("netProto", &x.netProto)
- m.Save("waiterQueue", &x.waiterQueue)
- m.Save("cooked", &x.cooked)
- m.Save("rcvList", &x.rcvList)
- m.Save("rcvBufSize", &x.rcvBufSize)
- m.Save("rcvClosed", &x.rcvClosed)
- m.Save("sndBufSize", &x.sndBufSize)
- m.Save("closed", &x.closed)
- m.Save("bound", &x.bound)
-}
-
-func (x *endpoint) load(m state.Map) {
- m.Load("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Load("netProto", &x.netProto)
- m.Load("waiterQueue", &x.waiterQueue)
- m.Load("cooked", &x.cooked)
- m.Load("rcvList", &x.rcvList)
- m.Load("rcvBufSize", &x.rcvBufSize)
- m.Load("rcvClosed", &x.rcvClosed)
- m.Load("sndBufSize", &x.sndBufSize)
- m.Load("closed", &x.closed)
- m.Load("bound", &x.bound)
- m.LoadValue("rcvBufSizeMax", new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
+ m.SaveValue(5, rcvBufSizeMax)
+ m.Save(0, &x.TransportEndpointInfo)
+ m.Save(1, &x.netProto)
+ m.Save(2, &x.waiterQueue)
+ m.Save(3, &x.cooked)
+ m.Save(4, &x.rcvList)
+ m.Save(6, &x.rcvBufSize)
+ m.Save(7, &x.rcvClosed)
+ m.Save(8, &x.sndBufSize)
+ m.Save(9, &x.closed)
+ m.Save(10, &x.bound)
+}
+
+func (x *endpoint) StateLoad(m state.Source) {
+ m.Load(0, &x.TransportEndpointInfo)
+ m.Load(1, &x.netProto)
+ m.Load(2, &x.waiterQueue)
+ m.Load(3, &x.cooked)
+ m.Load(4, &x.rcvList)
+ m.Load(6, &x.rcvBufSize)
+ m.Load(7, &x.rcvClosed)
+ m.Load(8, &x.sndBufSize)
+ m.Load(9, &x.closed)
+ m.Load(10, &x.bound)
+ m.LoadValue(5, new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
m.AfterLoad(x.afterLoad)
}
+func (x *packetList) StateTypeName() string {
+ return "pkg/tcpip/transport/packet.packetList"
+}
+
+func (x *packetList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
+}
+
func (x *packetList) beforeSave() {}
-func (x *packetList) save(m state.Map) {
+
+func (x *packetList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *packetList) afterLoad() {}
-func (x *packetList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *packetList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *packetEntry) StateTypeName() string {
+ return "pkg/tcpip/transport/packet.packetEntry"
+}
+
+func (x *packetEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *packetEntry) beforeSave() {}
-func (x *packetEntry) save(m state.Map) {
+
+func (x *packetEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *packetEntry) afterLoad() {}
-func (x *packetEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *packetEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/tcpip/transport/packet.packet", (*packet)(nil), state.Fns{Save: (*packet).save, Load: (*packet).load})
- state.Register("pkg/tcpip/transport/packet.endpoint", (*endpoint)(nil), state.Fns{Save: (*endpoint).save, Load: (*endpoint).load})
- state.Register("pkg/tcpip/transport/packet.packetList", (*packetList)(nil), state.Fns{Save: (*packetList).save, Load: (*packetList).load})
- state.Register("pkg/tcpip/transport/packet.packetEntry", (*packetEntry)(nil), state.Fns{Save: (*packetEntry).save, Load: (*packetEntry).load})
+ state.Register((*packet)(nil))
+ state.Register((*endpoint)(nil))
+ state.Register((*packetList)(nil))
+ state.Register((*packetEntry)(nil))
}
diff --git a/pkg/tcpip/transport/raw/raw_packet_list.go b/pkg/tcpip/transport/raw/raw_packet_list.go
index 15a8c845b..5f955e86a 100644
--- a/pkg/tcpip/transport/raw/raw_packet_list.go
+++ b/pkg/tcpip/transport/raw/raw_packet_list.go
@@ -56,7 +56,7 @@ func (l *rawPacketList) Back() *rawPacket {
//
// NOTE: This is an O(n) operation.
func (l *rawPacketList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (rawPacketElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *rawPacketList) Remove(e *rawPacket) {
if prev != nil {
rawPacketElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
rawPacketElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/transport/raw/raw_state_autogen.go b/pkg/tcpip/transport/raw/raw_state_autogen.go
index 875ebda36..669477cf9 100644
--- a/pkg/tcpip/transport/raw/raw_state_autogen.go
+++ b/pkg/tcpip/transport/raw/raw_state_autogen.go
@@ -7,88 +7,151 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/buffer"
)
+func (x *rawPacket) StateTypeName() string {
+ return "pkg/tcpip/transport/raw.rawPacket"
+}
+
+func (x *rawPacket) StateFields() []string {
+ return []string{
+ "rawPacketEntry",
+ "data",
+ "timestampNS",
+ "senderAddr",
+ }
+}
+
func (x *rawPacket) beforeSave() {}
-func (x *rawPacket) save(m state.Map) {
+
+func (x *rawPacket) StateSave(m state.Sink) {
x.beforeSave()
var data buffer.VectorisedView = x.saveData()
- m.SaveValue("data", data)
- m.Save("rawPacketEntry", &x.rawPacketEntry)
- m.Save("timestampNS", &x.timestampNS)
- m.Save("senderAddr", &x.senderAddr)
+ m.SaveValue(1, data)
+ m.Save(0, &x.rawPacketEntry)
+ m.Save(2, &x.timestampNS)
+ m.Save(3, &x.senderAddr)
}
func (x *rawPacket) afterLoad() {}
-func (x *rawPacket) load(m state.Map) {
- m.Load("rawPacketEntry", &x.rawPacketEntry)
- m.Load("timestampNS", &x.timestampNS)
- m.Load("senderAddr", &x.senderAddr)
- m.LoadValue("data", new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
+
+func (x *rawPacket) StateLoad(m state.Source) {
+ m.Load(0, &x.rawPacketEntry)
+ m.Load(2, &x.timestampNS)
+ m.Load(3, &x.senderAddr)
+ m.LoadValue(1, new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
}
-func (x *endpoint) save(m state.Map) {
+func (x *endpoint) StateTypeName() string {
+ return "pkg/tcpip/transport/raw.endpoint"
+}
+
+func (x *endpoint) StateFields() []string {
+ return []string{
+ "TransportEndpointInfo",
+ "waiterQueue",
+ "associated",
+ "rcvList",
+ "rcvBufSize",
+ "rcvBufSizeMax",
+ "rcvClosed",
+ "sndBufSize",
+ "sndBufSizeMax",
+ "closed",
+ "connected",
+ "bound",
+ "owner",
+ }
+}
+
+func (x *endpoint) StateSave(m state.Sink) {
x.beforeSave()
var rcvBufSizeMax int = x.saveRcvBufSizeMax()
- m.SaveValue("rcvBufSizeMax", rcvBufSizeMax)
- m.Save("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Save("waiterQueue", &x.waiterQueue)
- m.Save("associated", &x.associated)
- m.Save("rcvList", &x.rcvList)
- m.Save("rcvBufSize", &x.rcvBufSize)
- m.Save("rcvClosed", &x.rcvClosed)
- m.Save("sndBufSize", &x.sndBufSize)
- m.Save("sndBufSizeMax", &x.sndBufSizeMax)
- m.Save("closed", &x.closed)
- m.Save("connected", &x.connected)
- m.Save("bound", &x.bound)
- m.Save("owner", &x.owner)
-}
-
-func (x *endpoint) load(m state.Map) {
- m.Load("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Load("waiterQueue", &x.waiterQueue)
- m.Load("associated", &x.associated)
- m.Load("rcvList", &x.rcvList)
- m.Load("rcvBufSize", &x.rcvBufSize)
- m.Load("rcvClosed", &x.rcvClosed)
- m.Load("sndBufSize", &x.sndBufSize)
- m.Load("sndBufSizeMax", &x.sndBufSizeMax)
- m.Load("closed", &x.closed)
- m.Load("connected", &x.connected)
- m.Load("bound", &x.bound)
- m.Load("owner", &x.owner)
- m.LoadValue("rcvBufSizeMax", new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
+ m.SaveValue(5, rcvBufSizeMax)
+ m.Save(0, &x.TransportEndpointInfo)
+ m.Save(1, &x.waiterQueue)
+ m.Save(2, &x.associated)
+ m.Save(3, &x.rcvList)
+ m.Save(4, &x.rcvBufSize)
+ m.Save(6, &x.rcvClosed)
+ m.Save(7, &x.sndBufSize)
+ m.Save(8, &x.sndBufSizeMax)
+ m.Save(9, &x.closed)
+ m.Save(10, &x.connected)
+ m.Save(11, &x.bound)
+ m.Save(12, &x.owner)
+}
+
+func (x *endpoint) StateLoad(m state.Source) {
+ m.Load(0, &x.TransportEndpointInfo)
+ m.Load(1, &x.waiterQueue)
+ m.Load(2, &x.associated)
+ m.Load(3, &x.rcvList)
+ m.Load(4, &x.rcvBufSize)
+ m.Load(6, &x.rcvClosed)
+ m.Load(7, &x.sndBufSize)
+ m.Load(8, &x.sndBufSizeMax)
+ m.Load(9, &x.closed)
+ m.Load(10, &x.connected)
+ m.Load(11, &x.bound)
+ m.Load(12, &x.owner)
+ m.LoadValue(5, new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
m.AfterLoad(x.afterLoad)
}
+func (x *rawPacketList) StateTypeName() string {
+ return "pkg/tcpip/transport/raw.rawPacketList"
+}
+
+func (x *rawPacketList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
+}
+
func (x *rawPacketList) beforeSave() {}
-func (x *rawPacketList) save(m state.Map) {
+
+func (x *rawPacketList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *rawPacketList) afterLoad() {}
-func (x *rawPacketList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *rawPacketList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *rawPacketEntry) StateTypeName() string {
+ return "pkg/tcpip/transport/raw.rawPacketEntry"
+}
+
+func (x *rawPacketEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *rawPacketEntry) beforeSave() {}
-func (x *rawPacketEntry) save(m state.Map) {
+
+func (x *rawPacketEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *rawPacketEntry) afterLoad() {}
-func (x *rawPacketEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *rawPacketEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/tcpip/transport/raw.rawPacket", (*rawPacket)(nil), state.Fns{Save: (*rawPacket).save, Load: (*rawPacket).load})
- state.Register("pkg/tcpip/transport/raw.endpoint", (*endpoint)(nil), state.Fns{Save: (*endpoint).save, Load: (*endpoint).load})
- state.Register("pkg/tcpip/transport/raw.rawPacketList", (*rawPacketList)(nil), state.Fns{Save: (*rawPacketList).save, Load: (*rawPacketList).load})
- state.Register("pkg/tcpip/transport/raw.rawPacketEntry", (*rawPacketEntry)(nil), state.Fns{Save: (*rawPacketEntry).save, Load: (*rawPacketEntry).load})
+ state.Register((*rawPacket)(nil))
+ state.Register((*endpoint)(nil))
+ state.Register((*rawPacketList)(nil))
+ state.Register((*rawPacketEntry)(nil))
}
diff --git a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
index fb7046d8f..71ae11c81 100644
--- a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
+++ b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
@@ -56,7 +56,7 @@ func (l *endpointList) Back() *endpoint {
//
// NOTE: This is an O(n) operation.
func (l *endpointList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (endpointElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *endpointList) Remove(e *endpoint) {
if prev != nil {
endpointElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
endpointElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/transport/tcp/tcp_segment_list.go b/pkg/tcpip/transport/tcp/tcp_segment_list.go
index 21638041c..fcd0c7ec1 100644
--- a/pkg/tcpip/transport/tcp/tcp_segment_list.go
+++ b/pkg/tcpip/transport/tcp/tcp_segment_list.go
@@ -56,7 +56,7 @@ func (l *segmentList) Back() *segment {
//
// NOTE: This is an O(n) operation.
func (l *segmentList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (segmentElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *segmentList) Remove(e *segment) {
if prev != nil {
segmentElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
segmentElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/transport/tcp/tcp_state_autogen.go b/pkg/tcpip/transport/tcp/tcp_state_autogen.go
index 8f9e742fc..4b513121f 100644
--- a/pkg/tcpip/transport/tcp/tcp_state_autogen.go
+++ b/pkg/tcpip/transport/tcp/tcp_state_autogen.go
@@ -7,543 +7,916 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/buffer"
)
+func (x *cubicState) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.cubicState"
+}
+
+func (x *cubicState) StateFields() []string {
+ return []string{
+ "wLastMax",
+ "wMax",
+ "t",
+ "numCongestionEvents",
+ "c",
+ "k",
+ "beta",
+ "wC",
+ "wEst",
+ "s",
+ }
+}
+
func (x *cubicState) beforeSave() {}
-func (x *cubicState) save(m state.Map) {
+
+func (x *cubicState) StateSave(m state.Sink) {
x.beforeSave()
var t unixTime = x.saveT()
- m.SaveValue("t", t)
- m.Save("wLastMax", &x.wLastMax)
- m.Save("wMax", &x.wMax)
- m.Save("numCongestionEvents", &x.numCongestionEvents)
- m.Save("c", &x.c)
- m.Save("k", &x.k)
- m.Save("beta", &x.beta)
- m.Save("wC", &x.wC)
- m.Save("wEst", &x.wEst)
- m.Save("s", &x.s)
+ m.SaveValue(2, t)
+ m.Save(0, &x.wLastMax)
+ m.Save(1, &x.wMax)
+ m.Save(3, &x.numCongestionEvents)
+ m.Save(4, &x.c)
+ m.Save(5, &x.k)
+ m.Save(6, &x.beta)
+ m.Save(7, &x.wC)
+ m.Save(8, &x.wEst)
+ m.Save(9, &x.s)
}
func (x *cubicState) afterLoad() {}
-func (x *cubicState) load(m state.Map) {
- m.Load("wLastMax", &x.wLastMax)
- m.Load("wMax", &x.wMax)
- m.Load("numCongestionEvents", &x.numCongestionEvents)
- m.Load("c", &x.c)
- m.Load("k", &x.k)
- m.Load("beta", &x.beta)
- m.Load("wC", &x.wC)
- m.Load("wEst", &x.wEst)
- m.Load("s", &x.s)
- m.LoadValue("t", new(unixTime), func(y interface{}) { x.loadT(y.(unixTime)) })
+
+func (x *cubicState) StateLoad(m state.Source) {
+ m.Load(0, &x.wLastMax)
+ m.Load(1, &x.wMax)
+ m.Load(3, &x.numCongestionEvents)
+ m.Load(4, &x.c)
+ m.Load(5, &x.k)
+ m.Load(6, &x.beta)
+ m.Load(7, &x.wC)
+ m.Load(8, &x.wEst)
+ m.Load(9, &x.s)
+ m.LoadValue(2, new(unixTime), func(y interface{}) { x.loadT(y.(unixTime)) })
+}
+
+func (x *SACKInfo) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.SACKInfo"
+}
+
+func (x *SACKInfo) StateFields() []string {
+ return []string{
+ "Blocks",
+ "NumBlocks",
+ }
}
func (x *SACKInfo) beforeSave() {}
-func (x *SACKInfo) save(m state.Map) {
+
+func (x *SACKInfo) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("Blocks", &x.Blocks)
- m.Save("NumBlocks", &x.NumBlocks)
+ m.Save(0, &x.Blocks)
+ m.Save(1, &x.NumBlocks)
}
func (x *SACKInfo) afterLoad() {}
-func (x *SACKInfo) load(m state.Map) {
- m.Load("Blocks", &x.Blocks)
- m.Load("NumBlocks", &x.NumBlocks)
+
+func (x *SACKInfo) StateLoad(m state.Source) {
+ m.Load(0, &x.Blocks)
+ m.Load(1, &x.NumBlocks)
+}
+
+func (x *rcvBufAutoTuneParams) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.rcvBufAutoTuneParams"
+}
+
+func (x *rcvBufAutoTuneParams) StateFields() []string {
+ return []string{
+ "measureTime",
+ "copied",
+ "prevCopied",
+ "rtt",
+ "rttMeasureSeqNumber",
+ "rttMeasureTime",
+ "disabled",
+ }
}
func (x *rcvBufAutoTuneParams) beforeSave() {}
-func (x *rcvBufAutoTuneParams) save(m state.Map) {
+
+func (x *rcvBufAutoTuneParams) StateSave(m state.Sink) {
x.beforeSave()
var measureTime unixTime = x.saveMeasureTime()
- m.SaveValue("measureTime", measureTime)
+ m.SaveValue(0, measureTime)
var rttMeasureTime unixTime = x.saveRttMeasureTime()
- m.SaveValue("rttMeasureTime", rttMeasureTime)
- m.Save("copied", &x.copied)
- m.Save("prevCopied", &x.prevCopied)
- m.Save("rtt", &x.rtt)
- m.Save("rttMeasureSeqNumber", &x.rttMeasureSeqNumber)
- m.Save("disabled", &x.disabled)
+ m.SaveValue(5, rttMeasureTime)
+ m.Save(1, &x.copied)
+ m.Save(2, &x.prevCopied)
+ m.Save(3, &x.rtt)
+ m.Save(4, &x.rttMeasureSeqNumber)
+ m.Save(6, &x.disabled)
}
func (x *rcvBufAutoTuneParams) afterLoad() {}
-func (x *rcvBufAutoTuneParams) load(m state.Map) {
- m.Load("copied", &x.copied)
- m.Load("prevCopied", &x.prevCopied)
- m.Load("rtt", &x.rtt)
- m.Load("rttMeasureSeqNumber", &x.rttMeasureSeqNumber)
- m.Load("disabled", &x.disabled)
- m.LoadValue("measureTime", new(unixTime), func(y interface{}) { x.loadMeasureTime(y.(unixTime)) })
- m.LoadValue("rttMeasureTime", new(unixTime), func(y interface{}) { x.loadRttMeasureTime(y.(unixTime)) })
+
+func (x *rcvBufAutoTuneParams) StateLoad(m state.Source) {
+ m.Load(1, &x.copied)
+ m.Load(2, &x.prevCopied)
+ m.Load(3, &x.rtt)
+ m.Load(4, &x.rttMeasureSeqNumber)
+ m.Load(6, &x.disabled)
+ m.LoadValue(0, new(unixTime), func(y interface{}) { x.loadMeasureTime(y.(unixTime)) })
+ m.LoadValue(5, new(unixTime), func(y interface{}) { x.loadRttMeasureTime(y.(unixTime)) })
+}
+
+func (x *EndpointInfo) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.EndpointInfo"
+}
+
+func (x *EndpointInfo) StateFields() []string {
+ return []string{
+ "TransportEndpointInfo",
+ "HardError",
+ }
}
func (x *EndpointInfo) beforeSave() {}
-func (x *EndpointInfo) save(m state.Map) {
+
+func (x *EndpointInfo) StateSave(m state.Sink) {
x.beforeSave()
var HardError string = x.saveHardError()
- m.SaveValue("HardError", HardError)
- m.Save("TransportEndpointInfo", &x.TransportEndpointInfo)
+ m.SaveValue(1, HardError)
+ m.Save(0, &x.TransportEndpointInfo)
}
func (x *EndpointInfo) afterLoad() {}
-func (x *EndpointInfo) load(m state.Map) {
- m.Load("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.LoadValue("HardError", new(string), func(y interface{}) { x.loadHardError(y.(string)) })
-}
-func (x *endpoint) save(m state.Map) {
+func (x *EndpointInfo) StateLoad(m state.Source) {
+ m.Load(0, &x.TransportEndpointInfo)
+ m.LoadValue(1, new(string), func(y interface{}) { x.loadHardError(y.(string)) })
+}
+
+func (x *endpoint) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.endpoint"
+}
+
+func (x *endpoint) StateFields() []string {
+ return []string{
+ "EndpointInfo",
+ "waiterQueue",
+ "uniqueID",
+ "lastError",
+ "rcvList",
+ "rcvClosed",
+ "rcvBufSize",
+ "rcvBufUsed",
+ "rcvAutoParams",
+ "ownedByUser",
+ "state",
+ "boundNICID",
+ "ttl",
+ "v6only",
+ "isConnectNotified",
+ "broadcast",
+ "portFlags",
+ "boundBindToDevice",
+ "boundPortFlags",
+ "boundDest",
+ "effectiveNetProtos",
+ "workerRunning",
+ "workerCleanup",
+ "sendTSOk",
+ "recentTS",
+ "tsOffset",
+ "shutdownFlags",
+ "sackPermitted",
+ "sack",
+ "bindToDevice",
+ "delay",
+ "cork",
+ "scoreboard",
+ "slowAck",
+ "segmentQueue",
+ "synRcvdCount",
+ "userMSS",
+ "maxSynRetries",
+ "windowClamp",
+ "sndBufSize",
+ "sndBufUsed",
+ "sndClosed",
+ "sndBufInQueue",
+ "sndQueue",
+ "cc",
+ "packetTooBigCount",
+ "sndMTU",
+ "keepalive",
+ "userTimeout",
+ "deferAccept",
+ "acceptedChan",
+ "rcv",
+ "snd",
+ "connectingAddress",
+ "amss",
+ "sendTOS",
+ "gso",
+ "tcpLingerTimeout",
+ "closed",
+ "txHash",
+ "owner",
+ }
+}
+
+func (x *endpoint) StateSave(m state.Sink) {
x.beforeSave()
var lastError string = x.saveLastError()
- m.SaveValue("lastError", lastError)
+ m.SaveValue(3, lastError)
var state EndpointState = x.saveState()
- m.SaveValue("state", state)
+ m.SaveValue(10, state)
var acceptedChan []*endpoint = x.saveAcceptedChan()
- m.SaveValue("acceptedChan", acceptedChan)
- m.Save("EndpointInfo", &x.EndpointInfo)
- m.Save("waiterQueue", &x.waiterQueue)
- m.Save("uniqueID", &x.uniqueID)
- m.Save("rcvList", &x.rcvList)
- m.Save("rcvClosed", &x.rcvClosed)
- m.Save("rcvBufSize", &x.rcvBufSize)
- m.Save("rcvBufUsed", &x.rcvBufUsed)
- m.Save("rcvAutoParams", &x.rcvAutoParams)
- m.Save("ownedByUser", &x.ownedByUser)
- m.Save("boundNICID", &x.boundNICID)
- m.Save("ttl", &x.ttl)
- m.Save("v6only", &x.v6only)
- m.Save("isConnectNotified", &x.isConnectNotified)
- m.Save("broadcast", &x.broadcast)
- m.Save("portFlags", &x.portFlags)
- m.Save("boundBindToDevice", &x.boundBindToDevice)
- m.Save("boundPortFlags", &x.boundPortFlags)
- m.Save("boundDest", &x.boundDest)
- m.Save("effectiveNetProtos", &x.effectiveNetProtos)
- m.Save("workerRunning", &x.workerRunning)
- m.Save("workerCleanup", &x.workerCleanup)
- m.Save("sendTSOk", &x.sendTSOk)
- m.Save("recentTS", &x.recentTS)
- m.Save("tsOffset", &x.tsOffset)
- m.Save("shutdownFlags", &x.shutdownFlags)
- m.Save("sackPermitted", &x.sackPermitted)
- m.Save("sack", &x.sack)
- m.Save("bindToDevice", &x.bindToDevice)
- m.Save("delay", &x.delay)
- m.Save("cork", &x.cork)
- m.Save("scoreboard", &x.scoreboard)
- m.Save("slowAck", &x.slowAck)
- m.Save("segmentQueue", &x.segmentQueue)
- m.Save("synRcvdCount", &x.synRcvdCount)
- m.Save("userMSS", &x.userMSS)
- m.Save("maxSynRetries", &x.maxSynRetries)
- m.Save("windowClamp", &x.windowClamp)
- m.Save("sndBufSize", &x.sndBufSize)
- m.Save("sndBufUsed", &x.sndBufUsed)
- m.Save("sndClosed", &x.sndClosed)
- m.Save("sndBufInQueue", &x.sndBufInQueue)
- m.Save("sndQueue", &x.sndQueue)
- m.Save("cc", &x.cc)
- m.Save("packetTooBigCount", &x.packetTooBigCount)
- m.Save("sndMTU", &x.sndMTU)
- m.Save("keepalive", &x.keepalive)
- m.Save("userTimeout", &x.userTimeout)
- m.Save("deferAccept", &x.deferAccept)
- m.Save("rcv", &x.rcv)
- m.Save("snd", &x.snd)
- m.Save("connectingAddress", &x.connectingAddress)
- m.Save("amss", &x.amss)
- m.Save("sendTOS", &x.sendTOS)
- m.Save("gso", &x.gso)
- m.Save("tcpLingerTimeout", &x.tcpLingerTimeout)
- m.Save("closed", &x.closed)
- m.Save("txHash", &x.txHash)
- m.Save("owner", &x.owner)
-}
-
-func (x *endpoint) load(m state.Map) {
- m.Load("EndpointInfo", &x.EndpointInfo)
- m.LoadWait("waiterQueue", &x.waiterQueue)
- m.Load("uniqueID", &x.uniqueID)
- m.LoadWait("rcvList", &x.rcvList)
- m.Load("rcvClosed", &x.rcvClosed)
- m.Load("rcvBufSize", &x.rcvBufSize)
- m.Load("rcvBufUsed", &x.rcvBufUsed)
- m.Load("rcvAutoParams", &x.rcvAutoParams)
- m.Load("ownedByUser", &x.ownedByUser)
- m.Load("boundNICID", &x.boundNICID)
- m.Load("ttl", &x.ttl)
- m.Load("v6only", &x.v6only)
- m.Load("isConnectNotified", &x.isConnectNotified)
- m.Load("broadcast", &x.broadcast)
- m.Load("portFlags", &x.portFlags)
- m.Load("boundBindToDevice", &x.boundBindToDevice)
- m.Load("boundPortFlags", &x.boundPortFlags)
- m.Load("boundDest", &x.boundDest)
- m.Load("effectiveNetProtos", &x.effectiveNetProtos)
- m.Load("workerRunning", &x.workerRunning)
- m.Load("workerCleanup", &x.workerCleanup)
- m.Load("sendTSOk", &x.sendTSOk)
- m.Load("recentTS", &x.recentTS)
- m.Load("tsOffset", &x.tsOffset)
- m.Load("shutdownFlags", &x.shutdownFlags)
- m.Load("sackPermitted", &x.sackPermitted)
- m.Load("sack", &x.sack)
- m.Load("bindToDevice", &x.bindToDevice)
- m.Load("delay", &x.delay)
- m.Load("cork", &x.cork)
- m.Load("scoreboard", &x.scoreboard)
- m.Load("slowAck", &x.slowAck)
- m.LoadWait("segmentQueue", &x.segmentQueue)
- m.Load("synRcvdCount", &x.synRcvdCount)
- m.Load("userMSS", &x.userMSS)
- m.Load("maxSynRetries", &x.maxSynRetries)
- m.Load("windowClamp", &x.windowClamp)
- m.Load("sndBufSize", &x.sndBufSize)
- m.Load("sndBufUsed", &x.sndBufUsed)
- m.Load("sndClosed", &x.sndClosed)
- m.Load("sndBufInQueue", &x.sndBufInQueue)
- m.LoadWait("sndQueue", &x.sndQueue)
- m.Load("cc", &x.cc)
- m.Load("packetTooBigCount", &x.packetTooBigCount)
- m.Load("sndMTU", &x.sndMTU)
- m.Load("keepalive", &x.keepalive)
- m.Load("userTimeout", &x.userTimeout)
- m.Load("deferAccept", &x.deferAccept)
- m.LoadWait("rcv", &x.rcv)
- m.LoadWait("snd", &x.snd)
- m.Load("connectingAddress", &x.connectingAddress)
- m.Load("amss", &x.amss)
- m.Load("sendTOS", &x.sendTOS)
- m.Load("gso", &x.gso)
- m.Load("tcpLingerTimeout", &x.tcpLingerTimeout)
- m.Load("closed", &x.closed)
- m.Load("txHash", &x.txHash)
- m.Load("owner", &x.owner)
- m.LoadValue("lastError", new(string), func(y interface{}) { x.loadLastError(y.(string)) })
- m.LoadValue("state", new(EndpointState), func(y interface{}) { x.loadState(y.(EndpointState)) })
- m.LoadValue("acceptedChan", new([]*endpoint), func(y interface{}) { x.loadAcceptedChan(y.([]*endpoint)) })
+ m.SaveValue(50, acceptedChan)
+ m.Save(0, &x.EndpointInfo)
+ m.Save(1, &x.waiterQueue)
+ m.Save(2, &x.uniqueID)
+ m.Save(4, &x.rcvList)
+ m.Save(5, &x.rcvClosed)
+ m.Save(6, &x.rcvBufSize)
+ m.Save(7, &x.rcvBufUsed)
+ m.Save(8, &x.rcvAutoParams)
+ m.Save(9, &x.ownedByUser)
+ m.Save(11, &x.boundNICID)
+ m.Save(12, &x.ttl)
+ m.Save(13, &x.v6only)
+ m.Save(14, &x.isConnectNotified)
+ m.Save(15, &x.broadcast)
+ m.Save(16, &x.portFlags)
+ m.Save(17, &x.boundBindToDevice)
+ m.Save(18, &x.boundPortFlags)
+ m.Save(19, &x.boundDest)
+ m.Save(20, &x.effectiveNetProtos)
+ m.Save(21, &x.workerRunning)
+ m.Save(22, &x.workerCleanup)
+ m.Save(23, &x.sendTSOk)
+ m.Save(24, &x.recentTS)
+ m.Save(25, &x.tsOffset)
+ m.Save(26, &x.shutdownFlags)
+ m.Save(27, &x.sackPermitted)
+ m.Save(28, &x.sack)
+ m.Save(29, &x.bindToDevice)
+ m.Save(30, &x.delay)
+ m.Save(31, &x.cork)
+ m.Save(32, &x.scoreboard)
+ m.Save(33, &x.slowAck)
+ m.Save(34, &x.segmentQueue)
+ m.Save(35, &x.synRcvdCount)
+ m.Save(36, &x.userMSS)
+ m.Save(37, &x.maxSynRetries)
+ m.Save(38, &x.windowClamp)
+ m.Save(39, &x.sndBufSize)
+ m.Save(40, &x.sndBufUsed)
+ m.Save(41, &x.sndClosed)
+ m.Save(42, &x.sndBufInQueue)
+ m.Save(43, &x.sndQueue)
+ m.Save(44, &x.cc)
+ m.Save(45, &x.packetTooBigCount)
+ m.Save(46, &x.sndMTU)
+ m.Save(47, &x.keepalive)
+ m.Save(48, &x.userTimeout)
+ m.Save(49, &x.deferAccept)
+ m.Save(51, &x.rcv)
+ m.Save(52, &x.snd)
+ m.Save(53, &x.connectingAddress)
+ m.Save(54, &x.amss)
+ m.Save(55, &x.sendTOS)
+ m.Save(56, &x.gso)
+ m.Save(57, &x.tcpLingerTimeout)
+ m.Save(58, &x.closed)
+ m.Save(59, &x.txHash)
+ m.Save(60, &x.owner)
+}
+
+func (x *endpoint) StateLoad(m state.Source) {
+ m.Load(0, &x.EndpointInfo)
+ m.LoadWait(1, &x.waiterQueue)
+ m.Load(2, &x.uniqueID)
+ m.LoadWait(4, &x.rcvList)
+ m.Load(5, &x.rcvClosed)
+ m.Load(6, &x.rcvBufSize)
+ m.Load(7, &x.rcvBufUsed)
+ m.Load(8, &x.rcvAutoParams)
+ m.Load(9, &x.ownedByUser)
+ m.Load(11, &x.boundNICID)
+ m.Load(12, &x.ttl)
+ m.Load(13, &x.v6only)
+ m.Load(14, &x.isConnectNotified)
+ m.Load(15, &x.broadcast)
+ m.Load(16, &x.portFlags)
+ m.Load(17, &x.boundBindToDevice)
+ m.Load(18, &x.boundPortFlags)
+ m.Load(19, &x.boundDest)
+ m.Load(20, &x.effectiveNetProtos)
+ m.Load(21, &x.workerRunning)
+ m.Load(22, &x.workerCleanup)
+ m.Load(23, &x.sendTSOk)
+ m.Load(24, &x.recentTS)
+ m.Load(25, &x.tsOffset)
+ m.Load(26, &x.shutdownFlags)
+ m.Load(27, &x.sackPermitted)
+ m.Load(28, &x.sack)
+ m.Load(29, &x.bindToDevice)
+ m.Load(30, &x.delay)
+ m.Load(31, &x.cork)
+ m.Load(32, &x.scoreboard)
+ m.Load(33, &x.slowAck)
+ m.LoadWait(34, &x.segmentQueue)
+ m.Load(35, &x.synRcvdCount)
+ m.Load(36, &x.userMSS)
+ m.Load(37, &x.maxSynRetries)
+ m.Load(38, &x.windowClamp)
+ m.Load(39, &x.sndBufSize)
+ m.Load(40, &x.sndBufUsed)
+ m.Load(41, &x.sndClosed)
+ m.Load(42, &x.sndBufInQueue)
+ m.LoadWait(43, &x.sndQueue)
+ m.Load(44, &x.cc)
+ m.Load(45, &x.packetTooBigCount)
+ m.Load(46, &x.sndMTU)
+ m.Load(47, &x.keepalive)
+ m.Load(48, &x.userTimeout)
+ m.Load(49, &x.deferAccept)
+ m.LoadWait(51, &x.rcv)
+ m.LoadWait(52, &x.snd)
+ m.Load(53, &x.connectingAddress)
+ m.Load(54, &x.amss)
+ m.Load(55, &x.sendTOS)
+ m.Load(56, &x.gso)
+ m.Load(57, &x.tcpLingerTimeout)
+ m.Load(58, &x.closed)
+ m.Load(59, &x.txHash)
+ m.Load(60, &x.owner)
+ m.LoadValue(3, new(string), func(y interface{}) { x.loadLastError(y.(string)) })
+ m.LoadValue(10, new(EndpointState), func(y interface{}) { x.loadState(y.(EndpointState)) })
+ m.LoadValue(50, new([]*endpoint), func(y interface{}) { x.loadAcceptedChan(y.([]*endpoint)) })
m.AfterLoad(x.afterLoad)
}
+func (x *keepalive) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.keepalive"
+}
+
+func (x *keepalive) StateFields() []string {
+ return []string{
+ "enabled",
+ "idle",
+ "interval",
+ "count",
+ "unacked",
+ }
+}
+
func (x *keepalive) beforeSave() {}
-func (x *keepalive) save(m state.Map) {
+
+func (x *keepalive) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("enabled", &x.enabled)
- m.Save("idle", &x.idle)
- m.Save("interval", &x.interval)
- m.Save("count", &x.count)
- m.Save("unacked", &x.unacked)
+ m.Save(0, &x.enabled)
+ m.Save(1, &x.idle)
+ m.Save(2, &x.interval)
+ m.Save(3, &x.count)
+ m.Save(4, &x.unacked)
}
func (x *keepalive) afterLoad() {}
-func (x *keepalive) load(m state.Map) {
- m.Load("enabled", &x.enabled)
- m.Load("idle", &x.idle)
- m.Load("interval", &x.interval)
- m.Load("count", &x.count)
- m.Load("unacked", &x.unacked)
+
+func (x *keepalive) StateLoad(m state.Source) {
+ m.Load(0, &x.enabled)
+ m.Load(1, &x.idle)
+ m.Load(2, &x.interval)
+ m.Load(3, &x.count)
+ m.Load(4, &x.unacked)
+}
+
+func (x *receiver) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.receiver"
+}
+
+func (x *receiver) StateFields() []string {
+ return []string{
+ "ep",
+ "rcvNxt",
+ "rcvAcc",
+ "rcvWnd",
+ "rcvWndScale",
+ "closed",
+ "pendingRcvdSegments",
+ "pendingBufUsed",
+ "pendingBufSize",
+ "lastRcvdAckTime",
+ }
}
func (x *receiver) beforeSave() {}
-func (x *receiver) save(m state.Map) {
+
+func (x *receiver) StateSave(m state.Sink) {
x.beforeSave()
var lastRcvdAckTime unixTime = x.saveLastRcvdAckTime()
- m.SaveValue("lastRcvdAckTime", lastRcvdAckTime)
- m.Save("ep", &x.ep)
- m.Save("rcvNxt", &x.rcvNxt)
- m.Save("rcvAcc", &x.rcvAcc)
- m.Save("rcvWnd", &x.rcvWnd)
- m.Save("rcvWndScale", &x.rcvWndScale)
- m.Save("closed", &x.closed)
- m.Save("pendingRcvdSegments", &x.pendingRcvdSegments)
- m.Save("pendingBufUsed", &x.pendingBufUsed)
- m.Save("pendingBufSize", &x.pendingBufSize)
+ m.SaveValue(9, lastRcvdAckTime)
+ m.Save(0, &x.ep)
+ m.Save(1, &x.rcvNxt)
+ m.Save(2, &x.rcvAcc)
+ m.Save(3, &x.rcvWnd)
+ m.Save(4, &x.rcvWndScale)
+ m.Save(5, &x.closed)
+ m.Save(6, &x.pendingRcvdSegments)
+ m.Save(7, &x.pendingBufUsed)
+ m.Save(8, &x.pendingBufSize)
}
func (x *receiver) afterLoad() {}
-func (x *receiver) load(m state.Map) {
- m.Load("ep", &x.ep)
- m.Load("rcvNxt", &x.rcvNxt)
- m.Load("rcvAcc", &x.rcvAcc)
- m.Load("rcvWnd", &x.rcvWnd)
- m.Load("rcvWndScale", &x.rcvWndScale)
- m.Load("closed", &x.closed)
- m.Load("pendingRcvdSegments", &x.pendingRcvdSegments)
- m.Load("pendingBufUsed", &x.pendingBufUsed)
- m.Load("pendingBufSize", &x.pendingBufSize)
- m.LoadValue("lastRcvdAckTime", new(unixTime), func(y interface{}) { x.loadLastRcvdAckTime(y.(unixTime)) })
+
+func (x *receiver) StateLoad(m state.Source) {
+ m.Load(0, &x.ep)
+ m.Load(1, &x.rcvNxt)
+ m.Load(2, &x.rcvAcc)
+ m.Load(3, &x.rcvWnd)
+ m.Load(4, &x.rcvWndScale)
+ m.Load(5, &x.closed)
+ m.Load(6, &x.pendingRcvdSegments)
+ m.Load(7, &x.pendingBufUsed)
+ m.Load(8, &x.pendingBufSize)
+ m.LoadValue(9, new(unixTime), func(y interface{}) { x.loadLastRcvdAckTime(y.(unixTime)) })
+}
+
+func (x *renoState) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.renoState"
+}
+
+func (x *renoState) StateFields() []string {
+ return []string{
+ "s",
+ }
}
func (x *renoState) beforeSave() {}
-func (x *renoState) save(m state.Map) {
+
+func (x *renoState) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("s", &x.s)
+ m.Save(0, &x.s)
}
func (x *renoState) afterLoad() {}
-func (x *renoState) load(m state.Map) {
- m.Load("s", &x.s)
+
+func (x *renoState) StateLoad(m state.Source) {
+ m.Load(0, &x.s)
+}
+
+func (x *SACKScoreboard) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.SACKScoreboard"
+}
+
+func (x *SACKScoreboard) StateFields() []string {
+ return []string{
+ "smss",
+ "maxSACKED",
+ }
}
func (x *SACKScoreboard) beforeSave() {}
-func (x *SACKScoreboard) save(m state.Map) {
+
+func (x *SACKScoreboard) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("smss", &x.smss)
- m.Save("maxSACKED", &x.maxSACKED)
+ m.Save(0, &x.smss)
+ m.Save(1, &x.maxSACKED)
}
func (x *SACKScoreboard) afterLoad() {}
-func (x *SACKScoreboard) load(m state.Map) {
- m.Load("smss", &x.smss)
- m.Load("maxSACKED", &x.maxSACKED)
+
+func (x *SACKScoreboard) StateLoad(m state.Source) {
+ m.Load(0, &x.smss)
+ m.Load(1, &x.maxSACKED)
+}
+
+func (x *segment) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.segment"
+}
+
+func (x *segment) StateFields() []string {
+ return []string{
+ "segmentEntry",
+ "refCnt",
+ "data",
+ "hdr",
+ "viewToDeliver",
+ "sequenceNumber",
+ "ackNumber",
+ "flags",
+ "window",
+ "csum",
+ "csumValid",
+ "parsedOptions",
+ "options",
+ "hasNewSACKInfo",
+ "rcvdTime",
+ "xmitTime",
+ "xmitCount",
+ }
}
func (x *segment) beforeSave() {}
-func (x *segment) save(m state.Map) {
+
+func (x *segment) StateSave(m state.Sink) {
x.beforeSave()
var data buffer.VectorisedView = x.saveData()
- m.SaveValue("data", data)
+ m.SaveValue(2, data)
var options []byte = x.saveOptions()
- m.SaveValue("options", options)
+ m.SaveValue(12, options)
var rcvdTime unixTime = x.saveRcvdTime()
- m.SaveValue("rcvdTime", rcvdTime)
+ m.SaveValue(14, rcvdTime)
var xmitTime unixTime = x.saveXmitTime()
- m.SaveValue("xmitTime", xmitTime)
- m.Save("segmentEntry", &x.segmentEntry)
- m.Save("refCnt", &x.refCnt)
- m.Save("hdr", &x.hdr)
- m.Save("viewToDeliver", &x.viewToDeliver)
- m.Save("sequenceNumber", &x.sequenceNumber)
- m.Save("ackNumber", &x.ackNumber)
- m.Save("flags", &x.flags)
- m.Save("window", &x.window)
- m.Save("csum", &x.csum)
- m.Save("csumValid", &x.csumValid)
- m.Save("parsedOptions", &x.parsedOptions)
- m.Save("hasNewSACKInfo", &x.hasNewSACKInfo)
- m.Save("xmitCount", &x.xmitCount)
+ m.SaveValue(15, xmitTime)
+ m.Save(0, &x.segmentEntry)
+ m.Save(1, &x.refCnt)
+ m.Save(3, &x.hdr)
+ m.Save(4, &x.viewToDeliver)
+ m.Save(5, &x.sequenceNumber)
+ m.Save(6, &x.ackNumber)
+ m.Save(7, &x.flags)
+ m.Save(8, &x.window)
+ m.Save(9, &x.csum)
+ m.Save(10, &x.csumValid)
+ m.Save(11, &x.parsedOptions)
+ m.Save(13, &x.hasNewSACKInfo)
+ m.Save(16, &x.xmitCount)
}
func (x *segment) afterLoad() {}
-func (x *segment) load(m state.Map) {
- m.Load("segmentEntry", &x.segmentEntry)
- m.Load("refCnt", &x.refCnt)
- m.Load("hdr", &x.hdr)
- m.Load("viewToDeliver", &x.viewToDeliver)
- m.Load("sequenceNumber", &x.sequenceNumber)
- m.Load("ackNumber", &x.ackNumber)
- m.Load("flags", &x.flags)
- m.Load("window", &x.window)
- m.Load("csum", &x.csum)
- m.Load("csumValid", &x.csumValid)
- m.Load("parsedOptions", &x.parsedOptions)
- m.Load("hasNewSACKInfo", &x.hasNewSACKInfo)
- m.Load("xmitCount", &x.xmitCount)
- m.LoadValue("data", new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
- m.LoadValue("options", new([]byte), func(y interface{}) { x.loadOptions(y.([]byte)) })
- m.LoadValue("rcvdTime", new(unixTime), func(y interface{}) { x.loadRcvdTime(y.(unixTime)) })
- m.LoadValue("xmitTime", new(unixTime), func(y interface{}) { x.loadXmitTime(y.(unixTime)) })
+
+func (x *segment) StateLoad(m state.Source) {
+ m.Load(0, &x.segmentEntry)
+ m.Load(1, &x.refCnt)
+ m.Load(3, &x.hdr)
+ m.Load(4, &x.viewToDeliver)
+ m.Load(5, &x.sequenceNumber)
+ m.Load(6, &x.ackNumber)
+ m.Load(7, &x.flags)
+ m.Load(8, &x.window)
+ m.Load(9, &x.csum)
+ m.Load(10, &x.csumValid)
+ m.Load(11, &x.parsedOptions)
+ m.Load(13, &x.hasNewSACKInfo)
+ m.Load(16, &x.xmitCount)
+ m.LoadValue(2, new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
+ m.LoadValue(12, new([]byte), func(y interface{}) { x.loadOptions(y.([]byte)) })
+ m.LoadValue(14, new(unixTime), func(y interface{}) { x.loadRcvdTime(y.(unixTime)) })
+ m.LoadValue(15, new(unixTime), func(y interface{}) { x.loadXmitTime(y.(unixTime)) })
+}
+
+func (x *segmentQueue) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.segmentQueue"
+}
+
+func (x *segmentQueue) StateFields() []string {
+ return []string{
+ "list",
+ "limit",
+ "used",
+ }
}
func (x *segmentQueue) beforeSave() {}
-func (x *segmentQueue) save(m state.Map) {
+
+func (x *segmentQueue) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("list", &x.list)
- m.Save("limit", &x.limit)
- m.Save("used", &x.used)
+ m.Save(0, &x.list)
+ m.Save(1, &x.limit)
+ m.Save(2, &x.used)
}
func (x *segmentQueue) afterLoad() {}
-func (x *segmentQueue) load(m state.Map) {
- m.LoadWait("list", &x.list)
- m.Load("limit", &x.limit)
- m.Load("used", &x.used)
+
+func (x *segmentQueue) StateLoad(m state.Source) {
+ m.LoadWait(0, &x.list)
+ m.Load(1, &x.limit)
+ m.Load(2, &x.used)
+}
+
+func (x *sender) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.sender"
+}
+
+func (x *sender) StateFields() []string {
+ return []string{
+ "ep",
+ "lastSendTime",
+ "dupAckCount",
+ "fr",
+ "sndCwnd",
+ "sndSsthresh",
+ "sndCAAckCount",
+ "outstanding",
+ "sndWnd",
+ "sndUna",
+ "sndNxt",
+ "rttMeasureSeqNum",
+ "rttMeasureTime",
+ "firstRetransmittedSegXmitTime",
+ "closed",
+ "writeNext",
+ "writeList",
+ "rtt",
+ "rto",
+ "minRTO",
+ "maxRTO",
+ "maxRetries",
+ "maxPayloadSize",
+ "gso",
+ "sndWndScale",
+ "maxSentAck",
+ "state",
+ "cc",
+ }
}
func (x *sender) beforeSave() {}
-func (x *sender) save(m state.Map) {
+
+func (x *sender) StateSave(m state.Sink) {
x.beforeSave()
var lastSendTime unixTime = x.saveLastSendTime()
- m.SaveValue("lastSendTime", lastSendTime)
+ m.SaveValue(1, lastSendTime)
var rttMeasureTime unixTime = x.saveRttMeasureTime()
- m.SaveValue("rttMeasureTime", rttMeasureTime)
+ m.SaveValue(12, rttMeasureTime)
var firstRetransmittedSegXmitTime unixTime = x.saveFirstRetransmittedSegXmitTime()
- m.SaveValue("firstRetransmittedSegXmitTime", firstRetransmittedSegXmitTime)
- m.Save("ep", &x.ep)
- m.Save("dupAckCount", &x.dupAckCount)
- m.Save("fr", &x.fr)
- m.Save("sndCwnd", &x.sndCwnd)
- m.Save("sndSsthresh", &x.sndSsthresh)
- m.Save("sndCAAckCount", &x.sndCAAckCount)
- m.Save("outstanding", &x.outstanding)
- m.Save("sndWnd", &x.sndWnd)
- m.Save("sndUna", &x.sndUna)
- m.Save("sndNxt", &x.sndNxt)
- m.Save("rttMeasureSeqNum", &x.rttMeasureSeqNum)
- m.Save("closed", &x.closed)
- m.Save("writeNext", &x.writeNext)
- m.Save("writeList", &x.writeList)
- m.Save("rtt", &x.rtt)
- m.Save("rto", &x.rto)
- m.Save("minRTO", &x.minRTO)
- m.Save("maxRTO", &x.maxRTO)
- m.Save("maxRetries", &x.maxRetries)
- m.Save("maxPayloadSize", &x.maxPayloadSize)
- m.Save("gso", &x.gso)
- m.Save("sndWndScale", &x.sndWndScale)
- m.Save("maxSentAck", &x.maxSentAck)
- m.Save("state", &x.state)
- m.Save("cc", &x.cc)
-}
-
-func (x *sender) load(m state.Map) {
- m.Load("ep", &x.ep)
- m.Load("dupAckCount", &x.dupAckCount)
- m.Load("fr", &x.fr)
- m.Load("sndCwnd", &x.sndCwnd)
- m.Load("sndSsthresh", &x.sndSsthresh)
- m.Load("sndCAAckCount", &x.sndCAAckCount)
- m.Load("outstanding", &x.outstanding)
- m.Load("sndWnd", &x.sndWnd)
- m.Load("sndUna", &x.sndUna)
- m.Load("sndNxt", &x.sndNxt)
- m.Load("rttMeasureSeqNum", &x.rttMeasureSeqNum)
- m.Load("closed", &x.closed)
- m.Load("writeNext", &x.writeNext)
- m.Load("writeList", &x.writeList)
- m.Load("rtt", &x.rtt)
- m.Load("rto", &x.rto)
- m.Load("minRTO", &x.minRTO)
- m.Load("maxRTO", &x.maxRTO)
- m.Load("maxRetries", &x.maxRetries)
- m.Load("maxPayloadSize", &x.maxPayloadSize)
- m.Load("gso", &x.gso)
- m.Load("sndWndScale", &x.sndWndScale)
- m.Load("maxSentAck", &x.maxSentAck)
- m.Load("state", &x.state)
- m.Load("cc", &x.cc)
- m.LoadValue("lastSendTime", new(unixTime), func(y interface{}) { x.loadLastSendTime(y.(unixTime)) })
- m.LoadValue("rttMeasureTime", new(unixTime), func(y interface{}) { x.loadRttMeasureTime(y.(unixTime)) })
- m.LoadValue("firstRetransmittedSegXmitTime", new(unixTime), func(y interface{}) { x.loadFirstRetransmittedSegXmitTime(y.(unixTime)) })
+ m.SaveValue(13, firstRetransmittedSegXmitTime)
+ m.Save(0, &x.ep)
+ m.Save(2, &x.dupAckCount)
+ m.Save(3, &x.fr)
+ m.Save(4, &x.sndCwnd)
+ m.Save(5, &x.sndSsthresh)
+ m.Save(6, &x.sndCAAckCount)
+ m.Save(7, &x.outstanding)
+ m.Save(8, &x.sndWnd)
+ m.Save(9, &x.sndUna)
+ m.Save(10, &x.sndNxt)
+ m.Save(11, &x.rttMeasureSeqNum)
+ m.Save(14, &x.closed)
+ m.Save(15, &x.writeNext)
+ m.Save(16, &x.writeList)
+ m.Save(17, &x.rtt)
+ m.Save(18, &x.rto)
+ m.Save(19, &x.minRTO)
+ m.Save(20, &x.maxRTO)
+ m.Save(21, &x.maxRetries)
+ m.Save(22, &x.maxPayloadSize)
+ m.Save(23, &x.gso)
+ m.Save(24, &x.sndWndScale)
+ m.Save(25, &x.maxSentAck)
+ m.Save(26, &x.state)
+ m.Save(27, &x.cc)
+}
+
+func (x *sender) StateLoad(m state.Source) {
+ m.Load(0, &x.ep)
+ m.Load(2, &x.dupAckCount)
+ m.Load(3, &x.fr)
+ m.Load(4, &x.sndCwnd)
+ m.Load(5, &x.sndSsthresh)
+ m.Load(6, &x.sndCAAckCount)
+ m.Load(7, &x.outstanding)
+ m.Load(8, &x.sndWnd)
+ m.Load(9, &x.sndUna)
+ m.Load(10, &x.sndNxt)
+ m.Load(11, &x.rttMeasureSeqNum)
+ m.Load(14, &x.closed)
+ m.Load(15, &x.writeNext)
+ m.Load(16, &x.writeList)
+ m.Load(17, &x.rtt)
+ m.Load(18, &x.rto)
+ m.Load(19, &x.minRTO)
+ m.Load(20, &x.maxRTO)
+ m.Load(21, &x.maxRetries)
+ m.Load(22, &x.maxPayloadSize)
+ m.Load(23, &x.gso)
+ m.Load(24, &x.sndWndScale)
+ m.Load(25, &x.maxSentAck)
+ m.Load(26, &x.state)
+ m.Load(27, &x.cc)
+ m.LoadValue(1, new(unixTime), func(y interface{}) { x.loadLastSendTime(y.(unixTime)) })
+ m.LoadValue(12, new(unixTime), func(y interface{}) { x.loadRttMeasureTime(y.(unixTime)) })
+ m.LoadValue(13, new(unixTime), func(y interface{}) { x.loadFirstRetransmittedSegXmitTime(y.(unixTime)) })
m.AfterLoad(x.afterLoad)
}
+func (x *rtt) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.rtt"
+}
+
+func (x *rtt) StateFields() []string {
+ return []string{
+ "srtt",
+ "rttvar",
+ "srttInited",
+ }
+}
+
func (x *rtt) beforeSave() {}
-func (x *rtt) save(m state.Map) {
+
+func (x *rtt) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("srtt", &x.srtt)
- m.Save("rttvar", &x.rttvar)
- m.Save("srttInited", &x.srttInited)
+ m.Save(0, &x.srtt)
+ m.Save(1, &x.rttvar)
+ m.Save(2, &x.srttInited)
}
func (x *rtt) afterLoad() {}
-func (x *rtt) load(m state.Map) {
- m.Load("srtt", &x.srtt)
- m.Load("rttvar", &x.rttvar)
- m.Load("srttInited", &x.srttInited)
+
+func (x *rtt) StateLoad(m state.Source) {
+ m.Load(0, &x.srtt)
+ m.Load(1, &x.rttvar)
+ m.Load(2, &x.srttInited)
+}
+
+func (x *fastRecovery) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.fastRecovery"
+}
+
+func (x *fastRecovery) StateFields() []string {
+ return []string{
+ "active",
+ "first",
+ "last",
+ "maxCwnd",
+ "highRxt",
+ "rescueRxt",
+ }
}
func (x *fastRecovery) beforeSave() {}
-func (x *fastRecovery) save(m state.Map) {
+
+func (x *fastRecovery) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("active", &x.active)
- m.Save("first", &x.first)
- m.Save("last", &x.last)
- m.Save("maxCwnd", &x.maxCwnd)
- m.Save("highRxt", &x.highRxt)
- m.Save("rescueRxt", &x.rescueRxt)
+ m.Save(0, &x.active)
+ m.Save(1, &x.first)
+ m.Save(2, &x.last)
+ m.Save(3, &x.maxCwnd)
+ m.Save(4, &x.highRxt)
+ m.Save(5, &x.rescueRxt)
}
func (x *fastRecovery) afterLoad() {}
-func (x *fastRecovery) load(m state.Map) {
- m.Load("active", &x.active)
- m.Load("first", &x.first)
- m.Load("last", &x.last)
- m.Load("maxCwnd", &x.maxCwnd)
- m.Load("highRxt", &x.highRxt)
- m.Load("rescueRxt", &x.rescueRxt)
+
+func (x *fastRecovery) StateLoad(m state.Source) {
+ m.Load(0, &x.active)
+ m.Load(1, &x.first)
+ m.Load(2, &x.last)
+ m.Load(3, &x.maxCwnd)
+ m.Load(4, &x.highRxt)
+ m.Load(5, &x.rescueRxt)
+}
+
+func (x *unixTime) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.unixTime"
+}
+
+func (x *unixTime) StateFields() []string {
+ return []string{
+ "second",
+ "nano",
+ }
}
func (x *unixTime) beforeSave() {}
-func (x *unixTime) save(m state.Map) {
+
+func (x *unixTime) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("second", &x.second)
- m.Save("nano", &x.nano)
+ m.Save(0, &x.second)
+ m.Save(1, &x.nano)
}
func (x *unixTime) afterLoad() {}
-func (x *unixTime) load(m state.Map) {
- m.Load("second", &x.second)
- m.Load("nano", &x.nano)
+
+func (x *unixTime) StateLoad(m state.Source) {
+ m.Load(0, &x.second)
+ m.Load(1, &x.nano)
+}
+
+func (x *endpointList) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.endpointList"
+}
+
+func (x *endpointList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
}
func (x *endpointList) beforeSave() {}
-func (x *endpointList) save(m state.Map) {
+
+func (x *endpointList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *endpointList) afterLoad() {}
-func (x *endpointList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *endpointList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *endpointEntry) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.endpointEntry"
+}
+
+func (x *endpointEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *endpointEntry) beforeSave() {}
-func (x *endpointEntry) save(m state.Map) {
+
+func (x *endpointEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *endpointEntry) afterLoad() {}
-func (x *endpointEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *endpointEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
+}
+
+func (x *segmentList) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.segmentList"
+}
+
+func (x *segmentList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
}
func (x *segmentList) beforeSave() {}
-func (x *segmentList) save(m state.Map) {
+
+func (x *segmentList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *segmentList) afterLoad() {}
-func (x *segmentList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *segmentList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *segmentEntry) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.segmentEntry"
+}
+
+func (x *segmentEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *segmentEntry) beforeSave() {}
-func (x *segmentEntry) save(m state.Map) {
+
+func (x *segmentEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *segmentEntry) afterLoad() {}
-func (x *segmentEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *segmentEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/tcpip/transport/tcp.cubicState", (*cubicState)(nil), state.Fns{Save: (*cubicState).save, Load: (*cubicState).load})
- state.Register("pkg/tcpip/transport/tcp.SACKInfo", (*SACKInfo)(nil), state.Fns{Save: (*SACKInfo).save, Load: (*SACKInfo).load})
- state.Register("pkg/tcpip/transport/tcp.rcvBufAutoTuneParams", (*rcvBufAutoTuneParams)(nil), state.Fns{Save: (*rcvBufAutoTuneParams).save, Load: (*rcvBufAutoTuneParams).load})
- state.Register("pkg/tcpip/transport/tcp.EndpointInfo", (*EndpointInfo)(nil), state.Fns{Save: (*EndpointInfo).save, Load: (*EndpointInfo).load})
- state.Register("pkg/tcpip/transport/tcp.endpoint", (*endpoint)(nil), state.Fns{Save: (*endpoint).save, Load: (*endpoint).load})
- state.Register("pkg/tcpip/transport/tcp.keepalive", (*keepalive)(nil), state.Fns{Save: (*keepalive).save, Load: (*keepalive).load})
- state.Register("pkg/tcpip/transport/tcp.receiver", (*receiver)(nil), state.Fns{Save: (*receiver).save, Load: (*receiver).load})
- state.Register("pkg/tcpip/transport/tcp.renoState", (*renoState)(nil), state.Fns{Save: (*renoState).save, Load: (*renoState).load})
- state.Register("pkg/tcpip/transport/tcp.SACKScoreboard", (*SACKScoreboard)(nil), state.Fns{Save: (*SACKScoreboard).save, Load: (*SACKScoreboard).load})
- state.Register("pkg/tcpip/transport/tcp.segment", (*segment)(nil), state.Fns{Save: (*segment).save, Load: (*segment).load})
- state.Register("pkg/tcpip/transport/tcp.segmentQueue", (*segmentQueue)(nil), state.Fns{Save: (*segmentQueue).save, Load: (*segmentQueue).load})
- state.Register("pkg/tcpip/transport/tcp.sender", (*sender)(nil), state.Fns{Save: (*sender).save, Load: (*sender).load})
- state.Register("pkg/tcpip/transport/tcp.rtt", (*rtt)(nil), state.Fns{Save: (*rtt).save, Load: (*rtt).load})
- state.Register("pkg/tcpip/transport/tcp.fastRecovery", (*fastRecovery)(nil), state.Fns{Save: (*fastRecovery).save, Load: (*fastRecovery).load})
- state.Register("pkg/tcpip/transport/tcp.unixTime", (*unixTime)(nil), state.Fns{Save: (*unixTime).save, Load: (*unixTime).load})
- state.Register("pkg/tcpip/transport/tcp.endpointList", (*endpointList)(nil), state.Fns{Save: (*endpointList).save, Load: (*endpointList).load})
- state.Register("pkg/tcpip/transport/tcp.endpointEntry", (*endpointEntry)(nil), state.Fns{Save: (*endpointEntry).save, Load: (*endpointEntry).load})
- state.Register("pkg/tcpip/transport/tcp.segmentList", (*segmentList)(nil), state.Fns{Save: (*segmentList).save, Load: (*segmentList).load})
- state.Register("pkg/tcpip/transport/tcp.segmentEntry", (*segmentEntry)(nil), state.Fns{Save: (*segmentEntry).save, Load: (*segmentEntry).load})
+ state.Register((*cubicState)(nil))
+ state.Register((*SACKInfo)(nil))
+ state.Register((*rcvBufAutoTuneParams)(nil))
+ state.Register((*EndpointInfo)(nil))
+ state.Register((*endpoint)(nil))
+ state.Register((*keepalive)(nil))
+ state.Register((*receiver)(nil))
+ state.Register((*renoState)(nil))
+ state.Register((*SACKScoreboard)(nil))
+ state.Register((*segment)(nil))
+ state.Register((*segmentQueue)(nil))
+ state.Register((*sender)(nil))
+ state.Register((*rtt)(nil))
+ state.Register((*fastRecovery)(nil))
+ state.Register((*unixTime)(nil))
+ state.Register((*endpointList)(nil))
+ state.Register((*endpointEntry)(nil))
+ state.Register((*segmentList)(nil))
+ state.Register((*segmentEntry)(nil))
}
diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go
index a6513e1e4..5436b9de1 100644
--- a/pkg/tcpip/transport/udp/udp_packet_list.go
+++ b/pkg/tcpip/transport/udp/udp_packet_list.go
@@ -56,7 +56,7 @@ func (l *udpPacketList) Back() *udpPacket {
//
// NOTE: This is an O(n) operation.
func (l *udpPacketList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (udpPacketElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *udpPacketList) Remove(e *udpPacket) {
if prev != nil {
udpPacketElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
udpPacketElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/tcpip/transport/udp/udp_state_autogen.go b/pkg/tcpip/transport/udp/udp_state_autogen.go
index 0dba38a58..943022c38 100644
--- a/pkg/tcpip/transport/udp/udp_state_autogen.go
+++ b/pkg/tcpip/transport/udp/udp_state_autogen.go
@@ -7,145 +7,242 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/buffer"
)
+func (x *udpPacket) StateTypeName() string {
+ return "pkg/tcpip/transport/udp.udpPacket"
+}
+
+func (x *udpPacket) StateFields() []string {
+ return []string{
+ "udpPacketEntry",
+ "senderAddress",
+ "packetInfo",
+ "data",
+ "timestamp",
+ "tos",
+ }
+}
+
func (x *udpPacket) beforeSave() {}
-func (x *udpPacket) save(m state.Map) {
+
+func (x *udpPacket) StateSave(m state.Sink) {
x.beforeSave()
var data buffer.VectorisedView = x.saveData()
- m.SaveValue("data", data)
- m.Save("udpPacketEntry", &x.udpPacketEntry)
- m.Save("senderAddress", &x.senderAddress)
- m.Save("packetInfo", &x.packetInfo)
- m.Save("timestamp", &x.timestamp)
- m.Save("tos", &x.tos)
+ m.SaveValue(3, data)
+ m.Save(0, &x.udpPacketEntry)
+ m.Save(1, &x.senderAddress)
+ m.Save(2, &x.packetInfo)
+ m.Save(4, &x.timestamp)
+ m.Save(5, &x.tos)
}
func (x *udpPacket) afterLoad() {}
-func (x *udpPacket) load(m state.Map) {
- m.Load("udpPacketEntry", &x.udpPacketEntry)
- m.Load("senderAddress", &x.senderAddress)
- m.Load("packetInfo", &x.packetInfo)
- m.Load("timestamp", &x.timestamp)
- m.Load("tos", &x.tos)
- m.LoadValue("data", new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
+
+func (x *udpPacket) StateLoad(m state.Source) {
+ m.Load(0, &x.udpPacketEntry)
+ m.Load(1, &x.senderAddress)
+ m.Load(2, &x.packetInfo)
+ m.Load(4, &x.timestamp)
+ m.Load(5, &x.tos)
+ m.LoadValue(3, new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
+}
+
+func (x *endpoint) StateTypeName() string {
+ return "pkg/tcpip/transport/udp.endpoint"
}
-func (x *endpoint) save(m state.Map) {
+func (x *endpoint) StateFields() []string {
+ return []string{
+ "TransportEndpointInfo",
+ "waiterQueue",
+ "uniqueID",
+ "rcvReady",
+ "rcvList",
+ "rcvBufSizeMax",
+ "rcvBufSize",
+ "rcvClosed",
+ "sndBufSize",
+ "sndBufSizeMax",
+ "state",
+ "dstPort",
+ "v6only",
+ "ttl",
+ "multicastTTL",
+ "multicastAddr",
+ "multicastNICID",
+ "multicastLoop",
+ "portFlags",
+ "bindToDevice",
+ "broadcast",
+ "lastError",
+ "boundBindToDevice",
+ "boundPortFlags",
+ "sendTOS",
+ "receiveTOS",
+ "receiveTClass",
+ "receiveIPPacketInfo",
+ "shutdownFlags",
+ "multicastMemberships",
+ "effectiveNetProtos",
+ "owner",
+ }
+}
+
+func (x *endpoint) StateSave(m state.Sink) {
x.beforeSave()
var rcvBufSizeMax int = x.saveRcvBufSizeMax()
- m.SaveValue("rcvBufSizeMax", rcvBufSizeMax)
+ m.SaveValue(5, rcvBufSizeMax)
var lastError string = x.saveLastError()
- m.SaveValue("lastError", lastError)
- m.Save("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Save("waiterQueue", &x.waiterQueue)
- m.Save("uniqueID", &x.uniqueID)
- m.Save("rcvReady", &x.rcvReady)
- m.Save("rcvList", &x.rcvList)
- m.Save("rcvBufSize", &x.rcvBufSize)
- m.Save("rcvClosed", &x.rcvClosed)
- m.Save("sndBufSize", &x.sndBufSize)
- m.Save("sndBufSizeMax", &x.sndBufSizeMax)
- m.Save("state", &x.state)
- m.Save("dstPort", &x.dstPort)
- m.Save("v6only", &x.v6only)
- m.Save("ttl", &x.ttl)
- m.Save("multicastTTL", &x.multicastTTL)
- m.Save("multicastAddr", &x.multicastAddr)
- m.Save("multicastNICID", &x.multicastNICID)
- m.Save("multicastLoop", &x.multicastLoop)
- m.Save("portFlags", &x.portFlags)
- m.Save("bindToDevice", &x.bindToDevice)
- m.Save("broadcast", &x.broadcast)
- m.Save("boundBindToDevice", &x.boundBindToDevice)
- m.Save("boundPortFlags", &x.boundPortFlags)
- m.Save("sendTOS", &x.sendTOS)
- m.Save("receiveTOS", &x.receiveTOS)
- m.Save("receiveTClass", &x.receiveTClass)
- m.Save("receiveIPPacketInfo", &x.receiveIPPacketInfo)
- m.Save("shutdownFlags", &x.shutdownFlags)
- m.Save("multicastMemberships", &x.multicastMemberships)
- m.Save("effectiveNetProtos", &x.effectiveNetProtos)
- m.Save("owner", &x.owner)
-}
-
-func (x *endpoint) load(m state.Map) {
- m.Load("TransportEndpointInfo", &x.TransportEndpointInfo)
- m.Load("waiterQueue", &x.waiterQueue)
- m.Load("uniqueID", &x.uniqueID)
- m.Load("rcvReady", &x.rcvReady)
- m.Load("rcvList", &x.rcvList)
- m.Load("rcvBufSize", &x.rcvBufSize)
- m.Load("rcvClosed", &x.rcvClosed)
- m.Load("sndBufSize", &x.sndBufSize)
- m.Load("sndBufSizeMax", &x.sndBufSizeMax)
- m.Load("state", &x.state)
- m.Load("dstPort", &x.dstPort)
- m.Load("v6only", &x.v6only)
- m.Load("ttl", &x.ttl)
- m.Load("multicastTTL", &x.multicastTTL)
- m.Load("multicastAddr", &x.multicastAddr)
- m.Load("multicastNICID", &x.multicastNICID)
- m.Load("multicastLoop", &x.multicastLoop)
- m.Load("portFlags", &x.portFlags)
- m.Load("bindToDevice", &x.bindToDevice)
- m.Load("broadcast", &x.broadcast)
- m.Load("boundBindToDevice", &x.boundBindToDevice)
- m.Load("boundPortFlags", &x.boundPortFlags)
- m.Load("sendTOS", &x.sendTOS)
- m.Load("receiveTOS", &x.receiveTOS)
- m.Load("receiveTClass", &x.receiveTClass)
- m.Load("receiveIPPacketInfo", &x.receiveIPPacketInfo)
- m.Load("shutdownFlags", &x.shutdownFlags)
- m.Load("multicastMemberships", &x.multicastMemberships)
- m.Load("effectiveNetProtos", &x.effectiveNetProtos)
- m.Load("owner", &x.owner)
- m.LoadValue("rcvBufSizeMax", new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
- m.LoadValue("lastError", new(string), func(y interface{}) { x.loadLastError(y.(string)) })
+ m.SaveValue(21, lastError)
+ m.Save(0, &x.TransportEndpointInfo)
+ m.Save(1, &x.waiterQueue)
+ m.Save(2, &x.uniqueID)
+ m.Save(3, &x.rcvReady)
+ m.Save(4, &x.rcvList)
+ m.Save(6, &x.rcvBufSize)
+ m.Save(7, &x.rcvClosed)
+ m.Save(8, &x.sndBufSize)
+ m.Save(9, &x.sndBufSizeMax)
+ m.Save(10, &x.state)
+ m.Save(11, &x.dstPort)
+ m.Save(12, &x.v6only)
+ m.Save(13, &x.ttl)
+ m.Save(14, &x.multicastTTL)
+ m.Save(15, &x.multicastAddr)
+ m.Save(16, &x.multicastNICID)
+ m.Save(17, &x.multicastLoop)
+ m.Save(18, &x.portFlags)
+ m.Save(19, &x.bindToDevice)
+ m.Save(20, &x.broadcast)
+ m.Save(22, &x.boundBindToDevice)
+ m.Save(23, &x.boundPortFlags)
+ m.Save(24, &x.sendTOS)
+ m.Save(25, &x.receiveTOS)
+ m.Save(26, &x.receiveTClass)
+ m.Save(27, &x.receiveIPPacketInfo)
+ m.Save(28, &x.shutdownFlags)
+ m.Save(29, &x.multicastMemberships)
+ m.Save(30, &x.effectiveNetProtos)
+ m.Save(31, &x.owner)
+}
+
+func (x *endpoint) StateLoad(m state.Source) {
+ m.Load(0, &x.TransportEndpointInfo)
+ m.Load(1, &x.waiterQueue)
+ m.Load(2, &x.uniqueID)
+ m.Load(3, &x.rcvReady)
+ m.Load(4, &x.rcvList)
+ m.Load(6, &x.rcvBufSize)
+ m.Load(7, &x.rcvClosed)
+ m.Load(8, &x.sndBufSize)
+ m.Load(9, &x.sndBufSizeMax)
+ m.Load(10, &x.state)
+ m.Load(11, &x.dstPort)
+ m.Load(12, &x.v6only)
+ m.Load(13, &x.ttl)
+ m.Load(14, &x.multicastTTL)
+ m.Load(15, &x.multicastAddr)
+ m.Load(16, &x.multicastNICID)
+ m.Load(17, &x.multicastLoop)
+ m.Load(18, &x.portFlags)
+ m.Load(19, &x.bindToDevice)
+ m.Load(20, &x.broadcast)
+ m.Load(22, &x.boundBindToDevice)
+ m.Load(23, &x.boundPortFlags)
+ m.Load(24, &x.sendTOS)
+ m.Load(25, &x.receiveTOS)
+ m.Load(26, &x.receiveTClass)
+ m.Load(27, &x.receiveIPPacketInfo)
+ m.Load(28, &x.shutdownFlags)
+ m.Load(29, &x.multicastMemberships)
+ m.Load(30, &x.effectiveNetProtos)
+ m.Load(31, &x.owner)
+ m.LoadValue(5, new(int), func(y interface{}) { x.loadRcvBufSizeMax(y.(int)) })
+ m.LoadValue(21, new(string), func(y interface{}) { x.loadLastError(y.(string)) })
m.AfterLoad(x.afterLoad)
}
+func (x *multicastMembership) StateTypeName() string {
+ return "pkg/tcpip/transport/udp.multicastMembership"
+}
+
+func (x *multicastMembership) StateFields() []string {
+ return []string{
+ "nicID",
+ "multicastAddr",
+ }
+}
+
func (x *multicastMembership) beforeSave() {}
-func (x *multicastMembership) save(m state.Map) {
+
+func (x *multicastMembership) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("nicID", &x.nicID)
- m.Save("multicastAddr", &x.multicastAddr)
+ m.Save(0, &x.nicID)
+ m.Save(1, &x.multicastAddr)
}
func (x *multicastMembership) afterLoad() {}
-func (x *multicastMembership) load(m state.Map) {
- m.Load("nicID", &x.nicID)
- m.Load("multicastAddr", &x.multicastAddr)
+
+func (x *multicastMembership) StateLoad(m state.Source) {
+ m.Load(0, &x.nicID)
+ m.Load(1, &x.multicastAddr)
+}
+
+func (x *udpPacketList) StateTypeName() string {
+ return "pkg/tcpip/transport/udp.udpPacketList"
+}
+
+func (x *udpPacketList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
}
func (x *udpPacketList) beforeSave() {}
-func (x *udpPacketList) save(m state.Map) {
+
+func (x *udpPacketList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *udpPacketList) afterLoad() {}
-func (x *udpPacketList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *udpPacketList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *udpPacketEntry) StateTypeName() string {
+ return "pkg/tcpip/transport/udp.udpPacketEntry"
+}
+
+func (x *udpPacketEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *udpPacketEntry) beforeSave() {}
-func (x *udpPacketEntry) save(m state.Map) {
+
+func (x *udpPacketEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *udpPacketEntry) afterLoad() {}
-func (x *udpPacketEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *udpPacketEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/tcpip/transport/udp.udpPacket", (*udpPacket)(nil), state.Fns{Save: (*udpPacket).save, Load: (*udpPacket).load})
- state.Register("pkg/tcpip/transport/udp.endpoint", (*endpoint)(nil), state.Fns{Save: (*endpoint).save, Load: (*endpoint).load})
- state.Register("pkg/tcpip/transport/udp.multicastMembership", (*multicastMembership)(nil), state.Fns{Save: (*multicastMembership).save, Load: (*multicastMembership).load})
- state.Register("pkg/tcpip/transport/udp.udpPacketList", (*udpPacketList)(nil), state.Fns{Save: (*udpPacketList).save, Load: (*udpPacketList).load})
- state.Register("pkg/tcpip/transport/udp.udpPacketEntry", (*udpPacketEntry)(nil), state.Fns{Save: (*udpPacketEntry).save, Load: (*udpPacketEntry).load})
+ state.Register((*udpPacket)(nil))
+ state.Register((*endpoint)(nil))
+ state.Register((*multicastMembership)(nil))
+ state.Register((*udpPacketList)(nil))
+ state.Register((*udpPacketEntry)(nil))
}