Changes in / [eef14771:69483af] in mainline


Ignore:
Files:
19 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    reef14771 r69483af  
    112112        $(USPACE_PATH)/srv/hid/remcons/remcons \
    113113        $(USPACE_PATH)/srv/hid/isdv4_tablet/isdv4_tablet \
    114         $(USPACE_PATH)/srv/net/dnsrsrv/dnsrsrv \
    115114        $(USPACE_PATH)/srv/net/ethip/ethip \
    116115        $(USPACE_PATH)/srv/net/inetsrv/inetsrv \
     
    166165        $(USPACE_PATH)/app/dltest2/dltest2 \
    167166        $(USPACE_PATH)/app/dload/dload \
    168         $(USPACE_PATH)/app/dnscfg/dnscfg \
    169         $(USPACE_PATH)/app/dnsres/dnsres \
    170167        $(USPACE_PATH)/app/edit/edit \
    171168        $(USPACE_PATH)/app/inet/inet \
  • uspace/Makefile

    reef14771 r69483af  
    3939        app/bnchmark \
    4040        app/devctl \
    41         app/dnscfg \
    42         app/dnsres \
    4341        app/edit \
    4442        app/getterm \
     
    8482        srv/devman \
    8583        srv/loader \
    86         srv/net/dnsrsrv \
    8784        srv/net/ethip \
    8885        srv/net/inetsrv \
  • uspace/app/inet/inet.c

    reef14771 r69483af  
    11/*
    2  * Copyright (c) 2013 Jiri Svoboda
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636
    3737#include <errno.h>
    38 #include <inet/addr.h>
    3938#include <inet/inetcfg.h>
    4039#include <loc.h>
     
    5554}
    5655
     56static int naddr_parse(const char *text, inet_naddr_t *naddr)
     57{
     58        unsigned long a[4], bits;
     59        char *cp = (char *)text;
     60        int i;
     61
     62        for (i = 0; i < 3; i++) {
     63                a[i] = strtoul(cp, &cp, 10);
     64                if (*cp != '.')
     65                        return EINVAL;
     66                ++cp;
     67        }
     68
     69        a[3] = strtoul(cp, &cp, 10);
     70        if (*cp != '/')
     71                return EINVAL;
     72        ++cp;
     73
     74        bits = strtoul(cp, &cp, 10);
     75        if (*cp != '\0')
     76                return EINVAL;
     77
     78        naddr->ipv4 = 0;
     79        for (i = 0; i < 4; i++) {
     80                if (a[i] > 255)
     81                        return EINVAL;
     82                naddr->ipv4 = (naddr->ipv4 << 8) | a[i];
     83        }
     84
     85        if (bits > 31)
     86                return EINVAL;
     87
     88        naddr->bits = bits;
     89        return EOK;
     90}
     91
     92static int addr_parse(const char *text, inet_addr_t *addr)
     93{
     94        unsigned long a[4];
     95        char *cp = (char *)text;
     96        int i;
     97
     98        for (i = 0; i < 3; i++) {
     99                a[i] = strtoul(cp, &cp, 10);
     100                if (*cp != '.')
     101                        return EINVAL;
     102                ++cp;
     103        }
     104
     105        a[3] = strtoul(cp, &cp, 10);
     106        if (*cp != '\0')
     107                return EINVAL;
     108
     109        addr->ipv4 = 0;
     110        for (i = 0; i < 4; i++) {
     111                if (a[i] > 255)
     112                        return EINVAL;
     113                addr->ipv4 = (addr->ipv4 << 8) | a[i];
     114        }
     115
     116        return EOK;
     117}
     118
     119static int naddr_format(inet_naddr_t *naddr, char **bufp)
     120{
     121        int rc;
     122
     123        rc = asprintf(bufp, "%d.%d.%d.%d/%d", naddr->ipv4 >> 24,
     124            (naddr->ipv4 >> 16) & 0xff, (naddr->ipv4 >> 8) & 0xff,
     125            naddr->ipv4 & 0xff, naddr->bits);
     126
     127        if (rc < 0)
     128                return ENOMEM;
     129
     130        return EOK;
     131}
     132
     133static int addr_format(inet_addr_t *addr, char **bufp)
     134{
     135        int rc;
     136
     137        rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
     138            (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
     139            addr->ipv4 & 0xff);
     140
     141        if (rc < 0)
     142                return ENOMEM;
     143
     144        return EOK;
     145}
     146
    57147static int addr_create_static(int argc, char *argv[])
    58148{
     
    88178        }
    89179
    90         rc = inet_naddr_parse(addr_spec, &naddr);
     180        rc = naddr_parse(addr_spec, &naddr);
    91181        if (rc != EOK) {
    92182                printf(NAME ": Invalid network address format '%s'.\n",
     
    177267        route_name = argv[2];
    178268
    179         rc = inet_naddr_parse(dest_str, &dest);
     269        rc = naddr_parse(dest_str, &dest);
    180270        if (rc != EOK) {
    181271                printf(NAME ": Invalid network address format '%s'.\n",
     
    184274        }
    185275
    186         rc = inet_addr_parse(router_str, &router);
     276        rc = addr_parse(router_str, &router);
    187277        if (rc != EOK) {
    188278                printf(NAME ": Invalid address format '%s'.\n", router_str);
     
    276366                }
    277367
    278                 rc = inet_naddr_format(&ainfo.naddr, &astr);
     368                rc = naddr_format(&ainfo.naddr, &astr);
    279369                if (rc != EOK) {
    280370                        printf("Memory allocation failed.\n");
     
    340430                }
    341431
    342                 rc = inet_naddr_format(&srinfo.dest, &dest_str);
     432                rc = naddr_format(&srinfo.dest, &dest_str);
    343433                if (rc != EOK) {
    344434                        printf("Memory allocation failed.\n");
     
    347437                }
    348438
    349                 rc = inet_addr_format(&srinfo.router, &router_str);
     439                rc = addr_format(&srinfo.router, &router_str);
    350440                if (rc != EOK) {
    351441                        printf("Memory allocation failed.\n");
  • uspace/app/init/init.c

    reef14771 r69483af  
    359359        srv_start("/srv/tcp");
    360360        srv_start("/srv/udp");
    361         srv_start("/srv/dnsrsrv");
    362361       
    363362        srv_start("/srv/clipboard");
  • uspace/app/nettest1/nettest1.c

    reef14771 r69483af  
    4646#include <arg_parse.h>
    4747
    48 #include <inet/dnsr.h>
    4948#include <net/in.h>
    5049#include <net/in6.h>
     
    7675        printf(
    7776            "Network Networking test 1 aplication - sockets\n"
    78             "Usage: nettest1 [options] host\n"
     77            "Usage: echo [options] numeric_address\n"
    7978            "Where options are:\n"
    8079            "-f protocol_family | --family=protocol_family\n"
     
    291290        struct sockaddr_in address_in;
    292291        struct sockaddr_in6 address_in6;
    293         dnsr_hostinfo_t *hinfo;
    294292        uint8_t *address_start;
    295293
     
    321319        }
    322320
    323         /* If not before the last argument containing the host */
     321        /* If not before the last argument containing the address */
    324322        if (index >= argc) {
    325                 printf("Command line error: missing host name\n");
     323                printf("Command line error: missing address\n");
    326324                nettest1_print_help();
    327325                return EINVAL;
     
    350348        }
    351349
    352         /* Parse the last argument which should contain the host/address */
     350        /* Parse the last argument which should contain the address */
    353351        rc = inet_pton(family, argv[argc - 1], address_start);
    354352        if (rc != EOK) {
    355                 /* Try interpreting as a host name */
    356                 rc = dnsr_name2host(argv[argc - 1], &hinfo);
    357                 if (rc != EOK) {
    358                         printf("Error resolving host '%s'.\n", argv[argc - 1]);
    359                         return rc;
    360                 }
    361 
    362                 address_in.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4);
     353                fprintf(stderr, "Address parse error %d\n", rc);
     354                return rc;
    363355        }
    364356
  • uspace/app/nettest2/nettest2.c

    reef14771 r69483af  
    4747#include <stdbool.h>
    4848
    49 #include <inet/dnsr.h>
    5049#include <net/in.h>
    5150#include <net/in6.h>
     
    7271        printf(
    7372            "Network Networking test 2 aplication - UDP transfer\n"
    74             "Usage: nettest2 [options] host\n"
     73            "Usage: echo [options] address\n"
    7574            "Where options are:\n"
    7675            "-f protocol_family | --family=protocol_family\n"
     
    228227        struct sockaddr_in address_in;
    229228        struct sockaddr_in6 address_in6;
    230         dnsr_hostinfo_t *hinfo;
    231229        socklen_t addrlen;
    232230        uint8_t *address_start;
     
    267265        }
    268266
    269         /* If not before the last argument containing the host */
     267        /* If not before the last argument containing the address */
    270268        if (index >= argc) {
    271                 printf("Command line error: missing host name\n");
     269                printf("Command line error: missing address\n");
    272270                nettest2_print_help();
    273271                return EINVAL;
     
    296294        }
    297295
    298         /* Parse the last argument which should contain the host/address */
     296        /* Parse the last argument which should contain the address. */
    299297        rc = inet_pton(family, argv[argc - 1], address_start);
    300298        if (rc != EOK) {
    301                 /* Try interpreting as a host name */
    302                 rc = dnsr_name2host(argv[argc - 1], &hinfo);
    303                 if (rc != EOK) {
    304                         printf("Error resolving host '%s'.\n", argv[argc - 1]);
    305                         return rc;
    306                 }
    307 
    308                 address_in.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4);
     299                fprintf(stderr, "Address parse error %d\n", rc);
     300                return rc;
    309301        }
    310302
  • uspace/app/nettest3/nettest3.c

    reef14771 r69483af  
    3939#include <str.h>
    4040
    41 #include <inet/dnsr.h>
    4241#include <net/in.h>
    4342#include <net/in6.h>
     
    6160        int fd;
    6261        char *endptr;
    63         dnsr_hostinfo_t *hinfo;
    6462
    6563        port = 7;
     
    7775                rc = inet_pton(AF_INET, argv[1], (uint8_t *)&addr.sin_addr.s_addr);
    7876                if (rc != EOK) {
    79                         /* Try interpreting as a host name */
    80                         rc = dnsr_name2host(argv[1], &hinfo);
    81                         if (rc != EOK) {
    82                                 printf("Error resolving host '%s'.\n", argv[1]);
    83                                 return rc;
    84                         }
    85 
    86                         addr.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4);
    87                         addr.sin_family = AF_INET;
     77                        fprintf(stderr, "Error parsing address\n");
     78                        return 1;
    8879                }
    8980                printf("result: rc=%d, family=%d, addr=%x\n", rc,
  • uspace/app/nterm/conn.c

    reef14771 r69483af  
    3333 */
    3434
    35 #include <byteorder.h>
    3635#include <stdbool.h>
    3736#include <errno.h>
    3837#include <fibril.h>
    39 #include <inet/dnsr.h>
    4038#include <net/socket.h>
    4139#include <stdio.h>
     
    7674{
    7775        struct sockaddr_in addr;
    78         dnsr_hostinfo_t *hinfo = NULL;
    7976        int rc;
    8077        char *endptr;
     
    8481        rc = inet_pton(addr.sin_family, addr_s, (uint8_t *)&addr.sin_addr);
    8582        if (rc != EOK) {
    86                 /* Try interpreting as a host name */
    87                 rc = dnsr_name2host(addr_s, &hinfo);
    88                 if (rc != EOK) {
    89                         printf("Error resolving host '%s'.\n", addr_s);
    90                         goto error;
    91                 }
    92 
    93                 addr.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4);
     83                printf("Invalid addres %s\n", addr_s);
     84                return EINVAL;
    9485        }
    9586
     
    9788        if (*endptr != '\0') {
    9889                printf("Invalid port number %s\n", port_s);
    99                 goto error;
     90                return EINVAL;
    10091        }
    10192
     
    10495                goto error;
    10596
    106         printf("Connecting to host %s port %u\n", addr_s, ntohs(addr.sin_port));
     97        printf("Connecting to address %s port %u\n", addr_s, ntohs(addr.sin_port));
    10798
    10899        rc = connect(conn_fd, (struct sockaddr *)&addr, sizeof(addr));
  • uspace/app/nterm/nterm.c

    reef14771 r69483af  
    104104static void print_syntax(void)
    105105{
    106         printf("syntax: nterm <host> <port>\n");
     106        printf("syntax: nterm <ip-address> <port>\n");
    107107}
    108108
  • uspace/app/ping/ping.c

    reef14771 r69483af  
    11/*
    2  * Copyright (c) 2013 Jiri Svoboda
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3737#include <errno.h>
    3838#include <fibril_synch.h>
    39 #include <inet/dnsr.h>
    40 #include <inet/addr.h>
    4139#include <inet/inetping.h>
    4240#include <io/console.h>
     
    7068static void print_syntax(void)
    7169{
    72         printf("syntax: " NAME " [-r] <host>\n");
     70        printf("syntax: " NAME " [-r] <addr>\n");
     71}
     72
     73static int addr_parse(const char *text, inet_addr_t *addr)
     74{
     75        unsigned long a[4];
     76        char *cp = (char *)text;
     77        int i;
     78
     79        for (i = 0; i < 3; i++) {
     80                a[i] = strtoul(cp, &cp, 10);
     81                if (*cp != '.')
     82                        return EINVAL;
     83                ++cp;
     84        }
     85
     86        a[3] = strtoul(cp, &cp, 10);
     87        if (*cp != '\0')
     88                return EINVAL;
     89
     90        addr->ipv4 = 0;
     91        for (i = 0; i < 4; i++) {
     92                if (a[i] > 255)
     93                        return EINVAL;
     94                addr->ipv4 = (addr->ipv4 << 8) | a[i];
     95        }
     96
     97        return EOK;
     98}
     99
     100static int addr_format(inet_addr_t *addr, char **bufp)
     101{
     102        int rc;
     103
     104        rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
     105            (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
     106            addr->ipv4 & 0xff);
     107
     108        if (rc < 0)
     109                return ENOMEM;
     110
     111        return EOK;
    73112}
    74113
     
    86125        int rc;
    87126
    88         rc = inet_addr_format(&sdu->src, &asrc);
     127        rc = addr_format(&sdu->src, &asrc);
    89128        if (rc != EOK)
    90129                return ENOMEM;
    91130
    92         rc = inet_addr_format(&sdu->dest, &adest);
     131        rc = addr_format(&sdu->dest, &adest);
    93132        if (rc != EOK) {
    94133                free(asrc);
     
    174213int main(int argc, char *argv[])
    175214{
    176         dnsr_hostinfo_t *hinfo = NULL;
    177         char *asrc = NULL;
    178         char *adest = NULL;
    179         char *sdest = NULL;
    180215        int rc;
    181216        int argi;
     
    185220                printf(NAME ": Failed connecting to internet ping service "
    186221                    "(%d).\n", rc);
    187                 goto error;
     222                return 1;
    188223        }
    189224
     
    198233        if (argc - argi != 1) {
    199234                print_syntax();
    200                 goto error;
     235                return 1;
    201236        }
    202237
    203238        /* Parse destination address */
    204         rc = inet_addr_parse(argv[argi], &dest_addr);
    205         if (rc != EOK) {
    206                 /* Try interpreting as a host name */
    207                 rc = dnsr_name2host(argv[argi], &hinfo);
    208                 if (rc != EOK) {
    209                         printf(NAME ": Error resolving host '%s'.\n", argv[argi]);
    210                         goto error;
    211                 }
    212 
    213                 dest_addr = hinfo->addr;
     239        rc = addr_parse(argv[argi], &dest_addr);
     240        if (rc != EOK) {
     241                printf(NAME ": Invalid address format.\n");
     242                print_syntax();
     243                return 1;
    214244        }
    215245
     
    218248        if (rc != EOK) {
    219249                printf(NAME ": Failed determining source address.\n");
    220                 goto error;
    221         }
    222 
    223         rc = inet_addr_format(&src_addr, &asrc);
    224         if (rc != EOK) {
    225                 printf(NAME ": Out of memory.\n");
    226                 goto error;
    227         }
    228 
    229         rc = inet_addr_format(&dest_addr, &adest);
    230         if (rc != EOK) {
    231                 printf(NAME ": Out of memory.\n");
    232                 goto error;
    233         }
    234 
    235         if (hinfo != NULL) {
    236                 rc = asprintf(&sdest, "%s (%s)", hinfo->name, adest);
    237                 if (rc < 0) {
    238                         printf(NAME ": Out of memory.\n");
    239                         goto error;
    240                 }
    241         } else {
    242                 sdest = adest;
    243                 adest = NULL;
    244         }
    245 
    246         printf("Sending ICMP echo request from %s to %s.\n",
    247             asrc, sdest);
     250                return 1;
     251        }
    248252
    249253        fid_t fid;
     
    253257                if (fid == 0) {
    254258                        printf(NAME ": Failed creating transmit fibril.\n");
    255                         goto error;
     259                        return 1;
    256260                }
    257261
     
    261265                if (fid == 0) {
    262266                        printf(NAME ": Failed creating input fibril.\n");
    263                         goto error;
     267                        return 1;
    264268                }
    265269
     
    279283        if (rc == ETIMEOUT) {
    280284                printf(NAME ": Echo request timed out.\n");
    281                 goto error;
    282         }
    283 
    284         free(asrc);
    285         free(adest);
    286         free(sdest);
    287         dnsr_hostinfo_destroy(hinfo);
     285                return 1;
     286        }
     287
    288288        return 0;
    289 error:
    290         free(asrc);
    291         free(adest);
    292         free(sdest);
    293         dnsr_hostinfo_destroy(hinfo);
    294         return 1;
    295289}
    296290
  • uspace/lib/c/Makefile

    reef14771 r69483af  
    7474        generic/device/pci.c \
    7575        generic/device/ahci.c \
    76         generic/dnsr.c \
    7776        generic/dlfcn.c \
    7877        generic/elf/elf_load.c \
     
    9291        generic/task.c \
    9392        generic/futex.c \
    94         generic/inet/addr.c \
    9593        generic/inet.c \
    9694        generic/inetcfg.c \
  • uspace/lib/c/include/inet/inet.h

    reef14771 r69483af  
    3636#define LIBC_INET_INET_H_
    3737
    38 #include <inet/addr.h>
    3938#include <sys/types.h>
    4039
    4140#define INET_TTL_MAX 255
     41
     42typedef struct {
     43        uint32_t ipv4;
     44} inet_addr_t;
    4245
    4346typedef struct {
  • uspace/lib/c/include/inet/inetcfg.h

    reef14771 r69483af  
    3838#include <inet/inet.h>
    3939#include <sys/types.h>
     40
     41/** Network address */
     42typedef struct {
     43        /** Address */
     44        uint32_t ipv4;
     45        /** Number of valid bits in @c ipv4 */
     46        int bits;
     47} inet_naddr_t;
    4048
    4149/** Address object info */
  • uspace/lib/c/include/ipc/services.h

    reef14771 r69483af  
    5353} services_t;
    5454
    55 #define SERVICE_NAME_DNSR     "net/dnsr"
    5655#define SERVICE_NAME_INET     "net/inet"
    5756#define SERVICE_NAME_INETCFG  "net/inetcfg"
  • uspace/srv/net/inetsrv/addrobj.c

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

    reef14771 r69483af  
    9898        }
    9999       
    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 = (192 << 24) | (168 << 16) | (0 << 8) | 1;
    109         sroute->name = str_dup("default");
    110         inet_sroute_add(sroute);
    111 
    112         rc = inet_link_discovery_start();
     100        rc = inet_link_discovery_start();
    113101        if (rc != EOK)
    114102                return EEXIST;
  • uspace/srv/net/inetsrv/inetsrv.h

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

    reef14771 r69483af  
    279279
    280280        fibril_mutex_lock(&assoc->lock);
    281         while (list_empty(&assoc->rcv_queue) && !assoc->reset) {
     281        while (list_empty(&assoc->rcv_queue)) {
    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;
    290284        }
    291285
     
    329323}
    330324
    331 /** Reset association.
    332  *
    333  * This causes any pendingreceive operations to return immediately with
    334  * UDP_ERESET.
    335  */
    336 void 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 
    344325static int udp_assoc_queue_msg(udp_assoc_t *assoc, udp_sockpair_t *sp,
    345326    udp_msg_t *msg)
  • uspace/srv/net/udp/assoc.h

    reef14771 r69483af  
    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 extern void udp_assoc_reset(udp_assoc_t *);
     53
    5454
    5555#endif
  • uspace/srv/net/udp/sock.c

    reef14771 r69483af  
    537537        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close()");
    538538        int socket_id = SOCKET_GET_SOCKET_ID(call);
    539 
    540         log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - find core");
     539       
    541540        socket_core_t *sock_core =
    542541            socket_cores_find(&client->sockets, socket_id);
    543542        if (sock_core == NULL) {
    544         log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - core not found");
    545543                async_answer_0(callid, ENOTSOCK);
    546544                return;
    547545        }
    548 
    549         log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - spec data");
     546       
    550547        udp_sockdata_t *socket =
    551548            (udp_sockdata_t *) sock_core->specific_data;
    552         log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close() - lock socket");
    553549        fibril_mutex_lock(&socket->lock);
    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 
     550       
    563551        int rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock,
    564552            udp_free_sock_data);
    565553        if (rc != EOK) {
    566                 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - socket_destroy failed");
    567554                fibril_mutex_unlock(&socket->lock);
    568555                async_answer_0(callid, rc);
    569556                return;
    570557        }
    571 
    572         log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - broadcast recv_buffer_cv");
    573         fibril_condvar_broadcast(&socket->recv_buffer_cv);
    574 
     558       
    575559        fibril_mutex_unlock(&socket->lock);
    576560        async_answer_0(callid, EOK);
     
    598582        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril()");
    599583
    600         fibril_mutex_lock(&sock->recv_buffer_lock);
    601 
    602584        while (true) {
    603585                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] wait for rcv buffer empty()");
    604                 while (sock->recv_buffer_used != 0 && sock->sock_core != NULL) {
     586                fibril_mutex_lock(&sock->recv_buffer_lock);
     587                while (sock->recv_buffer_used != 0) {
    605588                        fibril_condvar_wait(&sock->recv_buffer_cv,
    606589                            &sock->recv_buffer_lock);
    607590                }
    608 
    609                 fibril_mutex_unlock(&sock->recv_buffer_lock);
    610 
     591               
    611592                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] call udp_uc_receive()");
    612593                urc = udp_uc_receive(sock->assoc, sock->recv_buffer,
    613594                    UDP_FRAGMENT_SIZE, &rcvd, &xflags, &sock->recv_fsock);
    614                 fibril_mutex_lock(&sock->recv_buffer_lock);
    615595                sock->recv_error = urc;
    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 
     596               
     597                udp_sock_notify_data(sock->sock_core);
     598               
    622599                if (urc != UDP_EOK) {
    623                         log_msg(LOG_DEFAULT, LVL_DEBUG, "[] urc != UDP_EOK, break");
    624600                        fibril_condvar_broadcast(&sock->recv_buffer_cv);
    625                         break;
    626                 }
    627 
     601                        fibril_mutex_unlock(&sock->recv_buffer_lock);
     602                        break;
     603                }
     604               
    628605                log_msg(LOG_DEFAULT, LVL_DEBUG, "[] got data - broadcast recv_buffer_cv");
    629 
     606               
    630607                sock->recv_buffer_used = rcvd;
     608                fibril_mutex_unlock(&sock->recv_buffer_lock);
    631609                fibril_condvar_broadcast(&sock->recv_buffer_cv);
    632610        }
    633611
    634         log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() exited loop");
    635         fibril_mutex_unlock(&sock->recv_buffer_lock);
    636612        udp_uc_destroy(sock->assoc);
    637 
    638         log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() terminated");
    639613
    640614        return 0;
  • uspace/srv/net/udp/ucall.c

    reef14771 r69483af  
    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);
    116115        switch (rc) {
    117         case EOK:
    118                 break;
    119         case ECONNABORTED:
    120                 return UDP_ERESET;
    121         default:
    122                 assert(false);
    123116        }
    124117
     
    140133{
    141134        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_uc_destroy()");
    142         udp_assoc_reset(assoc);
    143135        udp_assoc_remove(assoc);
    144136        udp_assoc_delete(assoc);
    145 }
    146 
    147 void udp_uc_reset(udp_assoc_t *assoc)
    148 {
    149         udp_assoc_reset(assoc);
    150137}
    151138
  • uspace/srv/net/udp/ucall.h

    reef14771 r69483af  
    4949extern void udp_uc_status(udp_assoc_t *, udp_assoc_status_t *);
    5050extern void udp_uc_destroy(udp_assoc_t *);
    51 extern void udp_uc_reset(udp_assoc_t *);
    5251
    5352#endif
  • uspace/srv/net/udp/udp_type.h

    reef14771 r69483af  
    5151        UDP_EUNSPEC,
    5252        /* No route to destination */
    53         UDP_ENOROUTE,
    54         /** Association reset by user */
    55         UDP_ERESET
     53        UDP_ENOROUTE
    5654} udp_error_t;
    5755
     
    121119        udp_sockpair_t ident;
    122120
    123         /** True if association was reset by user */
    124         bool reset;
    125 
    126121        /** True if association was deleted by user */
    127122        bool deleted;
Note: See TracChangeset for help on using the changeset viewer.