mirror of
https://github.com/rancher/os.git
synced 2025-07-18 17:11:04 +00:00
Fix for mtu display (#2209)
This commit is contained in:
parent
32fe594212
commit
9ab2a58e4f
@ -34,8 +34,9 @@ RUN rm /sbin/poweroff /sbin/reboot /sbin/halt && \
|
|||||||
COPY inputrc /etc/inputrc
|
COPY inputrc /etc/inputrc
|
||||||
COPY growpart /usr/bin/growpart
|
COPY growpart /usr/bin/growpart
|
||||||
COPY start_ntp.sh /bin/start_ntp.sh
|
COPY start_ntp.sh /bin/start_ntp.sh
|
||||||
COPY dhcpcd.enter-hook /etc/dhcpcd.enter-hook
|
COPY dhcpcd/dhcpcd.enter-hook /etc/dhcpcd.enter-hook
|
||||||
COPY dhcpcd.debug /usr/share/logrotate/logrotate.d/
|
COPY dhcpcd/10-mtu /lib/dhcpcd/dhcpcd-hooks/
|
||||||
|
COPY dhcpcd/dhcpcd.debug /usr/share/logrotate/logrotate.d/
|
||||||
RUN sed -i s/"partx --update \"\$part\" \"\$dev\""/"partx --update --nr \"\$part\" \"\$dev\""/g /usr/bin/growpart && \
|
RUN sed -i s/"partx --update \"\$part\" \"\$dev\""/"partx --update --nr \"\$part\" \"\$dev\""/g /usr/bin/growpart && \
|
||||||
sed -i -e 's/duid/clientid/g' /etc/dhcpcd.conf && \
|
sed -i -e 's/duid/clientid/g' /etc/dhcpcd.conf && \
|
||||||
sed -i 1,10d /etc/rsyslog.conf && \
|
sed -i 1,10d /etc/rsyslog.conf && \
|
||||||
|
38
images/01-base/dhcpcd/10-mtu
Normal file
38
images/01-base/dhcpcd/10-mtu
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Configure the MTU for the interface
|
||||||
|
|
||||||
|
mtu_dir="$state_dir/mtu"
|
||||||
|
|
||||||
|
set_mtu()
|
||||||
|
{
|
||||||
|
local mtu=$1
|
||||||
|
|
||||||
|
if [ -w /sys/class/net/$interface/mtu ]; then
|
||||||
|
echo "$mtu" >/sys/class/net/$interface/mtu
|
||||||
|
else
|
||||||
|
ifconfig "$interface" mtu "$mtu"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$reason" = PREINIT -a -e "$mtu_dir/$interface" ]; then
|
||||||
|
rm "$mtu_dir/$interface"
|
||||||
|
elif [ -n "$new_interface_mtu" ] && $if_up; then
|
||||||
|
# The smalled MTU dhcpcd can work with is 576
|
||||||
|
if [ "$new_interface_mtu" -ge 576 ]; then
|
||||||
|
if set_mtu "$new_interface_mtu"; then
|
||||||
|
syslog info "MTU set to $new_interface_mtu"
|
||||||
|
# Save the MTU so we can restore it later
|
||||||
|
if [ ! -e "$mtu_dir/$interface" ]; then
|
||||||
|
mkdir -p "$mtu_dir"
|
||||||
|
echo "$ifmtu" > "$mtu_dir/$interface"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ -e "$mtu_dir/$interface" ]; then
|
||||||
|
if $if_up || $if_down; then
|
||||||
|
# No MTU in this state, so restore the prior MTU
|
||||||
|
mtu=$(cat "$mtu_dir/$interface")
|
||||||
|
syslog info "MTU restored to $mtu"
|
||||||
|
set_mtu "$mtu"
|
||||||
|
rm "$mtu_dir/$interface"
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user