User complained they set static ip address in ifcfg-xx with IPADDR0, but that ip address is not set successfully. That's because the IPADDRn can not be recognized by dracut-module-setup.sh. Even though in initscript, ifup-eth can recognize IPADDDR[0-255], and if 2 IPADDRxx missed the latter will be skipped, that's enough to only respect IPADDR[0-3]. And take the predencence order as IPADDR, IPADDR0, IPADDR1~3.
Signed-off-by: Baoquan He bhe@redhat.com --- dracut-module-setup.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index bdadf7c..e8d660d 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -69,12 +69,21 @@ kdump_setup_dns() { #$1: netdev name #checking /etc/sysconfig/network-scripts/ifcfg-$1, #if it use static ip echo it, or echo null +#kdump only respect IPADDR[0-3] and take the predencence +#order as IPADDR, IPADDR0, IPADDR1~3 kdump_static_ip() { + local _ipaddr + . /etc/sysconfig/network-scripts/ifcfg-$1 - if [ -n "$IPADDR" ]; then + _ipaddr=${IPADDR:-$IPADDR0} + _ipaddr=${_ipaddr:-$IPADDR1} + _ipaddr=${_ipaddr:-$IPADDR2} + _ipaddr=${_ipaddr:-$IPADDR3} + + if [ -n "$_ipaddr" ]; then [ -z "$NETMASK" -a -n "$PREFIX" ] && \ - NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2) - echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::" + NETMASK=$(ipcalc -m $_ipaddr/$PREFIX | cut -d'=' -f2) + echo -n "${_ipaddr}::${GATEWAY}:${NETMASK}::" fi }