From: Ben Hutchings <benh@debian.org>
To: linux-hyperv@vger.kernel.org
Subject: [PATCH 2/2] tools/hv: Make network-scripts DHCP status check more specific
Date: Mon, 16 Jun 2025 01:06:09 +0200 [thread overview]
Message-ID: <aE9R4V2w9cQPhsQK@decadent.org.uk> (raw)
In-Reply-To: <aE9Ri42HK2L1YOn3@decadent.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]
We currently look for the string 'dhcp' in a network-scripts
configuration file, but this could potentially be found in a comment
line. The variable that controls whether DHCPv4 is used is BOOTPROTO,
so check for that variable name as well as the value 'dhcp'.
Also quote the interface name when constructing the configuration
filename, just in case it contains a special character.
Signed-off-by: Ben Hutchings <benh@debian.org>
---
tools/hv/hv_get_dhcp_info.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/hv/hv_get_dhcp_info.sh b/tools/hv/hv_get_dhcp_info.sh
index 310b16a2f734..7815d55a9295 100755
--- a/tools/hv/hv_get_dhcp_info.sh
+++ b/tools/hv/hv_get_dhcp_info.sh
@@ -75,10 +75,10 @@ check_ifupdown() {
}
check_network_scripts() {
- local if_file="/etc/sysconfig/network-scripts/ifcfg-"$1
+ local if_file="/etc/sysconfig/network-scripts/ifcfg-$1"
if [ -f "$if_file" ]; then
- grep -q dhcp "$if_file"
+ grep -q '^\s*BOOTPROTO=.*dhcp' "$if_file"
report
else
return 1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-06-15 23:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-15 23:04 [PATCH 0/2] tools/hv: Improve the sample hv_get_dhcp_info script Ben Hutchings
2025-06-15 23:05 ` [PATCH 1/2] tools/hv: Make the sample hv_get_dhcp_info script more useful Ben Hutchings
2025-06-15 23:06 ` Ben Hutchings [this message]
2025-07-09 22:44 ` [PATCH 0/2] tools/hv: Improve the sample hv_get_dhcp_info script Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aE9R4V2w9cQPhsQK@decadent.org.uk \
--to=benh@debian.org \
--cc=linux-hyperv@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox