On 02/17/15 at 06:05pm, Baoquan He wrote:
On 02/15/15 at 03:45pm, Minfei Huang wrote:
> Currently kdump doesn't support ipv6 nfs/ssh dump. Due to the lastet
> version of the Internet Protocal, it is a significant feature for kdump
> to enhance to support ipv6.
>
> Following is the special config for ipv6 protocal.
>
> For ipv6 nfs dump:
> Link scope, /etc/kdump.conf should be specified like
> "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt"
> otherwise
> "nfs [2001:db8:0:f101::2]:/mnt"
>
> For ipv6 ssh dump:
> Link scope, /etc/kdump.conf should be edited like
> "ssh root at fe80::5054:ff:fe48:ca80%eth0"
> otherwise
> "ssh root at 2001:db8:0:f101::2"
>
> Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> ---
> dracut-module-setup.sh | 65 ++++++++++++++++++++++++++++++++++----------------
> 1 file changed, 44 insertions(+), 21 deletions(-)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index 73e5087..1a1f03e 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#*\/}
Hi Minfei,
Did you also check the "ipcalc " whether it will has similar effect with
ipv4?
Hi, Bao!
Thank you for your review.
The ipv6 does not have the mask, only the prefix, default is 64.
> + _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
> }
>
It could be taken out to compose another patch as I said previously.
Ok, I will bisect it.
Thanks
Minfei
> @@ -286,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}"
> --
> 2.2.2
>