mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 02:55:55 +02:00
networking: Set configured MTU to all network zones
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -26,6 +26,7 @@ if [ "$(basename $0)" == "green" ]; then
|
||||
NETADDRESS="${GREEN_NETADDRESS}"
|
||||
NETMASK="${GREEN_NETMASK}"
|
||||
DEVICE="${GREEN_DEV}"
|
||||
MTU="${GREEN_MTU}"
|
||||
elif [ "$(basename $0)" == "blue" ]; then
|
||||
DEVICE="${BLUE_DEV}"
|
||||
ADDRESS="${BLUE_ADDRESS}"
|
||||
@@ -33,6 +34,7 @@ elif [ "$(basename $0)" == "blue" ]; then
|
||||
NETADDRESS="${BLUE_NETADDRESS}"
|
||||
NETMASK="${BLUE_NETMASK}"
|
||||
DEVICE="${BLUE_DEV}"
|
||||
MTU="${GREEN_MTU}"
|
||||
elif [ "$(basename $0)" == "orange" ]; then
|
||||
DEVICE="${ORANGE_DEV}"
|
||||
ADDRESS="${ORANGE_ADDRESS}"
|
||||
@@ -40,6 +42,7 @@ elif [ "$(basename $0)" == "orange" ]; then
|
||||
NETADDRESS="${ORANGE_NETADDRESS}"
|
||||
NETMASK="${ORANGE_NETMASK}"
|
||||
DEVICE="${ORANGE_DEV}"
|
||||
MTU="${ORANGE_MTU}"
|
||||
fi
|
||||
|
||||
if [ -z "${BROADCAST}" ]; then
|
||||
@@ -77,6 +80,14 @@ case "${1}" in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set the MTU
|
||||
if [ -n "${MTU}" ]; then
|
||||
if ! ip link set dev "${DEVICE}" mtu "${MTU}" &>/dev/null; then
|
||||
boot_mesg "Could not set MTU of ${MTU} to ${DEVICE}..."
|
||||
echo_warning
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create & Enable vnstat data collection
|
||||
/usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
|
||||
|
||||
|
||||
@@ -54,11 +54,13 @@ if [ "${TYPE}" == "STATIC" ]; then
|
||||
BROADCAST="${RED_BROADCAST}"
|
||||
NETADDRESS="${RED_NETADDRESS}"
|
||||
NETMASK="${RED_NETMASK}"
|
||||
MTU="${RED_MTU}"
|
||||
else
|
||||
ADDRESS="${GREEN_ADDRESS}"
|
||||
BROADCAST="${GREEN_BROADCAST}"
|
||||
NETADDRESS="${GREEN_NETADDRESS}"
|
||||
NETMASK="${GREEN_NETMASK}"
|
||||
MTU="${GREEN_MTU}"
|
||||
fi
|
||||
GATEWAY="${DEFAULT_GATEWAY}"
|
||||
# DNS1
|
||||
@@ -108,7 +110,14 @@ case "${1}" in
|
||||
/usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
|
||||
|
||||
if [ "${TYPE}" == "STATIC" ]; then
|
||||
|
||||
# Set the MTU
|
||||
if [ -n "${MTU}" ]; then
|
||||
if ! ip link set dev "${DEVICE}" mtu "${MTU}" &>/dev/null; then
|
||||
boot_mesg "Could not set MTU of ${MTU} to ${DEVICE}..."
|
||||
echo_warning
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DEVICE" != "${GREEN_DEV}" ]; then
|
||||
boot_mesg "Adding IPv4 address ${ADDRESS} to the ${DEVICE} interface..."
|
||||
ip addr add ${args} dev ${DEVICE}
|
||||
|
||||
Reference in New Issue
Block a user