Skip to content

fix: correct inverted error check in getTunnelName#2659

Merged
wwqgtxx merged 1 commit into
MetaCubeX:Alphafrom
0xZOne:fix/inverted-getTunnelName-error-check
Mar 31, 2026
Merged

fix: correct inverted error check in getTunnelName#2659
wwqgtxx merged 1 commit into
MetaCubeX:Alphafrom
0xZOne:fix/inverted-getTunnelName-error-check

Conversation

@0xZOne

@0xZOne 0xZOne commented Mar 31, 2026

Copy link
Copy Markdown

Summary

  • Fix inverted error condition (err != nilerr == nil) in listener/sing_tun/server.go:158
  • The current code assigns tunName from getTunnelName only when the call fails, discarding the correct tunnel name on success
  • This causes incorrect forwarderBindInterface behavior when FileDescriptor > 0 (Android/iOS scenarios)

Change

- if tunnelName, err := getTunnelName(int32(options.FileDescriptor)); err != nil {
+ if tunnelName, err := getTunnelName(int32(options.FileDescriptor)); err == nil {

Test plan

  • Verify TUN mode works correctly on Android/iOS where FileDescriptor > 0
  • Verify tunName is correctly set from the fd-based interface name
  • Verify forwarderBindInterface is true only when getTunnelName succeeds

Fixes #2658

🤖 Generated with Claude Code

The condition `err != nil` should be `err == nil`. The current code
assigns tunName from getTunnelName only when the call fails, discarding
the correct tunnel name on success. This causes incorrect
forwarderBindInterface behavior when FileDescriptor > 0.

Fixes MetaCubeX#2658

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wwqgtxx wwqgtxx merged commit f82a365 into MetaCubeX:Alpha Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants