From f938083fb5d097ea4c677ec08da91f61fa9f67d1 Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Sat, 30 Nov 2019 22:21:42 +0100 Subject: [PATCH] dhcpcd: 10-mtu break if carrier was lost some nic's like Intel e1000e needs a reinit to change the mtu. In this case the dhcp hook reinit the nic and terminate now to let the dhcpcd reinit the card in backgrounnd without running the rest of the hooks. Signed-off-by: Arne Fitzenreiter --- config/dhcpc/dhcpcd-hooks/10-mtu | 4 ++- src/initscripts/networking/functions.network | 38 ++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/config/dhcpc/dhcpcd-hooks/10-mtu b/config/dhcpc/dhcpcd-hooks/10-mtu index 49e05192ba..8eb4297514 100644 --- a/config/dhcpc/dhcpcd-hooks/10-mtu +++ b/config/dhcpc/dhcpcd-hooks/10-mtu @@ -10,11 +10,13 @@ set_mtu() # test for buggy nic that lose link at mtu set... carrier=`cat /sys/class/net/$interface/carrier` if [ "$carrier" == "0" ]; then - syslog info "Warning! Carrier loss after MTU set. Reinit ..." + syslog info "Warning! Carrier loss after MTU set. Reinit needed..." ip link set "$interface" down ip link set "$interface" up + exit 1 fi } + if [ -n "$new_interface_mtu" ] && $if_up; then if [ $RED_DHCP_FORCE_MTU -ge 576 ]; then new_interface_mtu=$RED_DHCP_FORCE_MTU diff --git a/src/initscripts/networking/functions.network b/src/initscripts/networking/functions.network index 1af3482df4..17191e7a9c 100644 --- a/src/initscripts/networking/functions.network +++ b/src/initscripts/networking/functions.network @@ -80,24 +80,32 @@ dhcpcd_start() { if [ "${ret}" -eq 0 ]; then . /var/ipfire/dhcpc/dhcpcd-"${device}".info - echo "" - echo_ok - boot_mesg " DHCP Assigned Settings for ${device}:" - boot_mesg_flush - boot_mesg " IP Address: $ip_address" - boot_mesg_flush - if [ -n "${RED_DHCP_HOSTNAME}" ]; then - boot_mesg " Hostname: $RED_DHCP_HOSTNAME" + if [ $ip_address ]; then + echo "" + echo_ok + boot_mesg " DHCP Assigned Settings for ${device}:" boot_mesg_flush - fi + boot_mesg " IP Address: $ip_address" + boot_mesg_flush + + if [ -n "${RED_DHCP_HOSTNAME}" ]; then + boot_mesg " Hostname: $RED_DHCP_HOSTNAME" + boot_mesg_flush + fi - boot_mesg " Subnet Mask: $subnet_mask" - boot_mesg_flush - boot_mesg " Default Gateway: $routers" - boot_mesg_flush - boot_mesg " DNS Server: $domain_name_servers" - boot_mesg_flush + boot_mesg " Subnet Mask: $subnet_mask" + boot_mesg_flush + boot_mesg " Default Gateway: $routers" + boot_mesg_flush + boot_mesg " DNS Server: $domain_name_servers" + boot_mesg_flush + else + echo "" + echo_ok + boot_mesg "DHCP for ${device} still running..." + boot_mesg_flush + fi else echo "" $(exit "${ret}") -- 2.39.2