summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2022-02-07 17:44:06 +0100
committer Eric Hameleers <alien@slackware.com>2022-02-07 17:44:06 +0100
commit4c60dc89a46aeeb8c65897e22942793e62d283e7 (patch)
treea76992be2bf6cb6cbd67fab30b2185d05cf5e139
parent83ee0c42fb54069d78e090cec506ce24435129e9 (diff)
downloadliveslak-4c60dc89a46aeeb8c65897e22942793e62d283e7.tar.gz
liveslak-4c60dc89a46aeeb8c65897e22942793e62d283e7.tar.xz
pxeserver: also check NetworkManager internal dhcp client
-rwxr-xr-xpxeserver.tpl19
1 files changed, 16 insertions, 3 deletions
diff --git a/pxeserver.tpl b/pxeserver.tpl
index 3a9c206..1bde266 100755
--- a/pxeserver.tpl
+++ b/pxeserver.tpl
@@ -168,7 +168,7 @@ int_to_ip() {
echo $(($1>>24)).$(($1>>16&0xff)).$(($1>>8&0xff)).$(($1&0xff))
}
-# Find the location of the dhcpcd PID file:
+# Find out whether the interface is managed by DHCP:
get_dhcpcd_pid() {
# Find the location of the PID file of dhcpcd:
MYDEV="$1"
@@ -185,6 +185,17 @@ get_dhcpcd_pid() {
fi
}
+# Find out whether the interface is managed by DHCP:
+get_nm_internal_lease() {
+ # Find the lease of NetworkManager internal dhcp client:
+ MYDEV="$1"
+ if [ -s /var/lib/NetworkManager/intern*-${MYDEV}.lease ]; then
+ echo "$(ls --indicator-style=none /var/lib/NetworkManager/intern*-${MYDEV}.lease)"
+ else
+ echo UNKNOWNLOC
+ fi
+}
+
# The network interface IP configuration routine.
# Will be called if the interface was not configured by DHCP.
# It ends with a configured network interface:
@@ -392,10 +403,12 @@ Alternate keys may also be used: '+', '-', and TAB." 13 72 9 \
# We now know what network interface to use.
#
- # If dhcpcd is running, it likely has a lease from a LAN DHCP server,
- # so we should not activate another DHCP server ourselves now:
+ # If our interface is configured by DHCP, it likely has a lease from a
+ # LAN DHCP server, so we should not activate another DHCP server ourself now:
if [ -s $(get_dhcpcd_pid ${INTERFACE}) -a -n "$(ps -q $(cat $(get_dhcpcd_pid ${INTERFACE})) -o comm=)" ]; then
OWNDHCP="no"
+ elif [ -s $(get_nm_internal_lease ${INTERFACE}) ]; then
+ OWNDHCP="no"
else
# Assume nothing... we will ask the user for confirmation later!
OWNDHCP="yes"