Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision e9caf4779c4818e0894f8ea2cb6815ec2e723d8f)
+++ uspace/srv/net/il/arp/arp.c	(revision 63a1e60da60804c071e3ab1530947ddc61f6e85b)
@@ -55,5 +55,5 @@
 #include <ipc/il.h>
 #include <byteorder.h>
-#include <err.h>
+#include <errno.h>
 
 #include <net/modules.h>
@@ -179,16 +179,20 @@
     measured_string_ref address)
 {
-	ERROR_DECLARE;
+	int rc;
 
 	*proto = (arp_proto_ref) malloc(sizeof(arp_proto_t));
 	if (!*proto)
 		return ENOMEM;
+	
 	(*proto)->service = service;
 	(*proto)->addr = address;
 	(*proto)->addr_data = address->value;
-	if (ERROR_OCCURRED(arp_addr_initialize(&(*proto)->addresses))) {
+	
+	rc = arp_addr_initialize(&(*proto)->addresses);
+	if (rc != EOK) {
 		free(*proto);
-		return ERROR_CODE;
-	}
+		return rc;
+	}
+	
 	return EOK;
 }
@@ -214,10 +218,9 @@
     services_t protocol, measured_string_ref address)
 {
-	ERROR_DECLARE;
-
 	arp_device_ref device;
 	arp_proto_ref proto;
+	hw_type_t hardware;
 	int index;
-	hw_type_t hardware;
+	int rc;
 
 	fibril_rwlock_write_lock(&arp_globals.lock);
@@ -237,8 +240,8 @@
 			proto->addr_data = address->value;
 		} else {
-			if (ERROR_OCCURRED(arp_proto_create(&proto, protocol,
-			    address))) {
+			rc = arp_proto_create(&proto, protocol, address);
+			if (rc != EOK) {
 				fibril_rwlock_write_unlock(&arp_globals.lock);
-				return ERROR_CODE;
+				return rc;
 			}
 			index = arp_protos_add(&device->protos, proto->service,
@@ -265,10 +268,15 @@
 		device->hardware = hardware;
 		device->device_id = device_id;
-		if (ERROR_OCCURRED(arp_protos_initialize(&device->protos)) ||
-		    ERROR_OCCURRED(arp_proto_create(&proto, protocol,
-		    address))) {
+		rc = arp_protos_initialize(&device->protos);
+		if (rc != EOK) {
 			fibril_rwlock_write_unlock(&arp_globals.lock);
 			free(device);
-			return ERROR_CODE;
+			return rc;
+		}
+		rc = arp_proto_create(&proto, protocol, address);
+		if (rc != EOK) {
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			free(device);
+			return rc;
 		}
 		index = arp_protos_add(&device->protos, proto->service, proto);
@@ -293,25 +301,27 @@
 		
 		// get packet dimensions
-		if (ERROR_OCCURRED(nil_packet_size_req(device->phone, device_id,
-		    &device->packet_dimension))) {
+		rc = nil_packet_size_req(device->phone, device_id,
+		    &device->packet_dimension);
+		if (rc != EOK) {
 			fibril_rwlock_write_unlock(&arp_globals.lock);
 			arp_protos_destroy(&device->protos);
 			free(device);
-			return ERROR_CODE;
+			return rc;
 		}
 		
 		// get hardware address
-		if (ERROR_OCCURRED(nil_get_addr_req(device->phone, device_id,
-		    &device->addr, &device->addr_data))) {
+		rc = nil_get_addr_req(device->phone, device_id, &device->addr,
+		    &device->addr_data);
+		if (rc != EOK) {
 			fibril_rwlock_write_unlock(&arp_globals.lock);
 			arp_protos_destroy(&device->protos);
 			free(device);
-			return ERROR_CODE;
+			return rc;
 		}
 		
 		// get broadcast address
-		if (ERROR_OCCURRED(nil_get_broadcast_addr_req(device->phone,
-		    device_id, &device->broadcast_addr,
-		    &device->broadcast_data))) {
+		rc = nil_get_broadcast_addr_req(device->phone, device_id,
+		    &device->broadcast_addr, &device->broadcast_data);
+		if (rc != EOK) {
 			fibril_rwlock_write_unlock(&arp_globals.lock);
 			free(device->addr);
@@ -319,9 +329,10 @@
 			arp_protos_destroy(&device->protos);
 			free(device);
-			return ERROR_CODE;
-		}
-		
-		if (ERROR_OCCURRED(arp_cache_add(&arp_globals.cache,
-		    device->device_id, device))) {
+			return rc;
+		}
+		
+		rc = arp_cache_add(&arp_globals.cache, device->device_id,
+		    device);
+		if (rc != EOK) {
 			fibril_rwlock_write_unlock(&arp_globals.lock);
 			free(device->addr);
@@ -331,5 +342,5 @@
 			arp_protos_destroy(&device->protos);
 			free(device);
-			return ERROR_CODE;
+			return rc;
 		}
 		printf("%s: Device registered (id: %d, type: 0x%x, service: %d,"
@@ -351,12 +362,13 @@
 int arp_initialize(async_client_conn_t client_connection)
 {
-	ERROR_DECLARE;
+	int rc;
 
 	fibril_rwlock_initialize(&arp_globals.lock);
 	fibril_rwlock_write_lock(&arp_globals.lock);
 	arp_globals.client_connection = client_connection;
-	ERROR_PROPAGATE(arp_cache_initialize(&arp_globals.cache));
+	rc = arp_cache_initialize(&arp_globals.cache);
 	fibril_rwlock_write_unlock(&arp_globals.lock);
-	return EOK;
+	
+	return rc;
 }
 
@@ -406,6 +418,4 @@
 static int arp_receive_message(device_id_t device_id, packet_t packet)
 {
-	ERROR_DECLARE;
-
 	size_t length;
 	arp_header_ref header;
@@ -417,4 +427,5 @@
 	uint8_t *des_hw;
 	uint8_t *des_proto;
+	int rc;
 
 	length = packet_get_data_length(packet);
@@ -467,7 +478,9 @@
 				return ENOMEM;
 
-			ERROR_PROPAGATE(arp_addr_add(&proto->addresses,
-			    (char *) src_proto, CONVERT_SIZE(uint8_t, char,
-			    header->protocol_length), hw_source));
+			rc = arp_addr_add(&proto->addresses, (char *) src_proto,
+			    CONVERT_SIZE(uint8_t, char,
+			    header->protocol_length), hw_source);
+			if (rc != EOK)
+				return rc;
 		}
 		if (ntohs(header->operation) == ARPOP_REQUEST) {
@@ -480,6 +493,10 @@
 			memcpy(des_hw, hw_source->value,
 			    header->hardware_length);
-			ERROR_PROPAGATE(packet_set_addr(packet, src_hw, des_hw,
-			    header->hardware_length));
+			
+			rc = packet_set_addr(packet, src_hw, des_hw,
+			    header->hardware_length);
+			if (rc != EOK)
+				return rc;
+			
 			nil_send_msg(device->phone, device_id, packet,
 			    SERVICE_ARP);
@@ -596,6 +613,4 @@
     ipc_call_t *answer, int *answer_count)
 {
-	ERROR_DECLARE;
-	
 	measured_string_ref address;
 	measured_string_ref translation;
@@ -603,4 +618,5 @@
 	packet_t packet;
 	packet_t next;
+	int rc;
 	
 	*answer_count = 0;
@@ -610,14 +626,21 @@
 	
 	case NET_ARP_DEVICE:
-		ERROR_PROPAGATE(measured_strings_receive(&address, &data, 1));
-		if (ERROR_OCCURRED(arp_device_message(IPC_GET_DEVICE(call),
-		    IPC_GET_SERVICE(call), ARP_GET_NETIF(call), address))) {
+		rc = measured_strings_receive(&address, &data, 1);
+		if (rc != EOK)
+			return rc;
+		
+		rc = arp_device_message(IPC_GET_DEVICE(call),
+		    IPC_GET_SERVICE(call), ARP_GET_NETIF(call), address);
+		if (rc != EOK) {
 			free(address);
 			free(data);
 		}
-		return ERROR_CODE;
+		return rc;
 	
 	case NET_ARP_TRANSLATE:
-		ERROR_PROPAGATE(measured_strings_receive(&address, &data, 1));
+		rc = measured_strings_receive(&address, &data, 1);
+		if (rc != EOK)
+			return rc;
+		
 		fibril_rwlock_read_lock(&arp_globals.lock);
 		translation = arp_translate_message(IPC_GET_DEVICE(call),
@@ -629,7 +652,7 @@
 			return ENOENT;
 		}
-		ERROR_CODE = measured_strings_reply(translation, 1);
+		rc = measured_strings_reply(translation, 1);
 		fibril_rwlock_read_unlock(&arp_globals.lock);
-		return ERROR_CODE;
+		return rc;
 
 	case NET_ARP_CLEAR_DEVICE:
@@ -637,5 +660,8 @@
 
 	case NET_ARP_CLEAR_ADDRESS:
-		ERROR_PROPAGATE(measured_strings_receive(&address, &data, 1));
+		rc = measured_strings_receive(&address, &data, 1);
+		if (rc != EOK)
+			return rc;
+		
 		arp_clear_address_req(0, IPC_GET_DEVICE(call),
 		    IPC_GET_SERVICE(call), address);
@@ -652,21 +678,22 @@
 	
 	case NET_IL_RECEIVED:
-		if (ERROR_NONE(packet_translate_remote(arp_globals.net_phone,
-		    &packet, IPC_GET_PACKET(call)))) {
-			fibril_rwlock_read_lock(&arp_globals.lock);
-			do {
-				next = pq_detach(packet);
-				ERROR_CODE =
-				    arp_receive_message(IPC_GET_DEVICE(call),
-				    packet);
-				if (ERROR_CODE != 1) {
-					pq_release_remote(arp_globals.net_phone,
-					    packet_get_id(packet));
-				}
-				packet = next;
-			} while (packet);
-			fibril_rwlock_read_unlock(&arp_globals.lock);
-		}
-		return ERROR_CODE;
+		rc = packet_translate_remote(arp_globals.net_phone, &packet,
+		    IPC_GET_PACKET(call));
+		if (rc != EOK)
+			return rc;
+		
+		fibril_rwlock_read_lock(&arp_globals.lock);
+		do {
+			next = pq_detach(packet);
+			rc = arp_receive_message(IPC_GET_DEVICE(call), packet);
+			if (rc != 1) {
+				pq_release_remote(arp_globals.net_phone,
+				    packet_get_id(packet));
+			}
+			packet = next;
+		} while (packet);
+		fibril_rwlock_read_unlock(&arp_globals.lock);
+		
+		return EOK;
 	
 	case NET_IL_MTU_CHANGED:
@@ -727,9 +754,9 @@
 int main(int argc, char *argv[])
 {
-	ERROR_DECLARE;
+	int rc;
 	
 	/* Start the module */
-	ERROR_PROPAGATE(il_module_start_standalone(il_client_connection));
-	return EOK;
+	rc = il_module_start_standalone(il_client_connection);
+	return rc;
 }
 
