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