Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/inetsrv/inetcfg.c

    r257feec ra1a101d  
    5656        inet_link_t *ilink;
    5757        inet_addrobj_t *addr;
    58         inet_addr_t iaddr;
     58        iplink_addr_t iaddr;
    5959        int rc;
    6060
     
    8282        }
    8383
    84         inet_naddr_addr(&addr->naddr, &iaddr);
     84        iaddr.ipv4 = addr->naddr.ipv4;
    8585        rc = iplink_addr_add(ilink->iplink, &iaddr);
    8686        if (rc != EOK) {
     
    254254        }
    255255
    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);
    258259
    259260        addr_id = 0;
     
    278279static void inetcfg_addr_get_srv(ipc_callid_t callid, ipc_call_t *call)
    279280{
     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);
    280289        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;
    287293        ainfo.ilink = 0;
    288294        ainfo.name = NULL;
    289        
    290         ipc_callid_t rcallid;
    291         size_t max_size;
    292        
     295
    293296        if (!async_data_read_receive(&rcallid, &max_size)) {
    294297                async_answer_0(rcallid, EREFUSED);
     
    296299                return;
    297300        }
    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
    313308        sysarg_t retval = async_data_read_finalize(rcallid, ainfo.name,
    314309            min(max_size, str_size(ainfo.name)));
    315310        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);
    319314}
    320315
     
    377372}
    378373
     374
    379375static void inetcfg_get_link_list_srv(ipc_callid_t callid, ipc_call_t *call)
    380376{
     
    480476    ipc_call_t *call)
    481477{
    482         log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");
    483        
    484478        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        
    492479        inet_naddr_t dest;
    493480        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;
    499498        rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id);
    500499        free(name);
     
    517516static void inetcfg_sroute_get_srv(ipc_callid_t callid, ipc_call_t *call)
    518517{
    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        
    529518        ipc_callid_t rcallid;
    530519        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
    531533        if (!async_data_read_receive(&rcallid, &max_size)) {
    532534                async_answer_0(rcallid, EREFUSED);
     
    534536                return;
    535537        }
    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
    558545        sysarg_t retval = async_data_read_finalize(rcallid, srinfo.name,
    559546            min(max_size, str_size(srinfo.name)));
    560547        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);
    564551}
    565552
Note: See TracChangeset for help on using the changeset viewer.