Index: uspace/lib/c/generic/inetcfg.c
===================================================================
--- uspace/lib/c/generic/inetcfg.c	(revision b5cf742a59181f253244bd8f695f588d137834ed)
+++ uspace/lib/c/generic/inetcfg.c	(revision 98abd409db889cb4a1e3a865f6034f5a68f66184)
@@ -136,41 +136,136 @@
     sysarg_t link_id, sysarg_t *addr_id)
 {
-	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);
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+	
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_ADDR_CREATE_STATIC, link_id,
+	    &answer);
+	
+	int rc = async_data_write_start(exch, naddr, sizeof(inet_naddr_t));
+	if (rc != EOK) {
+		async_exchange_end(exch);
+		async_forget(req);
+		return rc;
+	}
+	
+	rc = async_data_write_start(exch, name, str_size(name));
+	
+	async_exchange_end(exch);
+	
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+	
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	*addr_id = IPC_GET_ARG1(answer);
+	
+	return (int) retval;
+}
+
+int inetcfg_addr_delete(sysarg_t addr_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
+int inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+	
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_ADDR_GET, addr_id, &answer);
+	
+	ipc_call_t answer_naddr;
+	aid_t req_naddr = async_data_read(exch, &ainfo->naddr,
+	    sizeof(inet_naddr_t), &answer_naddr);
+	
+	sysarg_t retval_naddr;
+	async_wait_for(req_naddr, &retval_naddr);
+	
+	if (retval_naddr != EOK) {
+		async_exchange_end(exch);
+		async_forget(req);
+		return (int) retval_naddr;
+	}
+	
+	ipc_call_t answer_name;
+	char name_buf[LOC_NAME_MAXLEN + 1];
+	aid_t req_name = async_data_read(exch, name_buf, LOC_NAME_MAXLEN,
+	    &answer_name);
+	
+	async_exchange_end(exch);
+	
+	sysarg_t retval_name;
+	async_wait_for(req_name, &retval_name);
+	
+	if (retval_name != EOK) {
+		async_forget(req);
+		return (int) retval_name;
+	}
+	
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	if (retval != EOK)
+		return (int) retval;
+	
+	size_t act_size = IPC_GET_ARG2(answer_name);
+	assert(act_size <= LOC_NAME_MAXLEN);
+	
+	name_buf[act_size] = '\0';
+	
+	ainfo->ilink = IPC_GET_ARG1(answer);
+	ainfo->name = str_dup(name_buf);
+	
+	return EOK;
+}
+
+int inetcfg_addr_get_id(const char *name, 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_1(exch, INETCFG_ADDR_GET_ID, link_id, &answer);
 	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
-	
-	async_exchange_end(exch);
-	
+
+	async_exchange_end(exch);
+
 	if (retval != EOK) {
 		async_forget(req);
 		return retval;
 	}
-	
+
 	async_wait_for(req, &retval);
 	*addr_id = IPC_GET_ARG1(answer);
-	
-	return (int) retval;
-}
-
-int inetcfg_addr_delete(sysarg_t addr_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	int rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-int inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
+
+	return retval;
+}
+
+int inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
+{
+	return inetcfg_get_ids_internal(INETCFG_GET_ADDR_LIST,
+	    0, addrs, count);
+}
+
+int inetcfg_get_link_list(sysarg_t **links, size_t *count)
+{
+	return inetcfg_get_ids_internal(INETCFG_GET_LINK_LIST,
+	    0, links, count);
+}
+
+int inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
+{
+	return inetcfg_get_ids_internal(INETCFG_GET_SROUTE_LIST,
+	    0, sroutes, count);
+}
+
+int inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
 {
 	ipc_call_t dreply;
@@ -178,83 +273,4 @@
 	size_t act_size;
 	char name_buf[LOC_NAME_MAXLEN + 1];
-	
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-	
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_ADDR_GET, addr_id, &answer);
-	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
-	async_wait_for(dreq, &dretval);
-	
-	async_exchange_end(exch);
-	
-	if (dretval != EOK) {
-		async_forget(req);
-		return dretval;
-	}
-	
-	sysarg_t retval;
-	async_wait_for(req, &retval);
-	
-	if (retval != EOK)
-		return (int) retval;
-	
-	act_size = IPC_GET_ARG2(dreply);
-	assert(act_size <= LOC_NAME_MAXLEN);
-	
-	name_buf[act_size] = '\0';
-	
-	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);
-	
-	return EOK;
-}
-
-int inetcfg_addr_get_id(const char *name, 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_1(exch, INETCFG_ADDR_GET_ID, 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_wait_for(req, &retval);
-	*addr_id = IPC_GET_ARG1(answer);
-
-	return retval;
-}
-
-int inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
-{
-	return inetcfg_get_ids_internal(INETCFG_GET_ADDR_LIST,
-	    0, addrs, count);
-}
-
-int inetcfg_get_link_list(sysarg_t **links, size_t *count)
-{
-	return inetcfg_get_ids_internal(INETCFG_GET_LINK_LIST,
-	    0, links, count);
-}
-
-int inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
-{
-	return inetcfg_get_ids_internal(INETCFG_GET_SROUTE_LIST,
-	    0, sroutes, count);
-}
-
-int inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
-{
-	ipc_call_t dreply;
-	sysarg_t dretval;
-	size_t act_size;
-	char name_buf[LOC_NAME_MAXLEN + 1];
 
 	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
@@ -291,34 +307,38 @@
     inet_addr_t *router, sysarg_t *sroute_id)
 {
-	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,
-	    (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_wait_for(req, &retval);
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+	
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, INETCFG_SROUTE_CREATE, &answer);
+	
+	int rc = async_data_write_start(exch, dest, sizeof(inet_naddr_t));
+	if (rc != EOK) {
+		async_exchange_end(exch);
+		async_forget(req);
+		return rc;
+	}
+	
+	rc = async_data_write_start(exch, router, sizeof(inet_addr_t));
+	if (rc != EOK) {
+		async_exchange_end(exch);
+		async_forget(req);
+		return rc;
+	}
+	
+	rc = async_data_write_start(exch, name, str_size(name));
+	
+	async_exchange_end(exch);
+	
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+	
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
 	*sroute_id = IPC_GET_ARG1(answer);
 	
-	return retval;
+	return (int) retval;
 }
 
@@ -335,21 +355,48 @@
 int inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
 {
-	ipc_call_t dreply;
-	sysarg_t dretval;
-	size_t act_size;
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+	
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_SROUTE_GET, sroute_id, &answer);
+	
+	ipc_call_t answer_dest;
+	aid_t req_dest = async_data_read(exch, &srinfo->dest,
+	    sizeof(inet_naddr_t), &answer_dest);
+	
+	sysarg_t retval_dest;
+	async_wait_for(req_dest, &retval_dest);
+	
+	if (retval_dest != EOK) {
+		async_exchange_end(exch);
+		async_forget(req);
+		return (int) retval_dest;
+	}
+	
+	ipc_call_t answer_router;
+	aid_t req_router = async_data_read(exch, &srinfo->router,
+	    sizeof(inet_addr_t), &answer_router);
+	
+	sysarg_t retval_router;
+	async_wait_for(req_router, &retval_router);
+	
+	if (retval_router != EOK) {
+		async_exchange_end(exch);
+		async_forget(req);
+		return (int) retval_router;
+	}
+	
+	ipc_call_t answer_name;
 	char name_buf[LOC_NAME_MAXLEN + 1];
-
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-	
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_SROUTE_GET, sroute_id, &answer);
-	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
-	async_wait_for(dreq, &dretval);
-	
-	async_exchange_end(exch);
-	
-	if (dretval != EOK) {
-		async_forget(req);
-		return dretval;
+	aid_t req_name = async_data_read(exch, name_buf, LOC_NAME_MAXLEN,
+	    &answer_name);
+	
+	async_exchange_end(exch);
+	
+	sysarg_t retval_name;
+	async_wait_for(req_name, &retval_name);
+	
+	if (retval_name != EOK) {
+		async_forget(req);
+		return (int) retval_name;
 	}
 	
@@ -360,11 +407,9 @@
 		return (int) retval;
 	
-	act_size = IPC_GET_ARG2(dreply);
+	size_t act_size = IPC_GET_ARG2(answer_name);
 	assert(act_size <= LOC_NAME_MAXLEN);
+	
 	name_buf[act_size] = '\0';
-
-	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);
 	
