On 10/28/14 at 02:15pm, Baoquan He wrote:
On 10/23/14 at 10:47am, Minfei Huang wrote:
--- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -70,14 +70,24 @@ kdump_setup_dns() {
> local _server _netdev _srcaddr
> local config_val="$1"
... skip ...
>
> - _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
> + _server=`get_remote_host $config_val`
>
> - _need_dns=`echo $_server|grep "[a-zA-Z]"`
Below I have the same concerns about the "getent hosts". "getent
hosts"
uses gethostbyaddr() to get addr while "getent ahosts" uses
getaddrinfo(). Checking manpage of gethostbyaddr(), I got below
information:
~~~~~~~~~~~~
The gethostbyname*() and gethostbyaddr*() functions are obsolete.
Applications should use getaddrinfo(3) and getnameinfo(3) instead.
~~~~~~~~~~~~~~
I think we should use "getent ahosts", it's the latest.
The command "getent ahosts google.com" will return the result by the
order of ipv4, ipv6.
If the target has ipv6 address assigned, using the command
"getent hosts google.com" will show you the ipv6 address, otherwise
show you the ipv4 address.
So the I prefer to use the command "getent hosts" to get the default type of
ip address which is assigned by the target.
> - [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut
-d' ' -f1`
> + if is_ipv6_target; then
> + _need_dns=`echo $_server|grep "[:]"`
> @@ -583,6 +612,8 @@ install() {
> inst "/bin/date" "/bin/date"
> inst "/bin/sync" "/bin/sync"
> inst "/bin/cut" "/bin/cut"
> + inst "/bin/getent" "/bin/getent"
In dracut-module-setup.sh there has been a getent calling, do we have to
include it again?
> + inst "/bin/head" "/bin/head"
> inst "/sbin/makedumpfile" "/sbin/makedumpfile"
...
skip ...