aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2021-06-08 12:31:17 -0500
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2021-06-08 12:31:17 -0500
commit25596ffb1df269be0dd123f274e3ff00f477ea80 (patch)
tree86c5cc4ede7e8404a97530e9b3c019107314b3ee
parent06cdaed873b0a951bdf97b70d65428df87bf4670 (diff)
Make stopping the network interfaces more robust.
SysV only. When stopping or rebooting the system, the network boot script is run and looks at all the /etc/sysconfig/ifconfig.* files. Some of the devices these files refer to may not be active or even refer to interfaces that are not defined on the current system. This change ignores non-existant interfaces and any interfaces that are not UP. This change also avoids bogus warning or error error messages when the system is shutting down.
-rw-r--r--bootscripts/ChangeLog6
-rw-r--r--bootscripts/lfs/init.d/network17
-rw-r--r--chapter01/changelog.xml9
-rw-r--r--packages.ent2
4 files changed, 24 insertions, 10 deletions
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog
index 9c8cca44f..8d37e862f 100644
--- a/bootscripts/ChangeLog
+++ b/bootscripts/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-08 Bruce Dubbs <bdubbs@linuxfromscratch.org>
+ * When shutting down the network, ignore invalid interfaces
+ or interfaces that are not UP.
+
2021-06-02 Thomas Trepl <thomas@linuxfromscratch.org>
* Prevent sendsignals from killing an active mdmon
@@ -5,7 +9,7 @@
* Make check_signal more robust.
* Use a better methog for killproc to remove a dead pid file.
* Clarify what signals killproc accepts.
- * Thanks to input an ddiscussion from Scott Andrews.
+ * Thanks to input and discussion from Scott Andrews.
2021-02-01 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* Tweak mountfs to properly exit when an error is found.
diff --git a/bootscripts/lfs/init.d/network b/bootscripts/lfs/init.d/network
index 17afa0983..710cfcfd4 100644
--- a/bootscripts/lfs/init.d/network
+++ b/bootscripts/lfs/init.d/network
@@ -35,10 +35,7 @@ case "${1}" in
interface=${file##*/ifconfig.}
# Skip if $file is * (because nothing was found)
- if [ "${interface}" = "*" ]
- then
- continue
- fi
+ if [ "${interface}" = "*" ]; then continue; fi
/sbin/ifup ${interface}
done
@@ -61,10 +58,14 @@ case "${1}" in
interface=${file##*/ifconfig.}
# Skip if $file is * (because nothing was found)
- if [ "${interface}" = "*" ]
- then
- continue
- fi
+ if [ "${interface}" = "*" ]; then continue; fi
+
+ # See if interface exists
+ if [ ! -e /sys/class/net/$interface ]; then continue; fi
+
+ # Is interface UP?
+ ip link show $interface 2>/dev/null | grep -q "state UP"
+ if [ $? -ne 0 ]; then continue; fi
/sbin/ifdown ${interface}
done
diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml
index 6f534292b..5cbc2f5fa 100644
--- a/chapter01/changelog.xml
+++ b/chapter01/changelog.xml
@@ -43,6 +43,15 @@
appropriate for the entry or if needed the entire day's listitem.
-->
<listitem revision="sysv">
+ <para>2021-06-08</para>
+ <itemizedlist>
+ <listitem>
+ <para>[bdubbs] - Make shutting down the netwrok more robust.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem revision="sysv">
<para>2021-06-02</para>
<itemizedlist>
<listitem>
diff --git a/packages.ent b/packages.ent
index b08620c86..05b3d4875 100644
--- a/packages.ent
+++ b/packages.ent
@@ -376,7 +376,7 @@
<!ENTITY less-fin-du "4.1 MB">
<!ENTITY less-fin-sbu "less than 0.1 SBU">
-<!ENTITY lfs-bootscripts-version "20210602"> <!-- Scripts depend on this format -->
+<!ENTITY lfs-bootscripts-version "20210608"> <!-- Scripts depend on this format -->
<!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">
<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">