Skip to content

Commit

Permalink
POC
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 616900703
  • Loading branch information
nybidari authored and gvisor-bot committed Apr 4, 2024
1 parent 5b30c4a commit 14d3292
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/sentry/inet/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Namespace struct {
inode *nsfs.Inode

// stack is the network stack implementation of this network namespace.
stack Stack `state:"nosave"`
stack Stack

// creator allows kernel to create new network stack for network namespaces.
// If nil, no networking will function if network is namespaced.
Expand Down
12 changes: 11 additions & 1 deletion pkg/sentry/kernel/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,17 @@ func (k *Kernel) LoadFrom(ctx context.Context, r wire.Reader, timeReady chan str

// rootNetworkNamespace should be populated after loading the state file.
// Restore the root network stack.
k.rootNetworkNamespace.RestoreRootStack(net)
//k.rootNetworkNamespace.RestoreRootStack(net)

log.Infof("Saved Network stack: %+v", k.rootNetworkNamespace.Stack())
log.Infof("Network stack: %+v", net)

if k.rootNetworkNamespace.Stack() != nil {
log.Infof("Saved Network stack: %+v", k.rootNetworkNamespace.Stack().Interfaces())
log.Infof("Network stack: %+v", net.Interfaces())
} else {
log.Infof("Network stack is nil")
}

// Load the memory files' state.
memoryStart := time.Now()
Expand Down
2 changes: 2 additions & 0 deletions pkg/tcpip/stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ var netRawMissingLogger = log.BasicRateLimitedLogger(time.Minute)
// table.
//
// LOCK ORDERING: mu > routeMu.
//
// +stateify savable
type Stack struct {
transportProtocols map[tcpip.TransportProtocolNumber]*transportProtocolState
networkProtocols map[tcpip.NetworkProtocolNumber]NetworkProtocol
Expand Down

0 comments on commit 14d3292

Please sign in to comment.