Skip to content

Commit c0a54e9

Browse files
nybidarigvisor-bot
authored andcommitted
Update iptables and nftables before restoring nics in netstack.
PiperOrigin-RevId: 802725954
1 parent b3f689c commit c0a54e9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/tcpip/stack/stack.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,10 +2038,16 @@ func (s *Stack) ReplaceConfig(st *Stack) {
20382038
// Update route table.
20392039
s.SetRouteTable(st.GetRouteTable())
20402040

2041-
// Update NICs.
20422041
nics := st.getNICs()
2042+
20432043
s.mu.Lock()
20442044
defer s.mu.Unlock()
2045+
2046+
// Update iptables and nftables.
2047+
s.tables = st.IPTables()
2048+
s.nftables = st.NFTables()
2049+
2050+
// Update NICs.
20452051
s.nics = make(map[tcpip.NICID]*nic)
20462052
s.loopbackNIC = nil
20472053
for id, nic := range nics {
@@ -2052,8 +2058,6 @@ func (s *Stack) ReplaceConfig(st *Stack) {
20522058
}
20532059
_ = s.NextNICID()
20542060
}
2055-
s.tables = st.tables
2056-
s.nftables = st.nftables
20572061
}
20582062

20592063
// Restore restarts the stack after a restore. This must be called after the

0 commit comments

Comments
 (0)