mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-29 16:44:03 +00:00
Add the ability to configure multiple interfaces.
Submitted by: glarkin Obtained from: PC-BSD MFC after: 3 days
This commit is contained in:
parent
5b24837478
commit
35840dd335
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234987
@ -192,7 +192,7 @@ save_manual_nic()
|
||||
# Get the target nic
|
||||
NIC="$1"
|
||||
|
||||
get_value_from_cfg netSaveIP
|
||||
get_value_from_cfg netSaveIP_${NIC}
|
||||
NETIP="${VAL}"
|
||||
|
||||
if [ "$NETIP" = "DHCP" ]
|
||||
@ -212,7 +212,7 @@ save_manual_nic()
|
||||
IFARGS="inet ${NETIP}"
|
||||
|
||||
# Check if we have a netmask to set
|
||||
get_value_from_cfg netSaveMask
|
||||
get_value_from_cfg netSaveMask_${NIC}
|
||||
NETMASK="${VAL}"
|
||||
if [ -n "${NETMASK}" ]
|
||||
then
|
||||
@ -220,7 +220,7 @@ save_manual_nic()
|
||||
fi
|
||||
fi
|
||||
|
||||
get_value_from_cfg netSaveIPv6
|
||||
get_value_from_cfg netSaveIPv6_${NIC}
|
||||
NETIP6="${VAL}"
|
||||
if [ -n "${NETIP6}" ]
|
||||
then
|
||||
@ -239,6 +239,12 @@ save_manual_nic()
|
||||
echo "ifconfig_${NIC}_ipv6=\"${IF6ARGS}\"" >>${FSMNT}/etc/rc.conf
|
||||
fi
|
||||
|
||||
};
|
||||
|
||||
# Function which saves a manual gateway router setup to the installed system
|
||||
save_manual_router()
|
||||
{
|
||||
|
||||
# Check if we have a default router to set
|
||||
get_value_from_cfg netSaveDefaultRouter
|
||||
NETROUTE="${VAL}"
|
||||
@ -253,19 +259,30 @@ save_manual_nic()
|
||||
echo "ipv6_defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf
|
||||
fi
|
||||
|
||||
};
|
||||
|
||||
save_manual_nameserver()
|
||||
{
|
||||
# Check if we have a nameserver to enable
|
||||
: > ${FSMNT}/etc/resolv.conf
|
||||
get_value_from_cfg netSaveNameServer
|
||||
NAMESERVER="${VAL}"
|
||||
if [ -n "${NAMESERVER}" ]
|
||||
get_value_from_cfg_with_spaces netSaveNameServer
|
||||
NAMESERVERLIST="${VAL}"
|
||||
if [ ! -z "${NAMESERVERLIST}" ]
|
||||
then
|
||||
echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
|
||||
for NAMESERVER in ${NAMESERVERLIST}
|
||||
do
|
||||
echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
|
||||
done
|
||||
fi
|
||||
get_value_from_cfg netSaveIPv6NameServer
|
||||
NAMESERVER="${VAL}"
|
||||
if [ -n "${NAMESERVER}" ]
|
||||
|
||||
get_value_from_cfg_with_spaces netSaveIPv6NameServer
|
||||
NAMESERVERLIST="${VAL}"
|
||||
if [ ! -z "${NAMESERVERLIST}" ]
|
||||
then
|
||||
echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
|
||||
for NAMESERVER in ${NAMESERVERLIST}
|
||||
do
|
||||
echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf
|
||||
done
|
||||
fi
|
||||
|
||||
};
|
||||
@ -454,25 +471,30 @@ save_networking_install()
|
||||
{
|
||||
|
||||
# Check if we have any networking requested to save
|
||||
get_value_from_cfg netSaveDev
|
||||
get_value_from_cfg_with_spaces netSaveDev
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
|
||||
NETDEV="${VAL}"
|
||||
if [ "$NETDEV" = "AUTO-DHCP" ]
|
||||
NETDEVLIST="${VAL}"
|
||||
if [ "$NETDEVLIST" = "AUTO-DHCP" ]
|
||||
then
|
||||
save_auto_dhcp
|
||||
elif [ "$NETDEV" = "IPv6-SLAAC" ]
|
||||
elif [ "$NETDEVLIST" = "IPv6-SLAAC" ]
|
||||
then
|
||||
save_auto_slaac
|
||||
elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ]
|
||||
elif [ "$NETDEVLIST" = "AUTO-DHCP-SLAAC" ]
|
||||
then
|
||||
save_auto_dhcp
|
||||
save_auto_slaac
|
||||
else
|
||||
save_manual_nic ${NETDEV}
|
||||
for NETDEV in ${NETDEVLIST}
|
||||
do
|
||||
save_manual_nic ${NETDEV}
|
||||
done
|
||||
save_manual_router
|
||||
save_manual_nameserver
|
||||
fi
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user