Skip to content

Commit d5f1770

Browse files
committed
all: rmv fatal test
1 parent 07836af commit d5f1770

4 files changed

Lines changed: 5 additions & 14 deletions

File tree

intra/netstack/forwarders.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ import (
4444

4545
const maxForwarders = 8
4646

47+
// disable log.wtf driven exit (it did not work the last time it was tested)
48+
const testwtf = false
49+
4750
type fiveTuple struct {
4851
srcAddr, dstAddr []byte
4952
srcPort, dstPort uint16
@@ -164,7 +167,7 @@ func (p *processor) start(wg *sync.WaitGroup) {
164167
func (p *processor) deliverPackets() {
165168
testpanic := !p.testcrash && settings.PanicAtRandom.Load() && rand10pc()
166169
if testpanic {
167-
defer core.Recover(core.DontExit, "ns.forwarder.deliverPackets")
170+
defer core.Recover(core.Exit11, "ns.forwarder.deliverPackets")
168171
}
169172

170173
p.mu.Lock()
@@ -183,7 +186,7 @@ func (p *processor) deliverPackets() {
183186

184187
if testpanic {
185188
panic("ns: tun: forwarder: deliverPackets rand10pc")
186-
} else if !p.testcrash && settings.FatalAtRandom.Load() && rand1pc() {
189+
} else if testwtf && !p.testcrash && settings.PanicAtRandom.Load() && rand1pc() {
187190
p.testcrash = true
188191
core.RuntimeWtf("ns: tun: forwarder: test fatal\n")
189192
var mu sync.Mutex

intra/settings/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,5 @@ const IntraUa = "Intra"
7474
// every once in a while (for testing).
7575
var PanicAtRandom = atomic.Bool{}
7676

77-
// FatalAtRandom is a global flag to fatally crash the network engine
78-
// every once in a while (for testing).
79-
var FatalAtRandom = atomic.Bool{}
80-
8177
// OwnTunFd is a global flag to indicate that the TUN fd is fully owned by netstack.
8278
var OwnTunFd = atomic.Bool{}

intra/tun2socks.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,6 @@ func PanicAtRandom(y bool) {
254254
log.I("tun: panic at random? %t", y)
255255
}
256256

257-
// FatalAtRandom instructs portions under test to fatally crash the network engine.
258-
// For testing only.
259-
func FatalAtRandom(y bool) {
260-
settings.FatalAtRandom.Store(y)
261-
log.I("tun: fatal at random? %t", y)
262-
}
263-
264257
func pipeCrashOutput(bdg Bridge) (ok bool) {
265258
r, w, err := os.Pipe()
266259
if err != nil {

intra/tunnel.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ func (t *rtunnel) stat() (*x.NetStat, error) {
490490
out.RDNSIn.PortForward = settings.PortForward.Load()
491491
out.RDNSIn.Transparency = settings.EndpointIndependentFiltering.Load()
492492
out.RDNSIn.PanicTest = settings.PanicAtRandom.Load()
493-
out.RDNSIn.FatalTest = settings.FatalAtRandom.Load()
494493
out.RDNSIn.SetUserAgent = settings.SetUserAgent.Load()
495494
out.RDNSIn.SystemDNSForUndelegated = settings.SystemDNSForUndelegatedDomains.Load()
496495
out.RDNSIn.DefaultDNSAsFallback = settings.DefaultDNSAsFallback.Load()

0 commit comments

Comments
 (0)