Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] panic: interface conversion: net.Addr is *net.IPAddr, not *net.IPNet #1130

Open
5 of 6 tasks
NavyD opened this issue Mar 24, 2024 · 2 comments
Open
5 of 6 tasks
Labels
bug Something isn't working

Comments

@NavyD
Copy link

NavyD commented Mar 24, 2024

Verify steps

  • 确保你使用的是本仓库最新的的 mihomo 或 mihomo Alpha 版本 Ensure you are using the latest version of Mihomo or Mihomo Alpha from this repository.
  • 如果你可以自己 debug 并解决的话,提交 PR 吧 Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
  • 我已经使用 Alpha 分支版本测试过,问题依旧存在 I have tested using the dev branch, and the issue still exists.
  • 我已经仔细看过 Documentation 并无法自行解决问题 I have read the documentation and was unable to solve the issue.
  • 这是 Mihomo 核心的问题,并非我所使用的 Mihomo 衍生版本(如 OpenMihomo、KoolMihomo 等)的特定问题 This is an issue of the Mihomo core per se, not to the derivatives of Mihomo, like OpenMihomo or KoolMihomo.

Mihomo version

Mihomo Meta alpha-d56a439 windows amd64 with go1.22.1 Sat Mar 23 14:32:19 UTC 2024 Use tags: with_gvisor

What OS are you seeing the problem on?

Windows

Mihomo config

mixed-port: 7890
mode: rule
log-level: debug
allow-lan: false
bind-address: "*"
external-controller: 0.0.0.0:10855
ipv6: true
profile:
  store-selected: true
  store-fake-ip: true
find-process-mode: strict
tcp-concurrent: true
keep-alive-interval: 30
sniffer:
  enable: true
  force-dns-mapping: true
  parse-pure-ip: false
  override-destination: false
  sniff:
    QUIC: null
    TLS: null
    HTTP:
      ports:
        - 80
        - 8080-8880
      override-destination: true
  force-domain:
    - +.netflix.com
    - +.nflxvideo.net
    - +.amazonaws.com
    - +.media.dssott.com
  skip-domain:
    - +.apple.com
    - Mijia Cloud
    - dlg.io.mi.com
tun:
  enable: true
  stack: gvisor
  dns-hijack:
    - any:53
  auto-route: true
  auto-detect-interface: true
  mtu: 1500
dns:
  enable: true
  ipv6: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  listen: 0.0.0.0:53
  use-hosts: true
  prefer-h3: true
  default-nameserver:
    - tls://223.5.5.5:853
    - tls://119.29.29.29:853
  nameserver:
    - tls://dns.quad9.net#DIRECT
    - tls://8.8.4.4#DIRECT
    - https://dns.cloudflare.com/dns-query
    - https://dns.google/dns-query
  proxy-server-nameserver:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
  nameserver-policy:
    "rule-set:cn-site,private-site":
      - https://doh.pub/dns-query
      - https://dns.alidns.com/dns-query
# ...

Mihomo log

time="2024-03-24T17:31:47.9011594+08:00" level=info msg="Start initial configuration in progress"
time="2024-03-24T17:31:47.9203404+08:00" level=info msg="Geodata Loader mode: standard"
time="2024-03-24T17:31:47.9203404+08:00" level=info msg="Geosite Matcher implementation: succinct"
time="2024-03-24T17:31:47.9402256+08:00" level=info msg="Initial configuration complete, total time: 21ms"
time="2024-03-24T17:31:47.9402256+08:00" level=info msg="Sniffer is loaded and working"
time="2024-03-24T17:31:47.9418121+08:00" level=info msg="Use tcp concurrent"
time="2024-03-24T17:31:47.9428589+08:00" level=info msg="RESTful API listening at: [::]:10855"
time="2024-03-24T17:31:47.9428589+08:00" level=info msg="DNS server listening at: [::]:53"
time="2024-03-24T17:31:47.9434138+08:00" level=info msg="Mixed(http+socks) proxy listening at: 127.0.0.1:7890"
time="2024-03-24T17:31:47.9461619+08:00" level=warning msg="[TUN] default interface changed by monitor,  => WLAN"
time="2024-03-24T17:31:48.4142917+08:00" level=info msg="[TUN] Tun adapter listening at: Meta([198.18.0.1/30],[]), mtu: 1500, auto route: true, ip stack: gVisor"
time="2024-03-24T17:31:48.4252792+08:00" level=info msg="Start initial provider SF-ALL"
time="2024-03-24T17:31:48.4308497+08:00" level=info msg="Start initial provider JKL-ALL"
time="2024-03-24T17:31:48.5450681+08:00" level=warning msg="[Provider] SF-ALL not updated for a long time, force refresh"
time="2024-03-24T17:31:48.6086091+08:00" level=warning msg="[Provider] JKL-ALL not updated for a long time, force refresh"
panic: interface conversion: net.Addr is *net.IPAddr, not *net.IPNet

goroutine 180 [running]:
github.com/metacubex/mihomo/component/iface.ResolveInterface.func1()
        github.com/metacubex/mihomo/component/iface/iface.go:43 +0x4b2
github.com/metacubex/mihomo/common/singledo.(*Single[...]).Do(0xc000263ce0, 0x10dcdc0?)
        github.com/metacubex/mihomo/common/singledo/singledo.go:46 +0x197
github.com/metacubex/mihomo/component/iface.ResolveInterface({0xc0001144a8, 0x4})
        github.com/metacubex/mihomo/component/iface/iface.go:27 +0x35
github.com/metacubex/mihomo/component/dialer.bindIfaceToDialer({0xc0001144a8?, 0xc0004100c0?}, 0xc000354310, {0x12131c0?, 0xe91c9e89e2fc7beb?}, {{0xc0004100ad?, 0xd7b4f5cbba3a9910?}, 0xd2523f8427a81a1?})
        github.com/metacubex/mihomo/component/dialer/bind_windows.go:80 +0x2f
github.com/metacubex/mihomo/component/dialer.dialContext({0x122a420, 0xc0003542a0}, {0x105fd90, 0x3}, {{0x487002fcd30205c4?, 0xf79d754948eb306c?}, 0xc0000060a8?}, {0xc0004100ad, 0x3}, 0xc000378c00)
        github.com/metacubex/mihomo/component/dialer/dialer.go:159 +0x383
github.com/metacubex/mihomo/component/dialer.parallelDialContext.func1({0x122a420?, 0xc0003542a0?}, {{0x9e72678dc98d1c3d?, 0xcd889df0d88022ae?}, 0xc0000060a8?})
        github.com/metacubex/mihomo/component/dialer/dialer.go:293 +0x106
created by github.com/metacubex/mihomo/component/dialer.parallelDialContext in goroutine 49
        github.com/metacubex/mihomo/component/dialer/dialer.go:297 +0x257

Description

在笔记本的windows 11上仅使用WIFI连接网络,再到设置->网络和Internet->移动热点开启热点后(想让手机连接笔记本的WIFI热点共享),启动mihomo在解析网络接口时出错:panic: interface conversion: net.Addr is *net.IPAddr, not *net.IPNet。关闭WIFI热点后可正常使用

在代码

ipNet := addr.(*net.IPNet)
中的部分返回的不是net.IPNet而是net.Addr(*net.IPAddr) *{IP: net.IP len: 16, cap: 16, [36,9,138,85,56,137,46,53,0,0,0,0,0,0,0,0], Zone: ""}导致的问题。

如果尝试忽略这个地址似乎会导致流量循环,连接迅速增加直到崩溃。下面是部分debug截图数据

image

windows版本

版本	Windows 11 专业版
版本	23H2
安装日期	‎2022/‎9/‎28
操作系统版本	22631.3296
体验	Windows Feature Experience Pack 1000.22687.1000.0
@NavyD NavyD added the bug Something isn't working label Mar 24, 2024
@xishang0128
Copy link

反馈请使用alpha版,而不是release

@NavyD
Copy link
Author

NavyD commented Mar 24, 2024

反馈请使用alpha版,而不是release

使用最新alpha版本问题依然存在

wwqgtxx added a commit that referenced this issue Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants