Commit Graph

20 Commits

Author SHA1 Message Date
5b0d91c633 fix: select correct primary IPv6 address whose subnet contains the gateway (#561)
* fix: select correct primary IPv6 address whose subnet contains the gateway

When a system has multiple IPv6 addresses with different prefix lengths
(e.g., /44 and /96), the script previously selected the first address
as primary regardless of whether its subnet contained the default gateway.
This caused the gateway to be unreachable after reinstallation.

This change:
- Adds pure shell expand_ipv6 and ip_addr_contains_gw functions to
  determine which IPv6 subnet contains the gateway (no python dependency)
- Modifies collect_netconf to select the correct primary IPv6 address
- Stores remaining addresses as ipv6_extra_addrs
- Adds extra IPv6 addresses via post-up in create_ifupdown_config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address review feedback for IPv6 extra addrs and edge cases

- Pass ipv6_extra_addrs through initrd-network.sh (receive as $7,
  add extra addresses in add_missing_ipv6_config, write to netconf)
  so that trans.sh can read them via get_netconf_to
- Fix cut -c1-0 error when prefix_len < 4 in ip_addr_contains_gw
- Use grep -Fxve for exact string matching instead of regex

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use subshell for IFS modification to avoid leaking to outer scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: avoid global IFS modification when iterating extra IPv6 addresses

Replace subshell IFS trick with tr+while read to split comma-separated
ipv6_extra_addrs, avoiding any modification of the IFS variable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use ip route get instead of subnet matching for IPv6 primary address selection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:17:59 +08:00
e7f8802bdd net: 修复天翼云电脑 udhcpc 不断尝试获取动态 IP
fixes #518
2026-01-08 22:33:43 +08:00
8b838f8871 core: 不重要的优化 2025-10-31 07:50:45 +08:00
66f3173c7b core: alpine initrd 使用 udhcpc
dhcpcd 会配置租约时间,过期会移除 IP,但我们的没有在后台运行 dhcpcd ,因此用 udhcpc
2025-10-31 07:50:42 +08:00
30a3616bf8 net: 修复 accept_ra 被关闭导致 scaleway 在安装阶段默认路由过期而断网
fixes #423
2025-09-07 00:58:02 +08:00
b879df8e9b feat: implement secondary DNS fallback for connectivity tests (#354)
* feat: implement secondary DNS fallback for connectivity tests

* refactor: optimize address retrieval in connectivity test
2025-05-28 22:07:12 +08:00
8895d23082 net: 修复特殊情况下 dns 写入后又被清空 2025-05-20 11:12:58 +08:00
8a3ef0c875 net: 改进网络配置
- 防止删除 IPv6 后再次通过 SLAAC 获得
- 如果 IP 不能联网,在最终系统后则也不使用该 IP
- 如果 IP 不能联网,且 IP 是从 SLAAC 获得的,则禁用 SLAAC
2025-05-20 00:14:24 +08:00
2b9c82e97d core: DHCP 获取的 IP 不是重装前的 IP 时,一并删除 DHCP 获取的 DNS,以防 DNS 无效 2025-05-13 12:31:12 +08:00
bbf78e6d9a core: 添加 frpc 内网穿透 2025-04-28 23:18:27 +08:00
06559947e3 core: 修复判断动静态的逻辑错误
关联 #298
2025-03-28 13:26:28 +08:00
3a460f9004 core: 尝试修复是静态 IPv6 ,但是从 RA 获取到错误网关的情况 #298 2025-03-28 00:13:22 +08:00
2a8e760b97 core: initrd 阶段等待网卡启动 2025-03-26 20:50:45 +08:00
0f147ed656 core: 不重要的优化 2025-02-21 00:30:36 +08:00
e57a15118b core: 拆分 accept_ra autoconf
因为静态 IPv6 也可以从 RA 自动获取网关
2025-02-15 00:25:36 +08:00
024c8841e2 core: 判断动态获取的 IP 是否与旧系统相同时,不考虑掩码和网关 2025-02-15 00:02:08 +08:00
f84f40f869 core: 判断 IPv6 动静态时,先考虑实际测试结果,再考虑 RA,从而处理 RA 乱配的情况
fixes #231
2025-02-15 00:02:08 +08:00
34f64e31db core: alpine netboot 阶段使用 dhcpcd 2024-11-23 23:50:13 +08:00
e93584a6f2 core: 如果自动获取的 IP 不是重装前的,则使用之前的 2024-11-23 23:50:10 +08:00
6faca06003 core: alpine-network.sh 改名为 initrd-network.sh 2024-11-23 23:50:09 +08:00