Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ boot/Makefile.common	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
@@ -108,4 +108,5 @@
 	$(USPACE_PATH)/srv/net/ethip/ethip \
 	$(USPACE_PATH)/srv/net/inet/inet \
+	$(USPACE_PATH)/srv/net/loopip/loopip \
 	$(USPACE_PATH)/srv/net/tcp/tcp \
 	$(USPACE_PATH)/srv/net/udp/udp \
@@ -119,5 +120,4 @@
 	test/test2 \
 	test/test3 \
-	nic/lo \
 	nic/ne2k \
 	nic/e1k \
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ uspace/Makefile	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
@@ -77,4 +77,5 @@
 	srv/net/ethip \
 	srv/net/inet \
+	srv/net/loopip \
 	srv/net/tcp \
 	srv/net/udp \
@@ -119,5 +120,4 @@
 	drv/bus/usb/usbmid \
 	drv/bus/usb/vhc \
-	drv/nic/lo \
 	drv/nic/ne2k \
 	drv/nic/e1k \
Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ uspace/app/init/init.c	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
@@ -305,4 +305,5 @@
 	srv_start("/srv/s3c24ts");
 	
+	spawn("/srv/loopip");
 	spawn("/srv/ethip");
 	spawn("/srv/inet");
Index: uspace/drv/infrastructure/rootvirt/devices.def
===================================================================
--- uspace/drv/infrastructure/rootvirt/devices.def	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ uspace/drv/infrastructure/rootvirt/devices.def	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
@@ -4,10 +4,4 @@
  * Unless the list is empty, the last item shall be followed by a comma.
  */
-
-/* Loopback network interface */
-{
-    .name = "lo",
-    .match_id = "virtual&loopback"
-},
 
 #ifdef CONFIG_TEST_DRIVERS
Index: pace/drv/nic/lo/Makefile
===================================================================
--- uspace/drv/nic/lo/Makefile	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# 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.
-#
-
-USPACE_PREFIX = ../../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBNIC_PREFIX)/libnic.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBNIC_PREFIX)/include
-BINARY = lo
-
-SOURCES = \
-	lo.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: pace/drv/nic/lo/lo.c
===================================================================
--- uspace/drv/nic/lo/lo.c	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * 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 drv_lo
- * @brief Loopback virtual device driver
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <async.h>
-#include <nic.h>
-
-#define NAME  "lo"
-
-static nic_address_t lo_addr = {
-	.address = {0, 0, 0, 0, 0, 0}
-};
-
-static ddf_dev_ops_t lo_dev_ops;
-
-static nic_device_info_t lo_info = {
-	.vendor_name = "HelenOS",
-	.model_name = "loopback",
-	.part_number = "N/A (virtual device)",
-	.serial_number = "N/A (virtual device)"
-};
-
-static void lo_send_frame(nic_t *nic_data, void *data, size_t size)
-{
-	nic_report_send_ok(nic_data, 1, size);
-	nic_received_noneth_frame(nic_data, data, size);
-}
-
-static int lo_set_address(ddf_fun_t *fun, const nic_address_t *address)
-{
-	printf("%s: Set loopback HW to " PRIMAC "\n", NAME,
-	    ARGSMAC(address->address));
-	return ENOTSUP;
-}
-
-static int lo_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
-{
-	assert(info);
-	memcpy(info, &lo_info, sizeof(nic_device_info_t));
-	return EOK;
-}
-
-static int lo_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun = NULL;
-	bool bound = false;
-	
-	nic_t *nic = nic_create_and_bind(dev);
-	if (nic == NULL) {
-		printf("%s: Failed to initialize\n", NAME);
-		return ENOMEM;
-	}
-	
-	dev->driver_data = nic;
-	nic_set_send_frame_handler(nic, lo_send_frame);
-	
-	int rc = nic_connect_to_services(nic);
-	if (rc != EOK) {
-		printf("%s: Failed to connect to services\n", NAME);
-		goto error;
-	}
-	
-	fun = ddf_fun_create(nic_get_ddf_dev(nic), fun_exposed, "port0");
-	if (fun == NULL) {
-		printf("%s: Failed creating function\n", NAME);
-		rc = ENOMEM;
-		goto error;
-	}
-	nic_set_ddf_fun(nic, fun);
-	fun->ops = &lo_dev_ops;
-	fun->driver_data = nic;
-	
-	rc = nic_report_address(nic, &lo_addr);
-	if (rc != EOK) {
-		printf("%s: Failed to setup loopback address\n", NAME);
-		goto error;
-	}
-	
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		printf("%s: Failed binding function\n", NAME);
-		goto error;
-	}
-	bound = true;
-	
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK)
-		goto error;
-	
-	printf("%s: Adding loopback device '%s'\n", NAME, dev->name);
-	return EOK;
-	
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	
-	nic_unbind_and_destroy(dev);
-	return rc;
-}
-
-static nic_iface_t lo_nic_iface;
-
-static driver_ops_t lo_driver_ops = {
-	.dev_add = lo_dev_add,
-};
-
-static driver_t lo_driver = {
-	.name = NAME,
-	.driver_ops = &lo_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	nic_driver_init(NAME);
-	nic_driver_implement(&lo_driver_ops, &lo_dev_ops, &lo_nic_iface);
-	lo_nic_iface.set_address = lo_set_address;
-	lo_nic_iface.get_device_info = lo_get_device_info;
-	
-	return ddf_driver_main(&lo_driver);
-}
-
-/** @}
- */
Index: pace/drv/nic/lo/lo.ma
===================================================================
--- uspace/drv/nic/lo/lo.ma	(revision 63920b02179b4258a03b675bc059ebd54804be3b)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 virtual&loopback
Index: uspace/srv/net/loopip/Makefile
===================================================================
--- uspace/srv/net/loopip/Makefile	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
+++ uspace/srv/net/loopip/Makefile	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2012 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.
+#
+
+USPACE_PREFIX = ../../..
+BINARY = loopip
+
+SOURCES = \
+	loopip.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/loopip/loopip.c
===================================================================
--- uspace/srv/net/loopip/loopip.c	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
+++ uspace/srv/net/loopip/loopip.c	(revision 606c36909b6993ba6c2ab0208a9d54e4aa98d7d3)
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2012 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 loopip
+ * @{
+ */
+/**
+ * @file
+ * @brief Loopback IP link provider
+ */
+
+#include <adt/prodcons.h>
+#include <async.h>
+#include <errno.h>
+#include <inet/iplink_srv.h>
+#include <io/log.h>
+#include <loc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define NAME "loopip"
+
+static int loopip_open(iplink_srv_t *srv);
+static int loopip_close(iplink_srv_t *srv);
+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 void loopip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
+
+static iplink_ops_t loopip_iplink_ops = {
+	.open = loopip_open,
+	.close = loopip_close,
+	.send = loopip_send,
+	.get_mtu = loopip_get_mtu,
+	.addr_add = loopip_addr_add,
+	.addr_remove = loopip_addr_remove
+};
+
+static iplink_srv_t loopip_iplink;
+static prodcons_t loopip_rcv_queue;
+
+typedef struct {
+	link_t link;
+	iplink_srv_sdu_t sdu;
+} rqueue_entry_t;
+
+static int loopip_recv_fibril(void *arg)
+{
+	while (true) {
+		log_msg(LVL_DEBUG, "loopip_recv_fibril(): Wait for one item");
+		link_t *link = prodcons_consume(&loopip_rcv_queue);
+		rqueue_entry_t *rqe = list_get_instance(link, rqueue_entry_t, link);
+
+		(void) iplink_ev_recv(&loopip_iplink, &rqe->sdu);
+	}
+
+	return 0;
+}
+
+static int loopip_init(void)
+{
+	int rc;
+	service_id_t sid;
+	category_id_t iplink_cat;
+	const char *svc_name = "net/loopback";
+
+	async_set_client_connection(loopip_client_conn);
+
+	rc = loc_server_register(NAME);
+	if (rc != EOK) {
+		log_msg(LVL_ERROR, "Failed registering server.");
+		return rc;
+	}
+
+	iplink_srv_init(&loopip_iplink);
+	loopip_iplink.ops = &loopip_iplink_ops;
+	loopip_iplink.arg = NULL;
+
+	prodcons_initialize(&loopip_rcv_queue);
+
+	rc = loc_service_register(svc_name, &sid);
+	if (rc != EOK) {
+		log_msg(LVL_ERROR, "Failed registering service %s.", svc_name);
+		return rc;
+	}
+
+	rc = loc_category_get_id("iplink", &iplink_cat, IPC_FLAG_BLOCKING);
+	if (rc != EOK) {
+		log_msg(LVL_ERROR, "Failed resolving category 'iplink'.");
+		return rc;
+	}
+
+	rc = loc_service_add_to_cat(sid, iplink_cat);
+	if (rc != EOK) {
+		log_msg(LVL_ERROR, "Failed adding %s to category.", svc_name);
+		return rc;
+	}
+
+	fid_t fid = fibril_create(loopip_recv_fibril, NULL);
+	if (fid == 0)
+		return ENOMEM;
+
+	fibril_add_ready(fid);
+
+	return EOK;
+}
+
+static void loopip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	log_msg(LVL_DEBUG, "loopip_client_conn()");
+	iplink_conn(iid, icall, &loopip_iplink);
+}
+
+static int loopip_open(iplink_srv_t *srv)
+{
+	log_msg(LVL_DEBUG, "loopip_open()");
+	return EOK;
+}
+
+static int loopip_close(iplink_srv_t *srv)
+{
+	log_msg(LVL_DEBUG, "loopip_close()");
+	return EOK;
+}
+
+static int loopip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu)
+{
+	rqueue_entry_t *rqe;
+
+	log_msg(LVL_DEBUG, "loopip_send()");
+
+	rqe = calloc(1, sizeof(rqueue_entry_t));
+	if (rqe == NULL)
+		return ENOMEM;
+	/*
+	 * Clone SDU
+	 */
+	rqe->sdu.lsrc = sdu->ldest;
+	rqe->sdu.ldest = sdu->lsrc;
+	rqe->sdu.data = malloc(sdu->size);
+	if (rqe->sdu.data == NULL) {
+		free(rqe);
+		return ENOMEM;
+	}
+
+	memcpy(rqe->sdu.data, sdu->data, sdu->size);
+	rqe->sdu.size = sdu->size;
+
+	/*
+	 * Insert to receive queue
+	 */
+	prodcons_produce(&loopip_rcv_queue, &rqe->link);
+
+	return EOK;
+}
+
+static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)
+{
+	log_msg(LVL_DEBUG, "loopip_get_mtu()");
+	*mtu = 1500;
+	return EOK;
+}
+
+static int loopip_addr_add(iplink_srv_t *srv, iplink_srv_addr_t *addr)
+{
+	log_msg(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(LVL_DEBUG, "loopip_addr_remove(0x%" PRIx32 ")", addr->ipv4);
+	return EOK;
+}
+
+int main(int argc, char *argv[])
+{
+	int rc;
+
+	printf(NAME ": HelenOS loopback IP link provider\n");
+
+	if (log_init(NAME, LVL_WARN) != EOK) {
+		printf(NAME ": Failed to initialize logging.\n");
+		return 1;
+	}
+
+	rc = loopip_init();
+	if (rc != EOK)
+		return 1;
+
+	printf(NAME ": Accepting connections.\n");
+	task_retval(0);
+	async_manager();
+
+	/* Not reached */
+	return 0;
+}
+
+/** @}
+ */
