Repository navigation
WireGuard kernelTun: Fix IPv6 table index allocation when the first table is occupied - #6881
Merged
Merged
Conversation
Refactor IPv6 table index allocation to use atomic operations and remove mutex locking.
Member
|
我知道了 这个向下search是最早加的 用以控制多个出站的场景 因为你找的这个bug导致search实际是失效的 多余一个wireguard出站就会坏掉 早年的时候接到这个issue我没看到下面代码以为是硬编码才写了个递增alloc然后放弃多instance场景了 如果这里有搜索的话就拿起来用上吧 |
Refactor loop to find available IPv6 table index, preventing infinite loop by checking table index limit.
Fangliding
approved these changes
Oct 2, 2026
patterniha
pushed a commit
to patterniha/Xray-core
that referenced
this pull request
Oct 3, 2026
…able is occupied Early merge of XTLS#6881 (PR head ea728a4), squashed, ahead of it landing upstream: XTLS#6881 Co-authored-by: 风扇滑翔翼 <[email protected]>
Member
|
@Hacinsl 修一下 fmt |
olivezane
added a commit
to olivezane/Xray-core-ai
that referenced
this pull request
Oct 6, 2026
7 upstream commits: WireGuard kernelTun IPv6 table index fix (XTLS#6881), WireGuard idle-flow memory and ICMP pong (XTLS#6856, XTLS#6855), QUIC sniffer zero-filled tails (XTLS#6882), XDNS resolver deadlock (XTLS#7089), gRPC redial context (XTLS#6877), scenario test process leaks (XTLS#6863). Conflict in proxy/wireguard/tun_linux.go: took upstream's loop guard while keeping the local errors.New lint fix.
fanymagnet
pushed a commit
to fanymagnet/Xray-core
that referenced
this pull request
Oct 8, 2026
…able is occupied (XTLS#6881) XTLS#6881 (comment) --------- Co-authored-by: 风扇滑翔翼 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Linux 下使用 kernel TUN(默认模式)且配置包含 IPv6 地址时,启动可能失败:
Failed to initialize: main: failed to create server > failed to find available ipv6 table index原因
在
proxy/wireguard/tun_linux.go挑选空闲 IPv6 路由表的循环里,过滤器r只在循环外构造一次:netlink.RouteListFiltered是按r.Table做过滤的,而循环里只递减了ipv6TableIndex,从未把新值写回r.Table,因此每次迭代查询的始终是同一张表。由于
tableIndex是包级变量、每个进程都从10230开始,10230被占用(最常见的可能性是已有Xray实例运行,同时启动新实例检查配置)会导致启动/配置检查失败。修复
allocateIPv6TableIndex改为返回(int, error),为表号空间加入上界(65535);行为变化
若预设的10230被占用,会向上搜索可用表号直到65535,原设计意图可能是向下搜寻,但区别不大。