diff --git a/ChangeLog b/ChangeLog index 56708e08f..8cf7d7d10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-20 Vladimir Serbinenko + + * grub-core/net/dns.c (grub_cmd_nslookup): Use configured DNS servers if + none is explicitly specified. + 2012-06-20 Vladimir Serbinenko * grub-core/net/dns.c (grub_net_add_dns_server): Don't erase old servers diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c index 26ce52edb..d0b391aa1 100644 --- a/grub-core/net/dns.c +++ b/grub-core/net/dns.c @@ -604,18 +604,23 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) { grub_err_t err; - struct grub_net_network_level_address server; grub_size_t naddresses, i; struct grub_net_network_level_address *addresses; - if (argc != 2) + if (argc != 2 && argc != 1) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected")); - err = grub_net_resolve_address (args[1], &server); - if (err) - return err; + if (argc == 2) + { + struct grub_net_network_level_address server; + err = grub_net_resolve_address (args[1], &server); + if (err) + return err; + err = grub_net_dns_lookup (args[0], &server, 1, &naddresses, + &addresses, 0); + } + else + err = grub_net_dns_lookup (args[0], dns_servers, dns_nservers, &naddresses, + &addresses, 0); - err = grub_net_dns_lookup (args[0], &server, 1, &naddresses, &addresses, 0); - if (err) - return err; for (i = 0; i < naddresses; i++) { char buf[GRUB_NET_MAX_STR_ADDR_LEN];