Add systemd-networkd additional modes logic with heuristics

This commit is contained in:
Evgeny Sinelnikov 2021-10-29 05:15:30 +04:00
parent a775a26bf9
commit e55d8643c4

View File

@ -732,7 +732,7 @@ get_systemd_networkd_bootproto()
{
local ipv4config="$1"; shift
local ipv6config="$1"; shift
local bootproto=
local bootproto="$ipv4config"
if [ -z "$ipv4config" ]; then
case "$ipv6config" in
@ -749,33 +749,46 @@ get_systemd_networkd_bootproto()
if [ "$ipv6config" = dhcp ]; then
bootproto=dhcp6
elif [ "$ipv6config" = ra ]; then
bootproto=ipv6ll
bootproto=static
else
bootproto=static
fi
;;
ipv4ll)
if [ "$ipv6config" = dhcp ]; then
if [ "$ipv6config" = static ]; then
bootproto=ipll
elif [ "$ipv6config" = ra ]; then
bootproto=ipll
else
bootproto=ipv4ll
else # static | ra
bootproto=ip4ll
fi
;;
dhcp)
if [ "$ipv6config" = dhcp ]; then
bootproto=dhcp
else # static | ra
elif [ "$ipv6config" = ra ]; then
bootproto=dhcp
else
bootproto=dhcp4
fi
;;
dhcp6|ipv6ll)
bootproto="$bootproto"
;;
*dhcp)
if [ "$ipv6config" = dhcp ]; then
bootproto=dhcp
elif [ "$ipv6config" = ra ]; then
bootproto=dhcp
else
bootproto=dhcp4
fi
;;
*)
if [ "$ipv6config" = dhcp ]; then
bootproto=dhcp6
elif [ "$ipv6config" = ra ]; then
bootproto=dhcp
bootproto=dhcp6
else
bootproto=static
fi