Changeset 98abd40 in mainline for uspace/srv/net/inetsrv/addrobj.c


Ignore:
Timestamp:
2013-07-06T21:57:22Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c8bb1633, cdc8a391
Parents:
b8e72fd1 (diff), 507c6f3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    rb8e72fd1 r98abd40  
    4242#include <stdlib.h>
    4343#include <str.h>
    44 
    4544#include "addrobj.h"
    4645#include "inetsrv.h"
    4746#include "inet_link.h"
    48 #include "inet_util.h"
    4947
    5048static inet_addrobj_t *inet_addrobj_find_by_name_locked(const char *, inet_link_t *);
     
    106104/** Find address object matching address @a addr.
    107105 *
    108  * @param addr  Address
    109  * @oaram find  iaf_net to find network (using mask),
    110  *              iaf_addr to find local address (exact match)
     106 * @param addr Address
     107 * @oaram find iaf_net to find network (using mask),
     108 *             iaf_addr to find local address (exact match)
     109 *
    111110 */
    112111inet_addrobj_t *inet_addrobj_find(inet_addr_t *addr, inet_addrobj_find_t find)
    113112{
    114         uint32_t mask;
    115 
    116         log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find(%x)", (unsigned)addr->ipv4);
    117 
    118         fibril_mutex_lock(&addr_list_lock);
    119 
     113        fibril_mutex_lock(&addr_list_lock);
     114       
    120115        list_foreach(addr_list, link) {
    121116                inet_addrobj_t *naddr = list_get_instance(link,
    122117                    inet_addrobj_t, addr_list);
    123 
    124                 mask = inet_netmask(naddr->naddr.bits);
    125                 if ((naddr->naddr.ipv4 & mask) == (addr->ipv4 & mask)) {
     118               
     119                if (inet_naddr_compare_mask(&naddr->naddr, addr)) {
    126120                        fibril_mutex_unlock(&addr_list_lock);
    127121                        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p",
     
    130124                }
    131125        }
    132 
     126       
    133127        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: Not found");
    134128        fibril_mutex_unlock(&addr_list_lock);
    135 
     129       
    136130        return NULL;
    137131}
     
    218212{
    219213        inet_addr_t lsrc_addr;
    220         inet_addr_t *ldest_addr;
    221 
    222         lsrc_addr.ipv4 = addr->naddr.ipv4;
    223         ldest_addr = ldest;
    224 
    225         return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest_addr, dgram,
     214        inet_naddr_addr(&addr->naddr, &lsrc_addr);
     215       
     216        return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest, dgram,
    226217            proto, ttl, df);
    227218}
Note: See TracChangeset for help on using the changeset viewer.