Index: uspace/app/inet/inet.c
===================================================================
--- uspace/app/inet/inet.c	(revision 9e7898e4e94c2715de7d87c6aa29d0768cdbaf2e)
+++ uspace/app/inet/inet.c	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2012 Jiri Svoboda
+ * Copyright (c) 2013 Jiri Svoboda
  * All rights reserved.
  *
@@ -36,4 +36,5 @@
 
 #include <errno.h>
+#include <inet/addr.h>
 #include <inet/inetcfg.h>
 #include <loc.h>
@@ -54,95 +55,4 @@
 }
 
-static int naddr_parse(const char *text, inet_naddr_t *naddr)
-{
-	unsigned long a[4], bits;
-	char *cp = (char *)text;
-	int i;
-
-	for (i = 0; i < 3; i++) {
-		a[i] = strtoul(cp, &cp, 10);
-		if (*cp != '.')
-			return EINVAL;
-		++cp;
-	}
-
-	a[3] = strtoul(cp, &cp, 10);
-	if (*cp != '/')
-		return EINVAL;
-	++cp;
-
-	bits = strtoul(cp, &cp, 10);
-	if (*cp != '\0')
-		return EINVAL;
-
-	naddr->ipv4 = 0;
-	for (i = 0; i < 4; i++) {
-		if (a[i] > 255)
-			return EINVAL;
-		naddr->ipv4 = (naddr->ipv4 << 8) | a[i];
-	}
-
-	if (bits > 31)
-		return EINVAL;
-
-	naddr->bits = bits;
-	return EOK;
-}
-
-static int addr_parse(const char *text, inet_addr_t *addr)
-{
-	unsigned long a[4];
-	char *cp = (char *)text;
-	int i;
-
-	for (i = 0; i < 3; i++) {
-		a[i] = strtoul(cp, &cp, 10);
-		if (*cp != '.')
-			return EINVAL;
-		++cp;
-	}
-
-	a[3] = strtoul(cp, &cp, 10);
-	if (*cp != '\0')
-		return EINVAL;
-
-	addr->ipv4 = 0;
-	for (i = 0; i < 4; i++) {
-		if (a[i] > 255)
-			return EINVAL;
-		addr->ipv4 = (addr->ipv4 << 8) | a[i];
-	}
-
-	return EOK;
-}
-
-static int naddr_format(inet_naddr_t *naddr, char **bufp)
-{
-	int rc;
-
-	rc = asprintf(bufp, "%d.%d.%d.%d/%d", naddr->ipv4 >> 24,
-	    (naddr->ipv4 >> 16) & 0xff, (naddr->ipv4 >> 8) & 0xff,
-	    naddr->ipv4 & 0xff, naddr->bits);
-
-	if (rc < 0)
-		return ENOMEM;
-
-	return EOK;
-}
-
-static int addr_format(inet_addr_t *addr, char **bufp)
-{
-	int rc;
-
-	rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
-	    (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
-	    addr->ipv4 & 0xff);
-
-	if (rc < 0)
-		return ENOMEM;
-
-	return EOK;
-}
-
 static int addr_create_static(int argc, char *argv[])
 {
@@ -178,5 +88,5 @@
 	}
 
-	rc = naddr_parse(addr_spec, &naddr);
+	rc = inet_naddr_parse(addr_spec, &naddr);
 	if (rc != EOK) {
 		printf(NAME ": Invalid network address format '%s'.\n",
@@ -267,5 +177,5 @@
 	route_name = argv[2];
 
-	rc = naddr_parse(dest_str, &dest);
+	rc = inet_naddr_parse(dest_str, &dest);
 	if (rc != EOK) {
 		printf(NAME ": Invalid network address format '%s'.\n",
@@ -274,5 +184,5 @@
 	}
 
-	rc = addr_parse(router_str, &router);
+	rc = inet_addr_parse(router_str, &router);
 	if (rc != EOK) {
 		printf(NAME ": Invalid address format '%s'.\n", router_str);
@@ -366,5 +276,5 @@
 		}
 
-		rc = naddr_format(&ainfo.naddr, &astr);
+		rc = inet_naddr_format(&ainfo.naddr, &astr);
 		if (rc != EOK) {
 			printf("Memory allocation failed.\n");
@@ -430,5 +340,5 @@
 		}
 
-		rc = naddr_format(&srinfo.dest, &dest_str);
+		rc = inet_naddr_format(&srinfo.dest, &dest_str);
 		if (rc != EOK) {
 			printf("Memory allocation failed.\n");
@@ -437,5 +347,5 @@
 		}
 
-		rc = addr_format(&srinfo.router, &router_str);
+		rc = inet_addr_format(&srinfo.router, &router_str);
 		if (rc != EOK) {
 			printf("Memory allocation failed.\n");
Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 9e7898e4e94c2715de7d87c6aa29d0768cdbaf2e)
+++ uspace/app/ping/ping.c	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -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/addr.h>
 #include <inet/inetping.h>
 #include <io/console.h>
@@ -71,45 +72,4 @@
 }
 
-static int addr_parse(const char *text, inet_addr_t *addr)
-{
-	unsigned long a[4];
-	char *cp = (char *)text;
-	int i;
-
-	for (i = 0; i < 3; i++) {
-		a[i] = strtoul(cp, &cp, 10);
-		if (*cp != '.')
-			return EINVAL;
-		++cp;
-	}
-
-	a[3] = strtoul(cp, &cp, 10);
-	if (*cp != '\0')
-		return EINVAL;
-
-	addr->ipv4 = 0;
-	for (i = 0; i < 4; i++) {
-		if (a[i] > 255)
-			return EINVAL;
-		addr->ipv4 = (addr->ipv4 << 8) | a[i];
-	}
-
-	return EOK;
-}
-
-static int addr_format(inet_addr_t *addr, char **bufp)
-{
-	int rc;
-
-	rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
-	    (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
-	    addr->ipv4 & 0xff);
-
-	if (rc < 0)
-		return ENOMEM;
-
-	return EOK;
-}
-
 static void ping_signal_done(void)
 {
@@ -125,9 +85,9 @@
 	int rc;
 
-	rc = addr_format(&sdu->src, &asrc);
+	rc = inet_addr_format(&sdu->src, &asrc);
 	if (rc != EOK)
 		return ENOMEM;
 
-	rc = addr_format(&sdu->dest, &adest);
+	rc = inet_addr_format(&sdu->dest, &adest);
 	if (rc != EOK) {
 		free(asrc);
@@ -237,5 +197,5 @@
 
 	/* Parse destination address */
-	rc = addr_parse(argv[argi], &dest_addr);
+	rc = inet_addr_parse(argv[argi], &dest_addr);
 	if (rc != EOK) {
 		printf(NAME ": Invalid address format.\n");
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 9e7898e4e94c2715de7d87c6aa29d0768cdbaf2e)
+++ uspace/lib/c/Makefile	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -91,4 +91,5 @@
 	generic/task.c \
 	generic/futex.c \
+	generic/inet/addr.c \
 	generic/inet.c \
 	generic/inetcfg.c \
Index: uspace/lib/c/generic/inet/addr.c
===================================================================
--- uspace/lib/c/generic/inet/addr.c	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
+++ uspace/lib/c/generic/inet/addr.c	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2013 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file Internet address parsing and formatting.
+ */
+
+#include <errno.h>
+#include <inet/addr.h>
+#include <stdio.h>
+
+/** Parse network address.
+ *
+ * @param text	Network address in CIDR notation (a.b.c.d/w)
+ * @param naddr	Place to store network address
+ *
+ * @return 	EOK on success, EINVAL if input is not in valid format
+ */
+int inet_naddr_parse(const char *text, inet_naddr_t *naddr)
+{
+	unsigned long a[4], bits;
+	char *cp = (char *)text;
+	int i;
+
+	for (i = 0; i < 3; i++) {
+		a[i] = strtoul(cp, &cp, 10);
+		if (*cp != '.')
+			return EINVAL;
+		++cp;
+	}
+
+	a[3] = strtoul(cp, &cp, 10);
+	if (*cp != '/')
+		return EINVAL;
+	++cp;
+
+	bits = strtoul(cp, &cp, 10);
+	if (*cp != '\0')
+		return EINVAL;
+
+	naddr->ipv4 = 0;
+	for (i = 0; i < 4; i++) {
+		if (a[i] > 255)
+			return EINVAL;
+		naddr->ipv4 = (naddr->ipv4 << 8) | a[i];
+	}
+
+	if (bits > 31)
+		return EINVAL;
+
+	naddr->bits = bits;
+	return EOK;
+}
+
+/** Parse node address.
+ *
+ * @param text	Network address in dot notation (a.b.c.d)
+ * @param addr	Place to store node address
+ *
+ * @return 	EOK on success, EINVAL if input is not in valid format
+ */
+int inet_addr_parse(const char *text, inet_addr_t *addr)
+{
+	unsigned long a[4];
+	char *cp = (char *)text;
+	int i;
+
+	for (i = 0; i < 3; i++) {
+		a[i] = strtoul(cp, &cp, 10);
+		if (*cp != '.')
+			return EINVAL;
+		++cp;
+	}
+
+	a[3] = strtoul(cp, &cp, 10);
+	if (*cp != '\0')
+		return EINVAL;
+
+	addr->ipv4 = 0;
+	for (i = 0; i < 4; i++) {
+		if (a[i] > 255)
+			return EINVAL;
+		addr->ipv4 = (addr->ipv4 << 8) | a[i];
+	}
+
+	return EOK;
+}
+
+/** Format network address.
+ *
+ * @param naddr	Network address
+ * @param bufp	Place to store pointer to formatted string (CIDR notation)
+ *
+ * @return 	EOK on success, ENOMEM if out of memory.
+ */
+int inet_naddr_format(inet_naddr_t *naddr, char **bufp)
+{
+	int rc;
+
+	rc = asprintf(bufp, "%d.%d.%d.%d/%d", naddr->ipv4 >> 24,
+	    (naddr->ipv4 >> 16) & 0xff, (naddr->ipv4 >> 8) & 0xff,
+	    naddr->ipv4 & 0xff, naddr->bits);
+
+	if (rc < 0)
+		return ENOMEM;
+
+	return EOK;
+}
+
+/** Format node address.
+ *
+ * @param addr	Node address
+ * @param bufp	Place to store pointer to formatted string (dot notation)
+ *
+ * @return 	EOK on success, ENOMEM if out of memory.
+ */
+int inet_addr_format(inet_addr_t *addr, char **bufp)
+{
+	int rc;
+
+	rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
+	    (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
+	    addr->ipv4 & 0xff);
+
+	if (rc < 0)
+		return ENOMEM;
+
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/inet/addr.h
===================================================================
--- uspace/lib/c/include/inet/addr.h	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
+++ uspace/lib/c/include/inet/addr.h	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_ADDR_H_
+#define LIBC_INET_ADDR_H_
+
+#include <inet/inet.h>
+
+extern int inet_naddr_parse(const char *, inet_naddr_t *);
+extern int inet_addr_parse(const char *, inet_addr_t *);
+extern int inet_naddr_format(inet_naddr_t *, char **);
+extern int inet_addr_format(inet_addr_t *, char **);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/inet/inet.h
===================================================================
--- uspace/lib/c/include/inet/inet.h	(revision 9e7898e4e94c2715de7d87c6aa29d0768cdbaf2e)
+++ uspace/lib/c/include/inet/inet.h	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -40,7 +40,16 @@
 #define INET_TTL_MAX 255
 
+/** Node address */
 typedef struct {
 	uint32_t ipv4;
 } inet_addr_t;
+
+/** Network address */
+typedef struct {
+	/** Address */
+	uint32_t ipv4;
+	/** Number of valid bits in @c ipv4 */
+	int bits;
+} inet_naddr_t;
 
 typedef struct {
Index: uspace/lib/c/include/inet/inetcfg.h
===================================================================
--- uspace/lib/c/include/inet/inetcfg.h	(revision 9e7898e4e94c2715de7d87c6aa29d0768cdbaf2e)
+++ uspace/lib/c/include/inet/inetcfg.h	(revision 3495654bdc189479ad81ce8b577ef5be40a481c3)
@@ -38,12 +38,4 @@
 #include <inet/inet.h>
 #include <sys/types.h>
-
-/** Network address */
-typedef struct {
-	/** Address */
-	uint32_t ipv4;
-	/** Number of valid bits in @c ipv4 */
-	int bits;
-} inet_naddr_t;
 
 /** Address object info */
