The system may have multiple default route entry. Following is an
example to show the details.
# ip -6 route list dev eth0
2620:52:0:1040::/64 proto kernel metric 256 expires 2591978sec fe80::/64 proto kernel
metric 256
default via fe80:52:0:1040::1 proto ra metric 1024 expires 1778sec hoplimit 64
default via fe80:52:0:1040::2 proto ra metric 1024 expires 1778sec hoplimit 64
Choose the first matched entry.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index c37f7c0..a615124 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -99,7 +99,8 @@ kdump_static_ip() {
fi
if [ -n "$_ipaddr" ]; then
- _gateway=$(ip $_ipv6_flag route list dev $_netdev | awk '/^default /{print
$3}')
+ _gateway=$(ip $_ipv6_flag route list dev $_netdev | \
+ awk '/^default /{print $3}' | head -n 1)
if [ "x" != "x"$_ipv6_flag ]; then
# _ipaddr="2002::56ff:feb6:56d5/64", _netmask is the number after
"/"
--
2.1.0
Show replies by date