Enhance kdump to support ipv6 protocal.
v10: - re-intergate the patch structure and fix some small issue base on dyoung's comment
Minfei Huang (8): kdump-lib: Quote the parameter to correct it if contains the blank mkdumprd: Add proper prefix "kdump-" before ethX in 2nd kernel kdump-lib: Add functions to enhance ipv6 judgement dracut-kdump: Use the first filtered ip address as the dumping directory dracut-module-setup: Support the static route with ipv6 mode dracut-module-setup: Support the static ip with ipv6 mode dracut-module-setup: Parse the ipv6 to get the parameter to install network in 2nd kernel dracut-module-setup: Enhance iscsi to support ipv6
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 162 ++++++++++++++++++++++++++++++++++++------------- kdump-lib.sh | 60 ++++++++++++++---- mkdumprd | 16 ++++- 4 files changed, 186 insertions(+), 56 deletions(-)
If the $1 parameter contains the blank, it may break the condition that whether the $1 parameter contains the "eth".
Quote the $1 to integrate it as one parameter.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Baoquan He bhe@redhat.com Acked-by: Dave Young dyoung@redhat.com --- kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 2abb513..1fa6058 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -205,7 +205,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then + if [[ "$1" =~ eth* ]]; then _ifname="kdump-$1" else _ifname="$1"
The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to append the netdevice to identify the ipv6 address.
Due to add prefix "kdump-" before ethX(commit: ba7660f) in the 2nd kernel, we should correct the mount parameter and /etc/kdump.conf to add the prefix "kdump-" before ethX, if use the ipv6 link scope.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Dave Young dyoung@redhat.com --- dracut-module-setup.sh | 23 +++++++++++++++++++++++ mkdumprd | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 73ab938..fd60b24 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -380,6 +380,28 @@ adjust_bind_mount_path() fi }
+# The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to +# append the netdevice to identify the ipv6 address. Kdump will add the +# prefix "kdump-" before ethX in the 2nd kernel. +kdump_ipv6_netdev_fixup() +{ + local _srcaddr _tmp_conf=$1 + if is_ssh_dump_target; then + _srcaddr=$(get_option_value ssh) + elif is_nfs_dump_target; then + _srcaddr=$(get_option_value nfs) + fi + + if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then + local _orig_netdev=${_srcaddr#*%} + _orig_netdev=${_orig_netdev%]*} + local _pre_netdev=$(kdump_setup_ifname $_orig_netdev) + if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then + sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf + fi + fi +} + #install kdump.conf and what user specifies in kdump.conf kdump_install_conf() { sed -ne '/^#/!p' /etc/kdump.conf > ${initdir}/tmp/$$-kdump.conf @@ -397,6 +419,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val" + kdump_ipv6_netdev_fixup "${initdir}/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val diff --git a/mkdumprd b/mkdumprd index 28ecdd7..62caa1b 100644 --- a/mkdumprd +++ b/mkdumprd @@ -81,8 +81,22 @@ add_dracut_module() { add_dracut_arg "--add" "$1" }
+# The ipv6 link scope which appends the netdevice to identify the ipv6 +# address is start with prefix "fe80", so we should correct the mount +# parameter to add the prefix "kdump-" before ethX. add_dracut_mount() { - add_dracut_arg "--mount" "$1" + local _val="$1" + + if is_nfs_dump_target; then + if `echo "$_val" | grep -q "^[fe80"`; then + local _prefix="${_val%%%*}" + local _netdev="${_val#*%}" + _netdev=$(kdump_setup_ifname "$_netdev") + _val="$_prefix"%"$_netdev" + fi + fi + + add_dracut_arg "--mount" "$_val" }
add_dracut_sshkey() {
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to append the netdevice to identify the ipv6 address.
Due to add prefix "kdump-" before ethX(commit: ba7660f) in the 2nd kernel, we should correct the mount parameter and /etc/kdump.conf to add the prefix "kdump-" before ethX, if use the ipv6 link scope.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Dave Young dyoung@redhat.com
dracut-module-setup.sh | 23 +++++++++++++++++++++++ mkdumprd | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 73ab938..fd60b24 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -380,6 +380,28 @@ adjust_bind_mount_path() fi }
+# The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to +# append the netdevice to identify the ipv6 address. Kdump will add the +# prefix "kdump-" before ethX in the 2nd kernel. +kdump_ipv6_netdev_fixup() +{
- local _srcaddr _tmp_conf=$1
- if is_ssh_dump_target; then
_srcaddr=$(get_option_value ssh)
- elif is_nfs_dump_target; then
_srcaddr=$(get_option_value nfs)
- fi
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
It is risky to search and replace in whole config file, reassemble the dump target line with nwe _srcaddr and other parts then replace the ssh or nfs line, it will be better.
Is it difficult?
fi
- fi
+}
#install kdump.conf and what user specifies in kdump.conf kdump_install_conf() { sed -ne '/^#/!p' /etc/kdump.conf > ${initdir}/tmp/$$-kdump.conf @@ -397,6 +419,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_netdev_fixup "${initdir}/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/mkdumprd b/mkdumprd index 28ecdd7..62caa1b 100644 --- a/mkdumprd +++ b/mkdumprd @@ -81,8 +81,22 @@ add_dracut_module() { add_dracut_arg "--add" "$1" }
+# The ipv6 link scope which appends the netdevice to identify the ipv6 +# address is start with prefix "fe80", so we should correct the mount +# parameter to add the prefix "kdump-" before ethX. add_dracut_mount() {
- add_dracut_arg "--mount" "$1"
- local _val="$1"
- if is_nfs_dump_target; then
if `echo "$_val" | grep -q "^\[fe80"`; then
local _prefix="${_val%%\%*}"
local _netdev="${_val#*\%}"
_netdev=$(kdump_setup_ifname "$_netdev")
_val="$_prefix"%"$_netdev"
fi
- fi
- add_dracut_arg "--mount" "$_val"
}
add_dracut_sshkey() {
2.1.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 06/18/15 at 10:34am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
It is risky to search and replace in whole config file, reassemble the dump target line with nwe _srcaddr and other parts then replace the ssh or nfs line, it will be better.
Is it difficult?
Actually, I think it is fine, since the netdevice name is so special, in the other hand, we replace the config which is used in 2nd kernel.
The case you worry never corrupt the config in /etc/kdump.conf.
But I do not insist my view. If you think it is necessary, I can modify it.
Thanks Minfei
On 06/18/15 at 08:56pm, Minfei Huang wrote:
On 06/18/15 at 10:34am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
It is risky to search and replace in whole config file, reassemble the dump target line with nwe _srcaddr and other parts then replace the ssh or nfs line, it will be better.
Is it difficult?
Actually, I think it is fine, since the netdevice name is so special, in the other hand, we replace the config which is used in 2nd kernel.
The case you worry never corrupt the config in /etc/kdump.conf.
Kdump will fail if it corrupt 2nd kernel kdump.conf
But I do not insist my view. If you think it is necessary, I can modify it.
Yes, I think it is necessary, to only replace netdev part instead of whole config file..
Thanks Dave
On 06/19/15 at 10:38am, Dave Young wrote:
On 06/18/15 at 08:56pm, Minfei Huang wrote:
On 06/18/15 at 10:34am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
It is risky to search and replace in whole config file, reassemble the dump target line with nwe _srcaddr and other parts then replace the ssh or nfs line, it will be better.
Is it difficult?
Actually, I think it is fine, since the netdevice name is so special, in the other hand, we replace the config which is used in 2nd kernel.
The case you worry never corrupt the config in /etc/kdump.conf.
Kdump will fail if it corrupt 2nd kernel kdump.conf
But I do not insist my view. If you think it is necessary, I can modify it.
Yes, I think it is necessary, to only replace netdev part instead of whole config file..
Ok, I will modify it and repost it laster.
Thanks Dave
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to append the netdevice to identify the ipv6 address.
Due to add prefix "kdump-" before ethX(commit: ba7660f) in the 2nd kernel, we should correct the mount parameter and /etc/kdump.conf to add the prefix "kdump-" before ethX, if use the ipv6 link scope.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Dave Young dyoung@redhat.com
dracut-module-setup.sh | 23 +++++++++++++++++++++++ mkdumprd | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 73ab938..fd60b24 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -380,6 +380,28 @@ adjust_bind_mount_path() fi }
+# The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to +# append the netdevice to identify the ipv6 address. Kdump will add the +# prefix "kdump-" before ethX in the 2nd kernel. +kdump_ipv6_netdev_fixup() +{
- local _srcaddr _tmp_conf=$1
- if is_ssh_dump_target; then
_srcaddr=$(get_option_value ssh)
- elif is_nfs_dump_target; then
_srcaddr=$(get_option_value nfs)
- fi
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
fi
- fi
+}
Rethink about this, it should be fixed in function kdump_setup_ifname() instead of fix it outside..
Thanks Dave
On 06/23/15 at 03:48pm, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to append the netdevice to identify the ipv6 address.
Due to add prefix "kdump-" before ethX(commit: ba7660f) in the 2nd kernel, we should correct the mount parameter and /etc/kdump.conf to add the prefix "kdump-" before ethX, if use the ipv6 link scope.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Dave Young dyoung@redhat.com
dracut-module-setup.sh | 23 +++++++++++++++++++++++ mkdumprd | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 73ab938..fd60b24 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -380,6 +380,28 @@ adjust_bind_mount_path() fi }
+# The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to +# append the netdevice to identify the ipv6 address. Kdump will add the +# prefix "kdump-" before ethX in the 2nd kernel. +kdump_ipv6_netdev_fixup() +{
- local _srcaddr _tmp_conf=$1
- if is_ssh_dump_target; then
_srcaddr=$(get_option_value ssh)
- elif is_nfs_dump_target; then
_srcaddr=$(get_option_value nfs)
- fi
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
fi
- fi
+}
Rethink about this, it should be fixed in function kdump_setup_ifname() instead of fix it outside..
We call the function kdump_setup_ifname to add the prefix "kdump-", if it is necessary. Maybe we can change the caller kdump_ipv6_netdev_fixup to kdump_fixup_netdev_conf.
Thanks Minfei
On 06/26/15 at 09:33am, Minfei Huang wrote:
On 06/23/15 at 03:48pm, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to append the netdevice to identify the ipv6 address.
Due to add prefix "kdump-" before ethX(commit: ba7660f) in the 2nd kernel, we should correct the mount parameter and /etc/kdump.conf to add the prefix "kdump-" before ethX, if use the ipv6 link scope.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Dave Young dyoung@redhat.com
dracut-module-setup.sh | 23 +++++++++++++++++++++++ mkdumprd | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 73ab938..fd60b24 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -380,6 +380,28 @@ adjust_bind_mount_path() fi }
+# The ipv6 link scope (like: fe80::fab1:56ff:feb6:56d5%eth1) needs to +# append the netdevice to identify the ipv6 address. Kdump will add the +# prefix "kdump-" before ethX in the 2nd kernel. +kdump_ipv6_netdev_fixup() +{
- local _srcaddr _tmp_conf=$1
- if is_ssh_dump_target; then
_srcaddr=$(get_option_value ssh)
- elif is_nfs_dump_target; then
_srcaddr=$(get_option_value nfs)
- fi
- if [ "x" != "x"$_srcaddr ] && `echo $_srcaddr | grep -q "%"`; then
local _orig_netdev=${_srcaddr#*\%}
_orig_netdev=${_orig_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_orig_netdev)
if [ "x"$_orig_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_orig_netdev#$_pre_netdev#" $_tmp_conf
fi
- fi
+}
Rethink about this, it should be fixed in function kdump_setup_ifname() instead of fix it outside..
We call the function kdump_setup_ifname to add the prefix "kdump-", if it is necessary. Maybe we can change the caller kdump_ipv6_netdev_fixup to kdump_fixup_netdev_conf.
Appoligize, kdump_setup_ifname accepts only devname as argument, so kdump_ipv6_netdev_fixup is still necessary, please ignore the comment..
Thanks Dave
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com --- dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date" + inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile" diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() { - local _server _server_tmp + local _ip_address + + _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1` + _ip_address=${_ip_address:-$1} + echo $_ip_address +} + +is_ipv6_host() +{ + local _addr=$(get_ip_address $1) + echo $_addr | grep -q ":" +} + +get_network_target() +{ + local _target
if is_ssh_dump_target; then - _server=`get_option_value ssh` + _target=`get_option_value ssh` elif is_nfs_dump_target; then - _server=`get_option_value nfs` + _target=`get_option_value nfs` fi
- [ -z "$_server" ] && return 1 - _server=`get_remote_host $_server` - _server_tmp=$_server - _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1` - _server=${_server:-$_server_tmp} - echo $_server | grep -q ":" + [ -z "$_target" ] && return + + _target=`get_remote_host $_target` + echo $_target +} + +# check the remote server ip address tpye +is_ipv6_target() +{ + local _target=$(get_network_target) + + [ -z "$_target" ] && return 1 + echo $(is_ipv6_host $_target) }
is_atomic()
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
It is long time ago you posted the last version, I remember we discussed about the issue no need to handle hostname target, only handle explict ip address in kdump.conf, right?
About getent, is it reliable to always return one type, either ipv4 or ipv6, or randomly?
+get_network_target() +{
local _target
if is_ssh_dump_target; then
_server=`get_option_value ssh`
elif is_nfs_dump_target; then_target=`get_option_value ssh`
_server=`get_option_value nfs`
fi_target=`get_option_value nfs`
- [ -z "$_server" ] && return 1
- _server=`get_remote_host $_server`
- _server_tmp=$_server
- _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
- [ -z "$_target" ] && return
- _target=`get_remote_host $_target`
- echo $_target
+}
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _target=$(get_network_target)
- [ -z "$_target" ] && return 1
- echo $(is_ipv6_host $_target)
}
is_atomic()
2.1.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 06/18/15 at 10:44am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
It is long time ago you posted the last version, I remember we discussed about the issue no need to handle hostname target, only handle explict ip address in kdump.conf, right?
Sorry. I forget it about the reason why we do not need to handle hostname target. Could you explain it?
About getent, is it reliable to always return one type, either ipv4 or ipv6, or randomly?
We can not confirm which ip type(maybe ipv4, maybe ipv6) will be returned by command getent. It depends on the configuration of domain service.
Whatever the command getent returns, I think it is ok. If it is the ipv4 protocol, we can walk through the ipv4 path, otherwise through ipv6 path.
Thanks Minfei
On 06/18/15 at 08:34pm, Minfei Huang wrote:
On 06/18/15 at 10:44am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
It is long time ago you posted the last version, I remember we discussed about the issue no need to handle hostname target, only handle explict ip address in kdump.conf, right?
Sorry. I forget it about the reason why we do not need to handle hostname target. Could you explain it?
I assume hostname will naturally works without any modification. So we only need take care of ip address specifed in kdump.conf
But I suspect the static route code breaks the assumption since it will pass route table to 2nd kernel.
About getent, is it reliable to always return one type, either ipv4 or ipv6, or randomly?
We can not confirm which ip type(maybe ipv4, maybe ipv6) will be returned by command getent. It depends on the configuration of domain service.
Whatever the command getent returns, I think it is ok. If it is the ipv4 protocol, we can walk through the ipv4 path, otherwise through ipv6 path.
Thanks Minfei
On 06/19/15 at 10:28am, Dave Young wrote:
On 06/18/15 at 08:34pm, Minfei Huang wrote:
On 06/18/15 at 10:44am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
It is long time ago you posted the last version, I remember we discussed about the issue no need to handle hostname target, only handle explict ip address in kdump.conf, right?
Sorry. I forget it about the reason why we do not need to handle hostname target. Could you explain it?
I assume hostname will naturally works without any modification. So we only need take care of ip address specifed in kdump.conf
But I suspect the static route code breaks the assumption since it will pass route table to 2nd kernel.
We need to parse the hostname, since we shall do some specifical process for ipv6 procotol.
You can find that we do different for ipv4 and ipv6.
308 if is_ipv6_host $_server; then 309 _netdev=`/sbin/ip -6 route get to $_server 2>&1` 310 [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 311 312 if [ -n "`echo $_netdev | grep via`" ]; then 313 # 2001:151::112 via 2001:150::121 from :: dev eth1 src 2001:150::120 metric 0 314 _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1` 315 _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1` 316 else 317 # 2001:150::11f from :: dev eth1 src 2001:150::120 metric 0 318 _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` 319 _netdev=`echo $_netdev|awk '{print $5}'|head -n 1` 320 fi 321 else 322 _netdev=`/sbin/ip route get to $_server 2>&1` 323 [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 324 if [ -n "`echo $_netdev | grep via`" ]; then 325 # 192.168.151.215 via 192.168.150.137 dev kdump-eth1 src 192.168.150.129 326 _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` 327 _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1` 328 else 329 # 192.168.150.137 dev eth1 src 192.168.150.129 330 _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1` 331 _netdev=`echo $_netdev|awk '{print $3}'|head -n 1` 332 fi 333 fi
We shall take care of the hostname, since the result format is different by command "/sbin/ip -6 route get to $_server".
As you said, static route or other function may breake, if we do not parse the hostname.
Thanks Minfei
About getent, is it reliable to always return one type, either ipv4 or ipv6, or randomly?
We can not confirm which ip type(maybe ipv4, maybe ipv6) will be returned by command getent. It depends on the configuration of domain service.
Whatever the command getent returns, I think it is ok. If it is the ipv4 protocol, we can walk through the ipv4 path, otherwise through ipv6 path.
Thanks Minfei
On 06/19/15 at 12:06pm, Minfei Huang wrote:
On 06/19/15 at 10:28am, Dave Young wrote:
On 06/18/15 at 08:34pm, Minfei Huang wrote:
On 06/18/15 at 10:44am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
It is long time ago you posted the last version, I remember we discussed about the issue no need to handle hostname target, only handle explict ip address in kdump.conf, right?
Sorry. I forget it about the reason why we do not need to handle hostname target. Could you explain it?
I assume hostname will naturally works without any modification. So we only need take care of ip address specifed in kdump.conf
But I suspect the static route code breaks the assumption since it will pass route table to 2nd kernel.
We need to parse the hostname, since we shall do some specifical process for ipv6 procotol.
You can find that we do different for ipv4 and ipv6.
308 if is_ipv6_host $_server; then 309 _netdev=`/sbin/ip -6 route get to $_server 2>&1` 310 [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 311 312 if [ -n "`echo $_netdev | grep via`" ]; then 313 # 2001:151::112 via 2001:150::121 from :: dev eth1 src 2001:150::120 metric 0 314 _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1` 315 _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1` 316 else 317 # 2001:150::11f from :: dev eth1 src 2001:150::120 metric 0 318 _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` 319 _netdev=`echo $_netdev|awk '{print $5}'|head -n 1` 320 fi 321 else 322 _netdev=`/sbin/ip route get to $_server 2>&1` 323 [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 324 if [ -n "`echo $_netdev | grep via`" ]; then 325 # 192.168.151.215 via 192.168.150.137 dev kdump-eth1 src 192.168.150.129 326 _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` 327 _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1` 328 else 329 # 192.168.150.137 dev eth1 src 192.168.150.129 330 _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1` 331 _netdev=`echo $_netdev|awk '{print $3}'|head -n 1` 332 fi 333 fi
We shall take care of the hostname, since the result format is different by command "/sbin/ip -6 route get to $_server".
As you said, static route or other function may breake, if we do not parse the hostname.
But you said "ip route" will works for both ipv4 and ipv6, so we should leave "ip" tool to handle the different protocals, we should only change the kdump dev name what we pass to 2nd kernel with prefix kdump-
Thanks Dave
On 06/23/15 at 03:24pm, Dave Young wrote:
We shall take care of the hostname, since the result format is different by command "/sbin/ip -6 route get to $_server".
As you said, static route or other function may breake, if we do not parse the hostname.
But you said "ip route" will works for both ipv4 and ipv6, so we should leave "ip" tool to handle the different protocals, we should only change the kdump dev name what we pass to 2nd kernel with prefix kdump-
In my opinion, we can do a cleanup later, since this patchset passed the testcase. And the cleanup does not break up code path, so I think it may be better. Otherwise there are a lot of duplicate test work to do.
Thanks Minfei
On 06/25/15 at 05:48pm, Minfei Huang wrote:
On 06/23/15 at 03:24pm, Dave Young wrote:
We shall take care of the hostname, since the result format is different by command "/sbin/ip -6 route get to $_server".
As you said, static route or other function may breake, if we do not parse the hostname.
But you said "ip route" will works for both ipv4 and ipv6, so we should leave "ip" tool to handle the different protocals, we should only change the kdump dev name what we pass to 2nd kernel with prefix kdump-
In my opinion, we can do a cleanup later, since this patchset passed the testcase. And the cleanup does not break up code path, so I think it may be better. Otherwise there are a lot of duplicate test work to do.
Sorry, I can not agree that adding more code in case you can add less. It is hard to review. This is not the last version, you still need restructure the patches shouldn't you retest them?
Thanks Dave
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
+get_network_target() +{
local _target
if is_ssh_dump_target; then
_server=`get_option_value ssh`
elif is_nfs_dump_target; then_target=`get_option_value ssh`
_server=`get_option_value nfs`
fi_target=`get_option_value nfs`
- [ -z "$_server" ] && return 1
- _server=`get_remote_host $_server`
- _server_tmp=$_server
- _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
- [ -z "$_target" ] && return
- _target=`get_remote_host $_target`
- echo $_target
+}
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _target=$(get_network_target)
- [ -z "$_target" ] && return 1
- echo $(is_ipv6_host $_target)
}
is_atomic()
Seems chaowang mistakenly merged one of your patches for ipv6: commit 63476302aa09b7844ac0fff5aa3878bcc9a5bc0d Author: Minfei Huang mhuang@redhat.com Date: Fri Dec 5 16:24:30 2014 +0800
We should revert the patch, and rebase your patchset so that we can get a clean ipv6 support intead of fix things based on the original patch.
BTW, seems DNS problems should also be taken care of..
Ideally we need below changes
1. common functions is_ipv6_addr()
2. kdump_setup_ifname
3. ssh knownhosts
4. dns
5. static ip
6. dhcp
7. iscsi
Thanks Dave
On 06/23/15 at 03:46pm, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
+get_network_target() +{
local _target
if is_ssh_dump_target; then
_server=`get_option_value ssh`
elif is_nfs_dump_target; then_target=`get_option_value ssh`
_server=`get_option_value nfs`
fi_target=`get_option_value nfs`
- [ -z "$_server" ] && return 1
- _server=`get_remote_host $_server`
- _server_tmp=$_server
- _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
- [ -z "$_target" ] && return
- _target=`get_remote_host $_target`
- echo $_target
+}
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _target=$(get_network_target)
- [ -z "$_target" ] && return 1
- echo $(is_ipv6_host $_target)
}
is_atomic()
Seems chaowang mistakenly merged one of your patches for ipv6: commit 63476302aa09b7844ac0fff5aa3878bcc9a5bc0d Author: Minfei Huang mhuang@redhat.com Date: Fri Dec 5 16:24:30 2014 +0800
We should revert the patch, and rebase your patchset so that we can get a clean ipv6 support intead of fix things based on the original patch.
BTW, seems DNS problems should also be taken care of..
Ideally we need below changes
- common functions
is_ipv6_addr()
kdump_setup_ifname
ssh knownhosts
dns
static ip
dhcp
iscsi
Reordering the patches will make review easier, ideally like below: ipv6 support for non local link addresses ipv6 support for local link addresses, so all kdump prefix to devname can go in last patch.
Thanks Dave
On 06/24/15 at 09:26am, Dave Young wrote:
On 06/23/15 at 03:46pm, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
The ipv6 address has the special character colon ":", so we can use the new function to pick it out. We can use the new function to parse the passed parameter. The passed parameter is hostname/domain, if it is satisfied with the condition that it is without colon ":", and contanis the [a-zA-Z].
Add a new function to simplify to get the ip address, if the specified address is a domain/hostname in /etc/kdump.conf. The function will parse the passed parameter, and use the "getent ahost" to get the ip address, if passed parameter is domain/hostname.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 1 + kdump-lib.sh | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index fd60b24..657530b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -668,6 +668,7 @@ install() { inst "/bin/dd" "/bin/dd" inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date"
- inst "/bin/getent" "/bin/getent" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 1fa6058..481876b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -229,23 +229,46 @@ get_remote_host() echo $_config_val }
-# check the remote server ip address tpye -is_ipv6_target() +# Convert hostname to ip address, echo the original value if $1 is already an ip address. +# $1: hostname or ip address +get_ip_address() {
- local _server _server_tmp
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
+is_ipv6_host() +{
- local _addr=$(get_ip_address $1)
- echo $_addr | grep -q ":"
+}
+get_network_target() +{
local _target
if is_ssh_dump_target; then
_server=`get_option_value ssh`
elif is_nfs_dump_target; then_target=`get_option_value ssh`
_server=`get_option_value nfs`
fi_target=`get_option_value nfs`
- [ -z "$_server" ] && return 1
- _server=`get_remote_host $_server`
- _server_tmp=$_server
- _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
- [ -z "$_target" ] && return
- _target=`get_remote_host $_target`
- echo $_target
+}
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _target=$(get_network_target)
- [ -z "$_target" ] && return 1
- echo $(is_ipv6_host $_target)
}
is_atomic()
Seems chaowang mistakenly merged one of your patches for ipv6: commit 63476302aa09b7844ac0fff5aa3878bcc9a5bc0d Author: Minfei Huang mhuang@redhat.com Date: Fri Dec 5 16:24:30 2014 +0800
We should revert the patch, and rebase your patchset so that we can get a clean ipv6 support intead of fix things based on the original patch.
BTW, seems DNS problems should also be taken care of..
Ideally we need below changes
- common functions
is_ipv6_addr()
kdump_setup_ifname
ssh knownhosts
dns
static ip
dhcp
iscsi
Reordering the patches will make review easier, ideally like below: ipv6 support for non local link addresses ipv6 support for local link addresses, so all kdump prefix to devname can go in last patch.
But there is no difficult to support local link address, it is fine to make either of patchset to support both non local link address and local link address.
Thanks Minfei
Thanks Dave
In general, the dracut will setup the ipv4 or ipv6 mode exclusively, If we specify the config to use the ssh or nfs to dump the core.
Modify the function to get the first filered ip address as the dumping directory, and does not concern the ip address is ipv4 or ipv6.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Baoquan He bhe@redhat.com Acked-by: Dave Young dyoung@redhat.com --- dracut-kdump.sh | 4 ++-- dracut-module-setup.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..af73532 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -121,9 +121,9 @@ get_host_ip() then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1 - _host=`ip addr show dev $kdumpnic|grep 'inet '` + _host=`ip addr show dev $kdumpnic|grep 'inet'` [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 - _host="${_host##*inet }" + _host=`echo $_host | head -n 1 | cut -d' ' -f2` _host="${_host%%/*}" [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 657530b..8c36b90 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -669,6 +669,7 @@ install() { inst "/bin/tail" "/bin/tail" inst "/bin/date" "/bin/date" inst "/bin/getent" "/bin/getent" + inst "/bin/head" "/bin/head" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
In order to enhance kdump to support ipv6, support the static route with ipv6, which ipv4 has supported already.
Due to the different format with ipv4 and ipv6, dracut uses bracket "[]" to quote the ipv6 address to identify it in the 2nd kernel.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Baoquan He bhe@redhat.com Acked-by: Dave Young dyoung@redhat.com --- dracut-module-setup.sh | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 8c36b90..55a8d82 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -195,27 +195,45 @@ kdump_setup_znet() { echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} > ${initdir}/etc/cmdline.d/30znet.conf }
+# +# For the same subnet region, following is the route format +# ipv4: +# _route='192.168.200.137 dev eth1 src 192.168.200.129 +# cache ' +# ipv6: +# _route='2001:11::11f from :: dev eth1 src 2001:11::120 metric 0 +# cache' +# For the different subnet region, following is the route format +# ipv4: +# _route='192.168.201.215 via 192.168.200.137 dev eth1 src 192.168.200.129 +# cache ' +# ipv6: +# _route='2001:10::120 from :: via 2001:11::11f dev eth1 src 2001:11::120 metric 0 +# cache' get_routes() { local _netdev="$1" _target="$2" local _route _nexthop
- _route=`/sbin/ip route get to $_target 2>&1` -# -# in the same subnet region, following is the route format -# _route='192.168.200.137 dev eth1 src 192.168.200.129 -# cache ' -# -# in the different subnet region, following is the route format -# _route='192.168.201.215 via 192.168.200.137 dev eth1 src 192.168.200.129 -# cache ' -# - if `echo $_route | grep -q "via"`; then - # route going to a different subnet via a router - _nexthop=`echo $_route | awk '{print $3}'` - fi - _netdev=$(kdump_setup_ifname $_netdev) + if is_ipv6_host $_target; then + _route=`/sbin/ip -6 route get to $_target 2>&1` + _netdev=$(kdump_setup_ifname $_netdev) + if `echo $_route | grep -q "via"`; then + # route going to a different subnet via a router + _nexthop=`echo $_route | awk '{print $5}'` + echo "rd.route=[$_target]:[$_nexthop]:$_netdev" >> ${initdir}/etc/cmdline.d/45route-static.conf + else + echo "rd.route=[$_target]::$_netdev" >> ${initdir}/etc/cmdline.d/45route-static.conf + fi + else + _route=`/sbin/ip route get to $_target 2>&1` + if `echo $_route | grep -q "via"`; then + # route going to a different subnet via a router + _nexthop=`echo $_route | awk '{print $3}'` + fi + _netdev=$(kdump_setup_ifname $_netdev)
- echo "rd.route=$_target:$_nexthop:$_netdev" >> ${initdir}/etc/cmdline.d/45route-static.conf + echo "rd.route=$_target:$_nexthop:$_netdev" >> ${initdir}/etc/cmdline.d/45route-static.conf + fi }
# Setup dracut to bringup a given network interface
In order to enhance kdump to support ipv6, support the static ip with ipv6, which ipv4 has supported already.
Due to the different format with ipv4 and ipv6, dracut uses bracket"[]" to quote the ipv6 address to identify it in the 2nd kernel.
Signed-off-by: Minfei Huang mhuang@redhat.com Acked-by: Dave Young dyoung@redhat.com --- dracut-module-setup.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 55a8d82..d61cc44 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -74,14 +74,25 @@ kdump_setup_dns() { #$2: srcaddr #if it use static ip echo it, or echo null kdump_static_ip() { - local _netmask _gateway + local _netmask _gateway _ipaddr local _netdev="$1" _srcaddr="$2" - local _ipaddr=$(ip addr show dev $_netdev permanent | \ + + if is_ipv6_host $_srcaddr; then + _ipaddr=$(ip -6 addr show dev $_netdev permanent | \ + awk "/ $_srcaddr/.* /{print $2}") + if [ -n "$_ipaddr" ]; then + _netmask=${_ipaddr#*/} + _gateway=$(ip -6 route list dev $_netdev | awk '/^default /{print $3}') + echo -n "[${_srcaddr}]::[${_gateway}]:${_netmask}::" + fi + else + _ipaddr=$(ip addr show dev $_netdev permanent | \ awk "/ $_srcaddr/.* $_netdev$/{print $2}") - if [ -n "$_ipaddr" ]; then - _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2) - _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}') - echo -n "${_srcaddr}::${_gateway}:${_netmask}::" + if [ -n "$_ipaddr" ]; then + _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2) + _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}') + echo -n "${_srcaddr}::${_gateway}:${_netmask}::" + fi fi }
Currently kdump doesn't support ipv6 nfs/ssh dump. Due to the lastet version of the Internet Protocal, it is a significant feature for kdump to enhance to support ipv6.
Following is the special config for ipv6 protocal.
For ipv6 nfs dump: Link scope, /etc/kdump.conf should be specified like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" otherwise "nfs [2001:db8:0:f101::2]:/mnt"
For ipv6 ssh dump: Link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" otherwise "ssh root at 2001:db8:0:f101::2"
Signed-off-by: Minfei Huang mhuang@redhat.com --- dracut-module-setup.sh | 39 +++++++++++++++++++++++++-------------- kdump-lib.sh | 13 +++++++++++++ 2 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index d61cc44..615455e 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -301,24 +301,35 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1` + _server=`get_remote_host $config_val`
- _need_dns=`echo $_server|grep "[a-zA-Z]"` - [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1` + is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- _netdev=`/sbin/ip route get to $_server 2>&1` - [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 + if is_ipv6_host $_server; then + _netdev=`/sbin/ip -6 route get to $_server 2>&1` + [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- #the field in the ip output changes if we go to another subnet - if [ -n "`echo $_netdev | grep via`" ] - then - # we are going to a different subnet - _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` - _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1` + if [ -n "`echo $_netdev | grep via`" ]; then + # 2001:151::112 via 2001:150::121 from :: dev eth1 src 2001:150::120 metric 0 + _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1` + _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1` + else + # 2001:150::11f from :: dev eth1 src 2001:150::120 metric 0 + _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` + _netdev=`echo $_netdev|awk '{print $5}'|head -n 1` + fi else - # we are on the same subnet - _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1` - _netdev=`echo $_netdev|awk '{print $3}'|head -n 1` + _netdev=`/sbin/ip route get to $_server 2>&1` + [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 + if [ -n "`echo $_netdev | grep via`" ]; then + # 192.168.151.215 via 192.168.150.137 dev kdump-eth1 src 192.168.150.129 + _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1` + _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1` + else + # 192.168.150.137 dev eth1 src 192.168.150.129 + _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1` + _netdev=`echo $_netdev|awk '{print $3}'|head -n 1` + fi fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}" diff --git a/kdump-lib.sh b/kdump-lib.sh index 481876b..e6e1413 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -271,6 +271,19 @@ is_ipv6_target() echo $(is_ipv6_host $_target) }
+# if the passed parameter is hostname/domain, it will be satisfied with +# condition which it is without colon ":", and contains the [a-zA-Z] +# $1: hostname/ip address +is_hostname() +{ + local _hostname=`echo $1 | grep ":"` + + if [ -n "$_hostname" ]; then + return 1 + fi + echo $1 | grep -q "[a-zA-Z]" +} + is_atomic() { grep -q "ostree" /proc/cmdline
On 06/13/15 at 02:51pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Due to the lastet version of the Internet Protocal, it is a significant feature for kdump to enhance to support ipv6.
Following is the special config for ipv6 protocal.
For ipv6 nfs dump: Link scope, /etc/kdump.conf should be specified like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" otherwise "nfs [2001:db8:0:f101::2]:/mnt"
For ipv6 ssh dump: Link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" otherwise "ssh root at 2001:db8:0:f101::2"
The description is general info for ipv6 support, the problem you are solving in this patch should be covered and explained.
This patch is only for kdump_install_net() ipv6 part..
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 39 +++++++++++++++++++++++++-------------- kdump-lib.sh | 13 +++++++++++++ 2 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index d61cc44..615455e 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -301,24 +301,35 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`get_remote_host $config_val`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- if is_ipv6_host $_server; then
_netdev=`/sbin/ip -6 route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
Does "ip route get to hostname" works for both ip4 and ip6?
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- then
# we are going to a different subnet
_srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
if [ -n "`echo $_netdev | grep via`" ]; then
# 2001:151::112 via 2001:150::121 from :: dev eth1 src 2001:150::120 metric 0
_srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
else
# 2001:150::11f from :: dev eth1 src 2001:150::120 metric 0
_srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $5}'|head -n 1`
elsefi
# we are on the same subnet
_srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
if [ -n "`echo $_netdev | grep via`" ]; then
# 192.168.151.215 via 192.168.150.137 dev kdump-eth1 src 192.168.150.129
_srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
else
# 192.168.150.137 dev eth1 src 192.168.150.129
_srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}"
diff --git a/kdump-lib.sh b/kdump-lib.sh index 481876b..e6e1413 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -271,6 +271,19 @@ is_ipv6_target() echo $(is_ipv6_host $_target) }
+# if the passed parameter is hostname/domain, it will be satisfied with +# condition which it is without colon ":", and contains the [a-zA-Z] +# $1: hostname/ip address +is_hostname() +{
- local _hostname=`echo $1 | grep ":"`
- if [ -n "$_hostname" ]; then
return 1
- fi
- echo $1 | grep -q "[a-zA-Z]"
+}
is_atomic() { grep -q "ostree" /proc/cmdline -- 2.1.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 06/18/15 at 10:53am, Dave Young wrote:
On 06/13/15 at 02:51pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Due to the lastet version of the Internet Protocal, it is a significant feature for kdump to enhance to support ipv6.
Following is the special config for ipv6 protocal.
For ipv6 nfs dump: Link scope, /etc/kdump.conf should be specified like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" otherwise "nfs [2001:db8:0:f101::2]:/mnt"
For ipv6 ssh dump: Link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" otherwise "ssh root at 2001:db8:0:f101::2"
The description is general info for ipv6 support, the problem you are solving in this patch should be covered and explained.
This patch is only for kdump_install_net() ipv6 part..
I will rewrite the commit log to explain the patch what it does.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 39 +++++++++++++++++++++++++-------------- kdump-lib.sh | 13 +++++++++++++ 2 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index d61cc44..615455e 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -301,24 +301,35 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`get_remote_host $config_val`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- if is_ipv6_host $_server; then
_netdev=`/sbin/ip -6 route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
Does "ip route get to hostname" works for both ip4 and ip6?
Yes, we use "ip -6" to get the ipv6 route info.
Thanks Minfei
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- if is_ipv6_host $_server; then
_netdev=`/sbin/ip -6 route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
Does "ip route get to hostname" works for both ip4 and ip6?
Yes, we use "ip -6" to get the ipv6 route info.
Can we remove "-6" if it simply works for both 4 and 6? What does "yes" means..
Thanks Dave
On 06/19/15 at 10:40am, Dave Young wrote:
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- if is_ipv6_host $_server; then
_netdev=`/sbin/ip -6 route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
Does "ip route get to hostname" works for both ip4 and ip6?
Yes, we use "ip -6" to get the ipv6 route info.
Can we remove "-6" if it simply works for both 4 and 6? What does "yes" means..
Previously, I think we shall append the "-6" to identify the ipv6 address, when we try to get the route info. Just now, I tested the command without the "-6", and it works for ipv6.
Dave, How about make this as an optimized patch to be posted laster, since the current code works well.
Thanks Minfei
On 06/19/15 at 11:56am, Minfei Huang wrote:
On 06/19/15 at 10:40am, Dave Young wrote:
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- if is_ipv6_host $_server; then
_netdev=`/sbin/ip -6 route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
Does "ip route get to hostname" works for both ip4 and ip6?
Yes, we use "ip -6" to get the ipv6 route info.
Can we remove "-6" if it simply works for both 4 and 6? What does "yes" means..
Previously, I think we shall append the "-6" to identify the ipv6 address, when we try to get the route info. Just now, I tested the command without the "-6", and it works for ipv6.
Dave, How about make this as an optimized patch to be posted laster, since the current code works well.
Because you will add a lot of "if" "else" based on the output, so I think we should do it now instead fix it later, it will make the patch cleaner easier to review.
Thanks Dave
On 06/23/15 at 03:27pm, Dave Young wrote:
On 06/19/15 at 11:56am, Minfei Huang wrote:
On 06/19/15 at 10:40am, Dave Young wrote:
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- if is_ipv6_host $_server; then
_netdev=`/sbin/ip -6 route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
Does "ip route get to hostname" works for both ip4 and ip6?
Yes, we use "ip -6" to get the ipv6 route info.
Can we remove "-6" if it simply works for both 4 and 6? What does "yes" means..
Previously, I think we shall append the "-6" to identify the ipv6 address, when we try to get the route info. Just now, I tested the command without the "-6", and it works for ipv6.
Dave, How about make this as an optimized patch to be posted laster, since the current code works well.
Because you will add a lot of "if" "else" based on the output, so I think we should do it now instead fix it later, it will make the patch cleaner easier to review.
Although it may be related a lot of code, it is sample to fix later.
Thanks Minfei
Now the dracut does not have enough info to setup the ipv6 to connect the iscsi target in the 2nd kernel, if the iscsi connecting is ipv6 protocal.
For this patch, we will parse the iscsi connecting, pass the config to the dracut to setup the ipv6 in the 2nd kernel.
Signed-off-by: Minfei Huang mhuang@redhat.com --- dracut-module-setup.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 615455e..8fd0cb8 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -526,6 +526,7 @@ kdump_get_iscsi_initiator() { kdump_setup_iscsi_device() { local path=$1 local tgt_name; local tgt_ipaddr; + local _srcaddr _prefix _netdev local username; local password; local userpwd_str; local username_in; local password_in; local userpwd_in_str; local netdev @@ -563,19 +564,33 @@ kdump_setup_iscsi_device() {
[ -n "$username_in" ] && userpwd_in_str=":$username_in:$password_in"
- netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \ - sed 's|.*dev (.*).*|\1|g') + if is_ipv6_host $tgt_ipaddr; then + netdev=$(/sbin/ip -6 route get to $(get_remote_host $tgt_ipaddr) | \ + sed 's|.*dev (.*).*|\1|g') + else + netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \ + sed 's|.*dev (.*).*|\1|g') + fi srcaddr=$(echo $netdev | awk '{ print $3; exit }') netdev=$(echo $netdev | awk '{ print $1; exit }')
- kdump_setup_netdev $netdev $srcaddr $tgt_ipaddr + kdump_setup_netdev $netdev $srcaddr $(get_remote_host $tgt_ipaddr)
# prepare netroot= command line - # FIXME: IPV6 addresses require explicit [] around $tgt_ipaddr # FIXME: Do we need to parse and set other parameters like protocol, port # iscsi_iface_name, netdev_name, LUN etc.
- netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name" + if is_ipv6_host $tgt_ipaddr; then + if `echo $tgt_ipaddr | grep -q "%"`; then + _prefix=${tgt_ipaddr%%*} + _netdev=${tgt_ipaddr#*%} + _netdev=$(kdump_setup_ifname $_netdev) + tgt_ipaddr=$_prefix%$_netdev + fi + netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@[$tgt_ipaddr]::::$tgt_name" + else + netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name" + fi
[[ -f $netroot_conf ]] || touch $netroot_conf
On 06/13/15 at 02:51pm, Minfei Huang wrote:
Now the dracut does not have enough info to setup the ipv6 to connect the iscsi target in the 2nd kernel, if the iscsi connecting is ipv6 protocal.
For this patch, we will parse the iscsi connecting, pass the config to the dracut to setup the ipv6 in the 2nd kernel.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 615455e..8fd0cb8 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -526,6 +526,7 @@ kdump_get_iscsi_initiator() { kdump_setup_iscsi_device() { local path=$1 local tgt_name; local tgt_ipaddr;
- local _srcaddr _prefix _netdev local username; local password; local userpwd_str; local username_in; local password_in; local userpwd_in_str; local netdev
@@ -563,19 +564,33 @@ kdump_setup_iscsi_device() {
[ -n "$username_in" ] && userpwd_in_str=":$username_in:$password_in"
- netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
sed 's|.*dev \(.*\).*|\1|g')
- if is_ipv6_host $tgt_ipaddr; then
netdev=$(/sbin/ip -6 route get to $(get_remote_host $tgt_ipaddr) | \
sed 's|.*dev \(.*\).*|\1|g')
- else
netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
sed 's|.*dev \(.*\).*|\1|g')
- fi
I wonder if we can directly use "ip route get to" instead of specific "-4" and "-6" If it works then we do not need above chunk
srcaddr=$(echo $netdev | awk '{ print $3; exit }') netdev=$(echo $netdev | awk '{ print $1; exit }')
- kdump_setup_netdev $netdev $srcaddr $tgt_ipaddr
- kdump_setup_netdev $netdev $srcaddr $(get_remote_host $tgt_ipaddr)
tgt_ipaddr is retrieved via iscsiadm, the tool should take care of ipv4 and ipv6 logic, what is the return value of iscsiadm, should we do extra parsing?
# prepare netroot= command line
# FIXME: IPV6 addresses require explicit [] around $tgt_ipaddr # FIXME: Do we need to parse and set other parameters like protocol, port # iscsi_iface_name, netdev_name, LUN etc.
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
- if is_ipv6_host $tgt_ipaddr; then
if `echo $tgt_ipaddr | grep -q "%"`; then
_prefix=${tgt_ipaddr%\%*}
_netdev=${tgt_ipaddr#*\%}
_netdev=$(kdump_setup_ifname $_netdev)
tgt_ipaddr=$_prefix%$_netdev
fi
Add prefix to an ipv6 address should be in a function, there's several places to use.
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@[$tgt_ipaddr]::::$tgt_name"
else
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
fi
[[ -f $netroot_conf ]] || touch $netroot_conf
Thanks Dave