Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 5a324d992b3382c26e5d9d448d8c857d73a4a6b4)
+++ uspace/app/ping/ping.c	(revision 0c96e6cbb2dc59f725618a8977250a3aa50919ad)
@@ -76,15 +76,18 @@
 };
 
-static addr32_t src;
-static addr32_t dest;
+static inet_addr_t src_addr;
+static inet_addr_t dest_addr;
 
 static bool repeat_forever = false;
 static size_t repeat_count = 1;
 
-static const char *short_options = "rn:";
+static const char *short_options = "46rn:";
 
 static void print_syntax(void)
 {
-	printf("Syntax: %s [-n <count>|-r] <host>\n", NAME);
+	printf("Syntax: %s [<options>] <host>\n", NAME);
+	printf("\t-n <count> Repeat the specified number of times\n");
+	printf("\t-r         Repeat forever\n");
+	printf("\t-4|-6      Use IPv4 or IPv6 destination host address\n");
 }
 
@@ -107,10 +110,4 @@
 static int ping_ev_recv(inetping_sdu_t *sdu)
 {
-	inet_addr_t src_addr;
-	inet_addr_set(sdu->src, &src_addr);
-	
-	inet_addr_t dest_addr;
-	inet_addr_set(sdu->dest, &dest_addr);
-	
 	char *asrc;
 	int rc = inet_addr_format(&src_addr, &asrc);
@@ -139,6 +136,6 @@
 	inetping_sdu_t sdu;
 	
-	sdu.src = src;
-	sdu.dest = dest;
+	sdu.src = src_addr;
+	sdu.dest = dest_addr;
 	sdu.seq_no = seq_no;
 	sdu.data = (void *) "foo";
@@ -221,4 +218,5 @@
 	char *adest = NULL;
 	char *sdest = NULL;
+	ip_ver_t ip_ver = ip_any;
 	
 	int rc = inetping_init(&ev_ops);
@@ -243,4 +241,10 @@
 			}
 			break;
+		case '4':
+			ip_ver = ip_v4;
+			break;
+		case '6':
+			ip_ver = ip_v6;
+			break;
 		default:
 			printf("Unknown option passed.\n");
@@ -257,9 +261,8 @@
 	
 	/* Parse destination address */
-	inet_addr_t dest_addr;
 	rc = inet_addr_parse(argv[optind], &dest_addr);
 	if (rc != EOK) {
 		/* Try interpreting as a host name */
-		rc = dnsr_name2host(argv[optind], &hinfo, ip_v4);
+		rc = dnsr_name2host(argv[optind], &hinfo, ip_ver);
 		if (rc != EOK) {
 			printf("Error resolving host '%s'.\n", argv[optind]);
@@ -270,20 +273,10 @@
 	}
 	
-	ip_ver_t ver = inet_addr_get(&dest_addr, &dest, NULL);
-	if (ver != ip_v4) {
-		printf("Destination '%s' is not an IPv4 address.\n",
-		    argv[optind]);
-		goto error;
-	}
-	
 	/* Determine source address */
-	rc = inetping_get_srcaddr(dest, &src);
+	rc = inetping_get_srcaddr(&dest_addr, &src_addr);
 	if (rc != EOK) {
 		printf("Failed determining source address.\n");
 		goto error;
 	}
-	
-	inet_addr_t src_addr;
-	inet_addr_set(src, &src_addr);
 	
 	rc = inet_addr_format(&src_addr, &asrc);
