MCPcopy Index your code
hub / github.com/google/gvisor / ReplaceConfig

Method ReplaceConfig

pkg/tcpip/stack/stack.go:2090–2120  ·  view source on GitHub ↗

ReplaceConfig replaces config in the loaded stack.

(st *Stack)

Source from the content-addressed store, hash-verified

2088
2089// ReplaceConfig replaces config in the loaded stack.
2090func (s *Stack) ReplaceConfig(st *Stack) {
2091 if st == nil {
2092 panic("stack.Stack cannot be nil when netstack s/r is enabled")
2093 }
2094
2095 // Update route table.
2096 s.SetRouteTable(st.GetRouteTable())
2097
2098 nics := st.getNICs()
2099
2100 s.mu.Lock()
2101 defer s.mu.Unlock()
2102
2103 // Update iptables and nftables.
2104 s.tables = st.IPTables()
2105 s.nftables = st.NFTables()
2106
2107 // Update NICs.
2108 s.nics = make(map[tcpip.NICID]*nic)
2109 s.loopbackNIC = nil
2110 for id, nic := range nics {
2111 nic.stack = s
2112 s.nics[id] = nic
2113 if nic.IsLoopback() {
2114 s.loopbackNIC = nic
2115 } else if s.externalNetworkingDisabled {
2116 nic.disable()
2117 }
2118 _ = s.NextNICID()
2119 }
2120}
2121
2122// Restore restarts the stack after a restore. This must be called after the
2123// entire system has been restored.

Callers

nothing calls this directly

Calls 10

SetRouteTableMethod · 0.95
NextNICIDMethod · 0.95
GetRouteTableMethod · 0.80
getNICsMethod · 0.80
NFTablesMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
IsLoopbackMethod · 0.65
disableMethod · 0.65
IPTablesMethod · 0.45

Tested by

no test coverage detected