Index: uspace/lib/c/generic/inet.c
===================================================================
--- uspace/lib/c/generic/inet.c	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/lib/c/generic/inet.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -144,4 +144,26 @@
 }
 
+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);
+	if (rc != EOK)
+		return rc;
+	
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+	
+	sysarg_t local_addr;
+	rc = async_req_2_1(exch, INET_GET_SRCADDR, (sysarg_t) remote_addr,
+	    tos, &local_addr);
+	
+	async_exchange_end(exch);
+	
+	if (rc != EOK)
+		return rc;
+	
+	inet2_addr_unpack(local_addr, local);
+	return EOK;
+}
+
 static void inet_ev_recv(ipc_callid_t callid, ipc_call_t *call)
 {
Index: uspace/lib/c/generic/inet/addr2.c
===================================================================
--- uspace/lib/c/generic/inet/addr2.c	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/lib/c/generic/inet/addr2.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -40,4 +40,17 @@
 #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.
  *
@@ -336,7 +349,22 @@
 }
 
-int inet2_addr_is_empty(inet2_addr_t *addr)
-{
-	return (addr->family == 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/include/inet/addr2.h
===================================================================
--- uspace/lib/c/include/inet/addr2.h	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/lib/c/include/inet/addr2.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -38,4 +38,5 @@
 #include <stdint.h>
 #include <net/in.h>
+#include <inet/addr.h>
 
 #define INET2_ADDR_SIZE  16
@@ -84,5 +85,8 @@
 
 extern int inet2_addr_compare(inet2_addr_t *, inet2_addr_t *);
-extern int inet2_addr_is_empty(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/inet.h
===================================================================
--- uspace/lib/c/include/inet/inet.h	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/lib/c/include/inet/inet.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -37,4 +37,5 @@
 
 #include <inet/addr.h>
+#include <inet/addr2.h>
 #include <sys/types.h>
 
@@ -60,4 +61,5 @@
 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/net/in.h
===================================================================
--- uspace/lib/c/include/net/in.h	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/lib/c/include/net/in.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -47,24 +47,14 @@
 #define INADDR_ANY 0
 
-/** Type definition of the INET address.
- * @see in_addr
- */
-typedef struct in_addr in_addr_t;
-
-/** Type definition of the INET socket address.
- * @see sockaddr_in
- */
-typedef struct sockaddr_in	sockaddr_in_t;
-
 /** INET address. */
-struct in_addr {
+typedef struct in_addr {
 	/** 4 byte IP address. */
 	uint32_t s_addr;
-};
+} in_addr_t;
 
 /** INET socket address.
  * @see sockaddr
  */
-struct sockaddr_in {
+typedef struct sockaddr_in {
 	/** Address family. Should be AF_INET. */
 	uint16_t sin_family;
@@ -72,8 +62,8 @@
 	uint16_t sin_port;
 	/** Internet address. */
-	struct in_addr sin_addr;
+	in_addr_t sin_addr;
 	/** Padding to meet the sockaddr size. */
 	uint8_t sin_zero[8];
-};
+} sockaddr_in_t;
 
 #endif
Index: uspace/lib/c/include/net/ip_protocols.h
===================================================================
--- uspace/lib/c/include/net/ip_protocols.h	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/lib/c/include/net/ip_protocols.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -44,7 +44,8 @@
 /*@{*/
 
-#define IPPROTO_ICMP	1
-#define IPPROTO_TCP	6
-#define IPPROTO_UDP	17
+#define IPPROTO_ICMP    1
+#define IPPROTO_TCP     6
+#define IPPROTO_UDP     17
+#define IPPROTO_ICMPV6  58
 
 /*@}*/
Index: uspace/srv/net/udp/assoc.c
===================================================================
--- uspace/srv/net/udp/assoc.c	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/srv/net/udp/assoc.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -82,4 +82,5 @@
 	if (lsock != NULL)
 		assoc->ident.local = *lsock;
+	
 	if (fsock != NULL)
 		assoc->ident.foreign = *fsock;
@@ -251,5 +252,6 @@
 		sp.foreign = *fsock;
 
-	if (sp.foreign.addr.ipv4 == 0 || sp.foreign.port == 0)
+	if ((inet2_addr_is_any(&sp.foreign.addr)) ||
+	    (sp.foreign.port == UDP_PORT_ANY))
 		return EINVAL;
 
@@ -370,17 +372,14 @@
 static bool udp_socket_match(udp_sock_t *sock, udp_sock_t *patt)
 {
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_socket_match(sock=(%x,%u), pat=(%x,%u))",
-	    sock->addr.ipv4, sock->port, patt->addr.ipv4, patt->port);
-
-	if (patt->addr.ipv4 != UDP_IPV4_ANY &&
-	    patt->addr.ipv4 != sock->addr.ipv4)
+	if ((!inet2_addr_is_any(&patt->addr)) &&
+	    (!inet2_addr_compare(&patt->addr, &sock->addr)))
 		return false;
-
-	if (patt->port != UDP_PORT_ANY &&
-	    patt->port != sock->port)
+	
+	if ((patt->port != UDP_PORT_ANY) &&
+	    (patt->port != sock->port))
 		return false;
-
+	
 	log_msg(LOG_DEFAULT, LVL_DEBUG, " -> match");
-
+	
 	return true;
 }
@@ -414,18 +413,15 @@
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_find_ref(%p)", sp);
-
+	
 	fibril_mutex_lock(&assoc_list_lock);
-
+	
 	list_foreach(assoc_list, link) {
 		udp_assoc_t *assoc = list_get_instance(link, udp_assoc_t, link);
 		udp_sockpair_t *asp = &assoc->ident;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "compare with assoc (f:(%x,%u), l:(%x,%u))",
-		    asp->foreign.addr.ipv4, asp->foreign.port,
-		    asp->local.addr.ipv4, asp->local.port);
-
+		
 		/* Skip unbound associations */
 		if (asp->local.port == UDP_PORT_ANY)
 			continue;
-
+		
 		if (udp_sockpair_match(sp, asp)) {
 			log_msg(LOG_DEFAULT, LVL_DEBUG, "Returning assoc %p", assoc);
@@ -435,5 +431,5 @@
 		}
 	}
-
+	
 	fibril_mutex_unlock(&assoc_list_lock);
 	return NULL;
Index: uspace/srv/net/udp/pdu.c
===================================================================
--- uspace/srv/net/udp/pdu.c	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/srv/net/udp/pdu.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -86,6 +86,14 @@
 static void udp_phdr_setup(udp_pdu_t *pdu, udp_phdr_t *phdr)
 {
-	phdr->src_addr = host2uint32_t_be(pdu->src.ipv4);
-	phdr->dest_addr = host2uint32_t_be(pdu->dest.ipv4);
+	// FIXME: Check for correctness
+	
+	uint32_t src;
+	inet2_addr_pack(&pdu->src, &src);
+	
+	uint32_t dest;
+	inet2_addr_pack(&pdu->dest, &dest);
+	
+	phdr->src_addr = host2uint32_t_be(src);
+	phdr->dest_addr = host2uint32_t_be(dest);
 	phdr->zero = 0;
 	phdr->protocol = IP_PROTO_UDP;
Index: uspace/srv/net/udp/sock.c
===================================================================
--- uspace/srv/net/udp/sock.c	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/srv/net/udp/sock.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -199,7 +199,8 @@
 	}
 
-	socket = (udp_sockdata_t *)sock_core->specific_data;
-
-	fsock.addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr);
+	socket = (udp_sockdata_t *) sock_core->specific_data;
+	
+	inet2_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
+	    &fsock.addr);
 	fsock.port = sock_core->port;
 	urc = udp_uc_set_local(socket->assoc, &fsock);
@@ -269,5 +270,6 @@
 		}
 		
-		fsock.addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr);
+		inet2_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr),
+		    &fsock.addr);
 		fsock.port = uint16_t_be2host(addr->sin_port);
 		fsock_ptr = &fsock;
@@ -314,12 +316,13 @@
 	fibril_mutex_lock(&socket->lock);
 	
-	if (socket->assoc->ident.local.addr.ipv4 == UDP_IPV4_ANY) {
+	if (inet2_addr_is_any(&socket->assoc->ident.local.addr)) {
 		/* Determine local IP address */
-		inet_addr_t loc_addr, rem_addr;
-		
-		rem_addr.ipv4 = fsock_ptr ? fsock.addr.ipv4 :
-		    socket->assoc->ident.foreign.addr.ipv4;
-		
-		int rc = inet_get_srcaddr(&rem_addr, 0, &loc_addr);
+		inet2_addr_t loc_addr;
+		inet2_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);
 		if (rc != EOK) {
 			fibril_mutex_unlock(&socket->lock);
@@ -330,7 +333,5 @@
 		}
 		
-		socket->assoc->ident.local.addr.ipv4 = loc_addr.ipv4;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Local IP address is %x",
-		    socket->assoc->ident.local.addr.ipv4);
+		socket->assoc->ident.local.addr = loc_addr;
 	}
 	
@@ -410,5 +411,5 @@
 	size_t data_len;
 	udp_error_t urc;
-	udp_sock_t rsock;
+	udp_sock_t *rsock;
 	struct sockaddr_in addr;
 	int rc;
@@ -446,5 +447,5 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "Got data in sock recv_buffer");
 
-	rsock = socket->recv_fsock;
+	rsock = &socket->recv_fsock;
 	data_len = socket->recv_buffer_used;
 	urc = socket->recv_error;
@@ -476,8 +477,17 @@
 
 	if (IPC_GET_IMETHOD(call) == NET_SOCKET_RECVFROM) {
-		/* Fill addr */
+		/* Fill address */
+		uint32_t rsock_addr;
+		int rc = inet2_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_port = host2uint16_t_be(rsock.port);
+		addr.sin_addr.s_addr = host2uint32_t_be(rsock_addr);
+		addr.sin_port = host2uint16_t_be(rsock->port);
 
 		log_msg(LOG_DEFAULT, LVL_DEBUG, "addr read receive");
Index: uspace/srv/net/udp/udp_inet.c
===================================================================
--- uspace/srv/net/udp/udp_inet.c	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/srv/net/udp/udp_inet.c	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -66,9 +66,7 @@
 	pdu->data = dgram->data;
 	pdu->data_size = dgram->size;
-
-	pdu->src.ipv4 = dgram->src.ipv4;
-	pdu->dest.ipv4 = dgram->dest.ipv4;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "src: 0x%08x, dest: 0x%08x",
-	    pdu->src.ipv4, pdu->dest.ipv4);
+	
+	inet_inet2(&dgram->src, &pdu->src);
+	inet_inet2(&dgram->dest, &pdu->dest);
 
 	udp_received_pdu(pdu);
@@ -86,6 +84,6 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_transmit_pdu()");
 
-	dgram.src.ipv4 = pdu->src.ipv4;
-	dgram.dest.ipv4 = pdu->dest.ipv4;
+	inet2_inet(&pdu->src, &dgram.src);
+	inet2_inet(&pdu->dest, &dgram.dest);
 	dgram.tos = 0;
 	dgram.data = pdu->data;
Index: uspace/srv/net/udp/udp_type.h
===================================================================
--- uspace/srv/net/udp/udp_type.h	(revision 3e664287e034298711db95506e3d6e3f1a348b8a)
+++ uspace/srv/net/udp/udp_type.h	(revision 19a4f73d732eaf01d22b3fdcb5c730406666b0d6)
@@ -40,4 +40,5 @@
 #include <socket_core.h>
 #include <sys/types.h>
+#include <inet/addr2.h>
 
 #define UDP_FRAGMENT_SIZE 4096
@@ -57,14 +58,6 @@
 
 typedef enum {
-	XF_DUMMY	= 0x1
+	XF_DUMMY = 0x1
 } xflags_t;
-
-typedef struct {
-	uint32_t ipv4;
-} netaddr_t;
-
-enum netaddr {
-	UDP_IPV4_ANY = 0
-};
 
 enum udp_port {
@@ -73,5 +66,5 @@
 
 typedef struct {
-	netaddr_t addr;
+	inet2_addr_t addr;
 	uint16_t port;
 } udp_sock_t;
@@ -93,8 +86,8 @@
 typedef struct {
 	/** Source address */
-	netaddr_t src;
+	inet2_addr_t src;
 	/** Destination address */
-	netaddr_t dest;
-
+	inet2_addr_t dest;
+	
 	/** Encoded PDU data including header */
 	void *data;
