network/parse-ip-opts.sh: avoid die with multiple "ip=" dhcp cases
PATCH 1/1 network/parse-ip-opts.sh: avoid die with multiple "ip=" dhcp cases
When multiple "ip=" dhcp related commands are specified, dracut will die. Two "ip=dhcp" is a simple example.
For kdump cases, when the kernel command line contains "ip=dhcp" which is inherited by kdump environment, the network dumping also hits this.
To fix it, we can treat multiple dhcp related commands just as one.
--- modules.d/40network/parse-ip-opts.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
modules.d/40network/parse-ip-opts.sh +9 -2
@@ -22,16 +22,23 @@ fi # Count ip= lines to decide whether we need bootdev= or not if [ -z "$NEEDBOOTDEV" ] ; then count=0 + has_dhcp=0 for p in $(getargs ip=); do - case "$p" in + ip_to_var $p + case "$autoconf" in ibft) continue;; + dhcp|dhcp6|on|any) + # Regard multiple dhcp cases as one to avoid die + has_dhcp=1 + continue;; esac count=$(( $count + 1 )) done + count=$(( $count + $has_dhcp )) [ $count -gt 1 ] && NEEDBOOTDEV=1 fi -unset count +unset count has_dhcp # If needed, check if bootdev= contains anything usable BOOTDEV=$(getarg bootdev=)
Signature · 1 line
1.8.3.1
Patchset imported to github.
Pull request:
<https://github.com/haraldh/dracut/compare/master...dracut-mailing-devs:1454574901-6290-1-git-send-email-xlpang%40redhat.com>
Cc more.
https://bugzilla.redhat.com/show_bug.cgi?id=1304069
One worry that I have about the patch is the multiple "ip=???:<interface>:dhcp:???" with a dhcp device specifed, not too sure about the bootdev in this case.
Quoted 23 lines · Xunlei Pang
When multiple "ip=" dhcp related commands are specified, dracut will die. Two "ip=dhcp" is a simple example.
For kdump cases, when the kernel command line contains "ip=dhcp" which is inherited by kdump environment, the network dumping also hits this.
To fix it, we can treat multiple dhcp related commands just as one.
Signed-off-by Xunlei Pang <[email protected]>--- modules.d/40network/parse-ip-opts.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)modules.d/40network/parse-ip-opts.sh +1
-0@@ -22,16 +22,23 @@ fi # Count ip= lines to decide whether we need bootdev= or not if [ -z "$NEEDBOOTDEV" ] ; then count=0 + has_dhcp=0
modules.d/40network/parse-ip-opts.sh fi · line 34
Quoted 10 lines
modules.d/40network/parse-ip-opts.sh +6
-1for p in $(getargs ip=); do - case "$p" in + ip_to_var $p + case "$autoconf" in ibft) continue;; + dhcp|dhcp6|on|any) + # Regard multiple dhcp cases as one to avoid die + has_dhcp=1 + continue;;
Should we have an extra judgement using $dev here, if NULL then continue?
Regards,
Xunlei
Quoted 11 lines
modules.d/40network/parse-ip-opts.sh +2
-1esac count=$(( $count + 1 )) done + count=$(( $count + $has_dhcp )) [ $count -gt 1 ] && NEEDBOOTDEV=1 fi -unset count +unset count has_dhcp # If needed, check if bootdev= contains anything usable BOOTDEV=$(getarg bootdev=)