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 if ip -6 addr add $client6_ip dev $iface; then
# this is definitely not required by all ipv6 implementation # this is definitely not required by all ipv6 implementation
# but it's better to keep working imo for. # but it's better to keep things working for all deployment possible
[ -z "$gw6_ip" ] || ip route add "$client6_ip" via "$gw6_ip" dev "$iface" #
# 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 fi
eend $? eend $?

View File

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

View File

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

View File

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