Index: uspace/srv/net/inetsrv/inetcfg.c
===================================================================
--- uspace/srv/net/inetsrv/inetcfg.c	(revision 257feec9d30b7aa8ced34c0ef045309a9cc98d3c)
+++ uspace/srv/net/inetsrv/inetcfg.c	(revision d8b47eca6f42cb0337bbfbbd1fcd114ae523a897)
@@ -236,29 +236,45 @@
 }
 
-static void inetcfg_addr_create_static_srv(ipc_callid_t callid,
-    ipc_call_t *call)
-{
+static void inetcfg_addr_create_static_srv(ipc_callid_t iid,
+    ipc_call_t *icall)
+{
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_create_static_srv()");
+	
+	sysarg_t link_id = IPC_GET_ARG1(*icall);
+	
+	ipc_callid_t callid;
+	size_t size;
+	if (!async_data_write_receive(&callid, &size)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	if (size != sizeof(inet_naddr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	inet_naddr_t naddr;
+	int rc = async_data_write_finalize(callid, &naddr, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
+	
 	char *name;
-	inet_naddr_t naddr;
-	sysarg_t link_id;
-	sysarg_t addr_id;
-	int rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_create_static_srv()");
-
 	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_unpack(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), &naddr);
-	link_id = IPC_GET_ARG3(*call);
-
-	addr_id = 0;
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	sysarg_t addr_id = 0;
 	rc = inetcfg_addr_create_static(name, &naddr, link_id, &addr_id);
 	free(name);
-	async_answer_1(callid, rc, addr_id);
+	async_answer_1(iid, rc, addr_id);
 }
 
@@ -276,9 +292,9 @@
 }
 
-static void inetcfg_addr_get_srv(ipc_callid_t callid, ipc_call_t *call)
+static void inetcfg_addr_get_srv(ipc_callid_t iid, ipc_call_t *icall)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()");
 	
-	sysarg_t addr_id = IPC_GET_ARG1(*call);
+	sysarg_t addr_id = IPC_GET_ARG1(*icall);
 	
 	inet_addr_info_t ainfo;
@@ -288,33 +304,48 @@
 	ainfo.name = NULL;
 	
-	ipc_callid_t rcallid;
-	size_t max_size;
-	
-	if (!async_data_read_receive(&rcallid, &max_size)) {
-		async_answer_0(rcallid, EREFUSED);
-		async_answer_0(callid, EREFUSED);
-		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)));
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	ipc_callid_t callid;
+	size_t size;
+	if (!async_data_read_receive(&callid, &size)) {
+		async_answer_0(callid, EREFUSED);
+		async_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	if (size != sizeof(inet_naddr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	rc = async_data_read_finalize(callid, &ainfo.naddr, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	if (!async_data_read_receive(&callid, &size)) {
+		async_answer_0(callid, EREFUSED);
+		async_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	rc = async_data_read_finalize(callid, ainfo.name,
+	    min(size, str_size(ainfo.name)));
 	free(ainfo.name);
 	
-	async_answer_3(callid, retval, (sysarg_t) naddr_addr,
-	    (sysarg_t) naddr_bits, ainfo.ilink);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	async_answer_1(iid, (sysarg_t) rc, ainfo.ilink);
 }
 
@@ -477,27 +508,63 @@
 }
 
-static void inetcfg_sroute_create_srv(ipc_callid_t callid,
-    ipc_call_t *call)
+static void inetcfg_sroute_create_srv(ipc_callid_t iid,
+    ipc_call_t *icall)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");
+
+	ipc_callid_t callid;
+	size_t size;
+	if (!async_data_write_receive(&callid, &size)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	if (size != sizeof(inet_naddr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	inet_naddr_t dest;
+	int rc = async_data_write_finalize(callid, &dest, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	if (!async_data_write_receive(&callid, &size)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	if (size != sizeof(inet_addr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	inet_addr_t router;
+	rc = async_data_write_finalize(callid, &router, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
 	
 	char *name;
-	int rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
+	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;
-	
-	inet_naddr_unpack(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), &dest);
-	inet_addr_unpack(IPC_GET_ARG3(*call), &router);
+		async_answer_0(iid, rc);
+		return;
+	}
 	
 	sysarg_t sroute_id = 0;
 	rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id);
 	free(name);
-	async_answer_1(callid, rc, sroute_id);
+	async_answer_1(iid, rc, sroute_id);
 }
 
@@ -515,9 +582,9 @@
 }
 
-static void inetcfg_sroute_get_srv(ipc_callid_t callid, ipc_call_t *call)
+static void inetcfg_sroute_get_srv(ipc_callid_t iid, ipc_call_t *icall)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()");
 	
-	sysarg_t sroute_id = IPC_GET_ARG1(*call);
+	sysarg_t sroute_id = IPC_GET_ARG1(*icall);
 	
 	inet_sroute_info_t srinfo;
@@ -527,39 +594,61 @@
 	srinfo.name = NULL;
 	
-	ipc_callid_t rcallid;
-	size_t max_size;
-	if (!async_data_read_receive(&rcallid, &max_size)) {
-		async_answer_0(rcallid, EREFUSED);
-		async_answer_0(callid, EREFUSED);
-		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)));
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	ipc_callid_t callid;
+	size_t size;
+	if (!async_data_read_receive(&callid, &size)) {
+		async_answer_0(callid, EREFUSED);
+		async_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	if (size != sizeof(inet_naddr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	rc = async_data_read_finalize(callid, &srinfo.dest, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	if (!async_data_read_receive(&callid, &size)) {
+		async_answer_0(callid, EREFUSED);
+		async_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	if (size != sizeof(inet_addr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	rc = async_data_read_finalize(callid, &srinfo.router, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	if (!async_data_read_receive(&callid, &size)) {
+		async_answer_0(callid, EREFUSED);
+		async_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	rc = async_data_read_finalize(callid, srinfo.name,
+	    min(size, str_size(srinfo.name)));
 	free(srinfo.name);
 	
-	async_answer_3(callid, retval, (sysarg_t) dest_addr,
-	    (sysarg_t) dest_bits, (sysarg_t) router_addr);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
