Changeset 192565b in mainline for uspace/srv/net


Ignore:
Timestamp:
2013-05-27T13:18:13Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f2c19b0
Parents:
d120133 (diff), c90aed4 (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.

Location:
uspace/srv/net
Files:
9 added
11 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/dnsrsrv/query.h

    rd120133 r192565b  
    11/*
    2  * Copyright (c) 2008 Martin Decky
     2 * Copyright (c) 2013 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup genarch
     29/** @addtogroup dnsres
    3030 * @{
    3131 */
    32 /** @file
     32/**
     33 * @file
    3334 */
    3435
    35 #ifndef KERN_LOGO_196X66_H_
    36 #define KERN_LOGO_196X66_H_
     36#ifndef QUERY_H
     37#define QUERY_H
    3738
    38 #define LOGO_WIDTH   196
    39 #define LOGO_HEIGHT  66
    40 #define LOGO_COLOR   0xffffff
     39#include "dns_type.h"
    4140
    42 #include <typedefs.h>
    43 
    44 extern uint32_t fb_logo[LOGO_WIDTH * LOGO_HEIGHT];
     41extern int dns_name2host(const char *, dns_host_info_t **);
     42extern void dns_hostinfo_destroy(dns_host_info_t *);
    4543
    4644#endif
  • uspace/srv/net/ethip/ethip.c

    rd120133 r192565b  
    221221        case ETYPE_IP:
    222222                log_msg(LOG_DEFAULT, LVL_DEBUG, " - construct SDU");
    223                 sdu.lsrc.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 1;
    224                 sdu.ldest.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 4;
     223                sdu.lsrc.ipv4 = 0;
     224                sdu.ldest.ipv4 = 0;
    225225                sdu.data = frame.data;
    226226                sdu.size = frame.size;
  • uspace/srv/net/inetsrv/addrobj.c

    rd120133 r192565b  
    221221
    222222        lsrc_addr.ipv4 = addr->naddr.ipv4;
    223         ldest_addr = &dgram->dest;
     223        ldest_addr = ldest;
    224224
    225225        return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest_addr, dgram,
  • uspace/srv/net/inetsrv/inet_link.c

    rd120133 r192565b  
    196196
    197197        static int first = 1;
    198         /* XXX For testing: set static IP address 192.168.0.4/24 */
     198        /* XXX For testing: set static IP address 10.0.2.15/24 */
    199199        addr = inet_addrobj_new();
    200200        if (first) {
     
    202202                first = 0;
    203203        } else {
    204                 addr->naddr.ipv4 = (192 << 24) + (168 << 16) + (0 << 8) + 4;
     204                addr->naddr.ipv4 = (10 << 24) + (0 << 16) + (2 << 8) + 15;
    205205        }
    206206        addr->naddr.bits = 24;
  • uspace/srv/net/inetsrv/inetsrv.c

    rd120133 r192565b  
    9898        }
    9999       
    100         rc = inet_link_discovery_start();
     100        inet_sroute_t *sroute = inet_sroute_new();
     101        if (sroute == NULL) {
     102                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating default route (%d).", rc);
     103                return ENOMEM;
     104        }
     105
     106        sroute->dest.ipv4 = 0;
     107        sroute->dest.bits = 0;
     108        sroute->router.ipv4 = (10 << 24) | (0 << 16) | (2 << 8) | 2;
     109        sroute->name = str_dup("default");
     110        inet_sroute_add(sroute);
     111
     112        rc = inet_link_discovery_start();
    101113        if (rc != EOK)
    102114                return EEXIST;
  • uspace/srv/net/inetsrv/inetsrv.h

    rd120133 r192565b  
    4040#include <adt/list.h>
    4141#include <stdbool.h>
     42#include <inet/addr.h>
    4243#include <inet/iplink.h>
    4344#include <ipc/loc.h>
     
    6162        link_t client_list;
    6263} inetping_client_t;
    63 
    64 /** Host address */
    65 typedef struct {
    66         uint32_t ipv4;
    67 } inet_addr_t;
    68 
    69 /** Network address */
    70 typedef struct {
    71         /** Address */
    72         uint32_t ipv4;
    73         /** Number of valid bits in @c ipv4 */
    74         int bits;
    75 } inet_naddr_t;
    7664
    7765/** Address object info */
  • uspace/srv/net/udp/assoc.c

    rd120133 r192565b  
    279279
    280280        fibril_mutex_lock(&assoc->lock);
    281         while (list_empty(&assoc->rcv_queue)) {
     281        while (list_empty(&assoc->rcv_queue) && !assoc->reset) {
    282282                log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - waiting");
    283283                fibril_condvar_wait(&assoc->rcv_queue_cv, &assoc->lock);
     284        }
     285
     286        if (assoc->reset) {
     287                log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - association was reset");
     288                fibril_mutex_unlock(&assoc->lock);
     289                return ECONNABORTED;
    284290        }
    285291
     
    323329}
    324330
     331/** Reset association.
     332 *
     333 * This causes any pendingreceive operations to return immediately with
     334 * UDP_ERESET.
     335 */
     336void udp_assoc_reset(udp_assoc_t *assoc)
     337{
     338        fibril_mutex_lock(&assoc->lock);
     339        assoc->reset = true;
     340        fibril_condvar_broadcast(&assoc->rcv_queue_cv);
     341        fibril_mutex_unlock(&assoc->lock);
     342}
     343
    325344static int udp_assoc_queue_msg(udp_assoc_t *assoc, udp_sockpair_t *sp,
    326345    udp_msg_t *msg)
  • uspace/srv/net/udp/assoc.h

    rd120133 r192565b  
    5151extern int udp_assoc_recv(udp_assoc_t *, udp_msg_t **, udp_sock_t *);
    5252extern void udp_assoc_received(udp_sockpair_t *, udp_msg_t *);
    53 
     53extern void udp_assoc_reset(udp_assoc_t *);
    5454
    5555#endif
  • uspace/srv/net/udp/sock.c

    rd120133 r192565b  
    537537        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close()");
    538538        int socket_id = SOCKET_GET_SOCKET_ID(call);
    539        
     539
     540        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - find core");
    540541        socket_core_t *sock_core =
    541542            socket_cores_find(&client->sockets, socket_id);
    542543        if (sock_core == NULL) {
     544        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - core not found");
    543545                async_answer_0(callid, ENOTSOCK);
    544546                return;
    545547        }
    546        
     548
     549        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - spec data");
    547550        udp_sockdata_t *socket =
    548551            (udp_sockdata_t *) sock_core->specific_data;
     552        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - lock socket");
    549553        fibril_mutex_lock(&socket->lock);
    550        
     554
     555        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - lock socket buffer");
     556        fibril_mutex_lock(&socket->recv_buffer_lock);
     557        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - set socket->sock_core = NULL");
     558        socket->sock_core = NULL;
     559        fibril_mutex_unlock(&socket->recv_buffer_lock);
     560
     561        udp_uc_reset(socket->assoc);
     562
    551563        int rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock,
    552564            udp_free_sock_data);
    553565        if (rc != EOK) {
     566                log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - socket_destroy failed");
    554567                fibril_mutex_unlock(&socket->lock);
    555568                async_answer_0(callid, rc);
    556569                return;
    557570        }
    558        
     571
     572        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - broadcast recv_buffer_cv");
     573        fibril_condvar_broadcast(&socket->recv_buffer_cv);
     574
    559575        fibril_mutex_unlock(&socket->lock);
    560576        async_answer_0(callid, EOK);
     
    582598        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril()");
    583599
     600        fibril_mutex_lock(&sock->recv_buffer_lock);
     601
    584602        while (true) {
    585603                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] wait for rcv buffer empty()");
    586                 fibril_mutex_lock(&sock->recv_buffer_lock);
    587                 while (sock->recv_buffer_used != 0) {
     604                while (sock->recv_buffer_used != 0 && sock->sock_core != NULL) {
    588605                        fibril_condvar_wait(&sock->recv_buffer_cv,
    589606                            &sock->recv_buffer_lock);
    590607                }
    591                
     608
     609                fibril_mutex_unlock(&sock->recv_buffer_lock);
     610
    592611                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] call udp_uc_receive()");
    593612                urc = udp_uc_receive(sock->assoc, sock->recv_buffer,
    594613                    UDP_FRAGMENT_SIZE, &rcvd, &xflags, &sock->recv_fsock);
     614                fibril_mutex_lock(&sock->recv_buffer_lock);
    595615                sock->recv_error = urc;
    596                
    597                 udp_sock_notify_data(sock->sock_core);
    598                
     616
     617                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] udp_uc_receive -> %d", urc);
     618
     619                if (sock->sock_core != NULL)
     620                        udp_sock_notify_data(sock->sock_core);
     621
    599622                if (urc != UDP_EOK) {
     623                        log_msg(LOG_DEFAULT, LVL_DEBUG, "[] urc != UDP_EOK, break");
    600624                        fibril_condvar_broadcast(&sock->recv_buffer_cv);
    601                         fibril_mutex_unlock(&sock->recv_buffer_lock);
    602                         break;
    603                 }
    604                
     625                        break;
     626                }
     627
    605628                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] got data - broadcast recv_buffer_cv");
    606                
     629
    607630                sock->recv_buffer_used = rcvd;
    608                 fibril_mutex_unlock(&sock->recv_buffer_lock);
    609631                fibril_condvar_broadcast(&sock->recv_buffer_cv);
    610632        }
    611633
     634        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() exited loop");
     635        fibril_mutex_unlock(&sock->recv_buffer_lock);
    612636        udp_uc_destroy(sock->assoc);
     637
     638        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() terminated");
    613639
    614640        return 0;
  • uspace/srv/net/udp/ucall.c

    rd120133 r192565b  
    113113        log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_uc_receive()", assoc->name);
    114114        rc = udp_assoc_recv(assoc, &msg, fsock);
     115        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv -> %d", rc);
    115116        switch (rc) {
     117        case EOK:
     118                break;
     119        case ECONNABORTED:
     120                return UDP_ERESET;
     121        default:
     122                assert(false);
    116123        }
    117124
     
    133140{
    134141        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_uc_destroy()");
     142        udp_assoc_reset(assoc);
    135143        udp_assoc_remove(assoc);
    136144        udp_assoc_delete(assoc);
     145}
     146
     147void udp_uc_reset(udp_assoc_t *assoc)
     148{
     149        udp_assoc_reset(assoc);
    137150}
    138151
  • uspace/srv/net/udp/ucall.h

    rd120133 r192565b  
    4949extern void udp_uc_status(udp_assoc_t *, udp_assoc_status_t *);
    5050extern void udp_uc_destroy(udp_assoc_t *);
     51extern void udp_uc_reset(udp_assoc_t *);
    5152
    5253#endif
  • uspace/srv/net/udp/udp_type.h

    rd120133 r192565b  
    5151        UDP_EUNSPEC,
    5252        /* No route to destination */
    53         UDP_ENOROUTE
     53        UDP_ENOROUTE,
     54        /** Association reset by user */
     55        UDP_ERESET
    5456} udp_error_t;
    5557
     
    119121        udp_sockpair_t ident;
    120122
     123        /** True if association was reset by user */
     124        bool reset;
     125
    121126        /** True if association was deleted by user */
    122127        bool deleted;
Note: See TracChangeset for help on using the changeset viewer.