mihomo icon indicating copy to clipboard operation
mihomo copied to clipboard

[Bug] tun模式下auto-route为false时仍会添加ipv6路由和规则

Open Yuanandcircle opened this issue 1 year ago • 2 comments

Verify steps

  • [X] I have read the documentation and understand the meaning of all configuration items I have written, avoiding a large number of seemingly useful options or default values.
  • [X] I have not reviewed the documentation and resolve this issue.
  • [X] I have not searched the Issue Tracker for the problem I am going to raise.
  • [X] I have tested with the latest Alpha branch version, and the issue still persists.
  • [X] I have provided server and client configuration files and processes that can reproduce the issue locally, rather than a desensitized complex client configuration file.
  • [X] I have provided the simplest configuration that can reproduce the error I reported, rather than relying on remote servers, TUN, graphical client interfaces, or other closed-source software.
  • [X] I have provided complete configuration files and logs, rather than providing only parts that I believe are useful due to confidence in my own intelligence.

Operating System

Linux

System Version

OpenWrt 23.05.3

Mihomo Version

v1.18.4

Configuration File

tun:
  enable: true
  stack: system
  auto-route: false
  auto-detect-interface: false

Description

TUN模式下,设置auto-route为false时,mihomo仍会添加ipv6路由和规则。

root@openwrt:~# ip -6 rule
0:      from all lookup local
32765:  from all lookup 2022
32766:  from all lookup main

root@openwrt:~# ip -6 route
default dev utun  metric 1024

Reproduction Steps

Linux下开启tun模式即可复现

Logs

No response

Yuanandcircle avatar Apr 30 '24 13:04 Yuanandcircle

该行为来自 https://github.com/SagerNet/sing-tun/blob/fb6e917a2cd7a5e6a0c45cc5291f2cbe9c8e8bcb/tun_rules.go#L106-L179 ,似乎是为了避免有 Inet6Address 但没有 ipv6 路由时,ipv6 绕过 tun 直连发出。

dyhkwong avatar May 08 '24 05:05 dyhkwong

应该是写错了

nekohasekai avatar Aug 08 '24 06:08 nekohasekai