Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 31e9fe0439e18929e4471ead9784560a4706b8a1)
+++ uspace/app/ping/ping.c	(revision c55cbbff53d7733e118facec5941d1afa63351ba)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2012 Jiri Svoboda
+ * Copyright (c) 2013 Jiri Svoboda
  * All rights reserved.
  *
@@ -37,4 +37,5 @@
 #include <errno.h>
 #include <fibril_synch.h>
+#include <inet/dnsr.h>
 #include <inet/inetping.h>
 #include <io/console.h>
@@ -213,4 +214,8 @@
 int main(int argc, char *argv[])
 {
+	dnsr_hostinfo_t *hinfo = NULL;
+	char *asrc = NULL;
+	char *adest = NULL;
+	char *sdest = NULL;
 	int rc;
 	int argi;
@@ -220,5 +225,5 @@
 		printf(NAME ": Failed connecting to internet ping service "
 		    "(%d).\n", rc);
-		return 1;
+		goto error;
 	}
 
@@ -233,5 +238,5 @@
 	if (argc - argi != 1) {
 		print_syntax();
-		return 1;
+		goto error;
 	}
 
@@ -239,7 +244,19 @@
 	rc = addr_parse(argv[argi], &dest_addr);
 	if (rc != EOK) {
-		printf(NAME ": Invalid address format.\n");
-		print_syntax();
-		return 1;
+		/* Try interpreting as a host name */
+		rc = dnsr_init();
+		if (rc != EOK) {
+			printf(NAME ": Failed connecting DNS resolution "
+			    "service (%d).\n", rc);
+			goto error;
+		}
+
+		rc = dnsr_name2host(argv[argi], &hinfo);
+		if (rc != EOK) {
+			printf(NAME ": Error resolving host '%s'.\n", argv[argi]);
+			goto error;
+		}
+
+		dest_addr = hinfo->addr;
 	}
 
@@ -248,6 +265,32 @@
 	if (rc != EOK) {
 		printf(NAME ": Failed determining source address.\n");
-		return 1;
-	}
+		goto error;
+	}
+
+	rc = addr_format(&src_addr, &asrc);
+	if (rc != EOK) {
+		printf(NAME ": Out of memory.\n");
+		goto error;
+	}
+
+	rc = addr_format(&dest_addr, &adest);
+	if (rc != EOK) {
+		printf(NAME ": Out of memory.\n");
+		goto error;
+	}
+
+	if (hinfo != NULL) {
+		rc = asprintf(&sdest, "%s (%s)", hinfo->name, adest);
+		if (rc < 0) {
+			printf(NAME ": Out of memory.\n");
+			goto error;
+		}
+	} else {
+		sdest = adest;
+		adest = NULL;
+	}
+
+	printf("Sending ICMP echo request from %s to %s.\n",
+	    asrc, sdest);
 
 	fid_t fid;
@@ -257,5 +300,5 @@
 		if (fid == 0) {
 			printf(NAME ": Failed creating transmit fibril.\n");
-			return 1;
+			goto error;
 		}
 
@@ -265,5 +308,5 @@
 		if (fid == 0) {
 			printf(NAME ": Failed creating input fibril.\n");
-			return 1;
+			goto error;
 		}
 
@@ -283,8 +326,18 @@
 	if (rc == ETIMEOUT) {
 		printf(NAME ": Echo request timed out.\n");
-		return 1;
-	}
-
+		goto error;
+	}
+
+	free(asrc);
+	free(adest);
+	free(sdest);
+	dnsr_hostinfo_destroy(hinfo);
 	return 0;
+error:
+	free(asrc);
+	free(adest);
+	free(sdest);
+	dnsr_hostinfo_destroy(hinfo);
+	return 1;
 }
 
Index: uspace/lib/c/generic/dnsr.c
===================================================================
--- uspace/lib/c/generic/dnsr.c	(revision 31e9fe0439e18929e4471ead9784560a4706b8a1)
+++ uspace/lib/c/generic/dnsr.c	(revision c55cbbff53d7733e118facec5941d1afa63351ba)
@@ -92,4 +92,7 @@
 void dnsr_hostinfo_destroy(dnsr_hostinfo_t *info)
 {
+	if (info == NULL)
+		return;
+
 	free(info->name);
 	free(info);
