[v1.14.0]: panic: runtime error: invalid memory address or nil pointer dereference in protocol/direct.(*Outbound).fetchMyAddresses on FreeBSD
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 38.1k
- Forks
- 4.6k
- Avg merge
- 19d 15h
- Merged PRs (30d)
- 1
Description
Operating system
Others
System version
FreeBSD v14.4
Installation type
Original sing-box Command Line
Description
sing-box crashes on startup with a SIGSEGV / nil pointer dereference on FreeBSD 14.4 when initializing the direct outbound.
In sing-box v1.14.0, fetchMyAddresses() was introduced into direct.Outbound.Start(). On FreeBSD, the interface monitoring subsystem is unsupported/stubbed, causing h.router.InterfaceMonitor() (or the default interface lookup) to return nil. Attempting to query addresses on a nil reference results in a crash.
Nearly the same configuration works as expected on FreeBSD 14.4 under v1.13.x.
Logs
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x10669f0]
goroutine 1 [running]:
github.com/sagernet/sing-box/protocol/direct.(*Outbound).fetchMyAddresses(0x87405c300)
github.com/sagernet/sing-box/protocol/direct/outbound.go:102 +0x30
github.com/sagernet/sing-box/protocol/direct.(*Outbound).Start(0x30c4cf0?, 0xa0?)
github.com/sagernet/sing-box/protocol/direct/outbound.go:95 +0x37
github.com/sagernet/sing-box/adapter.LegacyStart({0x1cd5ea0?, 0x87405c300}, 0x2?)
github.com/sagernet/sing-box/adapter/lifecycle_legacy.go:5 +0xa9
github.com/sagernet/sing-box/adapter/outbound.(*Manager).Start(0x8741a8000, 0x2)
github.com/sagernet/sing-box/adapter/outbound/manager.go:86 +0x39d
github.com/sagernet/sing-box/adapter.Start({0x1eafcd0, 0x86ff52370}, {0x1ed3ad8, 0x874239e48}, 0x2, {0x86fded290?, 0xb, 0x0?})
github.com/sagernet/sing-box/adapter/lifecycle.go:86 +0x1a8
github.com/sagernet/sing-box.(*Box).start(0x8741aa3c0)
github.com/sagernet/sing-box/box.go:623 +0x37d
github.com/sagernet/sing-box.(*Box).Start(0x8741aa3c0)
github.com/sagernet/sing-box/box.go:548 +0x36
main.create({{0x874226000, 0x3a17, 0x4000}, 0x0, {0x0, 0x0}, 0x874266210, 0x8741a3b20, 0x0, 0x0, ...})
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:164 +0x4a9
main.run()
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:190 +0x293
main.init.func86(0x8741eae00?, {0x1d6b9ec?, 0x4?, 0x1d6b9f0?})
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:30 +0x17
github.com/spf13/cobra.(*Command).execute(0x3101920, {0x8741804c0, 0x2, 0x2})
github.com/spf13/cobra@v1.10.2/command.go:1019 +0xafb
github.com/spf13/cobra.(*Command).ExecuteC(0x30f27a0)
github.com/spf13/cobra@v1.10.2/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.10.2/command.go:1071
main.main()
github.com/sagernet/sing-box/cmd/sing-box/main.go:8 +0x1e
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in protocol/direct/outbound.go, especially Outbound.Start and fetchMyAddresses around lines 95-102. Trace how InterfaceMonitor or the default interface lookup behaves on FreeBSD 14.4. Done means sing-box no longer panics during direct outbound startup when that subsystem is unavailable, while preserving the existing behavior on supported systems.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100