Changeset 02a09ed in mainline for uspace/srv/net/inetsrv/sroute.c


Ignore:
Timestamp:
2013-06-28T20:20:03Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d24ad3
Parents:
edf0d27
Message:

add basic infrastructure for IPv6 (inactive)
make inet_addr_t a universal address type

File:
1 edited

Legend:

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

    redf0d27 r02a09ed  
    4242#include <stdlib.h>
    4343#include <str.h>
    44 
    4544#include "sroute.h"
    4645#include "inetsrv.h"
    4746#include "inet_link.h"
    48 #include "inet_util.h"
    4947
    5048static FIBRIL_MUTEX_INITIALIZE(sroute_list_lock);
     
    9795inet_sroute_t *inet_sroute_find(inet_addr_t *addr)
    9896{
    99         uint32_t addr_addr;
    100         int rc = inet_addr_pack(addr, &addr_addr);
    101         if (rc != EOK)
    102                 return NULL;
     97        uint16_t addr_af = inet_addr_get(addr, NULL, NULL);
    10398       
    10499        inet_sroute_t *best = NULL;
     
    111106                    inet_sroute_t, sroute_list);
    112107               
    113                 uint32_t dest_addr;
    114108                uint8_t dest_bits;
    115                 rc = inet_naddr_pack(&sroute->dest, &dest_addr, &dest_bits);
    116                 if (rc != EOK)
     109                uint16_t dest_af = inet_naddr_get(&sroute->dest, NULL, NULL,
     110                    &dest_bits);
     111               
     112                /* Skip comparison with different address family */
     113                if (addr_af != dest_af)
    117114                        continue;
    118115               
     
    121118                        continue;
    122119               
    123                 uint32_t mask = inet_netmask(dest_bits);
    124                 if ((dest_addr & mask) == (addr_addr & mask)) {
     120                if (inet_naddr_compare_mask(&sroute->dest, addr)) {
    125121                        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: found candidate %p",
    126122                            sroute);
Note: See TracChangeset for help on using the changeset viewer.