alpine-initramfs: fix ipv6 routing priorities

This commit is contained in:
minoplhy 2024-12-11 23:38:50 +07:00
parent 144ce94192
commit d791f31d51
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
4 changed files with 35 additions and 23 deletions

View File

@ -332,8 +332,11 @@ configure_ip6() {
if ip -6 addr add $client6_ip dev $iface; then
# this is definitely not required by all ipv6 implementation
# but it's better to keep working imo for.
[ -z "$gw6_ip" ] || ip route add "$client6_ip" via "$gw6_ip" dev "$iface"
# but it's better to keep things working for all deployment possible
#
# metric is mandatory!
[ -z "$gw6_ip" ] || ip -6 route add "$gw6_ip" dev $iface metric 256
[ -z "$gw6_ip" ] || ip -6 route add ::0/0 via "$gw6_ip" dev "$iface" metric 128
fi
eend $?

View File

@ -1,4 +1,4 @@
271a272,347
271a272,350
> # configure ipv6 on initramfs
> # Valid syntaxes:
> # ip6=client-ip/gateway-ip/interface/dns1/dns2
@ -62,8 +62,11 @@
>
> if ip -6 addr add $client6_ip dev $iface; then
> # this is definitely not required by all ipv6 implementation
> # but it's better to keep working imo for.
> [ -z "$gw6_ip" ] || ip route add "$client6_ip" via "$gw6_ip" dev "$iface"
> # but it's better to keep things working for all deployment possible
> #
> # metric is mandatory!
> [ -z "$gw6_ip" ] || ip -6 route add "$gw6_ip" dev $iface metric 256
> [ -z "$gw6_ip" ] || ip -6 route add ::0/0 via "$gw6_ip" dev "$iface" metric 128
> fi
> eend $?
>
@ -75,7 +78,7 @@
> MAC_ADDRESS=$(cat "$ROOT/sys/class/net/$iface/address")
> }
>
325a402,416
325a405,419
> setup_dropbear() {
> local port="${KOPT_dropbear}"
> local keys=""
@ -91,10 +94,10 @@
> dropbear -R -E -s -j -k -p $port
> }
>
513a605,606
513a608,609
> dropbear
> ip6
642c735,743
642c738,746
< if [ -n "$KOPT_cryptroot" ]; then
---
> if [ -n "$KOPT_dropbear" ]; then
@ -106,12 +109,12 @@
>
> # Add Workaround for dropbear
> if [ -n "$KOPT_cryptroot" ] && [ ! -b /dev/mapper/"${KOPT_cryptdm}" ]; then
706a808,811
706a811,814
> # Kill all struck nlplug-findfs jobs and dropbear
> killall -9 nlplug-findfs
> killall -9 dropbear
>
789a895,898
789a898,901
>
> # Kill all struck nlplug-findfs jobs and dropbear
> killall -9 nlplug-findfs

View File

@ -286,8 +286,8 @@ configure_ip6() {
local client6_ip="$1"
local gw6_ip="$2"
local iface="$3"
local dns1="$4"
local dns2="$5"
local dns1="$4"
local dns2="$5"
if [ -e "$ROOT"/etc/mactab ]; then
$MOCK nameif -s
@ -331,9 +331,12 @@ configure_ip6() {
ebegin "Setting IP ($iface)"
if ip -6 addr add $client6_ip dev $iface; then
# this is definitely not required by all ipv6 implementation
# but it's better to keep working imo for.
[ -z "$gw6_ip" ] || ip route add "$client6_ip" via "$gw6_ip" dev "$iface"
# this is definitely not required by all ipv6 implementation
# but it's better to keep things working for all deployment possible
#
# metric is mandatory!
[ -z "$gw6_ip" ] || ip -6 route add "$gw6_ip" dev $iface metric 256
[ -z "$gw6_ip" ] || ip -6 route add ::0/0 via "$gw6_ip" dev "$iface" metric 128
fi
eend $?

View File

@ -1,4 +1,4 @@
271a272,347
271a272,350
> # configure ipv6 on initramfs
> # Valid syntaxes:
> # ip6=client-ip/gateway-ip/interface/dns1/dns2
@ -16,8 +16,8 @@
> local client6_ip="$1"
> local gw6_ip="$2"
> local iface="$3"
> local dns1="$4"
> local dns2="$5"
> local dns1="$4"
> local dns2="$5"
>
> if [ -e "$ROOT"/etc/mactab ]; then
> $MOCK nameif -s
@ -61,9 +61,12 @@
> ebegin "Setting IP ($iface)"
>
> if ip -6 addr add $client6_ip dev $iface; then
> # this is definitely not required by all ipv6 implementation
> # but it's better to keep working imo for.
> [ -z "$gw6_ip" ] || ip route add "$client6_ip" via "$gw6_ip" dev "$iface"
> # this is definitely not required by all ipv6 implementation
> # but it's better to keep things working for all deployment possible
> #
> # metric is mandatory!
> [ -z "$gw6_ip" ] || ip -6 route add "$gw6_ip" dev $iface metric 256
> [ -z "$gw6_ip" ] || ip -6 route add ::0/0 via "$gw6_ip" dev "$iface" metric 128
> fi
> eend $?
>
@ -75,5 +78,5 @@
> MAC_ADDRESS=$(cat "$ROOT/sys/class/net/$iface/address")
> }
>
513a590
> ip6
513a593
> ip6