On 05/27/14 at 10:45am, Marc Milgram wrote:
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 2a16900..87ad072 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -67,14 +67,17 @@ kdump_setup_dns() {
}
#$1: netdev name
-#checking /etc/sysconfig/network-scripts/ifcfg-$1,
+#$2: srcaddr
#if it use static ip echo it, or echo null
kdump_static_ip() {
- . /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
- [ -z "$NETMASK" -a -n "$PREFIX" ] && \
- NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
- echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
+ local _netmask _gateway
+ local _netdev="$1" _srcaddr="$2"
+ local _ipaddr=$(ip addr show dev $_netdev permanent | \
+ awk "/ $_srcaddr\/.* $_netdev\$/{print \$2}")
+ if [ -n "$_ipaddr" ]; then
+ _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
Hi Marc,
Here in this way, each netdev will get a gateway. I remember you told me
that if multiple gateways are specified only the last is available.
So if multiple NIC involved in kdump kernel, there's a trouble here.
+ _gateway=$(ip route list dev $_netdev | awk '/^default
/{print $3}')
+ echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
I just rethink about this when working on static route issue.
Baoquan
Thanks