Changeset 03c971f in mainline for uspace/srv/net/udp/assoc.c


Ignore:
Timestamp:
2013-08-15T14:20:16Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb2a5b2
Parents:
f2c19b0 (diff), 2921602 (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:

Mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/udp/assoc.c

    rf2c19b0 r03c971f  
    8282        if (lsock != NULL)
    8383                assoc->ident.local = *lsock;
     84       
    8485        if (fsock != NULL)
    8586                assoc->ident.foreign = *fsock;
     
    251252                sp.foreign = *fsock;
    252253
    253         if (sp.foreign.addr.ipv4 == 0 || sp.foreign.port == 0)
     254        if ((inet_addr_is_any(&sp.foreign.addr)) ||
     255            (sp.foreign.port == UDP_PORT_ANY))
    254256                return EINVAL;
    255257
     
    370372static bool udp_socket_match(udp_sock_t *sock, udp_sock_t *patt)
    371373{
    372         log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_socket_match(sock=(%x,%u), pat=(%x,%u))",
    373             sock->addr.ipv4, sock->port, patt->addr.ipv4, patt->port);
    374 
    375         if (patt->addr.ipv4 != UDP_IPV4_ANY &&
    376             patt->addr.ipv4 != sock->addr.ipv4)
     374        log_msg(LOG_DEFAULT, LVL_DEBUG,
     375            "udp_socket_match(sock=(%u), pat=(%u))", sock->port, patt->port);
     376       
     377        if ((!inet_addr_is_any(&patt->addr)) &&
     378            (!inet_addr_compare(&patt->addr, &sock->addr)))
    377379                return false;
    378 
    379         if (patt->port != UDP_PORT_ANY &&
    380             patt->port != sock->port)
     380       
     381        if ((patt->port != UDP_PORT_ANY) &&
     382            (patt->port != sock->port))
    381383                return false;
    382 
     384       
    383385        log_msg(LOG_DEFAULT, LVL_DEBUG, " -> match");
    384 
     386       
    385387        return true;
    386388}
     
    414416{
    415417        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_find_ref(%p)", sp);
    416 
     418       
    417419        fibril_mutex_lock(&assoc_list_lock);
    418 
     420       
    419421        list_foreach(assoc_list, link) {
    420422                udp_assoc_t *assoc = list_get_instance(link, udp_assoc_t, link);
    421423                udp_sockpair_t *asp = &assoc->ident;
    422                 log_msg(LOG_DEFAULT, LVL_DEBUG, "compare with assoc (f:(%x,%u), l:(%x,%u))",
    423                     asp->foreign.addr.ipv4, asp->foreign.port,
    424                     asp->local.addr.ipv4, asp->local.port);
    425 
     424               
    426425                /* Skip unbound associations */
    427426                if (asp->local.port == UDP_PORT_ANY)
    428427                        continue;
    429 
     428               
    430429                if (udp_sockpair_match(sp, asp)) {
    431430                        log_msg(LOG_DEFAULT, LVL_DEBUG, "Returning assoc %p", assoc);
     
    435434                }
    436435        }
    437 
     436       
    438437        fibril_mutex_unlock(&assoc_list_lock);
    439438        return NULL;
Note: See TracChangeset for help on using the changeset viewer.