Changes in uspace/srv/net/inetsrv/inetcfg.c [bd88bee:02a09ed] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inetcfg.c
rbd88bee r02a09ed 1 1 /* 2 * Copyright (c) 201 3Jiri Svoboda2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 #include <str.h> 45 45 #include <sys/types.h> 46 #include <types/inetcfg.h>47 46 48 47 #include "addrobj.h" … … 152 151 static int inetcfg_get_link_list(sysarg_t **addrs, size_t *count) 153 152 { 154 return inet_link_get_id_list(addrs, count);153 return ENOTSUP; 155 154 } 156 155 … … 158 157 { 159 158 return inet_sroute_get_id_list(sroutes, count); 160 }161 162 static int inetcfg_link_add(sysarg_t link_id)163 {164 return inet_link_open(link_id);165 159 } 166 160 … … 176 170 linfo->name = str_dup(ilink->svc_name); 177 171 linfo->def_mtu = ilink->def_mtu; 178 if (ilink->mac_valid) { 179 addr48(ilink->mac, linfo->mac_addr); 180 } else { 181 memset(linfo->mac_addr, 0, sizeof(linfo->mac_addr)); 182 } 183 184 return EOK; 185 } 186 187 static int inetcfg_link_remove(sysarg_t link_id) 188 { 189 return ENOTSUP; 172 return EOK; 190 173 } 191 174 … … 428 411 { 429 412 ipc_callid_t rcallid; 430 size_t count;431 413 size_t max_size; 432 414 size_t act_size; … … 435 417 int rc; 436 418 437 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_ addr_list_srv()");419 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_link_list_srv()"); 438 420 439 421 if (!async_data_read_receive(&rcallid, &max_size)) { … … 443 425 } 444 426 445 rc = inetcfg_get_link_list(&id_buf, & count);427 rc = inetcfg_get_link_list(&id_buf, &act_size); 446 428 if (rc != EOK) { 447 429 async_answer_0(rcallid, rc); … … 450 432 } 451 433 452 act_size = count * sizeof(sysarg_t);453 434 size = min(act_size, max_size); 454 435 … … 493 474 } 494 475 495 static void inetcfg_link_add_srv(ipc_callid_t callid, ipc_call_t *call)496 {497 sysarg_t link_id;498 int rc;499 500 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_add_srv()");501 502 link_id = IPC_GET_ARG1(*call);503 504 rc = inetcfg_link_add(link_id);505 async_answer_0(callid, rc);506 }507 508 476 static void inetcfg_link_get_srv(ipc_callid_t callid, ipc_call_t *call) 509 477 { 510 ipc_callid_t name_callid; 511 ipc_callid_t laddr_callid; 512 size_t name_max_size; 513 size_t laddr_max_size; 478 ipc_callid_t rcallid; 479 size_t max_size; 514 480 515 481 sysarg_t link_id; … … 522 488 linfo.name = NULL; 523 489 524 if (!async_data_read_receive(&name_callid, &name_max_size)) { 525 async_answer_0(name_callid, EREFUSED); 526 async_answer_0(callid, EREFUSED); 527 return; 528 } 529 530 if (!async_data_read_receive(&laddr_callid, &laddr_max_size)) { 531 async_answer_0(name_callid, EREFUSED); 490 if (!async_data_read_receive(&rcallid, &max_size)) { 491 async_answer_0(rcallid, EREFUSED); 532 492 async_answer_0(callid, EREFUSED); 533 493 return; … … 536 496 rc = inetcfg_link_get(link_id, &linfo); 537 497 if (rc != EOK) { 538 async_answer_0(laddr_callid, rc); 539 async_answer_0(name_callid, rc); 540 async_answer_0(callid, rc); 541 return; 542 } 543 544 sysarg_t retval = async_data_read_finalize(name_callid, linfo.name, 545 min(name_max_size, str_size(linfo.name))); 546 if (retval != EOK) { 547 free(linfo.name); 548 async_answer_0(laddr_callid, retval); 549 async_answer_0(callid, retval); 550 return; 551 } 552 553 retval = async_data_read_finalize(laddr_callid, &linfo.mac_addr, 554 min(laddr_max_size, sizeof(linfo.mac_addr))); 555 498 async_answer_0(rcallid, rc); 499 async_answer_0(callid, rc); 500 return; 501 } 502 503 sysarg_t retval = async_data_read_finalize(rcallid, linfo.name, 504 min(max_size, str_size(linfo.name))); 556 505 free(linfo.name); 557 506 558 507 async_answer_1(callid, retval, linfo.def_mtu); 559 }560 561 static void inetcfg_link_remove_srv(ipc_callid_t callid, ipc_call_t *call)562 {563 sysarg_t link_id;564 int rc;565 566 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_remove_srv()");567 568 link_id = IPC_GET_ARG1(*call);569 570 rc = inetcfg_link_remove(link_id);571 async_answer_0(callid, rc);572 508 } 573 509 … … 750 686 sysarg_t method = IPC_GET_IMETHOD(call); 751 687 752 log_msg(LOG_DEFAULT, LVL_DEBUG, "method %d", (int)method);753 688 if (!method) { 754 689 /* The other side has hung up */ … … 779 714 inetcfg_get_sroute_list_srv(callid, &call); 780 715 break; 781 case INETCFG_LINK_ADD:782 inetcfg_link_add_srv(callid, &call);783 break;784 716 case INETCFG_LINK_GET: 785 717 inetcfg_link_get_srv(callid, &call); 786 break;787 case INETCFG_LINK_REMOVE:788 inetcfg_link_remove_srv(callid, &call);789 718 break; 790 719 case INETCFG_SROUTE_CREATE:
Note:
See TracChangeset
for help on using the changeset viewer.