Changes in uspace/srv/net/inetsrv/inetcfg.c [257feec:a1a101d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inetcfg.c
r257feec ra1a101d 56 56 inet_link_t *ilink; 57 57 inet_addrobj_t *addr; 58 i net_addr_t iaddr;58 iplink_addr_t iaddr; 59 59 int rc; 60 60 … … 82 82 } 83 83 84 i net_naddr_addr(&addr->naddr, &iaddr);84 iaddr.ipv4 = addr->naddr.ipv4; 85 85 rc = iplink_addr_add(ilink->iplink, &iaddr); 86 86 if (rc != EOK) { … … 254 254 } 255 255 256 inet_naddr_unpack(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), &naddr); 257 link_id = IPC_GET_ARG3(*call); 256 naddr.ipv4 = IPC_GET_ARG1(*call); 257 naddr.bits = IPC_GET_ARG2(*call); 258 link_id = IPC_GET_ARG3(*call); 258 259 259 260 addr_id = 0; … … 278 279 static void inetcfg_addr_get_srv(ipc_callid_t callid, ipc_call_t *call) 279 280 { 281 ipc_callid_t rcallid; 282 size_t max_size; 283 284 sysarg_t addr_id; 285 inet_addr_info_t ainfo; 286 int rc; 287 288 addr_id = IPC_GET_ARG1(*call); 280 289 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()"); 281 282 sysarg_t addr_id = IPC_GET_ARG1(*call); 283 284 inet_addr_info_t ainfo; 285 286 inet_naddr_any(&ainfo.naddr); 290 291 ainfo.naddr.ipv4 = 0; 292 ainfo.naddr.bits = 0; 287 293 ainfo.ilink = 0; 288 294 ainfo.name = NULL; 289 290 ipc_callid_t rcallid; 291 size_t max_size; 292 295 293 296 if (!async_data_read_receive(&rcallid, &max_size)) { 294 297 async_answer_0(rcallid, EREFUSED); … … 296 299 return; 297 300 } 298 299 int rc = inetcfg_addr_get(addr_id, &ainfo); 300 if (rc != EOK) { 301 async_answer_0(callid, rc); 302 return; 303 } 304 305 uint32_t naddr_addr; 306 uint8_t naddr_bits; 307 rc = inet_naddr_pack(&ainfo.naddr, &naddr_addr, &naddr_bits); 308 if (rc != EOK) { 309 async_answer_0(callid, rc); 310 return; 311 } 312 301 302 rc = inetcfg_addr_get(addr_id, &ainfo); 303 if (rc != EOK) { 304 async_answer_0(callid, rc); 305 return; 306 } 307 313 308 sysarg_t retval = async_data_read_finalize(rcallid, ainfo.name, 314 309 min(max_size, str_size(ainfo.name))); 315 310 free(ainfo.name); 316 317 async_answer_3(callid, retval, (sysarg_t) naddr_addr,318 (sysarg_t) naddr_bits,ainfo.ilink);311 312 async_answer_3(callid, retval, ainfo.naddr.ipv4, ainfo.naddr.bits, 313 ainfo.ilink); 319 314 } 320 315 … … 377 372 } 378 373 374 379 375 static void inetcfg_get_link_list_srv(ipc_callid_t callid, ipc_call_t *call) 380 376 { … … 480 476 ipc_call_t *call) 481 477 { 482 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");483 484 478 char *name; 485 int rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,486 0, NULL);487 if (rc != EOK) {488 async_answer_0(callid, rc);489 return;490 }491 492 479 inet_naddr_t dest; 493 480 inet_addr_t router; 494 495 inet_naddr_unpack(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), &dest); 496 inet_addr_unpack(IPC_GET_ARG3(*call), &router); 497 498 sysarg_t sroute_id = 0; 481 sysarg_t sroute_id; 482 int rc; 483 484 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()"); 485 486 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN, 487 0, NULL); 488 if (rc != EOK) { 489 async_answer_0(callid, rc); 490 return; 491 } 492 493 dest.ipv4 = IPC_GET_ARG1(*call); 494 dest.bits = IPC_GET_ARG2(*call); 495 router.ipv4 = IPC_GET_ARG3(*call); 496 497 sroute_id = 0; 499 498 rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id); 500 499 free(name); … … 517 516 static void inetcfg_sroute_get_srv(ipc_callid_t callid, ipc_call_t *call) 518 517 { 519 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()");520 521 sysarg_t sroute_id = IPC_GET_ARG1(*call);522 523 inet_sroute_info_t srinfo;524 525 inet_naddr_any(&srinfo.dest);526 inet_addr_any(&srinfo.router);527 srinfo.name = NULL;528 529 518 ipc_callid_t rcallid; 530 519 size_t max_size; 520 521 sysarg_t sroute_id; 522 inet_sroute_info_t srinfo; 523 int rc; 524 525 sroute_id = IPC_GET_ARG1(*call); 526 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()"); 527 528 srinfo.dest.ipv4 = 0; 529 srinfo.dest.bits = 0; 530 srinfo.router.ipv4 = 0; 531 srinfo.name = NULL; 532 531 533 if (!async_data_read_receive(&rcallid, &max_size)) { 532 534 async_answer_0(rcallid, EREFUSED); … … 534 536 return; 535 537 } 536 537 int rc = inetcfg_sroute_get(sroute_id, &srinfo); 538 if (rc != EOK) { 539 async_answer_0(callid, rc); 540 return; 541 } 542 543 uint32_t dest_addr; 544 uint8_t dest_bits; 545 rc = inet_naddr_pack(&srinfo.dest, &dest_addr, &dest_bits); 546 if (rc != EOK) { 547 async_answer_0(callid, rc); 548 return; 549 } 550 551 uint32_t router_addr; 552 rc = inet_addr_pack(&srinfo.router, &router_addr); 553 if (rc != EOK) { 554 async_answer_0(callid, rc); 555 return; 556 } 557 538 539 rc = inetcfg_sroute_get(sroute_id, &srinfo); 540 if (rc != EOK) { 541 async_answer_0(callid, rc); 542 return; 543 } 544 558 545 sysarg_t retval = async_data_read_finalize(rcallid, srinfo.name, 559 546 min(max_size, str_size(srinfo.name))); 560 547 free(srinfo.name); 561 562 async_answer_3(callid, retval, (sysarg_t) dest_addr,563 (sysarg_t) dest_bits, (sysarg_t) router_addr);548 549 async_answer_3(callid, retval, srinfo.dest.ipv4, srinfo.dest.bits, 550 srinfo.router.ipv4); 564 551 } 565 552
Note:
See TracChangeset
for help on using the changeset viewer.