Index: uspace/app/dnscfg/dnscfg.c
===================================================================
--- uspace/app/dnscfg/dnscfg.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/dnscfg/dnscfg.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -36,5 +36,5 @@
 
 #include <errno.h>
-#include <inet/addr2.h>
+#include <inet/addr.h>
 #include <inet/dnsr.h>
 #include <ipc/services.h>
@@ -71,6 +71,6 @@
 	char *srv_addr  = argv[0];
 	
-	inet2_addr_t addr;
-	int rc = inet2_addr_parse(srv_addr, &addr);
+	inet_addr_t addr;
+	int rc = inet_addr_parse(srv_addr, &addr);
 	
 	if (rc != EOK) {
@@ -91,6 +91,6 @@
 static int dnscfg_unset_ns(void)
 {
-	inet2_addr_t addr;
-	inet2_addr_empty(&addr);
+	inet_addr_t addr;
+	inet_addr_any(&addr);
 	
 	int rc = dnsr_set_srvaddr(&addr);
@@ -106,5 +106,5 @@
 static int dnscfg_print(void)
 {
-	inet2_addr_t addr;
+	inet_addr_t addr;
 	int rc = dnsr_get_srvaddr(&addr);
 	if (rc != EOK) {
@@ -114,5 +114,5 @@
 	
 	char *addr_str;
-	rc = inet2_addr_format(&addr, &addr_str);
+	rc = inet_addr_format(&addr, &addr_str);
 	if (rc != EOK) {
 		printf("%s: Out of memory.\n", NAME);
Index: uspace/app/dnsres/dnsres.c
===================================================================
--- uspace/app/dnsres/dnsres.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/dnsres/dnsres.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -34,5 +34,5 @@
 
 #include <errno.h>
-#include <inet/addr2.h>
+#include <inet/addr.h>
 #include <inet/dnsr.h>
 #include <stdio.h>
@@ -66,5 +66,5 @@
 	}
 
-	rc = inet2_addr_format(&hinfo->addr, &saddr);
+	rc = inet_addr_format(&hinfo->addr, &saddr);
 	if (rc != EOK) {
 		dnsr_hostinfo_destroy(hinfo);
Index: uspace/app/nettest1/nettest1.c
===================================================================
--- uspace/app/nettest1/nettest1.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/nettest1/nettest1.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -360,5 +360,5 @@
 		}
 		
-		rc = inet2_addr_sockaddr_in(&hinfo->addr, &address_in);
+		rc = inet_addr_sockaddr_in(&hinfo->addr, &address_in);
 		if (rc != EOK) {
 			printf("Host '%s' not resolved as IPv4 address.\n", argv[argc - 1]);
Index: uspace/app/nettest2/nettest2.c
===================================================================
--- uspace/app/nettest2/nettest2.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/nettest2/nettest2.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -306,5 +306,5 @@
 		}
 		
-		rc = inet2_addr_sockaddr_in(&hinfo->addr, &address_in);
+		rc = inet_addr_sockaddr_in(&hinfo->addr, &address_in);
 		if (rc != EOK) {
 			printf("Host '%s' not resolved as IPv4 address.\n", argv[argc - 1]);
Index: uspace/app/nettest3/nettest3.c
===================================================================
--- uspace/app/nettest3/nettest3.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/nettest3/nettest3.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -84,5 +84,5 @@
 			}
 			
-			rc = inet2_addr_sockaddr_in(&hinfo->addr, &addr);
+			rc = inet_addr_sockaddr_in(&hinfo->addr, &addr);
 			if (rc != EOK) {
 				printf("Host '%s' not resolved as IPv4 address.\n", argv[1]);
Index: uspace/app/nterm/conn.c
===================================================================
--- uspace/app/nterm/conn.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/nterm/conn.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -91,5 +91,5 @@
 		}
 		
-		rc = inet2_addr_sockaddr_in(&hinfo->addr, &addr);
+		rc = inet_addr_sockaddr_in(&hinfo->addr, &addr);
 		if (rc != EOK) {
 			printf("Host '%s' not resolved as IPv4 address.\n", addr_s);
Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/app/ping/ping.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -83,17 +83,17 @@
 static int ping_ev_recv(inetping_sdu_t *sdu)
 {
-	inet2_addr_t src_addr;
-	inet2_addr_unpack(sdu->src, &src_addr);
-	
-	inet2_addr_t dest_addr;
-	inet2_addr_unpack(sdu->dest, &dest_addr);
+	inet_addr_t src_addr;
+	inet_addr_unpack(sdu->src, &src_addr);
+	
+	inet_addr_t dest_addr;
+	inet_addr_unpack(sdu->dest, &dest_addr);
 	
 	char *asrc;
-	int rc = inet2_addr_format(&src_addr, &asrc);
+	int rc = inet_addr_format(&src_addr, &asrc);
 	if (rc != EOK)
 		return ENOMEM;
 	
 	char *adest;
-	rc = inet2_addr_format(&dest_addr, &adest);
+	rc = inet_addr_format(&dest_addr, &adest);
 	if (rc != EOK) {
 		free(asrc);
@@ -207,6 +207,6 @@
 
 	/* Parse destination address */
-	inet2_addr_t dest_addr;
-	rc = inet2_addr_parse(argv[argi], &dest_addr);
+	inet_addr_t dest_addr;
+	rc = inet_addr_parse(argv[argi], &dest_addr);
 	if (rc != EOK) {
 		/* Try interpreting as a host name */
@@ -220,5 +220,5 @@
 	}
 	
-	rc = inet2_addr_pack(&dest_addr, &dest);
+	rc = inet_addr_pack(&dest_addr, &dest);
 	if (rc != EOK) {
 		printf(NAME ": Destination '%s' is not an IPv4 address.\n",
@@ -234,8 +234,8 @@
 	}
 	
-	inet2_addr_t src_addr;
-	inet2_addr_unpack(src, &src_addr);
-	
-	rc = inet2_addr_format(&src_addr, &asrc);
+	inet_addr_t src_addr;
+	inet_addr_unpack(src, &src_addr);
+	
+	rc = inet_addr_format(&src_addr, &asrc);
 	if (rc != EOK) {
 		printf(NAME ": Out of memory.\n");
@@ -243,5 +243,5 @@
 	}
 	
-	rc = inet2_addr_format(&dest_addr, &adest);
+	rc = inet_addr_format(&dest_addr, &adest);
 	if (rc != EOK) {
 		printf(NAME ": Out of memory.\n");
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/Makefile	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -93,5 +93,4 @@
 	generic/futex.c \
 	generic/inet/addr.c \
-	generic/inet/addr2.c \
 	generic/inet.c \
 	generic/inetcfg.c \
Index: uspace/lib/c/generic/dnsr.c
===================================================================
--- uspace/lib/c/generic/dnsr.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/dnsr.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -108,5 +108,5 @@
 
 	info->cname = str_dup(cname_buf);
-	inet2_addr_unpack(IPC_GET_ARG1(answer), &info->addr);
+	inet_addr_unpack(IPC_GET_ARG1(answer), &info->addr);
 
 	*rinfo = info;
@@ -123,5 +123,5 @@
 }
 
-int dnsr_get_srvaddr(inet2_addr_t *srvaddr)
+int dnsr_get_srvaddr(inet_addr_t *srvaddr)
 {
 	async_exch_t *exch = dnsr_exchange_begin();
@@ -129,5 +129,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, DNSR_GET_SRVADDR, &answer);
-	int rc = async_data_read_start(exch, srvaddr, sizeof(inet2_addr_t));
+	int rc = async_data_read_start(exch, srvaddr, sizeof(inet_addr_t));
 	
 	loc_exchange_end(exch);
@@ -144,5 +144,5 @@
 }
 
-int dnsr_set_srvaddr(inet2_addr_t *srvaddr)
+int dnsr_set_srvaddr(inet_addr_t *srvaddr)
 {
 	async_exch_t *exch = dnsr_exchange_begin();
@@ -150,5 +150,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, DNSR_SET_SRVADDR, &answer);
-	int rc = async_data_write_start(exch, srvaddr, sizeof(inet2_addr_t));
+	int rc = async_data_write_start(exch, srvaddr, sizeof(inet_addr_t));
 	
 	loc_exchange_end(exch);
Index: uspace/lib/c/generic/inet.c
===================================================================
--- uspace/lib/c/generic/inet.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/inet.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -107,22 +107,33 @@
 int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df)
 {
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-
+	uint32_t src;
+	int rc = inet_addr_pack(&dgram->src, &src);
+	if (rc != EOK)
+		return rc;
+	
+	uint32_t dest;
+	rc = inet_addr_pack(&dgram->dest, &dest);
+	if (rc != EOK)
+		return EOK;
+	
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+	
 	ipc_call_t answer;
-	aid_t req = async_send_5(exch, INET_SEND, dgram->src.ipv4,
-	    dgram->dest.ipv4, dgram->tos, ttl, df, &answer);
-	int rc = async_data_write_start(exch, dgram->data, dgram->size);
-	async_exchange_end(exch);
-
+	aid_t req = async_send_5(exch, INET_SEND, (sysarg_t) src,
+	    (sysarg_t) dest, dgram->tos, ttl, df, &answer);
+	rc = async_data_write_start(exch, dgram->data, dgram->size);
+	
+	async_exchange_end(exch);
+	
 	if (rc != EOK) {
 		async_forget(req);
 		return rc;
 	}
-
+	
 	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
 		return retval;
-
+	
 	return EOK;
 }
@@ -130,22 +141,6 @@
 int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
 {
-	sysarg_t local_addr;
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-
-	int rc = async_req_2_1(exch, INET_GET_SRCADDR, remote->ipv4,
-	    tos, &local_addr);
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	local->ipv4 = local_addr;
-	return EOK;
-}
-
-int inet2_get_srcaddr(inet2_addr_t *remote, uint8_t tos, inet2_addr_t *local)
-{
 	uint32_t remote_addr;
-	int rc = inet2_addr_pack(remote, &remote_addr);
+	int rc = inet_addr_pack(remote, &remote_addr);
 	if (rc != EOK)
 		return rc;
@@ -162,5 +157,5 @@
 		return rc;
 	
-	inet2_addr_unpack(local_addr, local);
+	inet_addr_unpack(local_addr, local);
 	return EOK;
 }
@@ -170,7 +165,7 @@
 	int rc;
 	inet_dgram_t dgram;
-
-	dgram.src.ipv4 = IPC_GET_ARG1(*call);
-	dgram.dest.ipv4 = IPC_GET_ARG2(*call);
+	
+	inet_addr_unpack(IPC_GET_ARG1(*call), &dgram.src);
+	inet_addr_unpack(IPC_GET_ARG2(*call), &dgram.dest);
 	dgram.tos = IPC_GET_ARG3(*call);
 
Index: uspace/lib/c/generic/inet/addr.c
===================================================================
--- uspace/lib/c/generic/inet/addr.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/inet/addr.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -34,124 +34,321 @@
 
 #include <errno.h>
+#include <unistd.h>
+#include <net/socket_codes.h>
 #include <inet/addr.h>
+#include <net/inet.h>
 #include <stdio.h>
 
+static inet_addr_t inet_addr_any_addr = {
+	.family = AF_INET,
+	.addr = {0, 0, 0, 0}
+};
+
+static inet_addr_t inet_addr_any_addr6 = {
+	.family = AF_INET6,
+	.addr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+};
+
+/** Parse network address family.
+ *
+ * @param text Network address in common notation.
+ * @param af   Place to store network address family.
+ *
+ * @return EOK on success, EINVAL if input is not in valid format.
+ *
+ */
+int inet_addr_family(const char *text, uint16_t *af)
+{
+	char *dot = str_chr(text, '.');
+	if (dot != NULL) {
+		*af = AF_INET;
+		return EOK;
+	}
+	
+	char *collon = str_chr(text, ':');
+	if (collon != NULL) {
+		*af = AF_INET6;
+		return EOK;
+	}
+	
+	*af = AF_NONE;
+	return EINVAL;
+}
+
+/** Parse node address.
+ *
+ * @param text Network address in common notation.
+ * @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)
+{
+	int rc = inet_addr_family(text, &addr->family);
+	if (rc != EOK)
+		return rc;
+	
+	rc = inet_pton(addr->family, text, addr->addr);
+	if (rc != EOK)
+		return rc;
+	
+	return EOK;
+}
+
 /** 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
+ * @param text  Network address in common notation.
+ * @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 != '.')
+	char *slash = str_chr(text, '/');
+	if (slash == NULL)
+		return EINVAL;
+	
+	*slash = 0;
+	
+	int rc = inet_addr_family(text, &naddr->family);
+	if (rc != EOK)
+		return rc;
+	
+	rc = inet_pton(naddr->family, text, naddr->addr);
+	*slash = '/';
+	
+	if (rc != EOK)
+		return rc;
+	
+	slash++;
+	
+	switch (naddr->family) {
+	case AF_INET:
+		naddr->prefix = strtoul(slash, &slash, 10);
+		if (naddr->prefix > 32)
 			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)
+		break;
+	case AF_INET6:
+		naddr->prefix = strtoul(slash, &slash, 10);
+		if (naddr->prefix > 128)
 			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)
+		break;
+	default:
+		return ENOTSUP;
+	}
+	
+	return EOK;
+}
+
+/** Format node address.
+ *
+ * @param addr Node address.
+ * @param bufp Place to store pointer to formatted string.
+ *
+ * @return EOK on success.
+ * @return ENOMEM if out of memory.
+ * @return ENOTSUP on unsupported address family.
+ *
+ */
+int inet_addr_format(inet_addr_t *addr, 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);
-
+	
+	switch (addr->family) {
+	case AF_NONE:
+		rc = asprintf(bufp, "none");
+		break;
+	case AF_INET:
+		rc = asprintf(bufp, "%u.%u.%u.%u", addr->addr[0],
+		    addr->addr[1], addr->addr[2], addr->addr[3]);
+		break;
+	case AF_INET6:
+		// FIXME TODO
+		break;
+	default:
+		return ENOTSUP;
+	}
+	
 	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)
+	
+	return EOK;
+}
+
+/** Format network address.
+ *
+ * @param naddr Network address.
+ * @param bufp  Place to store pointer to formatted string.
+ *
+ * @return EOK on success.
+ * @return ENOMEM if out of memory.
+ * @return ENOTSUP on unsupported address family.
+ *
+ */
+int inet_naddr_format(inet_naddr_t *naddr, 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);
-
+	
+	switch (naddr->family) {
+	case AF_NONE:
+		rc = asprintf(bufp, "none");
+		break;
+	case AF_INET:
+		rc = asprintf(bufp, "%u.%u.%u.%u/%u", naddr->addr[0],
+		    naddr->addr[1], naddr->addr[2], naddr->addr[3],
+		    naddr->prefix);
+		break;
+	case AF_INET6:
+		// FIXME TODO
+		break;
+	default:
+		return ENOTSUP;
+	}
+	
 	if (rc < 0)
 		return ENOMEM;
-
-	return EOK;
+	
+	return EOK;
+}
+
+/** Create packed IPv4 address
+ *
+ * Convert an IPv4 address to a packed 32 bit representation.
+ *
+ * @param addr   Source address.
+ * @param packed Place to store the packed 32 bit representation.
+ *
+ * @return EOK on success.
+ * @return EINVAL if addr is not an IPv4 address.
+ *
+ */
+int inet_addr_pack(inet_addr_t *addr, uint32_t *packed)
+{
+	if (addr->family != AF_INET)
+		return EINVAL;
+	
+	*packed = (addr->addr[0] << 24) | (addr->addr[1] << 16) |
+	    (addr->addr[2] << 8) | addr->addr[3];
+	return EOK;
+}
+
+/** Create packed IPv4 address
+ *
+ * Convert an IPv4 address to a packed 32 bit representation.
+ *
+ * @param naddr  Source address.
+ * @param packed Place to store the packed 32 bit representation.
+ * @param prefix Place to store the number of valid bits.
+ *
+ * @return EOK on success.
+ * @return EINVAL if addr is not an IPv4 address.
+ *
+ */
+int inet_naddr_pack(inet_naddr_t *naddr, uint32_t *packed, uint8_t *prefix)
+{
+	if (naddr->family != AF_INET)
+		return EINVAL;
+	
+	*packed = (naddr->addr[0] << 24) | (naddr->addr[1] << 16) |
+	    (naddr->addr[2] << 8) | naddr->addr[3];
+	*prefix = naddr->prefix;
+	
+	return EOK;
+}
+
+void inet_addr_unpack(uint32_t packed, inet_addr_t *addr)
+{
+	addr->family = AF_INET;
+	addr->addr[0] = (packed >> 24) & 0xff;
+	addr->addr[1] = (packed >> 16) & 0xff;
+	addr->addr[2] = (packed >> 8) & 0xff;
+	addr->addr[3] = packed & 0xff;
+}
+
+void inet_naddr_unpack(uint32_t packed, uint8_t prefix, inet_naddr_t *naddr)
+{
+	naddr->family = AF_INET;
+	naddr->addr[0] = (packed >> 24) & 0xff;
+	naddr->addr[1] = (packed >> 16) & 0xff;
+	naddr->addr[2] = (packed >> 8) & 0xff;
+	naddr->addr[3] = packed & 0xff;
+	naddr->prefix = prefix;
+}
+
+int inet_addr_sockaddr_in(inet_addr_t *addr, sockaddr_in_t *sockaddr_in)
+{
+	uint32_t packed;
+	int rc = inet_addr_pack(addr, &packed);
+	if (rc != EOK)
+		return rc;
+	
+	sockaddr_in->sin_family = AF_INET;
+	sockaddr_in->sin_addr.s_addr = host2uint32_t_be(packed);
+	return EOK;
+}
+
+void inet_naddr_addr(inet_naddr_t *naddr, inet_addr_t *addr)
+{
+	addr->family = naddr->family;
+	memcpy(addr->addr, naddr->addr, INET_ADDR_SIZE);
+}
+
+void inet_addr(inet_addr_t *addr, uint8_t a, uint8_t b, uint8_t c, uint8_t d)
+{
+	addr->family = AF_INET;
+	addr->addr[0] = a;
+	addr->addr[1] = b;
+	addr->addr[2] = c;
+	addr->addr[3] = d;
+}
+
+void inet_naddr(inet_naddr_t *naddr, uint8_t a, uint8_t b, uint8_t c, uint8_t d,
+    uint8_t prefix)
+{
+	naddr->family = AF_INET;
+	naddr->addr[0] = a;
+	naddr->addr[1] = b;
+	naddr->addr[2] = c;
+	naddr->addr[3] = d;
+	naddr->prefix = prefix;
+}
+
+void inet_addr_any(inet_addr_t *addr)
+{
+	addr->family = 0;
+	memset(addr->addr, 0, INET_ADDR_SIZE);
+}
+
+void inet_naddr_any(inet_naddr_t *naddr)
+{
+	naddr->family = 0;
+	memset(naddr->addr, 0, INET_ADDR_SIZE);
+	naddr->prefix = 0;
+}
+
+int inet_addr_compare(inet_addr_t *a, inet_addr_t *b)
+{
+	if (a->family != b->family)
+		return 0;
+	
+	switch (a->family) {
+	case AF_INET:
+		return ((a->addr[0] == b->addr[0]) && (a->addr[1] == b->addr[1]) &&
+		    (a->addr[2] == b->addr[2]) && (a->addr[3] == b->addr[3]));
+	case AF_INET6:
+		// FIXME TODO
+		return 0;
+	default:
+		return 0;
+	}
+}
+
+int inet_addr_is_any(inet_addr_t *addr)
+{
+	return ((addr->family == 0) ||
+	    (inet_addr_compare(addr, &inet_addr_any_addr)) ||
+	    (inet_addr_compare(addr, &inet_addr_any_addr6)));
 }
 
Index: uspace/lib/c/generic/inet/addr2.c
===================================================================
--- uspace/lib/c/generic/inet/addr2.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ 	(revision )
@@ -1,372 +1,0 @@
-/*
- * 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 <unistd.h>
-#include <inet/addr2.h>
-#include <net/socket_codes.h>
-#include <net/inet.h>
-#include <stdio.h>
-
-// TODO temporarily
-#include <assert.h>
-
-static inet2_addr_t inet2_addr_any = {
-	.family = AF_INET,
-	.addr = {0, 0, 0, 0}
-};
-
-static inet2_addr_t inet2_addr6_any = {
-	.family = AF_INET6,
-	.addr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-};
-
-/** Parse network address family.
- *
- * @param text Network address in common notation.
- * @param af   Place to store network address family.
- *
- * @return EOK on success, EINVAL if input is not in valid format.
- *
- */
-int inet2_addr_family(const char *text, uint16_t *af)
-{
-	char *dot = str_chr(text, '.');
-	if (dot != NULL) {
-		*af = AF_INET;
-		return EOK;
-	}
-	
-	char *collon = str_chr(text, ':');
-	if (collon != NULL) {
-		*af = AF_INET6;
-		return EOK;
-	}
-	
-	*af = AF_NONE;
-	return EINVAL;
-}
-
-/** Parse node address.
- *
- * @param text Network address in common notation.
- * @param addr Place to store node address.
- *
- * @return EOK on success, EINVAL if input is not in valid format.
- *
- */
-int inet2_addr_parse(const char *text, inet2_addr_t *addr)
-{
-	int rc = inet2_addr_family(text, &addr->family);
-	if (rc != EOK)
-		return rc;
-	
-	rc = inet_pton(addr->family, text, addr->addr);
-	if (rc != EOK)
-		return rc;
-	
-	return EOK;
-}
-
-/** Parse network address.
- *
- * @param text  Network address in common notation.
- * @param naddr Place to store network address.
- *
- * @return EOK on success, EINVAL if input is not in valid format.
- *
- */
-int inet2_naddr_parse(const char *text, inet2_naddr_t *naddr)
-{
-	char *slash = str_chr(text, '/');
-	if (slash == NULL)
-		return EINVAL;
-	
-	*slash = 0;
-	
-	int rc = inet2_addr_family(text, &naddr->family);
-	if (rc != EOK)
-		return rc;
-	
-	rc = inet_pton(naddr->family, text, naddr->addr);
-	*slash = '/';
-	
-	if (rc != EOK)
-		return rc;
-	
-	slash++;
-	
-	switch (naddr->family) {
-	case AF_INET:
-		naddr->prefix = strtoul(slash, &slash, 10);
-		if (naddr->prefix > 32)
-			return EINVAL;
-		break;
-	case AF_INET6:
-		naddr->prefix = strtoul(slash, &slash, 10);
-		if (naddr->prefix > 128)
-			return EINVAL;
-		break;
-	default:
-		return ENOTSUP;
-	}
-	
-	return EOK;
-}
-
-/** Format node address.
- *
- * @param addr Node address.
- * @param bufp Place to store pointer to formatted string.
- *
- * @return EOK on success.
- * @return ENOMEM if out of memory.
- * @return ENOTSUP on unsupported address family.
- *
- */
-int inet2_addr_format(inet2_addr_t *addr, char **bufp)
-{
-	int rc;
-	
-	switch (addr->family) {
-	case AF_NONE:
-		rc = asprintf(bufp, "none");
-		break;
-	case AF_INET:
-		rc = asprintf(bufp, "%u.%u.%u.%u", addr->addr[0],
-		    addr->addr[1], addr->addr[2], addr->addr[3]);
-		break;
-	case AF_INET6:
-		// FIXME TODO
-		break;
-	default:
-		return ENOTSUP;
-	}
-	
-	if (rc < 0)
-		return ENOMEM;
-	
-	return EOK;
-}
-
-/** Format network address.
- *
- * @param naddr Network address.
- * @param bufp  Place to store pointer to formatted string.
- *
- * @return EOK on success.
- * @return ENOMEM if out of memory.
- * @return ENOTSUP on unsupported address family.
- *
- */
-int inet2_naddr_format(inet2_naddr_t *naddr, char **bufp)
-{
-	int rc;
-	
-	switch (naddr->family) {
-	case AF_NONE:
-		rc = asprintf(bufp, "none");
-		break;
-	case AF_INET:
-		rc = asprintf(bufp, "%u.%u.%u.%u/%u", naddr->addr[0],
-		    naddr->addr[1], naddr->addr[2], naddr->addr[3],
-		    naddr->prefix);
-		break;
-	case AF_INET6:
-		// FIXME TODO
-		break;
-	default:
-		return ENOTSUP;
-	}
-	
-	if (rc < 0)
-		return ENOMEM;
-	
-	return EOK;
-}
-
-/** Create packed IPv4 address
- *
- * Convert an IPv4 address to a packed 32 bit representation.
- *
- * @param addr   Source address.
- * @param packed Place to store the packed 32 bit representation.
- *
- * @return EOK on success.
- * @return EINVAL if addr is not an IPv4 address.
- *
- */
-int inet2_addr_pack(inet2_addr_t *addr, uint32_t *packed)
-{
-	if (addr->family != AF_INET)
-		return EINVAL;
-	
-	*packed = (addr->addr[0] << 24) | (addr->addr[1] << 16) |
-	    (addr->addr[2] << 8) | addr->addr[3];
-	return EOK;
-}
-
-/** Create packed IPv4 address
- *
- * Convert an IPv4 address to a packed 32 bit representation.
- *
- * @param naddr  Source address.
- * @param packed Place to store the packed 32 bit representation.
- * @param prefix Place to store the number of valid bits.
- *
- * @return EOK on success.
- * @return EINVAL if addr is not an IPv4 address.
- *
- */
-int inet2_naddr_pack(inet2_naddr_t *naddr, uint32_t *packed, uint8_t *prefix)
-{
-	if (naddr->family != AF_INET)
-		return EINVAL;
-	
-	*packed = (naddr->addr[0] << 24) | (naddr->addr[1] << 16) |
-	    (naddr->addr[2] << 8) | naddr->addr[3];
-	*prefix = naddr->prefix;
-	
-	return EOK;
-}
-
-void inet2_addr_unpack(uint32_t packed, inet2_addr_t *addr)
-{
-	addr->family = AF_INET;
-	addr->addr[0] = (packed >> 24) & 0xff;
-	addr->addr[1] = (packed >> 16) & 0xff;
-	addr->addr[2] = (packed >> 8) & 0xff;
-	addr->addr[3] = packed & 0xff;
-}
-
-void inet2_naddr_unpack(uint32_t packed, uint8_t prefix, inet2_naddr_t *naddr)
-{
-	naddr->family = AF_INET;
-	naddr->addr[0] = (packed >> 24) & 0xff;
-	naddr->addr[1] = (packed >> 16) & 0xff;
-	naddr->addr[2] = (packed >> 8) & 0xff;
-	naddr->addr[3] = packed & 0xff;
-	naddr->prefix = prefix;
-}
-
-int inet2_addr_sockaddr_in(inet2_addr_t *addr, sockaddr_in_t *sockaddr_in)
-{
-	uint32_t packed;
-	int rc = inet2_addr_pack(addr, &packed);
-	if (rc != EOK)
-		return rc;
-	
-	sockaddr_in->sin_family = AF_INET;
-	sockaddr_in->sin_addr.s_addr = host2uint32_t_be(packed);
-	return EOK;
-}
-
-void inet2_naddr_addr(inet2_naddr_t *naddr, inet2_addr_t *addr)
-{
-	addr->family = naddr->family;
-	memcpy(addr->addr, naddr->addr, INET2_ADDR_SIZE);
-}
-
-void inet2_addr(inet2_addr_t *addr, uint8_t a, uint8_t b, uint8_t c, uint8_t d)
-{
-	addr->family = AF_INET;
-	addr->addr[0] = a;
-	addr->addr[1] = b;
-	addr->addr[2] = c;
-	addr->addr[3] = d;
-}
-
-void inet2_naddr(inet2_naddr_t *naddr, uint8_t a, uint8_t b, uint8_t c, uint8_t d,
-    uint8_t prefix)
-{
-	naddr->family = AF_INET;
-	naddr->addr[0] = a;
-	naddr->addr[1] = b;
-	naddr->addr[2] = c;
-	naddr->addr[3] = d;
-	naddr->prefix = prefix;
-}
-
-void inet2_addr_empty(inet2_addr_t *addr)
-{
-	addr->family = 0;
-	memset(addr->addr, 0, INET2_ADDR_SIZE);
-}
-
-void inet2_naddr_empty(inet2_naddr_t *naddr)
-{
-	naddr->family = 0;
-	memset(naddr->addr, 0, INET2_ADDR_SIZE);
-	naddr->prefix = 0;
-}
-
-int inet2_addr_compare(inet2_addr_t *a, inet2_addr_t *b)
-{
-	if (a->family != b->family)
-		return 0;
-	
-	switch (a->family) {
-	case AF_INET:
-		return ((a->addr[0] == b->addr[0]) && (a->addr[1] == b->addr[1]) &&
-		    (a->addr[2] == b->addr[2]) && (a->addr[3] == b->addr[3]));
-	case AF_INET6:
-		// FIXME TODO
-		return 0;
-	default:
-		return 0;
-	}
-}
-
-int inet2_addr_is_any(inet2_addr_t *addr)
-{
-	return ((addr->family == 0) ||
-	    (inet2_addr_compare(addr, &inet2_addr_any)) ||
-	    (inet2_addr_compare(addr, &inet2_addr6_any)));
-}
-
-void inet_inet2(inet_addr_t *addr, inet2_addr_t *addr2)
-{
-	// TODO temporarily
-	inet2_addr_unpack(addr->ipv4, addr2);
-}
-
-void inet2_inet(inet2_addr_t *addr2, inet_addr_t *addr)
-{
-	// TODO temporarily
-	assert(addr2->family == AF_INET);
-	inet2_addr_pack(addr2, &addr->ipv4);
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/inetcfg.c
===================================================================
--- uspace/lib/c/generic/inetcfg.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/inetcfg.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -136,21 +136,27 @@
     sysarg_t link_id, sysarg_t *addr_id)
 {
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_3(exch, INETCFG_ADDR_CREATE_STATIC, naddr->ipv4,
-	    naddr->bits, link_id, &answer);
+	uint32_t naddr_addr;
+	uint8_t naddr_bits;
+	int rc = inet_naddr_pack(naddr, &naddr_addr, &naddr_bits);
+	if (rc != EOK)
+		return rc;
+	
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+	
+	ipc_call_t answer;
+	aid_t req = async_send_3(exch, INETCFG_ADDR_CREATE_STATIC,
+	    (sysarg_t) naddr_addr, (sysarg_t) naddr_bits, link_id, &answer);
 	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
+	
+	async_exchange_end(exch);
+	
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+	
 	async_wait_for(req, &retval);
 	*addr_id = IPC_GET_ARG1(answer);
-
+	
 	return retval;
 }
@@ -196,7 +202,7 @@
 	assert(act_size <= LOC_NAME_MAXLEN);
 	name_buf[act_size] = '\0';
-
-	ainfo->naddr.ipv4 = IPC_GET_ARG1(answer);
-	ainfo->naddr.bits = IPC_GET_ARG2(answer);
+	
+	inet_naddr_unpack(IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
+	    &ainfo->naddr);
 	ainfo->ilink = IPC_GET_ARG3(answer);
 	ainfo->name = str_dup(name_buf);
@@ -284,21 +290,33 @@
     inet_addr_t *router, sysarg_t *sroute_id)
 {
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
+	uint32_t dest_addr;
+	uint8_t dest_bits;
+	int rc = inet_naddr_pack(dest, &dest_addr, &dest_bits);
+	if (rc != EOK)
+		return rc;
+	
+	uint32_t router_addr;
+	rc = inet_addr_pack(router, &router_addr);
+	if (rc != EOK)
+		return rc;
+	
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+	
 	ipc_call_t answer;
 	aid_t req = async_send_3(exch, INETCFG_SROUTE_CREATE,
-	    dest->ipv4, dest->bits, router->ipv4, &answer);
+	    (sysarg_t) dest_addr, (sysarg_t) dest_bits, (sysarg_t) router_addr,
+	    &answer);
 	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
+	
+	async_exchange_end(exch);
+	
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+	
 	async_wait_for(req, &retval);
 	*sroute_id = IPC_GET_ARG1(answer);
-
+	
 	return retval;
 }
@@ -345,7 +363,7 @@
 	name_buf[act_size] = '\0';
 
-	srinfo->dest.ipv4 = IPC_GET_ARG1(answer);
-	srinfo->dest.bits = IPC_GET_ARG2(answer);
-	srinfo->router.ipv4 = IPC_GET_ARG3(answer);
+	inet_naddr_unpack(IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
+	    &srinfo->dest);
+	inet_addr_unpack(IPC_GET_ARG3(answer), &srinfo->router);
 	srinfo->name = str_dup(name_buf);
 
Index: uspace/lib/c/generic/iplink.c
===================================================================
--- uspace/lib/c/generic/iplink.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/iplink.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -39,4 +39,5 @@
 #include <errno.h>
 #include <inet/iplink.h>
+#include <inet/addr.h>
 #include <ipc/iplink.h>
 #include <ipc/services.h>
@@ -83,21 +84,22 @@
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
+	
 	ipc_call_t answer;
-	aid_t req = async_send_2(exch, IPLINK_SEND, sdu->lsrc.ipv4,
-	    sdu->ldest.ipv4, &answer);
+	aid_t req = async_send_2(exch, IPLINK_SEND, (sysarg_t) sdu->lsrc,
+	    (sysarg_t) sdu->ldest, &answer);
 	int rc = async_data_write_start(exch, sdu->data, sdu->size);
+	
 	async_exchange_end(exch);
-
+	
 	if (rc != EOK) {
 		async_forget(req);
 		return rc;
 	}
-
+	
 	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
 		return retval;
-
+	
 	return EOK;
 }
@@ -118,21 +120,29 @@
 }
 
-int iplink_addr_add(iplink_t *iplink, iplink_addr_t *addr)
+int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
 {
+	uint32_t addr_addr;
+	int rc = inet_addr_pack(addr, &addr_addr);
+	if (rc != EOK)
+		return rc;
+	
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	int rc = async_req_1_0(exch, IPLINK_ADDR_ADD, (sysarg_t)addr->ipv4);
+	rc = async_req_1_0(exch, IPLINK_ADDR_ADD, (sysarg_t) addr_addr);
 	async_exchange_end(exch);
-
+	
 	return rc;
 }
 
-int iplink_addr_remove(iplink_t *iplink, iplink_addr_t *addr)
+int iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
 {
+	uint32_t addr_addr;
+	int rc = inet_addr_pack(addr, &addr_addr);
+	if (rc != EOK)
+		return rc;
+	
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	int rc = async_req_1_0(exch, IPLINK_ADDR_REMOVE, (sysarg_t)addr->ipv4);
+	rc = async_req_1_0(exch, IPLINK_ADDR_REMOVE, (sysarg_t) addr_addr);
 	async_exchange_end(exch);
-
+	
 	return rc;
 }
@@ -141,16 +151,15 @@
     ipc_call_t *call)
 {
-	int rc;
 	iplink_sdu_t sdu;
-
-	sdu.lsrc.ipv4 = IPC_GET_ARG1(*call);
-	sdu.ldest.ipv4 = IPC_GET_ARG2(*call);
-
-	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
+	
+	sdu.lsrc = IPC_GET_ARG1(*call);
+	sdu.ldest = IPC_GET_ARG2(*call);
+	
+	int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
 		return;
 	}
-
+	
 	rc = iplink->ev_ops->recv(iplink, &sdu);
 	free(sdu.data);
Index: uspace/lib/c/generic/iplink_srv.c
===================================================================
--- uspace/lib/c/generic/iplink_srv.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/iplink_srv.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -54,10 +54,5 @@
     ipc_call_t *call)
 {
-	int rc;
-	iplink_srv_addr_t addr;
-
-	addr.ipv4 = IPC_GET_ARG1(*call);
-
-	rc = srv->ops->addr_add(srv, &addr);
+	int rc = srv->ops->addr_add(srv, IPC_GET_ARG1(*call));
 	async_answer_0(callid, rc);
 }
@@ -66,10 +61,5 @@
     ipc_call_t *call)
 {
-	int rc;
-	iplink_srv_addr_t addr;
-
-	addr.ipv4 = IPC_GET_ARG1(*call);
-
-	rc = srv->ops->addr_remove(srv, &addr);
+	int rc = srv->ops->addr_remove(srv, IPC_GET_ARG1(*call));
 	async_answer_0(callid, rc);
 }
@@ -81,6 +71,6 @@
 	int rc;
 
-	sdu.lsrc.ipv4 = IPC_GET_ARG1(*call);
-	sdu.ldest.ipv4 = IPC_GET_ARG2(*call);
+	sdu.lsrc = IPC_GET_ARG1(*call);
+	sdu.ldest = IPC_GET_ARG2(*call);
 
 	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
@@ -139,7 +129,7 @@
 		if (!method) {
 			/* The other side has hung up */
-		    	fibril_mutex_lock(&srv->lock);
+			fibril_mutex_lock(&srv->lock);
 			srv->connected = false;
-		    	fibril_mutex_unlock(&srv->lock);
+			fibril_mutex_unlock(&srv->lock);
 			async_answer_0(callid, EOK);
 			break;
@@ -175,6 +165,6 @@
 
 	ipc_call_t answer;
-	aid_t req = async_send_2(exch, IPLINK_EV_RECV, sdu->lsrc.ipv4,
-	    sdu->ldest.ipv4, &answer);
+	aid_t req = async_send_2(exch, IPLINK_EV_RECV, (sysarg_t) sdu->lsrc,
+	    (sysarg_t) sdu->ldest, &answer);
 	int rc = async_data_write_start(exch, sdu->data, sdu->size);
 	async_exchange_end(exch);
Index: uspace/lib/c/generic/net/inet.c
===================================================================
--- uspace/lib/c/generic/net/inet.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/net/inet.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -39,5 +39,5 @@
 #include <net/in6.h>
 #include <net/inet.h>
-
+#include <inet/addr.h>
 #include <errno.h>
 #include <mem.h>
Index: uspace/lib/c/generic/net/socket_client.c
===================================================================
--- uspace/lib/c/generic/net/socket_client.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/net/socket_client.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -87,4 +87,6 @@
 	/** Parent module service. */
 	services_t service;
+	/** Socket family */
+	int family;
 
 	/**
@@ -395,4 +397,5 @@
 	switch (domain) {
 	case PF_INET:
+	case PF_INET6:
 		switch (type) {
 		case SOCK_STREAM:
@@ -433,5 +436,4 @@
 		break;
 
-	case PF_INET6:
 	default:
 		return EPFNOSUPPORT;
@@ -447,4 +449,5 @@
 
 	memset(socket, 0, sizeof(*socket));
+	socket->family = domain;
 	fibril_rwlock_write_lock(&socket_globals.lock);
 
Index: uspace/lib/c/generic/net/socket_parse.c
===================================================================
--- uspace/lib/c/generic/net/socket_parse.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/generic/net/socket_parse.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -79,11 +79,11 @@
 int socket_parse_protocol_family(const char *name, int *pf)
 {
+	if (str_lcmp(name, "PF_INET6", 8) == 0) {
+		*pf = PF_INET6;
+		return EOK;
+	}
+
 	if (str_lcmp(name, "PF_INET", 7) == 0) {
 		*pf = PF_INET;
-		return EOK;
-	}
-	
-	if (str_lcmp(name, "PF_INET6", 8) == 0) {
-		*pf = PF_INET6;
 		return EOK;
 	}
Index: uspace/lib/c/include/inet/addr.h
===================================================================
--- uspace/lib/c/include/inet/addr.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/include/inet/addr.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -37,22 +37,52 @@
 
 #include <stdint.h>
+#include <net/in.h>
+
+#define INET_ADDR_SIZE  16
 
 /** Node address */
 typedef struct {
-	uint32_t ipv4;
+	uint16_t family;
+	uint8_t addr[INET_ADDR_SIZE];
 } inet_addr_t;
 
 /** Network address */
 typedef struct {
+	/** Address family */
+	uint16_t family;
+	
 	/** Address */
-	uint32_t ipv4;
-	/** Number of valid bits in @c ipv4 */
-	int bits;
+	uint8_t addr[INET_ADDR_SIZE];
+	
+	/** Number of valid bits */
+	uint8_t prefix;
 } inet_naddr_t;
 
+extern int inet_addr_family(const char *, uint16_t *);
+
+extern int inet_addr_parse(const char *, inet_addr_t *);
 extern int inet_naddr_parse(const char *, inet_naddr_t *);
-extern int inet_addr_parse(const char *, inet_addr_t *);
+
+extern int inet_addr_format(inet_addr_t *, char **);
 extern int inet_naddr_format(inet_naddr_t *, char **);
-extern int inet_addr_format(inet_addr_t *, char **);
+
+extern int inet_addr_pack(inet_addr_t *, uint32_t *);
+extern int inet_naddr_pack(inet_naddr_t *, uint32_t *, uint8_t *);
+
+extern void inet_addr_unpack(uint32_t, inet_addr_t *);
+extern void inet_naddr_unpack(uint32_t, uint8_t, inet_naddr_t *);
+
+extern int inet_addr_sockaddr_in(inet_addr_t *, sockaddr_in_t *);
+extern void inet_naddr_addr(inet_naddr_t *, inet_addr_t *);
+
+extern void inet_addr(inet_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t);
+extern void inet_naddr(inet_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t,
+    uint8_t);
+
+extern void inet_addr_any(inet_addr_t *);
+extern void inet_naddr_any(inet_naddr_t *);
+
+extern int inet_addr_compare(inet_addr_t *, inet_addr_t *);
+extern int inet_addr_is_any(inet_addr_t *);
 
 #endif
Index: uspace/lib/c/include/inet/addr2.h
===================================================================
--- uspace/lib/c/include/inet/addr2.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * 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_INET2_ADDR_H_
-#define LIBC_INET2_ADDR_H_
-
-#include <stdint.h>
-#include <net/in.h>
-#include <inet/addr.h>
-
-#define INET2_ADDR_SIZE  16
-
-/** Node address */
-typedef struct {
-	uint16_t family;
-	uint8_t addr[INET2_ADDR_SIZE];
-} inet2_addr_t;
-
-/** Network address */
-typedef struct {
-	/** Address family */
-	uint16_t family;
-	
-	/** Address */
-	uint8_t addr[INET2_ADDR_SIZE];
-	
-	/** Number of valid bits */
-	uint8_t prefix;
-} inet2_naddr_t;
-
-extern int inet2_addr_family(const char *, uint16_t *);
-
-extern int inet2_addr_parse(const char *, inet2_addr_t *);
-extern int inet2_naddr_parse(const char *, inet2_naddr_t *);
-
-extern int inet2_addr_format(inet2_addr_t *, char **);
-extern int inet2_naddr_format(inet2_naddr_t *, char **);
-
-extern int inet2_addr_pack(inet2_addr_t *, uint32_t *);
-extern int inet2_naddr_pack(inet2_naddr_t *, uint32_t *, uint8_t *);
-
-extern void inet2_addr_unpack(uint32_t, inet2_addr_t *);
-extern void inet2_naddr_unpack(uint32_t, uint8_t, inet2_naddr_t *);
-
-extern int inet2_addr_sockaddr_in(inet2_addr_t *, sockaddr_in_t *);
-extern void inet2_naddr_addr(inet2_naddr_t *, inet2_addr_t *);
-
-extern void inet2_addr(inet2_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t);
-extern void inet2_naddr(inet2_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t,
-    uint8_t);
-
-extern void inet2_addr_empty(inet2_addr_t *);
-extern void inet2_naddr_empty(inet2_naddr_t *);
-
-extern int inet2_addr_compare(inet2_addr_t *, inet2_addr_t *);
-extern int inet2_addr_is_any(inet2_addr_t *);
-
-extern void inet_inet2(inet_addr_t *, inet2_addr_t *);
-extern void inet2_inet(inet2_addr_t *, inet_addr_t *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/inet/dnsr.h
===================================================================
--- uspace/lib/c/include/inet/dnsr.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/include/inet/dnsr.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -37,5 +37,5 @@
 
 #include <inet/inet.h>
-#include <inet/addr2.h>
+#include <inet/addr.h>
 
 enum {
@@ -47,5 +47,5 @@
 	char *cname;
 	/** Host address */
-	inet2_addr_t addr;
+	inet_addr_t addr;
 } dnsr_hostinfo_t;
 
@@ -53,6 +53,6 @@
 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **);
 extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *);
-extern int dnsr_get_srvaddr(inet2_addr_t *);
-extern int dnsr_set_srvaddr(inet2_addr_t *);
+extern int dnsr_get_srvaddr(inet_addr_t *);
+extern int dnsr_set_srvaddr(inet_addr_t *);
 
 #endif
Index: uspace/lib/c/include/inet/inet.h
===================================================================
--- uspace/lib/c/include/inet/inet.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/include/inet/inet.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -37,5 +37,4 @@
 
 #include <inet/addr.h>
-#include <inet/addr2.h>
 #include <sys/types.h>
 
@@ -61,5 +60,4 @@
 extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t);
 extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
-extern int inet2_get_srcaddr(inet2_addr_t *, uint8_t, inet2_addr_t *);
 
 #endif
Index: uspace/lib/c/include/inet/iplink.h
===================================================================
--- uspace/lib/c/include/inet/iplink.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/include/inet/iplink.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -38,4 +38,5 @@
 #include <async.h>
 #include <sys/types.h>
+#include <inet/addr.h>
 
 struct iplink_ev_ops;
@@ -46,14 +47,10 @@
 } iplink_t;
 
-typedef struct {
-	uint32_t ipv4;
-} iplink_addr_t;
-
-/** IP link Service Data Unit */
+/** IPv4 link Service Data Unit */
 typedef struct {
 	/** Local source address */
-	iplink_addr_t lsrc;
+	uint32_t lsrc;
 	/** Local destination address */
-	iplink_addr_t ldest;
+	uint32_t ldest;
 	/** Serialized IP packet */
 	void *data;
@@ -61,4 +58,14 @@
 	size_t size;
 } iplink_sdu_t;
+
+/** IPv6 link Service Data Unit */
+typedef struct {
+	/** Target MAC address */
+	uint64_t hwaddr;
+	/** Serialized IP packet */
+	void *data;
+	/** Size of @c data in bytes */
+	size_t size;
+} iplink_sdu6_t;
 
 typedef struct iplink_ev_ops {
@@ -69,6 +76,6 @@
 extern void iplink_close(iplink_t *);
 extern int iplink_send(iplink_t *, iplink_sdu_t *);
-extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
-extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
+extern int iplink_addr_add(iplink_t *, inet_addr_t *);
+extern int iplink_addr_remove(iplink_t *, inet_addr_t *);
 extern int iplink_get_mtu(iplink_t *, size_t *);
 
Index: uspace/lib/c/include/inet/iplink_srv.h
===================================================================
--- uspace/lib/c/include/inet/iplink_srv.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/lib/c/include/inet/iplink_srv.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -51,14 +51,10 @@
 } iplink_srv_t;
 
-typedef struct {
-	uint32_t ipv4;
-} iplink_srv_addr_t;
-
 /** IP link Service Data Unit */
 typedef struct {
 	/** Local source address */
-	iplink_srv_addr_t lsrc;
+	uint32_t lsrc;
 	/** Local destination address */
-	iplink_srv_addr_t ldest;
+	uint32_t ldest;
 	/** Serialized IP packet */
 	void *data;
@@ -72,6 +68,6 @@
 	int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
 	int (*get_mtu)(iplink_srv_t *, size_t *);
-	int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *);
-	int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *);
+	int (*addr_add)(iplink_srv_t *, uint32_t);
+	int (*addr_remove)(iplink_srv_t *, uint32_t);
 } iplink_ops_t;
 
Index: uspace/srv/net/dnsrsrv/dns_type.h
===================================================================
--- uspace/srv/net/dnsrsrv/dns_type.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/dnsrsrv/dns_type.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -39,5 +39,5 @@
 #include <adt/list.h>
 #include <inet/inet.h>
-#include <inet/addr2.h>
+#include <inet/addr.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -116,5 +116,5 @@
 	char *cname;
 	/** Host address */
-	inet2_addr_t addr;
+	inet_addr_t addr;
 } dns_host_info_t;
 
Index: uspace/srv/net/dnsrsrv/dnsrsrv.c
===================================================================
--- uspace/srv/net/dnsrsrv/dnsrsrv.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/dnsrsrv/dnsrsrv.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -118,5 +118,5 @@
 	
 	uint32_t addr;
-	rc = inet2_addr_pack(&hinfo->addr, &addr);
+	rc = inet_addr_pack(&hinfo->addr, &addr);
 	if (rc != EOK) {
 		async_answer_0(rcallid, rc);
@@ -151,5 +151,5 @@
 	}
 	
-	if (size != sizeof(inet2_addr_t)) {
+	if (size != sizeof(inet_addr_t)) {
 		async_answer_0(callid, EINVAL);
 		async_answer_0(iid, EINVAL);
@@ -177,5 +177,5 @@
 	}
 	
-	if (size != sizeof(inet2_addr_t)) {
+	if (size != sizeof(inet_addr_t)) {
 		async_answer_0(callid, EINVAL);
 		async_answer_0(iid, EINVAL);
Index: uspace/srv/net/dnsrsrv/query.c
===================================================================
--- uspace/srv/net/dnsrsrv/query.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/dnsrsrv/query.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -128,5 +128,5 @@
 
 			info->cname = str_dup(rr->name);
-			inet2_addr_unpack(dns_uint32_t_decode(rr->rdata, rr->rdata_size),
+			inet_addr_unpack(dns_uint32_t_decode(rr->rdata, rr->rdata_size),
 			    &info->addr);
 			
Index: uspace/srv/net/dnsrsrv/transport.c
===================================================================
--- uspace/srv/net/dnsrsrv/transport.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/dnsrsrv/transport.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -57,5 +57,5 @@
 #define REQ_RETRY_MAX 3
 
-inet2_addr_t dns_server_addr;
+inet_addr_t dns_server_addr;
 
 typedef struct {
@@ -195,5 +195,5 @@
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(DNS_SERVER_PORT);
-	inet2_addr_sockaddr_in(&dns_server_addr, &addr);
+	inet_addr_sockaddr_in(&dns_server_addr, &addr);
 
 	rc = dns_message_encode(req, &req_data, &req_size);
Index: uspace/srv/net/dnsrsrv/transport.h
===================================================================
--- uspace/srv/net/dnsrsrv/transport.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/dnsrsrv/transport.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -37,8 +37,8 @@
 #define TRANSPORT_H
 
-#include <inet/addr2.h>
+#include <inet/addr.h>
 #include "dns_type.h"
 
-extern inet2_addr_t dns_server_addr;
+extern inet_addr_t dns_server_addr;
 
 extern int transport_init(void);
Index: uspace/srv/net/ethip/arp.c
===================================================================
--- uspace/srv/net/ethip/arp.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/arp.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -66,11 +66,11 @@
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ARP PDU decoded, opcode=%d, tpa=%x",
-	    packet.opcode, packet.target_proto_addr.ipv4);
+	    packet.opcode, packet.target_proto_addr);
 
-	laddr = ethip_nic_addr_find(nic, &packet.target_proto_addr);
+	laddr = ethip_nic_addr_find(nic, packet.target_proto_addr);
 	if (laddr != NULL) {
 		log_msg(LOG_DEFAULT, LVL_DEBUG, "Request/reply to my address");
 
-		(void) atrans_add(&packet.sender_proto_addr,
+		(void) atrans_add(packet.sender_proto_addr,
 		    &packet.sender_hw_addr);
 
@@ -87,6 +87,6 @@
 }
 
-int arp_translate(ethip_nic_t *nic, iplink_srv_addr_t *src_addr,
-    iplink_srv_addr_t *ip_addr, mac48_addr_t *mac_addr)
+int arp_translate(ethip_nic_t *nic, uint32_t src_addr, uint32_t ip_addr,
+    mac48_addr_t *mac_addr)
 {
 	int rc;
@@ -99,7 +99,7 @@
 	packet.opcode = aop_request;
 	packet.sender_hw_addr = nic->mac_addr;
-	packet.sender_proto_addr = *src_addr;
+	packet.sender_proto_addr = src_addr;
 	packet.target_hw_addr.addr = MAC48_BROADCAST;
-	packet.target_proto_addr = *ip_addr;
+	packet.target_proto_addr = ip_addr;
 
 	rc = arp_send_packet(nic, &packet);
Index: uspace/srv/net/ethip/arp.h
===================================================================
--- uspace/srv/net/ethip/arp.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/arp.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -42,6 +42,5 @@
 
 extern void arp_received(ethip_nic_t *, eth_frame_t *);
-extern int arp_translate(ethip_nic_t *, iplink_srv_addr_t *,
-    iplink_srv_addr_t *, mac48_addr_t *);
+extern int arp_translate(ethip_nic_t *, uint32_t, uint32_t, mac48_addr_t *);
 
 #endif
Index: uspace/srv/net/ethip/atrans.c
===================================================================
--- uspace/srv/net/ethip/atrans.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/atrans.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -49,5 +49,5 @@
 static FIBRIL_CONDVAR_INITIALIZE(atrans_cv);
 
-static ethip_atrans_t *atrans_find(iplink_srv_addr_t *ip_addr)
+static ethip_atrans_t *atrans_find(uint32_t ip_addr)
 {
 	list_foreach(atrans_list, link) {
@@ -55,5 +55,5 @@
 		    ethip_atrans_t, atrans_list);
 
-		if (atrans->ip_addr.ipv4 == ip_addr->ipv4)
+		if (atrans->ip_addr == ip_addr)
 			return atrans;
 	}
@@ -62,5 +62,5 @@
 }
 
-int atrans_add(iplink_srv_addr_t *ip_addr, mac48_addr_t *mac_addr)
+int atrans_add(uint32_t ip_addr, mac48_addr_t *mac_addr)
 {
 	ethip_atrans_t *atrans;
@@ -71,5 +71,5 @@
 		return ENOMEM;
 
-	atrans->ip_addr = *ip_addr;
+	atrans->ip_addr = ip_addr;
 	atrans->mac_addr = *mac_addr;
 
@@ -88,5 +88,5 @@
 }
 
-int atrans_remove(iplink_srv_addr_t *ip_addr)
+int atrans_remove(uint32_t ip_addr)
 {
 	ethip_atrans_t *atrans;
@@ -106,5 +106,5 @@
 }
 
-int atrans_lookup(iplink_srv_addr_t *ip_addr, mac48_addr_t *mac_addr)
+int atrans_lookup(uint32_t ip_addr, mac48_addr_t *mac_addr)
 {
 	ethip_atrans_t *atrans;
Index: uspace/srv/net/ethip/atrans.h
===================================================================
--- uspace/srv/net/ethip/atrans.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/atrans.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -41,7 +41,7 @@
 #include "ethip.h"
 
-extern int atrans_add(iplink_srv_addr_t *, mac48_addr_t *);
-extern int atrans_remove(iplink_srv_addr_t *);
-extern int atrans_lookup(iplink_srv_addr_t *, mac48_addr_t *);
+extern int atrans_add(uint32_t, mac48_addr_t *);
+extern int atrans_remove(uint32_t);
+extern int atrans_lookup(uint32_t, mac48_addr_t *);
 extern int atrans_wait_timeout(suseconds_t);
 
Index: uspace/srv/net/ethip/ethip.c
===================================================================
--- uspace/srv/net/ethip/ethip.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/ethip.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -57,6 +57,6 @@
 static int ethip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu);
 static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu);
-static int ethip_addr_add(iplink_srv_t *srv, iplink_srv_addr_t *addr);
-static int ethip_addr_remove(iplink_srv_t *srv, iplink_srv_addr_t *addr);
+static int ethip_addr_add(iplink_srv_t *srv, uint32_t addr);
+static int ethip_addr_remove(iplink_srv_t *srv, uint32_t addr);
 
 static void ethip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
@@ -175,8 +175,8 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_send()");
 
-	rc = arp_translate(nic, &sdu->lsrc, &sdu->ldest, &dest_mac_addr);
+	rc = arp_translate(nic, sdu->lsrc, sdu->ldest, &dest_mac_addr);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_WARN, "Failed to look up IP address 0x%" PRIx32,
-		    sdu->ldest.ipv4);
+		    sdu->ldest);
 		return rc;
 	}
@@ -221,6 +221,6 @@
 	case ETYPE_IP:
 		log_msg(LOG_DEFAULT, LVL_DEBUG, " - construct SDU");
-		sdu.lsrc.ipv4 = 0;
-		sdu.ldest.ipv4 = 0;
+		sdu.lsrc = 0;
+		sdu.ldest = 0;
 		sdu.data = frame.data;
 		sdu.size = frame.size;
@@ -244,17 +244,19 @@
 }
 
-static int ethip_addr_add(iplink_srv_t *srv, iplink_srv_addr_t *addr)
-{
+static int ethip_addr_add(iplink_srv_t *srv, uint32_t addr)
+{
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_addr_add(0x%" PRIx32 ")", addr);
+	
+	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
+	
+	return ethip_nic_addr_add(nic, addr);
+}
+
+static int ethip_addr_remove(iplink_srv_t *srv, uint32_t addr)
+{
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_addr_remove(0x%" PRIx32 ")", addr);
+	
 	ethip_nic_t *nic = (ethip_nic_t *)srv->arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_addr_add(0x%" PRIx32 ")", addr->ipv4);
-	return ethip_nic_addr_add(nic, addr);
-}
-
-static int ethip_addr_remove(iplink_srv_t *srv, iplink_srv_addr_t *addr)
-{
-	ethip_nic_t *nic = (ethip_nic_t *)srv->arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_addr_remove(0x%" PRIx32 ")", addr->ipv4);
+	
 	return ethip_nic_addr_add(nic, addr);
 }
Index: uspace/srv/net/ethip/ethip.h
===================================================================
--- uspace/srv/net/ethip/ethip.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/ethip.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -48,5 +48,5 @@
 typedef struct {
 	link_t addr_list;
-	iplink_srv_addr_t addr;
+	uint32_t addr;
 } ethip_link_addr_t;
 
@@ -104,9 +104,9 @@
 	mac48_addr_t sender_hw_addr;
 	/** Sender protocol address */
-	iplink_srv_addr_t sender_proto_addr;
+	uint32_t sender_proto_addr;
 	/** Target hardware address */
 	mac48_addr_t target_hw_addr;
 	/** Target protocol address */
-	iplink_srv_addr_t target_proto_addr;
+	uint32_t target_proto_addr;
 } arp_eth_packet_t;
 
@@ -114,5 +114,5 @@
 typedef struct {
 	link_t atrans_list;
-	iplink_srv_addr_t ip_addr;
+	uint32_t ip_addr;
 	mac48_addr_t mac_addr;
 } ethip_atrans_t;
Index: uspace/srv/net/ethip/ethip_nic.c
===================================================================
--- uspace/srv/net/ethip/ethip_nic.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/ethip_nic.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -121,8 +121,7 @@
 }
 
-static ethip_link_addr_t *ethip_nic_addr_new(iplink_srv_addr_t *addr)
+static ethip_link_addr_t *ethip_nic_addr_new(uint32_t addr)
 {
 	ethip_link_addr_t *laddr = calloc(1, sizeof(ethip_link_addr_t));
-
 	if (laddr == NULL) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating NIC address structure. "
@@ -130,7 +129,8 @@
 		return NULL;
 	}
-
+	
 	link_initialize(&laddr->addr_list);
-	laddr->addr.ipv4 = addr->ipv4;
+	laddr->addr = addr;
+	
 	return laddr;
 }
@@ -335,27 +335,24 @@
 }
 
-int ethip_nic_addr_add(ethip_nic_t *nic, iplink_srv_addr_t *addr)
-{
-	ethip_link_addr_t *laddr;
-
+int ethip_nic_addr_add(ethip_nic_t *nic, uint32_t addr)
+{
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_add()");
-	laddr = ethip_nic_addr_new(addr);
+	
+	ethip_link_addr_t *laddr = ethip_nic_addr_new(addr);
 	if (laddr == NULL)
 		return ENOMEM;
-
+	
 	list_append(&laddr->addr_list, &nic->addr_list);
 	return EOK;
 }
 
-int ethip_nic_addr_remove(ethip_nic_t *nic, iplink_srv_addr_t *addr)
-{
-	ethip_link_addr_t *laddr;
-
+int ethip_nic_addr_remove(ethip_nic_t *nic, uint32_t addr)
+{
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_remove()");
-
-	laddr = ethip_nic_addr_find(nic, addr);
+	
+	ethip_link_addr_t *laddr = ethip_nic_addr_find(nic, addr);
 	if (laddr == NULL)
 		return ENOENT;
-
+	
 	list_remove(&laddr->addr_list);
 	ethip_link_addr_delete(laddr);
@@ -364,5 +361,5 @@
 
 ethip_link_addr_t *ethip_nic_addr_find(ethip_nic_t *nic,
-    iplink_srv_addr_t *addr)
+    uint32_t addr)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_find()");
@@ -372,5 +369,5 @@
 		    ethip_link_addr_t, addr_list);
 
-		if (addr->ipv4 == laddr->addr.ipv4)
+		if (addr == laddr->addr)
 			return laddr;
 	}
Index: uspace/srv/net/ethip/ethip_nic.h
===================================================================
--- uspace/srv/net/ethip/ethip_nic.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/ethip_nic.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -44,8 +44,7 @@
 extern ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t);
 extern int ethip_nic_send(ethip_nic_t *, void *, size_t);
-extern int ethip_nic_addr_add(ethip_nic_t *, iplink_srv_addr_t *);
-extern int ethip_nic_addr_remove(ethip_nic_t *, iplink_srv_addr_t *);
-extern ethip_link_addr_t *ethip_nic_addr_find(ethip_nic_t *,
-    iplink_srv_addr_t *);
+extern int ethip_nic_addr_add(ethip_nic_t *, uint32_t);
+extern int ethip_nic_addr_remove(ethip_nic_t *, uint32_t);
+extern ethip_link_addr_t *ethip_nic_addr_find(ethip_nic_t *, uint32_t);
 
 #endif
Index: uspace/srv/net/ethip/pdu.c
===================================================================
--- uspace/srv/net/ethip/pdu.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/ethip/pdu.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -170,8 +170,8 @@
 	mac48_encode(&packet->sender_hw_addr, pfmt->sender_hw_addr);
 	pfmt->sender_proto_addr =
-	    host2uint32_t_be(packet->sender_proto_addr.ipv4);
+	    host2uint32_t_be(packet->sender_proto_addr);
 	mac48_encode(&packet->target_hw_addr, pfmt->target_hw_addr);
 	pfmt->target_proto_addr =
-	    host2uint32_t_be(packet->target_proto_addr.ipv4);
+	    host2uint32_t_be(packet->target_proto_addr);
 
 	*rdata = data;
@@ -228,8 +228,8 @@
 
 	mac48_decode(pfmt->sender_hw_addr, &packet->sender_hw_addr);
-	packet->sender_proto_addr.ipv4 =
+	packet->sender_proto_addr =
 	    uint32_t_be2host(pfmt->sender_proto_addr);
 	mac48_decode(pfmt->target_hw_addr, &packet->target_hw_addr);
-	packet->target_proto_addr.ipv4 =
+	packet->target_proto_addr =
 	    uint32_t_be2host(pfmt->target_proto_addr);
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "packet->tpa = %x\n", pfmt->target_proto_addr);
@@ -238,5 +238,4 @@
 }
 
-
 /** @}
  */
Index: uspace/srv/net/inetsrv/addrobj.c
===================================================================
--- uspace/srv/net/inetsrv/addrobj.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/addrobj.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -112,16 +112,23 @@
 inet_addrobj_t *inet_addrobj_find(inet_addr_t *addr, inet_addrobj_find_t find)
 {
-	uint32_t mask;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find(%x)", (unsigned)addr->ipv4);
-
-	fibril_mutex_lock(&addr_list_lock);
-
+	uint32_t addr_addr;
+	int rc = inet_addr_pack(addr, &addr_addr);
+	if (rc != EOK)
+		return NULL;
+	
+	fibril_mutex_lock(&addr_list_lock);
+	
 	list_foreach(addr_list, link) {
 		inet_addrobj_t *naddr = list_get_instance(link,
 		    inet_addrobj_t, addr_list);
-
-		mask = inet_netmask(naddr->naddr.bits);
-		if ((naddr->naddr.ipv4 & mask) == (addr->ipv4 & mask)) {
+		
+		uint32_t naddr_addr;
+		uint8_t naddr_bits;
+		rc = inet_naddr_pack(&naddr->naddr, &naddr_addr, &naddr_bits);
+		if (rc != EOK)
+			continue;
+		
+		uint32_t mask = inet_netmask(naddr_bits);
+		if ((naddr_addr & mask) == (addr_addr & mask)) {
 			fibril_mutex_unlock(&addr_list_lock);
 			log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p",
@@ -218,9 +225,8 @@
 {
 	inet_addr_t lsrc_addr;
-	inet_addr_t *ldest_addr;
-
-	lsrc_addr.ipv4 = addr->naddr.ipv4;
-	ldest_addr = ldest;
-
+	inet_naddr_addr(&addr->naddr, &lsrc_addr);
+	
+	inet_addr_t *ldest_addr = ldest;
+	
 	return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest_addr, dgram,
 	    proto, ttl, df);
Index: uspace/srv/net/inetsrv/icmp.c
===================================================================
--- uspace/srv/net/inetsrv/icmp.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/icmp.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -120,21 +120,26 @@
 static int icmp_recv_echo_reply(inet_dgram_t *dgram)
 {
-	icmp_echo_t *reply;
-	inetping_sdu_t sdu;
-	uint16_t ident;
-
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmp_recv_echo_reply()");
-
+	
 	if (dgram->size < sizeof(icmp_echo_t))
 		return EINVAL;
-
-	reply = (icmp_echo_t *)dgram->data;
-
-	sdu.src = dgram->src;
-	sdu.dest = dgram->dest;
+	
+	icmp_echo_t *reply = (icmp_echo_t *) dgram->data;
+	
+	inetping_sdu_t sdu;
+	
+	int rc = inet_addr_pack(&dgram->src, &sdu.src);
+	if (rc != EOK)
+		return rc;
+	
+	rc = inet_addr_pack(&dgram->dest, &sdu.dest);
+	if (rc != EOK)
+		return rc;
+	
 	sdu.seq_no = uint16_t_be2host(reply->seq_no);
 	sdu.data = reply + sizeof(icmp_echo_t);
 	sdu.size = dgram->size - sizeof(icmp_echo_t);
-	ident = uint16_t_be2host(reply->ident);
+	
+	uint16_t ident = uint16_t_be2host(reply->ident);
 
 	return inetping_recv(ident, &sdu);
@@ -143,18 +148,11 @@
 int icmp_ping_send(uint16_t ident, inetping_sdu_t *sdu)
 {
-	inet_dgram_t dgram;
-	icmp_echo_t *request;
-	void *rdata;
-	size_t rsize;
-	uint16_t checksum;
-	int rc;
-
-	rsize = sizeof(icmp_echo_t) + sdu->size;
-	rdata = calloc(rsize, 1);
+	size_t rsize = sizeof(icmp_echo_t) + sdu->size;
+	void *rdata = calloc(rsize, 1);
 	if (rdata == NULL)
 		return ENOMEM;
-
-	request = (icmp_echo_t *)rdata;
-
+	
+	icmp_echo_t *request = (icmp_echo_t *)rdata;
+	
 	request->type = ICMP_ECHO_REQUEST;
 	request->code = 0;
@@ -162,18 +160,21 @@
 	request->ident = host2uint16_t_be(ident);
 	request->seq_no = host2uint16_t_be(sdu->seq_no);
-
+	
 	memcpy(rdata + sizeof(icmp_echo_t), sdu->data, sdu->size);
-
-	checksum = inet_checksum_calc(INET_CHECKSUM_INIT, rdata, rsize);
+	
+	uint16_t checksum = inet_checksum_calc(INET_CHECKSUM_INIT, rdata, rsize);
 	request->checksum = host2uint16_t_be(checksum);
-
-	dgram.src = sdu->src;
-	dgram.dest = sdu->dest;
+	
+	inet_dgram_t dgram;
+	
+	inet_addr_unpack(sdu->src, &dgram.src);
+	inet_addr_unpack(sdu->dest, &dgram.dest);
+	
 	dgram.tos = ICMP_TOS;
 	dgram.data = rdata;
 	dgram.size = rsize;
-
-	rc = inet_route_packet(&dgram, IP_PROTO_ICMP, INET_TTL_MAX, 0);
-
+	
+	int rc = inet_route_packet(&dgram, IP_PROTO_ICMP, INET_TTL_MAX, 0);
+	
 	free(rdata);
 	return rc;
Index: uspace/srv/net/inetsrv/inet_link.c
===================================================================
--- uspace/srv/net/inetsrv/inet_link.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/inet_link.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -153,5 +153,5 @@
 {
 	inet_link_t *ilink;
-	iplink_addr_t iaddr;
+	inet_addr_t iaddr;
 	int rc;
 
@@ -196,13 +196,15 @@
 
 	static int first = 1;
-	/* XXX For testing: set static IP address 10.0.2.15/24 */
+	
 	addr = inet_addrobj_new();
+	
 	if (first) {
-		addr->naddr.ipv4 = (127 << 24) + (0 << 16) + (0 << 8) + 1;
+		inet_naddr(&addr->naddr, 127, 0, 0, 1, 24);
 		first = 0;
 	} else {
-		addr->naddr.ipv4 = (10 << 24) + (0 << 16) + (2 << 8) + 15;
-	}
-	addr->naddr.bits = 24;
+		/* XXX For testing: set static IP address 10.0.2.15/24 */
+		inet_naddr(&addr->naddr, 10, 0, 2, 15, 24);
+	}
+	
 	addr->ilink = ilink;
 	addr->name = str_dup("v4a");
@@ -215,5 +217,5 @@
 	}
 
-	iaddr.ipv4 = addr->naddr.ipv4;
+	inet_naddr_addr(&addr->naddr, &iaddr);
 	rc = iplink_addr_add(ilink->iplink, &iaddr);
 	if (rc != EOK) {
@@ -257,13 +259,10 @@
     inet_addr_t *ldest, inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
 {
-	iplink_sdu_t sdu;
-	inet_packet_t packet;
-	int rc;
-	size_t offs, roffs;
-
 	/*
 	 * Fill packet structure. Fragmentation is performed by
 	 * inet_pdu_encode().
 	 */
+	inet_packet_t packet;
+	
 	packet.src = dgram->src;
 	packet.dest = dgram->dest;
@@ -274,10 +273,19 @@
 	packet.data = dgram->data;
 	packet.size = dgram->size;
-
-	sdu.lsrc.ipv4 = lsrc->ipv4;
-	sdu.ldest.ipv4 = ldest->ipv4;
-
-	offs = 0;
+	
+	iplink_sdu_t sdu;
+	
+	int rc = inet_addr_pack(lsrc, &sdu.lsrc);
+	if (rc != EOK)
+		return rc;
+	
+	rc = inet_addr_pack(ldest, &sdu.ldest);
+	if (rc != EOK)
+		return rc;
+	
+	size_t offs = 0;
 	do {
+		size_t roffs;
+		
 		/* Encode one fragment */
 		rc = inet_pdu_encode(&packet, offs, ilink->def_mtu, &sdu.data,
@@ -285,12 +293,12 @@
 		if (rc != EOK)
 			return rc;
-
+		
 		/* Send the PDU */
 		rc = iplink_send(ilink->iplink, &sdu);
 		free(sdu.data);
-
+		
 		offs = roffs;
 	} while (offs < packet.size);
-
+	
 	return rc;
 }
Index: uspace/srv/net/inetsrv/inetcfg.c
===================================================================
--- uspace/srv/net/inetsrv/inetcfg.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/inetcfg.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -56,5 +56,5 @@
 	inet_link_t *ilink;
 	inet_addrobj_t *addr;
-	iplink_addr_t iaddr;
+	inet_addr_t iaddr;
 	int rc;
 
@@ -82,5 +82,5 @@
 	}
 
-	iaddr.ipv4 = addr->naddr.ipv4;
+	inet_naddr_addr(&addr->naddr, &iaddr);
 	rc = iplink_addr_add(ilink->iplink, &iaddr);
 	if (rc != EOK) {
@@ -254,7 +254,6 @@
 	}
 
-	naddr.ipv4 = IPC_GET_ARG1(*call);
-	naddr.bits = IPC_GET_ARG2(*call);
-	link_id    = IPC_GET_ARG3(*call);
+	inet_naddr_unpack(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), &naddr);
+	link_id = IPC_GET_ARG3(*call);
 
 	addr_id = 0;
@@ -279,19 +278,17 @@
 static void inetcfg_addr_get_srv(ipc_callid_t callid, ipc_call_t *call)
 {
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()");
+	
+	sysarg_t addr_id = IPC_GET_ARG1(*call);
+	
+	inet_addr_info_t ainfo;
+	
+	inet_naddr_any(&ainfo.naddr);
+	ainfo.ilink = 0;
+	ainfo.name = NULL;
+	
 	ipc_callid_t rcallid;
 	size_t max_size;
-
-	sysarg_t addr_id;
-	inet_addr_info_t ainfo;
-	int rc;
-
-	addr_id = IPC_GET_ARG1(*call);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()");
-
-	ainfo.naddr.ipv4 = 0;
-	ainfo.naddr.bits = 0;
-	ainfo.ilink = 0;
-	ainfo.name = NULL;
-
+	
 	if (!async_data_read_receive(&rcallid, &max_size)) {
 		async_answer_0(rcallid, EREFUSED);
@@ -299,17 +296,25 @@
 		return;
 	}
-
-	rc = inetcfg_addr_get(addr_id, &ainfo);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
-		return;
-	}
-
+	
+	int rc = inetcfg_addr_get(addr_id, &ainfo);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
+	uint32_t naddr_addr;
+	uint8_t naddr_bits;
+	rc = inet_naddr_pack(&ainfo.naddr, &naddr_addr, &naddr_bits);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
 	sysarg_t retval = async_data_read_finalize(rcallid, ainfo.name,
 	    min(max_size, str_size(ainfo.name)));
 	free(ainfo.name);
-
-	async_answer_3(callid, retval, ainfo.naddr.ipv4, ainfo.naddr.bits,
-	    ainfo.ilink);
+	
+	async_answer_3(callid, retval, (sysarg_t) naddr_addr,
+	    (sysarg_t) naddr_bits, ainfo.ilink);
 }
 
@@ -476,24 +481,21 @@
     ipc_call_t *call)
 {
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");
+	
 	char *name;
+	int rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
+	    0, NULL);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
 	inet_naddr_t dest;
 	inet_addr_t router;
-	sysarg_t sroute_id;
-	int rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");
-
-	rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
-		return;
-	}
-
-	dest.ipv4   = IPC_GET_ARG1(*call);
-	dest.bits   = IPC_GET_ARG2(*call);
-	router.ipv4 = IPC_GET_ARG3(*call);
-
-	sroute_id = 0;
+	
+	inet_naddr_unpack(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), &dest);
+	inet_addr_unpack(IPC_GET_ARG3(*call), &router);
+	
+	sysarg_t sroute_id = 0;
 	rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id);
 	free(name);
@@ -516,19 +518,16 @@
 static void inetcfg_sroute_get_srv(ipc_callid_t callid, ipc_call_t *call)
 {
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()");
+	
+	sysarg_t sroute_id = IPC_GET_ARG1(*call);
+	
+	inet_sroute_info_t srinfo;
+	
+	inet_naddr_any(&srinfo.dest);
+	inet_addr_any(&srinfo.router);
+	srinfo.name = NULL;
+	
 	ipc_callid_t rcallid;
 	size_t max_size;
-
-	sysarg_t sroute_id;
-	inet_sroute_info_t srinfo;
-	int rc;
-
-	sroute_id = IPC_GET_ARG1(*call);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()");
-
-	srinfo.dest.ipv4 = 0;
-	srinfo.dest.bits = 0;
-	srinfo.router.ipv4 = 0;
-	srinfo.name = NULL;
-
 	if (!async_data_read_receive(&rcallid, &max_size)) {
 		async_answer_0(rcallid, EREFUSED);
@@ -536,17 +535,32 @@
 		return;
 	}
-
-	rc = inetcfg_sroute_get(sroute_id, &srinfo);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
-		return;
-	}
-
+	
+	int rc = inetcfg_sroute_get(sroute_id, &srinfo);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
+	uint32_t dest_addr;
+	uint8_t dest_bits;
+	rc = inet_naddr_pack(&srinfo.dest, &dest_addr, &dest_bits);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
+	uint32_t router_addr;
+	rc = inet_addr_pack(&srinfo.router, &router_addr);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
 	sysarg_t retval = async_data_read_finalize(rcallid, srinfo.name,
 	    min(max_size, str_size(srinfo.name)));
 	free(srinfo.name);
-
-	async_answer_3(callid, retval, srinfo.dest.ipv4, srinfo.dest.bits,
-	    srinfo.router.ipv4);
+	
+	async_answer_3(callid, retval, (sysarg_t) dest_addr,
+	    (sysarg_t) dest_bits, (sysarg_t) router_addr);
 }
 
Index: uspace/srv/net/inetsrv/inetping.c
===================================================================
--- uspace/srv/net/inetsrv/inetping.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/inetping.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -62,8 +62,16 @@
 }
 
-static int inetping_get_srcaddr(inetping_client_t *client, inet_addr_t *remote,
-    inet_addr_t *local)
-{
-	return inet_get_srcaddr(remote, ICMP_TOS, local);
+static int inetping_get_srcaddr(inetping_client_t *client, uint32_t remote,
+    uint32_t *local)
+{
+	inet_addr_t remote_addr;
+	inet_addr_unpack(remote, &remote_addr);
+	
+	inet_addr_t local_addr;
+	int rc = inet_get_srcaddr(&remote_addr, ICMP_TOS, &local_addr);
+	if (rc != EOK)
+		return rc;
+	
+	return inet_addr_pack(&local_addr, local);
 }
 
@@ -82,6 +90,6 @@
 	exch = async_exchange_begin(client->sess);
 
-	aid_t req = async_send_3(exch, INETPING_EV_RECV, sdu->src.ipv4,
-	    sdu->dest.ipv4, sdu->seq_no, &answer);
+	aid_t req = async_send_3(exch, INETPING_EV_RECV, (sysarg_t) sdu->src,
+	    (sysarg_t) sdu->dest, sdu->seq_no, &answer);
 	int rc = async_data_write_start(exch, sdu->data, sdu->size);
 	async_exchange_end(exch);
@@ -116,6 +124,6 @@
 	}
 
-	sdu.src.ipv4 = IPC_GET_ARG1(*call);
-	sdu.dest.ipv4 = IPC_GET_ARG2(*call);
+	sdu.src = IPC_GET_ARG1(*call);
+	sdu.dest = IPC_GET_ARG2(*call);
 	sdu.seq_no = IPC_GET_ARG3(*call);
 
@@ -129,15 +137,11 @@
     ipc_callid_t callid, ipc_call_t *call)
 {
-	inet_addr_t remote;
-	inet_addr_t local;
-	int rc;
-
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_get_srcaddr_srv()");
-
-	remote.ipv4 = IPC_GET_ARG1(*call);
-	local.ipv4 = 0;
-
-	rc = inetping_get_srcaddr(client, &remote, &local);
-	async_answer_1(callid, rc, local.ipv4);
+	
+	uint32_t remote = IPC_GET_ARG1(*call);
+	uint32_t local = 0;
+	
+	int rc = inetping_get_srcaddr(client, remote, &local);
+	async_answer_1(callid, rc, (sysarg_t) local);
 }
 
Index: uspace/srv/net/inetsrv/inetping.h
===================================================================
--- uspace/srv/net/inetsrv/inetping.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/inetping.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -38,4 +38,6 @@
 #define INETPING_H_
 
+#include "inetsrv.h"
+
 extern void inetping_conn(ipc_callid_t, ipc_call_t *, void *);
 extern int inetping_recv(uint16_t, inetping_sdu_t *);
Index: uspace/srv/net/inetsrv/inetsrv.c
===================================================================
--- uspace/srv/net/inetsrv/inetsrv.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/inetsrv.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -104,11 +104,10 @@
 	}
 
-	sroute->dest.ipv4 = 0;
-	sroute->dest.bits = 0;
-	sroute->router.ipv4 = (10 << 24) | (0 << 16) | (2 << 8) | 2;
+	inet_naddr(&sroute->dest, 0, 0, 0, 0, 0);
+	inet_addr(&sroute->router, 10, 0, 2, 2);
 	sroute->name = str_dup("default");
 	inet_sroute_add(sroute);
 
-       	rc = inet_link_discovery_start();
+	rc = inet_link_discovery_start();
 	if (rc != EOK)
 		return EEXIST;
@@ -194,5 +193,5 @@
 
 	/* Take source address from the address object */
-	local->ipv4 = dir.aobj->naddr.ipv4;
+	inet_naddr_addr(&dir.aobj->naddr, local);
 	return EOK;
 }
@@ -201,17 +200,25 @@
     ipc_call_t *call)
 {
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_get_srcaddr_srv()");
+	
 	inet_addr_t remote;
-	uint8_t tos;
+	inet_addr_unpack(IPC_GET_ARG1(*call), &remote);
+	uint8_t tos = IPC_GET_ARG2(*call);
+	
 	inet_addr_t local;
-	int rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_get_srcaddr_srv()");
-
-	remote.ipv4 = IPC_GET_ARG1(*call);
-	tos = IPC_GET_ARG2(*call);
-	local.ipv4 = 0;
-
-	rc = inet_get_srcaddr(&remote, tos, &local);
-	async_answer_1(callid, rc, local.ipv4);
+	int rc = inet_get_srcaddr(&remote, tos, &local);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
+	uint32_t local_addr;
+	rc = inet_addr_pack(&local, &local_addr);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+	
+	async_answer_1(callid, rc, (sysarg_t) local_addr);
 }
 
@@ -219,25 +226,24 @@
     ipc_call_t *call)
 {
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_send_srv()");
+	
 	inet_dgram_t dgram;
-	uint8_t ttl;
-	int df;
-	int rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_send_srv()");
-
-	dgram.src.ipv4 = IPC_GET_ARG1(*call);
-	dgram.dest.ipv4 = IPC_GET_ARG2(*call);
+	
+	inet_addr_unpack(IPC_GET_ARG1(*call), &dgram.src);
+	inet_addr_unpack(IPC_GET_ARG2(*call), &dgram.dest);
 	dgram.tos = IPC_GET_ARG3(*call);
-	ttl = IPC_GET_ARG4(*call);
-	df = IPC_GET_ARG5(*call);
-
-	rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size);
+	
+	uint8_t ttl = IPC_GET_ARG4(*call);
+	int df = IPC_GET_ARG5(*call);
+	
+	int rc = async_data_write_accept(&dgram.data, false, 0, 0, 0,
+	    &dgram.size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
 		return;
 	}
-
+	
 	rc = inet_send(client, &dgram, client->protocol, ttl, df);
-
+	
 	free(dgram.data);
 	async_answer_0(callid, rc);
@@ -365,22 +371,32 @@
 int inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
 {
+	uint32_t src;
+	int rc = inet_addr_pack(&dgram->src, &src);
+	if (rc != EOK)
+		return rc;
+	
+	uint32_t dest;
+	rc = inet_addr_pack(&dgram->dest, &dest);
+	if (rc != EOK)
+		return rc;
+	
 	async_exch_t *exch = async_exchange_begin(client->sess);
-
+	
 	ipc_call_t answer;
-	aid_t req = async_send_3(exch, INET_EV_RECV, dgram->src.ipv4,
-	    dgram->dest.ipv4, dgram->tos, &answer);
-	int rc = async_data_write_start(exch, dgram->data, dgram->size);
+	aid_t req = async_send_3(exch, INET_EV_RECV, (sysarg_t) src,
+	    (sysarg_t) dest, dgram->tos, &answer);
+	rc = async_data_write_start(exch, dgram->data, dgram->size);
 	async_exchange_end(exch);
-
+	
 	if (rc != EOK) {
 		async_forget(req);
 		return rc;
 	}
-
+	
 	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
 		return retval;
-
+	
 	return EOK;
 }
Index: uspace/srv/net/inetsrv/inetsrv.h
===================================================================
--- uspace/srv/net/inetsrv/inetsrv.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/inetsrv.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -172,6 +172,6 @@
 
 typedef struct {
-	inet_addr_t src;
-	inet_addr_t dest;
+	uint32_t src;
+	uint32_t dest;
 	uint16_t seq_no;
 	void *data;
Index: uspace/srv/net/inetsrv/pdu.c
===================================================================
--- uspace/srv/net/inetsrv/pdu.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/pdu.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -106,67 +106,64 @@
     void **rdata, size_t *rsize, size_t *roffs)
 {
-	void *data;
-	size_t size;
-	ip_header_t *hdr;
-	size_t hdr_size;
-	size_t data_offs;
-	uint16_t chksum;
-	uint16_t ident;
-	uint16_t flags_foff;
-	uint16_t foff;
-	size_t fragoff_limit;
-	size_t xfer_size;
-	size_t spc_avail;
-	size_t rem_offs;
-
+	uint32_t src_addr;
+	int rc = inet_addr_pack(&packet->src, &src_addr);
+	if (rc != EOK)
+		return rc;
+	
+	uint32_t dest_addr;
+	rc = inet_addr_pack(&packet->dest, &dest_addr);
+	if (rc != EOK)
+		return rc;
+	
 	/* Upper bound for fragment offset field */
-	fragoff_limit = 1 << (FF_FRAGOFF_h - FF_FRAGOFF_l);
-
+	size_t fragoff_limit = 1 << (FF_FRAGOFF_h - FF_FRAGOFF_l);
+	
 	/* Verify that total size of datagram is within reasonable bounds */
 	if (offs + packet->size > FRAG_OFFS_UNIT * fragoff_limit)
 		return ELIMIT;
-
-	hdr_size = sizeof(ip_header_t);
-	data_offs = ROUND_UP(hdr_size, 4);
-
+	
+	size_t hdr_size = sizeof(ip_header_t);
+	size_t data_offs = ROUND_UP(hdr_size, 4);
+	
 	assert(offs % FRAG_OFFS_UNIT == 0);
 	assert(offs / FRAG_OFFS_UNIT < fragoff_limit);
-
+	
 	/* Value for the fragment offset field */
-	foff = offs / FRAG_OFFS_UNIT;
-
+	uint16_t foff = offs / FRAG_OFFS_UNIT;
+	
 	if (hdr_size >= mtu)
 		return EINVAL;
-
+	
 	/* Amount of space in the PDU available for payload */
-	spc_avail = mtu - hdr_size;
+	size_t spc_avail = mtu - hdr_size;
 	spc_avail -= (spc_avail % FRAG_OFFS_UNIT);
-
+	
 	/* Amount of data (payload) to transfer */
-	xfer_size = min(packet->size - offs, spc_avail);
-
+	size_t xfer_size = min(packet->size - offs, spc_avail);
+	
 	/* Total PDU size */
-	size = hdr_size + xfer_size;
-
+	size_t size = hdr_size + xfer_size;
+	
 	/* Offset of remaining payload */
-	rem_offs = offs + xfer_size;
-
+	size_t rem_offs = offs + xfer_size;
+	
 	/* Flags */
-	flags_foff =
+	uint16_t flags_foff =
 	    (packet->df ? BIT_V(uint16_t, FF_FLAG_DF) : 0) +
 	    (rem_offs < packet->size ? BIT_V(uint16_t, FF_FLAG_MF) : 0) +
 	    (foff << FF_FRAGOFF_l);
-
-	data = calloc(size, 1);
+	
+	void *data = calloc(size, 1);
 	if (data == NULL)
 		return ENOMEM;
-
+	
 	/* Allocate identifier */
 	fibril_mutex_lock(&ip_ident_lock);
-	ident = ++ip_ident;
+	uint16_t ident = ++ip_ident;
 	fibril_mutex_unlock(&ip_ident_lock);
-
+	
 	/* Encode header fields */
-	hdr = (ip_header_t *)data;
+	ip_header_t *hdr = (ip_header_t *) data;
+	
 	hdr->ver_ihl = (4 << VI_VERSION_l) | (hdr_size / sizeof(uint32_t));
 	hdr->tos = packet->tos;
@@ -177,18 +174,19 @@
 	hdr->proto = packet->proto;
 	hdr->chksum = 0;
-	hdr->src_addr = host2uint32_t_be(packet->src.ipv4);
-	hdr->dest_addr = host2uint32_t_be(packet->dest.ipv4);
-
+	hdr->src_addr = host2uint32_t_be(src_addr);
+	hdr->dest_addr = host2uint32_t_be(dest_addr);
+	
 	/* Compute checksum */
-	chksum = inet_checksum_calc(INET_CHECKSUM_INIT, (void *)hdr, hdr_size);
+	uint16_t chksum = inet_checksum_calc(INET_CHECKSUM_INIT, (void *) hdr,
+	    hdr_size);
 	hdr->chksum = host2uint16_t_be(chksum);
-
+	
 	/* Copy payload */
-	memcpy((uint8_t *)data + data_offs, packet->data + offs, xfer_size);
-
+	memcpy((uint8_t *) data + data_offs, packet->data + offs, xfer_size);
+	
 	*rdata = data;
 	*rsize = size;
 	*roffs = rem_offs;
-
+	
 	return EOK;
 }
@@ -238,6 +236,6 @@
 	/* XXX Checksum */
 
-	packet->src.ipv4 = uint32_t_be2host(hdr->src_addr);
-	packet->dest.ipv4 = uint32_t_be2host(hdr->dest_addr);
+	inet_addr_unpack(uint32_t_be2host(hdr->src_addr), &packet->src);
+	inet_addr_unpack(uint32_t_be2host(hdr->dest_addr), &packet->dest);
 	packet->tos = hdr->tos;
 	packet->proto = hdr->proto;
Index: uspace/srv/net/inetsrv/reass.c
===================================================================
--- uspace/srv/net/inetsrv/reass.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/reass.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -139,8 +139,8 @@
 		    dgram_link);
 
-		if (f1->packet.src.ipv4 == packet->src.ipv4 &&
-		    f1->packet.dest.ipv4 == packet->dest.ipv4 &&
-		    f1->packet.proto == packet->proto &&
-		    f1->packet.ident == packet->ident) {
+		if ((inet_addr_compare(&f1->packet.src, &packet->src)) &&
+		    (inet_addr_compare(&f1->packet.dest, &packet->dest)) &&
+		    (f1->packet.proto == packet->proto) &&
+		    (f1->packet.ident == packet->ident)) {
 			/* Match */
 			return rdg;
Index: uspace/srv/net/inetsrv/sroute.c
===================================================================
--- uspace/srv/net/inetsrv/sroute.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/inetsrv/sroute.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -97,34 +97,44 @@
 inet_sroute_t *inet_sroute_find(inet_addr_t *addr)
 {
-	uint32_t mask;
-	inet_sroute_t *best;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find(%x)", (unsigned)addr->ipv4);
-
-	fibril_mutex_lock(&sroute_list_lock);
-
-	best = NULL;
-
-	list_foreach(sroute_list, link) {
-		inet_sroute_t *sroute = list_get_instance(link,
-		    inet_sroute_t, sroute_list);
-
+	uint32_t addr_addr;
+	int rc = inet_addr_pack(addr, &addr_addr);
+	if (rc != EOK)
+		return NULL;
+	
+	inet_sroute_t *best = NULL;
+	uint8_t best_bits = 0;
+	
+	fibril_mutex_lock(&sroute_list_lock);
+	
+	list_foreach(sroute_list, link) {
+		inet_sroute_t *sroute = list_get_instance(link,
+		    inet_sroute_t, sroute_list);
+		
+		uint32_t dest_addr;
+		uint8_t dest_bits;
+		rc = inet_naddr_pack(&sroute->dest, &dest_addr, &dest_bits);
+		if (rc != EOK)
+			continue;
+		
 		/* Look for the most specific route */
-		if (best != NULL && best->dest.bits >= sroute->dest.bits)
+		if ((best != NULL) && (best_bits >= dest_bits))
 			continue;
-
-		mask = inet_netmask(sroute->dest.bits);
-		if ((sroute->dest.ipv4 & mask) == (addr->ipv4 & mask)) {
-			fibril_mutex_unlock(&sroute_list_lock);
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: found %p",
+		
+		uint32_t mask = inet_netmask(dest_bits);
+		if ((dest_addr & mask) == (addr_addr & mask)) {
+			log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: found candidate %p",
 			    sroute);
-			return sroute;
+			
+			best = sroute;
+			best_bits = dest_bits;
 		}
 	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: Not found");
-	fibril_mutex_unlock(&sroute_list_lock);
-
-	return NULL;
+	
+	if (best == NULL)
+		log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: Not found");
+	
+	fibril_mutex_unlock(&sroute_list_lock);
+	
+	return best;
 }
 
Index: uspace/srv/net/loopip/loopip.c
===================================================================
--- uspace/srv/net/loopip/loopip.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/loopip/loopip.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -50,6 +50,6 @@
 static int loopip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu);
 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);
-static int loopip_addr_add(iplink_srv_t *srv, iplink_srv_addr_t *addr);
-static int loopip_addr_remove(iplink_srv_t *srv, iplink_srv_addr_t *addr);
+static int loopip_addr_add(iplink_srv_t *srv, uint32_t addr);
+static int loopip_addr_remove(iplink_srv_t *srv, uint32_t addr);
 
 static void loopip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
@@ -189,13 +189,13 @@
 }
 
-static int loopip_addr_add(iplink_srv_t *srv, iplink_srv_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_addr_add(0x%" PRIx32 ")", addr->ipv4);
-	return EOK;
-}
-
-static int loopip_addr_remove(iplink_srv_t *srv, iplink_srv_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_addr_remove(0x%" PRIx32 ")", addr->ipv4);
+static int loopip_addr_add(iplink_srv_t *srv, uint32_t addr)
+{
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_addr_add(0x%" PRIx32 ")", addr);
+	return EOK;
+}
+
+static int loopip_addr_remove(iplink_srv_t *srv, uint32_t addr)
+{
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_addr_remove(0x%" PRIx32 ")", addr);
 	return EOK;
 }
Index: uspace/srv/net/tcp/conn.c
===================================================================
--- uspace/srv/net/tcp/conn.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/conn.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -312,13 +312,10 @@
 static bool tcp_socket_match(tcp_sock_t *sock, tcp_sock_t *patt)
 {
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_socket_match(sock=(%x,%u), pat=(%x,%u))",
-	    sock->addr.ipv4, sock->port, patt->addr.ipv4, patt->port);
-
-	if (patt->addr.ipv4 != TCP_IPV4_ANY &&
-	    patt->addr.ipv4 != sock->addr.ipv4)
+	if ((!inet_addr_is_any(&patt->addr)) &&
+	    (!inet_addr_compare(&patt->addr, &sock->addr)))
 		return false;
 
-	if (patt->port != TCP_PORT_ANY &&
-	    patt->port != sock->port)
+	if ((patt->port != TCP_PORT_ANY) &&
+	    (patt->port != sock->port))
 		return false;
 
@@ -354,8 +351,4 @@
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_find_ref(%p)", sp);
-	
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "compare conn (f:(%x,%u), l:(%x,%u))",
-	    sp->foreign.addr.ipv4, sp->foreign.port,
-	    sp->local.addr.ipv4, sp->local.port);
 	
 	fibril_mutex_lock(&conn_list_lock);
@@ -364,8 +357,4 @@
 		tcp_conn_t *conn = list_get_instance(link, tcp_conn_t, link);
 		tcp_sockpair_t *csp = &conn->ident;
-		
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, " - with (f:(%x,%u), l:(%x,%u))",
-		    csp->foreign.addr.ipv4, csp->foreign.port,
-		    csp->local.addr.ipv4, csp->local.port);
 		
 		if (tcp_sockpair_match(sp, csp)) {
Index: uspace/srv/net/tcp/pdu.c
===================================================================
--- uspace/srv/net/tcp/pdu.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/pdu.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -146,6 +146,14 @@
 static void tcp_phdr_setup(tcp_pdu_t *pdu, tcp_phdr_t *phdr)
 {
-	phdr->src_addr = host2uint32_t_be(pdu->src_addr.ipv4);
-	phdr->dest_addr = host2uint32_t_be(pdu->dest_addr.ipv4);
+	// FIXME: Check for correctness
+	
+	uint32_t src_addr;
+	inet_addr_pack(&pdu->src_addr, &src_addr);
+	
+	uint32_t dest_addr;
+	inet_addr_pack(&pdu->dest_addr, &dest_addr);
+	
+	phdr->src_addr = host2uint32_t_be(src_addr);
+	phdr->dest_addr = host2uint32_t_be(dest_addr);
 	phdr->zero = 0;
 	phdr->protocol = 6; /* XXX Magic number */
Index: uspace/srv/net/tcp/sock.c
===================================================================
--- uspace/srv/net/tcp/sock.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/sock.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -179,5 +179,5 @@
 	}
 
-	sock->laddr.ipv4 = TCP_IPV4_ANY;
+	inet_addr_any(&sock->laddr);
 	sock->lconn = NULL;
 	sock->backlog = 0;
@@ -314,7 +314,8 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, " - open connections");
 	
-	lsocket.addr.ipv4 = TCP_IPV4_ANY;
+	inet_addr_any(&lsocket.addr);
 	lsocket.port = sock_core->port;
-	fsocket.addr.ipv4 = TCP_IPV4_ANY;
+	
+	inet_addr_any(&fsocket.addr);
 	fsocket.port = TCP_PORT_ANY;
 	
@@ -396,9 +397,11 @@
 	fibril_mutex_lock(&socket->lock);
 
-	if (socket->laddr.ipv4 == TCP_IPV4_ANY) {
+	if (inet_addr_is_any(&socket->laddr)) {
 		/* Determine local IP address */
-		inet_addr_t loc_addr, rem_addr;
-
-		rem_addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr);
+		inet_addr_t loc_addr;
+		inet_addr_t rem_addr;
+		
+		inet_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
+		    &rem_addr);
 		rc = inet_get_srcaddr(&rem_addr, 0, &loc_addr);
 		if (rc != EOK) {
@@ -409,12 +412,13 @@
 			return;
 		}
-
-		socket->laddr.ipv4 = loc_addr.ipv4;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Local IP address is %x", socket->laddr.ipv4);
-	}
-
-	lsocket.addr.ipv4 = socket->laddr.ipv4;
+		
+		socket->laddr = loc_addr;
+	}
+	
+	lsocket.addr = socket->laddr;
 	lsocket.port = sock_core->port;
-	fsocket.addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr);
+	
+	inet_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
+	    &fsocket.addr);
 	fsocket.port = uint16_t_be2host(addr->sin_port);
 
@@ -507,7 +511,8 @@
 	/* Replenish listening connection */
 
-	lsocket.addr.ipv4 = TCP_IPV4_ANY;
+	inet_addr_any(&lsocket.addr);
 	lsocket.port = sock_core->port;
-	fsocket.addr.ipv4 = TCP_IPV4_ANY;
+	
+	inet_addr_any(&fsocket.addr);
 	fsocket.port = TCP_PORT_ANY;
 
@@ -728,8 +733,18 @@
 
 	if (IPC_GET_IMETHOD(call) == NET_SOCKET_RECVFROM) {
-		/* Fill addr */
+		/* Fill address */
 		rsock = &socket->conn->ident.foreign;
+		
+		uint32_t rsock_addr;
+		int rc = inet_addr_pack(&rsock->addr, &rsock_addr);
+		if (rc != EOK) {
+			fibril_mutex_unlock(&socket->recv_buffer_lock);
+			fibril_mutex_unlock(&socket->lock);
+			async_answer_0(callid, rc);
+			return;
+		}
+		
 		addr.sin_family = AF_INET;
-		addr.sin_addr.s_addr = host2uint32_t_be(rsock->addr.ipv4);
+		addr.sin_addr.s_addr = host2uint32_t_be(rsock_addr);
 		addr.sin_port = host2uint16_t_be(rsock->port);
 
Index: uspace/srv/net/tcp/tcp.c
===================================================================
--- uspace/srv/net/tcp/tcp.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/tcp.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -115,8 +115,6 @@
 	}
 
-	pdu->src_addr.ipv4 = dgram->src.ipv4;
-	pdu->dest_addr.ipv4 = dgram->dest.ipv4;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "src: 0x%08x, dest: 0x%08x",
-	    pdu->src_addr.ipv4, pdu->dest_addr.ipv4);
+	pdu->src_addr = dgram->src;
+	pdu->dest_addr = dgram->dest;
 
 	tcp_received_pdu(pdu);
@@ -145,6 +143,6 @@
 	    pdu->text_size);
 
-	dgram.src.ipv4 = pdu->src_addr.ipv4;
-	dgram.dest.ipv4 = pdu->dest_addr.ipv4;
+	dgram.src = pdu->src_addr;
+	dgram.dest = pdu->dest_addr;
 	dgram.tos = 0;
 	dgram.data = pdu_raw;
Index: uspace/srv/net/tcp/tcp_type.h
===================================================================
--- uspace/srv/net/tcp/tcp_type.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/tcp_type.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -43,4 +43,5 @@
 #include <socket_core.h>
 #include <sys/types.h>
+#include <inet/addr.h>
 
 struct tcp_conn;
@@ -112,15 +113,7 @@
 
 typedef struct {
-	uint32_t ipv4;
-} netaddr_t;
-
-typedef struct {
-	netaddr_t addr;
+	inet_addr_t addr;
 	uint16_t port;
 } tcp_sock_t;
-
-enum netaddr {
-	TCP_IPV4_ANY = 0
-};
 
 enum tcp_port {
@@ -313,8 +306,8 @@
 typedef struct {
 	/** Source address */
-	netaddr_t src_addr;
+	inet_addr_t src_addr;
 	/** Destination address */
-	netaddr_t dest_addr;
-
+	inet_addr_t dest_addr;
+	
 	/** Encoded header */
 	void *header;
@@ -344,5 +337,5 @@
 	tcp_conn_t *conn;
 	/** Local address */
-	netaddr_t laddr;
+	inet_addr_t laddr;
 	/** Backlog size */
 	int backlog;
Index: uspace/srv/net/tcp/test.c
===================================================================
--- uspace/srv/net/tcp/test.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/test.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -57,8 +57,11 @@
 
 	printf("test_srv()\n");
+	
+	inet_addr(&lsock.addr, 127, 0, 0, 1);
 	lsock.port = 80;
-	lsock.addr.ipv4 = 0x7f000001;
+	
+	inet_addr(&fsock.addr, 127, 0, 0, 1);
 	fsock.port = 1024;
-	fsock.addr.ipv4 = 0x7f000001;
+	
 	printf("S: User open...\n");
 	tcp_uc_open(&lsock, &fsock, ap_passive, 0, &conn);
@@ -95,9 +98,10 @@
 
 	printf("test_cli()\n");
-
+	
+	inet_addr(&lsock.addr, 127, 0, 0, 1);
 	lsock.port = 1024;
-	lsock.addr.ipv4 = 0x7f000001;
+	
+	inet_addr(&fsock.addr, 127, 0, 0, 1);
 	fsock.port = 80;
-	fsock.addr.ipv4 = 0x7f000001;
 
 	async_usleep(1000*1000*3);
Index: uspace/srv/net/tcp/tqueue.c
===================================================================
--- uspace/srv/net/tcp/tqueue.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/tqueue.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -282,8 +282,4 @@
 void tcp_transmit_segment(tcp_sockpair_t *sp, tcp_segment_t *seg)
 {
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_transmit_segment(f:(%x,%u),l:(%x,%u), %p)",
-	    sp->foreign.addr.ipv4, sp->foreign.port,
-	    sp->local.addr.ipv4, sp->local.port, seg);
-
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "SEG.SEQ=%" PRIu32 ", SEG.WND=%" PRIu32,
 	    seg->seq, seg->wnd);
Index: uspace/srv/net/tcp/ucall.c
===================================================================
--- uspace/srv/net/tcp/ucall.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/tcp/ucall.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -298,8 +298,4 @@
 	tcp_conn_t *conn;
 
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_as_segment_arrived(f:(%x,%u), l:(%x,%u))",
-	    sp->foreign.addr.ipv4, sp->foreign.port,
-	    sp->local.addr.ipv4, sp->local.port);
-
 	conn = tcp_conn_find_ref(sp);
 	if (conn == NULL) {
@@ -319,10 +315,12 @@
 	}
 
-	if (conn->ident.foreign.addr.ipv4 == TCP_IPV4_ANY)
-		conn->ident.foreign.addr.ipv4 = sp->foreign.addr.ipv4;
+	if (inet_addr_is_any(&conn->ident.foreign.addr))
+		conn->ident.foreign.addr = sp->foreign.addr;
+	
 	if (conn->ident.foreign.port == TCP_PORT_ANY)
 		conn->ident.foreign.port = sp->foreign.port;
-	if (conn->ident.local.addr.ipv4 == TCP_IPV4_ANY)
-		conn->ident.local.addr.ipv4 = sp->local.addr.ipv4;
+	
+	if (inet_addr_is_any(&conn->ident.local.addr))
+		conn->ident.local.addr = sp->local.addr;
 
 	tcp_conn_segment_arrived(conn, seg);
Index: uspace/srv/net/udp/assoc.c
===================================================================
--- uspace/srv/net/udp/assoc.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/udp/assoc.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -252,5 +252,5 @@
 		sp.foreign = *fsock;
 
-	if ((inet2_addr_is_any(&sp.foreign.addr)) ||
+	if ((inet_addr_is_any(&sp.foreign.addr)) ||
 	    (sp.foreign.port == UDP_PORT_ANY))
 		return EINVAL;
@@ -372,6 +372,6 @@
 static bool udp_socket_match(udp_sock_t *sock, udp_sock_t *patt)
 {
-	if ((!inet2_addr_is_any(&patt->addr)) &&
-	    (!inet2_addr_compare(&patt->addr, &sock->addr)))
+	if ((!inet_addr_is_any(&patt->addr)) &&
+	    (!inet_addr_compare(&patt->addr, &sock->addr)))
 		return false;
 	
Index: uspace/srv/net/udp/pdu.c
===================================================================
--- uspace/srv/net/udp/pdu.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/udp/pdu.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -89,8 +89,8 @@
 	
 	uint32_t src;
-	inet2_addr_pack(&pdu->src, &src);
+	inet_addr_pack(&pdu->src, &src);
 	
 	uint32_t dest;
-	inet2_addr_pack(&pdu->dest, &dest);
+	inet_addr_pack(&pdu->dest, &dest);
 	
 	phdr->src_addr = host2uint32_t_be(src);
Index: uspace/srv/net/udp/sock.c
===================================================================
--- uspace/srv/net/udp/sock.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/udp/sock.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -201,5 +201,5 @@
 	socket = (udp_sockdata_t *) sock_core->specific_data;
 	
-	inet2_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
+	inet_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
 	    &fsock.addr);
 	fsock.port = sock_core->port;
@@ -270,5 +270,5 @@
 		}
 		
-		inet2_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
+		inet_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
 		    &fsock.addr);
 		fsock.port = uint16_t_be2host(addr->sin_port);
@@ -316,13 +316,13 @@
 	fibril_mutex_lock(&socket->lock);
 	
-	if (inet2_addr_is_any(&socket->assoc->ident.local.addr)) {
+	if (inet_addr_is_any(&socket->assoc->ident.local.addr)) {
 		/* Determine local IP address */
-		inet2_addr_t loc_addr;
-		inet2_addr_t rem_addr;
+		inet_addr_t loc_addr;
+		inet_addr_t rem_addr;
 		
 		rem_addr = fsock_ptr ? fsock.addr :
 		    socket->assoc->ident.foreign.addr;
 		
-		int rc = inet2_get_srcaddr(&rem_addr, 0, &loc_addr);
+		int rc = inet_get_srcaddr(&rem_addr, 0, &loc_addr);
 		if (rc != EOK) {
 			fibril_mutex_unlock(&socket->lock);
@@ -479,5 +479,5 @@
 		/* Fill address */
 		uint32_t rsock_addr;
-		int rc = inet2_addr_pack(&rsock->addr, &rsock_addr);
+		int rc = inet_addr_pack(&rsock->addr, &rsock_addr);
 		if (rc != EOK) {
 			fibril_mutex_unlock(&socket->recv_buffer_lock);
Index: uspace/srv/net/udp/udp_inet.c
===================================================================
--- uspace/srv/net/udp/udp_inet.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/udp/udp_inet.c	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -66,7 +66,7 @@
 	pdu->data = dgram->data;
 	pdu->data_size = dgram->size;
-	
-	inet_inet2(&dgram->src, &pdu->src);
-	inet_inet2(&dgram->dest, &pdu->dest);
+
+	pdu->src = dgram->src;
+	pdu->dest = dgram->dest;
 
 	udp_received_pdu(pdu);
@@ -84,6 +84,6 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_transmit_pdu()");
 
-	inet2_inet(&pdu->src, &dgram.src);
-	inet2_inet(&pdu->dest, &dgram.dest);
+	dgram.src = pdu->src;
+	dgram.dest = pdu->dest;
 	dgram.tos = 0;
 	dgram.data = pdu->data;
Index: uspace/srv/net/udp/udp_type.h
===================================================================
--- uspace/srv/net/udp/udp_type.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
+++ uspace/srv/net/udp/udp_type.h	(revision a2e3ee6092cd450ed63e80fa45ddb46a740aa02c)
@@ -40,5 +40,5 @@
 #include <socket_core.h>
 #include <sys/types.h>
-#include <inet/addr2.h>
+#include <inet/addr.h>
 
 #define UDP_FRAGMENT_SIZE 4096
@@ -66,5 +66,5 @@
 
 typedef struct {
-	inet2_addr_t addr;
+	inet_addr_t addr;
 	uint16_t port;
 } udp_sock_t;
@@ -86,7 +86,7 @@
 typedef struct {
 	/** Source address */
-	inet2_addr_t src;
+	inet_addr_t src;
 	/** Destination address */
-	inet2_addr_t dest;
+	inet_addr_t dest;
 	
 	/** Encoded PDU data including header */
