v7: - use interface function is_ipv6_address to check whether is ipv6 or not - fix some bugs v6: - construct the patches, split more small patches - wrap the similar functional code to make it more clearly v5: - modify the get_route function v4: - consistent the netdevice name to add the prefix "kdump-" before the ethX v3: - Support the static route v2: - Fix some bugs
Minfei Huang (4): mkdumprd: Add proper prefix "kdump-" before ethX in 2nd kernel kdump-lib: Add a new function to get the ip address kdump-lib: Add new libs to enhance kdump to support ipv6 ipv6: Enhance kdump to support ipv6
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 163 ++++++++++++++++++++++++++++++++++++------------- kdump-lib.sh | 47 +++++++++++--- mkdumprd | 16 ++++- 4 files changed, 175 insertions(+), 55 deletions(-)
The ipv6 link scope 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 --- dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_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 _netdev=${_srcaddr#*%} + _netdev=${_netdev%]*} + local _pre_netdev=$(kdump_setup_ifname $_netdev) + if [ "x"$_netdev != "x"$_pre_netdev ]; then + sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val" + kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then + if [[ "$1" =~ eth* ]]; then _ifname="kdump-$1" else _ifname="$1" diff --git a/mkdumprd b/mkdumprd index 4d251ba..34bed63 100644 --- a/mkdumprd +++ b/mkdumprd @@ -78,8 +78,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 01/15/15 at 07:27pm, Minfei Huang wrote:
The ipv6 link scope 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
dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_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 _netdev=${_srcaddr#*\%}
_netdev=${_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_netdev)
if [ "x"$_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then
- if [[ "$1" =~ eth* ]]; then _ifname="kdump-$1" else _ifname="$1"
diff --git a/mkdumprd b/mkdumprd index 4d251ba..34bed63 100644 --- a/mkdumprd +++ b/mkdumprd @@ -78,8 +78,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() {
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Minfei, it looks better though there's still some duplicate code between mkdumprd and dracut-module-setup.sh
Seem in module-setup.sh you are matching '%' but in mkdumprd you are matching 'fe80', is it possible to use same code?
Thanks Dave
On 01/22/15 at 03:18pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
The ipv6 link scope 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
dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_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 _netdev=${_srcaddr#*\%}
_netdev=${_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_netdev)
if [ "x"$_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then
- if [[ "$1" =~ eth* ]]; then _ifname="kdump-$1" else _ifname="$1"
diff --git a/mkdumprd b/mkdumprd index 4d251ba..34bed63 100644 --- a/mkdumprd +++ b/mkdumprd @@ -78,8 +78,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"
Hi, Dave!
We can't use the sign "%" to filte the link scope ipv6, becase the mount arguments $1 contains the sign "%". So we should use other specified sign(starting with characters "fe80") to filte the ipv6.
So we can't use the way what we filte the link scope ipv6 in the dracut-kdump-setup.sh.
Thanks Minfei
fi
- fi
- add_dracut_arg "--mount" "$_val"
}
add_dracut_sshkey() {
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Minfei, it looks better though there's still some duplicate code between mkdumprd and dracut-module-setup.sh
Seem in module-setup.sh you are matching '%' but in mkdumprd you are matching 'fe80', is it possible to use same code?
Thanks Dave
On 01/15/15 at 07:27pm, Minfei Huang wrote:
The ipv6 link scope 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
dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_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 _netdev=${_srcaddr#*\%}
_netdev=${_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_netdev)
if [ "x"$_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then
- if [[ "$1" =~ eth* ]]; then
The above bug fix should be in a seperate patch..
_ifname="kdump-$1" else _ifname="$1"
diff --git a/mkdumprd b/mkdumprd index 4d251ba..34bed63 100644 --- a/mkdumprd +++ b/mkdumprd @@ -78,8 +78,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() {
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 03:30pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
The ipv6 link scope 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
dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_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 _netdev=${_srcaddr#*\%}
_netdev=${_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_netdev)
if [ "x"$_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then
- if [[ "$1" =~ eth* ]]; then
The above bug fix should be in a seperate patch..
Hi, Dave!
If I just post the patch modified above code, it may be confuse by some guys why we just add the quote around the $1. Maybe we can block it to wait for other reviewer's comment.
Thanks Minfei
_ifname="kdump-$1" else _ifname="$1"
diff --git a/mkdumprd b/mkdumprd index 4d251ba..34bed63 100644 --- a/mkdumprd +++ b/mkdumprd @@ -78,8 +78,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() {
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 03:44pm, Minfei Huang wrote:
On 01/22/15 at 03:30pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
The ipv6 link scope 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
dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_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 _netdev=${_srcaddr#*\%}
_netdev=${_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_netdev)
if [ "x"$_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then
- if [[ "$1" =~ eth* ]]; then
The above bug fix should be in a seperate patch..
Hi, Dave!
If I just post the patch modified above code, it may be confuse by some guys why we just add the quote around the $1. Maybe we can block it to wait for other reviewer's comment.
It is an obvious fix for another patch. But I'm ok with it in this series.
Thanks Dave
On 01/15/15 at 07:27pm, Minfei Huang wrote:
The ipv6 link scope 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.
That will be good to provide a ipv6 address which can benifit reviewer. Otherwise I have to remind or look it up what it's like and why it cause trouble.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 20 ++++++++++++++++++++ kdump-lib.sh | 2 +- mkdumprd | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..1e81b42 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -339,6 +339,25 @@ default_dump_target_install_conf()
}
+kdump_ipv6_fixup()
The function name is too general. Could it be "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 _netdev=${_srcaddr#*\%}
_netdev=${_netdev%]*}
local _pre_netdev=$(kdump_setup_ifname $_netdev)
if [ "x"$_netdev != "x"$_pre_netdev ]; then
sed -i "s#$_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 > /tmp/$$-kdump.conf @@ -353,6 +372,7 @@ kdump_install_conf() { ;; ssh|nfs) kdump_install_net "$config_val"
kdump_ipv6_fixup "/tmp/$$-kdump.conf" ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val
diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..b886c5d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -146,7 +146,7 @@ check_save_path_fs() kdump_setup_ifname() { local _ifname
- if [[ $1 =~ eth* ]]; then
- if [[ "$1" =~ eth* ]]; then _ifname="kdump-$1" else _ifname="$1"
diff --git a/mkdumprd b/mkdumprd index 4d251ba..34bed63 100644 --- a/mkdumprd +++ b/mkdumprd @@ -78,8 +78,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() {
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Add a new function to parse the parameter, if the parameter is domain/hostname, not the ip address.
Signed-off-by: Minfei Huang mhuang@redhat.com --- kdump-lib.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b886c5d..6ca2b3a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -170,21 +170,28 @@ get_remote_host() echo $_config_val }
+get_ip_address() +{ + local _ip_address + + _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1` + _ip_address=${_ip_address:-$1} + echo $_ip_address +} + # check the remote server ip address tpye is_ipv6_target() { - local _server _server_tmp + 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 1 + _target=`get_remote_host $_target` + + echo $(get_ip_address $_target) | grep -q ":" }
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new function to parse the parameter, if the parameter is domain/hostname, not the ip address.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b886c5d..6ca2b3a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -170,21 +170,28 @@ get_remote_host() echo $_config_val }
+get_ip_address() +{
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
Function description is necessary. Can this patch be merged into patch 3/4 they are similar for introducing more ip address functions.
# check the remote server ip address tpye is_ipv6_target() {
- local _server _server_tmp
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 1
- _target=`get_remote_host $_target`
- echo $(get_ip_address $_target) | grep -q ":"
}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 03:28pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new function to parse the parameter, if the parameter is domain/hostname, not the ip address.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b886c5d..6ca2b3a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -170,21 +170,28 @@ get_remote_host() echo $_config_val }
+get_ip_address() +{
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
Function description is necessary. Can this patch be merged into patch 3/4 they are similar for introducing more ip address functions.
I think this patch doesn't concern with the patch 3/4. The patch 3/4 adds the new library function to filte the ipv6 address more simplier. For this patch, just wrap the function get_ip_address to parse the argument to get the real ip address. It will more clear to view the function.
Thanks Minfei
# check the remote server ip address tpye is_ipv6_target() {
- local _server _server_tmp
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 1
- _target=`get_remote_host $_target`
- echo $(get_ip_address $_target) | grep -q ":"
}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 05:33pm, Minfei Huang wrote:
On 01/22/15 at 03:28pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new function to parse the parameter, if the parameter is domain/hostname, not the ip address.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b886c5d..6ca2b3a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -170,21 +170,28 @@ get_remote_host() echo $_config_val }
+get_ip_address() +{
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
Function description is necessary. Can this patch be merged into patch 3/4 they are similar for introducing more ip address functions.
I think this patch doesn't concern with the patch 3/4. The patch 3/4 adds the new library function to filte the ipv6 address more simplier. For this patch, just wrap the function get_ip_address to parse the argument to get the real ip address. It will more clear to view the function.
Ok, but the patch description is not readable. Please improve the description and the function description.
Thanks Minfei
# check the remote server ip address tpye is_ipv6_target() {
- local _server _server_tmp
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 1
- _target=`get_remote_host $_target`
- echo $(get_ip_address $_target) | grep -q ":"
}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new function to parse the parameter, if the parameter is domain/hostname, not the ip address.
get_ip_address needn't be wrapped into a independent function since it's very simple and only called once. By face to face talking, I got it will be called later, in this case it's necessary. That will be good to mention it in log.
Otherwise patch looks good.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b886c5d..6ca2b3a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -170,21 +170,28 @@ get_remote_host() echo $_config_val }
+get_ip_address() +{
- local _ip_address
- _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
- _ip_address=${_ip_address:-$1}
- echo $_ip_address
+}
# check the remote server ip address tpye is_ipv6_target() {
- local _server _server_tmp
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 1
- _target=`get_remote_host $_target`
- echo $(get_ip_address $_target) | grep -q ":"
}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Add a new lib to check whether the parameter is ipv4 or ipv6. Return true, if the parameter is ipv6, otherwise return false.
Add a new lib to check whether the parameter is hostname/domain. Return turn, if the parameter is hostname/domain, otherwise return false.
Signed-off-by: Minfei Huang mhuang@redhat.com --- kdump-lib.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6ca2b3a..cb1bab7 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -179,6 +179,12 @@ get_ip_address() echo $_ip_address }
+is_ipv6_address() +{ + local _server=$(get_ip_address $1) + echo $_server | grep -q ":" +} + # check the remote server ip address tpye is_ipv6_target() { @@ -195,3 +201,17 @@ is_ipv6_target()
echo $(get_ip_address $_target) | grep -q ":" } + +is_hostname() +{ + local _hostname=`echo $1 | grep ":"` + +# ipv6 address + if [ -n "$_hostname" ]; then + return 1 + else +# if contains the character, it is hostname, +# otherwise is ipv4 address + echo $1 | grep -q "[a-zA-Z]" + fi +}
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new lib to check whether the parameter is ipv4 or ipv6. Return true, if the parameter is ipv6, otherwise return false.
Add a new lib to check whether the parameter is hostname/domain. Return turn, if the parameter is hostname/domain, otherwise return false.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6ca2b3a..cb1bab7 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -179,6 +179,12 @@ get_ip_address() echo $_ip_address }
+is_ipv6_address() +{
- local _server=$(get_ip_address $1)
- echo $_server | grep -q ":"
+}
For the functions in kdump-lib, a function comment is necessary so that we know what is the input, what is the expected output
# check the remote server ip address tpye is_ipv6_target() { @@ -195,3 +201,17 @@ is_ipv6_target()
echo $(get_ip_address $_target) | grep -q ":"
}
+is_hostname()
Function description is necessary
+{
- local _hostname=`echo $1 | grep ":"`
+# ipv6 address
Indent issue.
- if [ -n "$_hostname" ]; then
return 1
- else
+# if contains the character, it is hostname, +# otherwise is ipv4 address
Ditto
echo $1 | grep -q "[a-zA-Z]"
- fi
+}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 03:26pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new lib to check whether the parameter is ipv4 or ipv6. Return true, if the parameter is ipv6, otherwise return false.
Add a new lib to check whether the parameter is hostname/domain. Return turn, if the parameter is hostname/domain, otherwise return false.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6ca2b3a..cb1bab7 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -179,6 +179,12 @@ get_ip_address() echo $_ip_address }
+is_ipv6_address() +{
- local _server=$(get_ip_address $1)
- echo $_server | grep -q ":"
+}
For the functions in kdump-lib, a function comment is necessary so that we know what is the input, what is the expected output
Thanks.
Will attach the decription in the next version.
Thanks Minfei
# check the remote server ip address tpye is_ipv6_target() { @@ -195,3 +201,17 @@ is_ipv6_target()
echo $(get_ip_address $_target) | grep -q ":"
}
+is_hostname()
Function description is necessary
+{
- local _hostname=`echo $1 | grep ":"`
+# ipv6 address
Indent issue.
- if [ -n "$_hostname" ]; then
return 1
- else
+# if contains the character, it is hostname, +# otherwise is ipv4 address
Ditto
echo $1 | grep -q "[a-zA-Z]"
- fi
+}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new lib to check whether the parameter is ipv4 or ipv6. Return
~~~ you mean a new function?
true, if the parameter is ipv6, otherwise return false.
Add a new lib to check whether the parameter is hostname/domain. Return turn, if the parameter is hostname/domain, otherwise return false.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6ca2b3a..cb1bab7 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -179,6 +179,12 @@ get_ip_address() echo $_ip_address }
+is_ipv6_address() +{
- local _server=$(get_ip_address $1)
- echo $_server | grep -q ":"
+}
# check the remote server ip address tpye is_ipv6_target() { @@ -195,3 +201,17 @@ is_ipv6_target()
echo $(get_ip_address $_target) | grep -q ":"
}
+is_hostname() +{
- local _hostname=`echo $1 | grep ":"`
+# ipv6 address
- if [ -n "$_hostname" ]; then
return 1
- else
+# if contains the character, it is hostname, +# otherwise is ipv4 address
echo $1 | grep -q "[a-zA-Z]"
- fi
+}
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com --- dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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 | 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 1e81b42..6a7da8c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -70,14 +70,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_address $_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 }
@@ -191,27 +202,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_address $_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 @@ -268,24 +297,36 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1` - - _need_dns=`echo $_server|grep "[a-zA-Z]"` - [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1` + _server=`get_remote_host $config_val`
- _netdev=`/sbin/ip route get to $_server 2>&1` - [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 + is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- #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 is_ipv6_address $_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 $9}'|head -n 1` + _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1` + else + # we are on the same subnet + _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 + #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` + 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` + fi fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}" @@ -439,6 +480,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 @@ -476,19 +518,34 @@ 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_address $tgt_ipaddr; then +# filer out the network deivce if the target ip address is scope link address of ipv6 + 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_address $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
@@ -621,6 +678,8 @@ install() { inst "/bin/dd" "/bin/dd" 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"
Hi, Minfei
Overall structure looks good to me except two nickpicks.
On 01/15/15 at 07:28pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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'`
Per previous discussion it should work for most cases with minimal modifications we can address the issue if we have a bug report.
As for the code itself, a nitpick: In case ipv4 & ipv6, there are multiple line, should filter with |head -n 1 ?
[ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
_host="${_host##*inet }"
_host=`echo $_host | 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 1e81b42..6a7da8c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -70,14 +70,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_address $_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}::"
fifi
}
@@ -191,27 +202,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_address $_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 @@ -268,24 +297,36 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`get_remote_host $config_val`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- #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 is_ipv6_address $_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 $9}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
else
# we are on the same subnet
_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
#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`
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`
fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}"
@@ -439,6 +480,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
@@ -476,19 +518,34 @@ 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_address $tgt_ipaddr; then
+# filer out the network deivce if the target ip address is scope link address of ipv6
Indent issue.
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_address $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
@@ -621,6 +678,8 @@ install() { inst "/bin/dd" "/bin/dd" 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"
-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 03:39pm, Dave Young wrote:
Hi, Minfei
Overall structure looks good to me except two nickpicks.
On 01/15/15 at 07:28pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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'`
Per previous discussion it should work for most cases with minimal modifications we can address the issue if we have a bug report.
As for the code itself, a nitpick: In case ipv4 & ipv6, there are multiple line, should filter with |head -n 1 ?
Hi, Dave!
It works when the ipv4 & ipv6 is up. We will use the command "cut -d' ' -f2" to get the ip address who we need.
The HOST_IP is correct, though the variable _host contains ipv4 & ipv6 config.
[ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
_host="${_host##*inet }"
_host=`echo $_host | 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 1e81b42..6a7da8c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -70,14 +70,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_address $_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}::"
fifi
}
@@ -191,27 +202,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_address $_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 @@ -268,24 +297,36 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`get_remote_host $config_val`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- #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 is_ipv6_address $_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 $9}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
else
# we are on the same subnet
_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
#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`
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`
fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}"
@@ -439,6 +480,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
@@ -476,19 +518,34 @@ 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_address $tgt_ipaddr; then
+# filer out the network deivce if the target ip address is scope link address of ipv6
Indent issue.
Thanks
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_address $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
@@ -621,6 +678,8 @@ install() { inst "/bin/dd" "/bin/dd" 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"
-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 01/22/15 at 04:51pm, Minfei Huang wrote:
On 01/22/15 at 03:39pm, Dave Young wrote:
Hi, Minfei
Overall structure looks good to me except two nickpicks.
On 01/15/15 at 07:28pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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'`
Per previous discussion it should work for most cases with minimal modifications we can address the issue if we have a bug report.
As for the code itself, a nitpick: In case ipv4 & ipv6, there are multiple line, should filter with |head -n 1 ?
Hi, Dave!
It works when the ipv4 & ipv6 is up. We will use the command "cut -d' ' -f2" to get the ip address who we need.
The HOST_IP is correct, though the variable _host contains ipv4 & ipv6 config.
The variable will get the value from first line, but code itself looks odd..
Thanks Dave
On 01/15/15 at 07:28pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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 | cut -d' ' -f2`
Why is above change?
Hi Minfei,
Don't you think this patch is too big? It's not easy to review. For me, I will make a patch for above change, then we can skip it next time if we think it's OK this time. From patch log, I didn't get hint how to review it, just get a general information that it's a ipv6 enhancement.
I have personal suggestion in below inline comment.
_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 1e81b42..6a7da8c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -70,14 +70,25 @@ kdump_setup_dns() { #$2: srcaddr #if it use static ip echo it, or echo null
For static info checking and handling, it should be separated as a patch.
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_address $_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}::"
fifi
}
@@ -191,27 +202,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'
route handling either.
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_address $_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
Please take below change as a single patch or two.
@@ -268,24 +297,36 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`get_remote_host $config_val`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- #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 is_ipv6_address $_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 $9}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
else
# we are on the same subnet
_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
#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`
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`
fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}"
@@ -439,6 +480,7 @@ kdump_get_iscsi_initiator() {
And iscsu handling.
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
@@ -476,19 +518,34 @@ 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_address $tgt_ipaddr; then
+# filer out the network deivce if the target ip address is scope link address of ipv6
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_address $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
And this. You can merge it with other general handling or a single patch.
At last, it's least we need add some description in document, after all it's a new feature.
Please try to split it into several several patches according to functionality block. Each time I want to review this patch, I have you apply them and read all code to understand. With small patches, it's easier to you write the patch log, and you needn't take care of it each time as soon as reviewers think it's OK and offer a ACK.
Persona opinion.
Thanks Baoquan
@@ -621,6 +678,8 @@ install() { inst "/bin/dd" "/bin/dd" 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"
-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Hi, Bao!
Thanks for your review.
Maybe I should re-construct the patchset to make it more clear. For simple patch, it is more confortable to review or modify.
Thanks Minfei
On 02/11/15 at 10:23am, Baoquan He wrote:
On 01/15/15 at 07:28pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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 | cut -d' ' -f2`
Why is above change?
Hi Minfei,
Don't you think this patch is too big? It's not easy to review. For me, I will make a patch for above change, then we can skip it next time if we think it's OK this time. From patch log, I didn't get hint how to review it, just get a general information that it's a ipv6 enhancement.
I have personal suggestion in below inline comment.
_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 1e81b42..6a7da8c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -70,14 +70,25 @@ kdump_setup_dns() { #$2: srcaddr #if it use static ip echo it, or echo null
For static info checking and handling, it should be separated as a patch.
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_address $_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}::"
fifi
}
@@ -191,27 +202,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'
route handling either.
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_address $_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
Please take below change as a single patch or two.
@@ -268,24 +297,36 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`get_remote_host $config_val`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- #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 is_ipv6_address $_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 $9}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
else
# we are on the same subnet
_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
#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`
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`
fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}"
@@ -439,6 +480,7 @@ kdump_get_iscsi_initiator() {
And iscsu handling.
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
@@ -476,19 +518,34 @@ 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_address $tgt_ipaddr; then
+# filer out the network deivce if the target ip address is scope link address of ipv6
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_address $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
And this. You can merge it with other general handling or a single patch.
At last, it's least we need add some description in document, after all it's a new feature.
Please try to split it into several several patches according to functionality block. Each time I want to review this patch, I have you apply them and read all code to understand. With small patches, it's easier to you write the patch log, and you needn't take care of it each time as soon as reviewers think it's OK and offer a ACK.
Persona opinion.
Thanks Baoquan
@@ -621,6 +678,8 @@ install() { inst "/bin/dd" "/bin/dd" 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"
-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 02/11/15 at 11:14am, Minfei Huang wrote:
Hi, Bao!
Thanks for your review.
Maybe I should re-construct the patchset to make it more clear. For simple patch, it is more confortable to review or modify.
Yes, totally agree.
There isn't a standard on how to split patch. I personally think if you can write what you have done in patch log and reviewer can understand it only from patch log, then this should be a well split patch.
Thanks Minfei
On 02/11/15 at 10:23am, Baoquan He wrote:
On 01/15/15 at 07:28pm, Minfei Huang wrote:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. So it is a significant feture for kdump to enhance to support ipv6.
What is the main difference in userspace between ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root at fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root at 2001:db8:0:f101::2"
How to create a ipv6 enviromnet. 1): Reserving two beaker machine with family fedora. 2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address by "ip address del ipv4-address dev nicname" 3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-kdump.sh | 4 +- dracut-module-setup.sh | 143 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 44 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index e062665..7e6b810 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 | cut -d' ' -f2`
Why is above change?
Hi Minfei,
Don't you think this patch is too big? It's not easy to review. For me, I will make a patch for above change, then we can skip it next time if we think it's OK this time. From patch log, I didn't get hint how to review it, just get a general information that it's a ipv6 enhancement.
I have personal suggestion in below inline comment.
_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 1e81b42..6a7da8c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -70,14 +70,25 @@ kdump_setup_dns() { #$2: srcaddr #if it use static ip echo it, or echo null
For static info checking and handling, it should be separated as a patch.
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_address $_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}::"
fifi
}
@@ -191,27 +202,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'
route handling either.
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_address $_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
Please take below change as a single patch or two.
@@ -268,24 +297,36 @@ kdump_install_net() { local _server _netdev _srcaddr local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`get_remote_host $config_val`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- is_hostname $_server && _server=`getent ahosts $_server|cut -d' ' -f1`
- #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 is_ipv6_address $_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 $9}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
else
# we are on the same subnet
_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
#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`
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`
fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}" "${_server}"
@@ -439,6 +480,7 @@ kdump_get_iscsi_initiator() {
And iscsu handling.
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
@@ -476,19 +518,34 @@ 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_address $tgt_ipaddr; then
+# filer out the network deivce if the target ip address is scope link address of ipv6
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_address $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
And this. You can merge it with other general handling or a single patch.
At last, it's least we need add some description in document, after all it's a new feature.
Please try to split it into several several patches according to functionality block. Each time I want to review this patch, I have you apply them and read all code to understand. With small patches, it's easier to you write the patch log, and you needn't take care of it each time as soon as reviewers think it's OK and offer a ACK.
Persona opinion.
Thanks Baoquan
@@ -621,6 +678,8 @@ install() { inst "/bin/dd" "/bin/dd" 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"
-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec