Changeset 61bfc370 in mainline for uspace/srv/net/il


Ignore:
Timestamp:
2011-01-07T18:57:55Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e08a733
Parents:
7c34b28f
Message:
  • make measured_string and other network-related data types binary-safe
  • fix several network-related routines binary-safe (replace clearly suspicious use of str_lcmp() with bcmp())
  • rename spawn() to net_spawn()
Location:
uspace/srv/net/il
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/il/arp/arp.c

    r7c34b28f r61bfc370  
    215215        (*proto)->service = service;
    216216        (*proto)->addr = address;
    217         (*proto)->addr_data = (uint8_t *) address->value;
     217        (*proto)->addr_data = address->value;
    218218       
    219219        rc = arp_addr_initialize(&(*proto)->addresses);
     
    267267                        free(proto->addr_data);
    268268                        proto->addr = address;
    269                         proto->addr_data = (uint8_t *) address->value;
     269                        proto->addr_data = address->value;
    270270                } else {
    271271                        rc = arp_proto_create(&proto, protocol, address);
     
    482482        des_hw = src_proto + header->protocol_length;
    483483        des_proto = des_hw + header->hardware_length;
    484         trans = arp_addr_find(&proto->addresses, (char *) src_proto,
     484        trans = arp_addr_find(&proto->addresses, src_proto,
    485485            header->protocol_length);
    486486        /* Exists? */
     
    493493        if (proto->addr->length != header->protocol_length)
    494494                return EINVAL;
    495         if (!str_lcmp(proto->addr->value, (char *) des_proto,
    496             proto->addr->length)) {
     495       
     496        if (!bcmp(proto->addr->value, des_proto, proto->addr->length)) {
    497497                /* Not already updated? */
    498498                if (!trans) {
     
    502502                        trans->hw_addr = NULL;
    503503                        fibril_condvar_initialize(&trans->cv);
    504                         rc = arp_addr_add(&proto->addresses, (char *) src_proto,
     504                        rc = arp_addr_add(&proto->addresses, src_proto,
    505505                            header->protocol_length, trans);
    506506                        if (rc != EOK) {
     
    510510                }
    511511                if (!trans->hw_addr) {
    512                         trans->hw_addr = measured_string_create_bulk(
    513                             (char *) src_hw, header->hardware_length);
     512                        trans->hw_addr = measured_string_create_bulk(src_hw,
     513                            header->hardware_length);
    514514                        if (!trans->hw_addr)
    515515                                return ENOMEM;
    516 
     516                       
    517517                        /* Notify the fibrils that wait for the translation. */
    518518                        fibril_condvar_broadcast(&trans->cv);
     
    681681        measured_string_t *address;
    682682        measured_string_t *translation;
    683         char *data;
     683        uint8_t *data;
    684684        packet_t *packet;
    685685        packet_t *next;
     
    748748       
    749749        case NET_IL_RECEIVED:
     750               
    750751                rc = packet_translate_remote(arp_globals.net_phone, &packet,
    751752                    IPC_GET_PACKET(call));
  • uspace/srv/net/il/ip/ip.c

    r7c34b28f r61bfc370  
    275275        if (rc != EOK)
    276276                goto out;
    277         rc = add_module(NULL, &ip_globals.modules, ARP_NAME, ARP_FILENAME,
    278             SERVICE_ARP, 0, arp_connect_module);
     277        rc = add_module(NULL, &ip_globals.modules, (uint8_t *) ARP_NAME,
     278            (uint8_t *) ARP_FILENAME, SERVICE_ARP, 0, arp_connect_module);
    279279
    280280out:
     
    312312        measured_string_t names[] = {
    313313                {
    314                         (char *) "IPV",
     314                        (uint8_t *) "IPV",
    315315                        3
    316316                },
    317317                {
    318                         (char *) "IP_CONFIG",
     318                        (uint8_t *) "IP_CONFIG",
    319319                        9
    320320                },
    321321                {
    322                         (char *) "IP_ADDR",
     322                        (uint8_t *) "IP_ADDR",
    323323                        7
    324324                },
    325325                {
    326                         (char *) "IP_NETMASK",
     326                        (uint8_t *) "IP_NETMASK",
    327327                        10
    328328                },
    329329                {
    330                         (char *) "IP_GATEWAY",
     330                        (uint8_t *) "IP_GATEWAY",
    331331                        10
    332332                },
    333333                {
    334                         (char *) "IP_BROADCAST",
     334                        (uint8_t *) "IP_BROADCAST",
    335335                        12
    336336                },
    337337                {
    338                         (char *) "ARP",
     338                        (uint8_t *) "ARP",
    339339                        3
    340340                },
    341341                {
    342                         (char *) "IP_ROUTING",
     342                        (uint8_t *) "IP_ROUTING",
    343343                        10
    344344                }
     
    346346        measured_string_t *configuration;
    347347        size_t count = sizeof(names) / sizeof(measured_string_t);
    348         char *data;
     348        uint8_t *data;
    349349        measured_string_t address;
    350350        ip_route_t *route;
     
    368368        if (configuration) {
    369369                if (configuration[0].value)
    370                         ip_netif->ipv = strtol(configuration[0].value, NULL, 0);
    371 
    372                 ip_netif->dhcp = !str_lcmp(configuration[1].value, "dhcp",
     370                        ip_netif->ipv = strtol((char *) configuration[0].value, NULL, 0);
     371               
     372                ip_netif->dhcp = !str_lcmp((char *) configuration[1].value, "dhcp",
    373373                    configuration[1].length);
    374374               
     
    394394                        }
    395395                       
    396                         if ((inet_pton(AF_INET, configuration[2].value,
     396                        if ((inet_pton(AF_INET, (char *) configuration[2].value,
    397397                            (uint8_t *) &route->address.s_addr) != EOK) ||
    398                             (inet_pton(AF_INET, configuration[3].value,
     398                            (inet_pton(AF_INET, (char *) configuration[3].value,
    399399                            (uint8_t *) &route->netmask.s_addr) != EOK) ||
    400                             (inet_pton(AF_INET, configuration[4].value,
     400                            (inet_pton(AF_INET, (char *) configuration[4].value,
    401401                            (uint8_t *) &gateway.s_addr) == EINVAL) ||
    402                             (inet_pton(AF_INET, configuration[5].value,
     402                            (inet_pton(AF_INET, (char *) configuration[5].value,
    403403                            (uint8_t *) &ip_netif->broadcast.s_addr) == EINVAL))
    404404                            {
     
    441441        if (ip_netif->arp) {
    442442                if (route) {
    443                         address.value = (char *) &route->address.s_addr;
     443                        address.value = (uint8_t *) &route->address.s_addr;
    444444                        address.length = sizeof(in_addr_t);
    445445                       
     
    997997        measured_string_t destination;
    998998        measured_string_t *translation;
    999         char *data;
     999        uint8_t *data;
    10001000        int phone;
    10011001        int rc;
     
    10041004        if (netif->arp && (route->address.s_addr != dest.s_addr)) {
    10051005                destination.value = route->gateway.s_addr ?
    1006                     (char *) &route->gateway.s_addr : (char *) &dest.s_addr;
     1006                    (uint8_t *) &route->gateway.s_addr : (uint8_t *) &dest.s_addr;
    10071007                destination.length = sizeof(dest.s_addr);
    10081008
     
    17561756                    (header->destination_address & route->netmask.s_addr))) {
    17571757                        // clear the ARP mapping if any
    1758                         address.value = (char *) &header->destination_address;
     1758                        address.value = (uint8_t *) &header->destination_address;
    17591759                        address.length = sizeof(header->destination_address);
    17601760                        arp_clear_address_req(netif->arp->phone,
Note: See TracChangeset for help on using the changeset viewer.