Changeset 4c14b88 in mainline for uspace/app


Ignore:
Timestamp:
2013-12-31T07:57:14Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b973dc
Parents:
6297465 (diff), 208b5f5 (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

Location:
uspace/app
Files:
20 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/dnsres/dnsres.c

    r6297465 r4c14b88  
    3636#include <inet/addr.h>
    3737#include <inet/dnsr.h>
    38 #include <net/socket_codes.h>
    3938#include <stdio.h>
    4039#include <stdlib.h>
     
    5453        }
    5554       
    56         uint16_t af;
     55        uint16_t ver;
    5756        char *hname;
    5857       
     
    6362                }
    6463               
    65                 af = AF_INET;
     64                ver = ip_v4;
    6665                hname = argv[2];
    6766        } else if (str_cmp(argv[1], "-6") == 0) {
     
    7170                }
    7271               
    73                 af = AF_INET6;
     72                ver = ip_v6;
    7473                hname = argv[2];
    7574        } else {
    76                 af = 0;
     75                ver = ip_any;
    7776                hname = argv[1];
    7877        }
    7978       
    8079        dnsr_hostinfo_t *hinfo;
    81         int rc = dnsr_name2host(hname, &hinfo, af);
     80        int rc = dnsr_name2host(hname, &hinfo, ver);
    8281        if (rc != EOK) {
    8382                printf("%s: Error resolving '%s'.\n", NAME, hname);
  • uspace/app/download/Makefile

    r6297465 r4c14b88  
    2929USPACE_PREFIX = ../..
    3030LIBS = $(LIBHTTP_PREFIX)/libhttp.a $(LIBURI_PREFIX)/liburi.a
    31 EXTRA_CFLAGS = -I$(LIBHTTP_PREFIX) -I$(LIBURI_PREFIX)
     31EXTRA_CFLAGS = -I$(LIBHTTP_PREFIX)/include -I$(LIBURI_PREFIX)
    3232DEFS = -DRELEASE=$(RELEASE)
    3333BINARY = download
  • uspace/app/download/main.c

    r6297465 r4c14b88  
    4747#include <net/socket.h>
    4848
    49 #include <http.h>
     49#include <http/http.h>
    5050#include <uri.h>
    5151
     
    132132                fprintf(stderr, "Failed creating request\n");
    133133                uri_destroy(uri);
    134                 free(server_path);
    135134                return 3;
    136135        }
    137136       
    138         http_header_t *header_host = http_header_create("Host", uri->host);
    139         if (header_host == NULL) {
    140                 fprintf(stderr, "Failed creating Host header\n");
    141                 uri_destroy(uri);
    142                 free(server_path);
    143                 return 3;
    144         }
    145         list_append(&header_host->link, &req->headers);
    146        
    147         http_header_t *header_ua = http_header_create("User-Agent", USER_AGENT);
    148         if (header_ua == NULL) {
    149                 fprintf(stderr, "Failed creating User-Agent header\n");
    150                 uri_destroy(uri);
    151                 free(server_path);
    152                 return 3;
    153         }
    154         list_append(&header_ua->link, &req->headers);
     137        int rc = http_headers_append(&req->headers, "Host", uri->host);
     138        if (rc != EOK) {
     139                fprintf(stderr, "Failed setting Host header: %s\n", str_error(rc));
     140                uri_destroy(uri);
     141                return rc;
     142        }
     143       
     144        rc = http_headers_append(&req->headers, "User-Agent", USER_AGENT);
     145        if (rc != EOK) {
     146                fprintf(stderr, "Failed creating User-Agent header: %s\n", str_error(rc));
     147                uri_destroy(uri);
     148                return rc;
     149        }
    155150       
    156151        http_t *http = http_create(uri->host, port);
    157152        if (http == NULL) {
    158153                uri_destroy(uri);
    159                 free(server_path);
    160154                fprintf(stderr, "Failed creating HTTP object\n");
    161155                return 3;
    162156        }
    163157       
    164         int rc = http_connect(http);
     158        rc = http_connect(http);
    165159        if (rc != EOK) {
    166160                fprintf(stderr, "Failed connecting: %s\n", str_error(rc));
    167161                uri_destroy(uri);
    168                 free(server_path);
    169162                return rc;
    170163        }
     
    174167                fprintf(stderr, "Failed sending request: %s\n", str_error(rc));
    175168                uri_destroy(uri);
    176                 free(server_path);
    177169                return rc;
    178170        }
    179171       
    180172        http_response_t *response = NULL;
    181         rc = http_receive_response(http, &response);
     173        rc = http_receive_response(&http->recv_buffer, &response, 16 * 1024,
     174            100);
    182175        if (rc != EOK) {
    183176                fprintf(stderr, "Failed receiving response: %s\n", str_error(rc));
    184177                uri_destroy(uri);
    185                 free(server_path);
    186178                return rc;
    187179        }
     
    197189                        fprintf(stderr, "Failed allocating buffer\n)");
    198190                        uri_destroy(uri);
    199                         free(server_path);
    200191                        return ENOMEM;
    201192                }
    202193               
    203194                int body_size;
    204                 while ((body_size = http_receive_body(http, buf, buf_size)) > 0) {
     195                while ((body_size = recv_buffer(&http->recv_buffer, buf, buf_size)) > 0) {
    205196                        fwrite(buf, 1, body_size, stdout);
    206197                }
     
    212203       
    213204        uri_destroy(uri);
    214         free(server_path);
    215205        return EOK;
    216206}
  • uspace/app/getterm/getterm.c

    r6297465 r4c14b88  
    112112        reopen(&stderr, 2, term, O_WRONLY, "w");
    113113       
    114         /*
    115          * FIXME: fdopen() should actually detect that we are opening a console
    116          * and it should set line-buffering mode automatically.
    117          */
    118         setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
    119        
    120114        if (stdin == NULL)
    121115                return -2;
     
    126120        if (stderr == NULL)
    127121                return -4;
     122       
     123        /*
     124         * FIXME: fdopen() should actually detect that we are opening a console
     125         * and it should set line-buffering mode automatically.
     126         */
     127        setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
    128128       
    129129        version_print(term);
  • uspace/app/init/init.c

    r6297465 r4c14b88  
    360360        srv_start("/srv/udp");
    361361        srv_start("/srv/dnsrsrv");
     362        srv_start("/srv/dhcp");
     363        srv_start("/srv/nconfsrv");
    362364       
    363365        srv_start("/srv/clipboard");
  • uspace/app/netspeed/netspeed.c

    r6297465 r4c14b88  
    3636 */
    3737
     38#include <assert.h>
     39#include <inet/dnsr.h>
     40#include <net/in.h>
     41#include <net/inet.h>
     42#include <net/socket.h>
    3843#include <stdio.h>
    3944#include <stdlib.h>
     
    4146#include <str_error.h>
    4247#include <task.h>
    43 
    44 #include <net/in.h>
    45 #include <net/inet.h>
    46 #include <net/socket.h>
    4748
    4849#define NAME "netspeed"
     
    114115}
    115116
    116 static int client(sock_type_t sock_type, const char *address, unsigned port,
     117static int client(sock_type_t sock_type, const char *host, unsigned port,
    117118    unsigned long count, char *buf, size_t bufsize)
    118119{
    119         struct sockaddr_in addr;
    120        
    121         addr.sin_family = AF_INET;
    122         addr.sin_port = htons(port);
    123        
    124         int rc = inet_pton(AF_INET, address, (void *) &addr.sin_addr.s_addr);
    125         if (rc != EOK) {
    126                 fprintf(stderr, "inet_pton failed: %s\n", str_error(rc));
    127                 return rc;
    128         }
    129        
    130         int conn_sd = socket(PF_INET, sock_type, 0);
     120        inet_addr_t iaddr;
     121        struct sockaddr *saddr;
     122        socklen_t saddrlen;
     123       
     124        int rc = inet_addr_parse(host, &iaddr);
     125        if (rc != EOK) {
     126                dnsr_hostinfo_t *hinfo = NULL;
     127                rc = dnsr_name2host(host, &hinfo, ip_any);
     128                if (rc != EOK) {
     129                        fprintf(stderr, "Error resolving host '%s'.\n", host);
     130                        return ENOENT;
     131                }
     132               
     133                iaddr = hinfo->addr;
     134        }
     135       
     136        rc = inet_addr_sockaddr(&iaddr, port, &saddr, &saddrlen);
     137        if (rc != EOK) {
     138                assert(rc == ENOMEM);
     139                fprintf(stderr, "Out of memory.\n");
     140                return ENOMEM;
     141        }
     142       
     143        int conn_sd = socket(saddr->sa_family, sock_type, 0);
    131144        if (conn_sd < 0) {
    132145                fprintf(stderr, "socket failed: %s\n", str_error(rc));
     
    135148       
    136149        if (sock_type == SOCK_STREAM) {
    137                 rc = connect(conn_sd, (struct sockaddr *) &addr, sizeof(addr));
     150                rc = connect(conn_sd, saddr, saddrlen);
    138151                if (rc != EOK) {
    139152                        fprintf(stderr, "connect failed: %s\n", str_error(rc));
     
    151164                        rc = send(conn_sd, buf, bufsize, 0);
    152165                } else {
    153                         rc = sendto(conn_sd, buf, bufsize, 0,
    154                             (struct sockaddr *) &addr, sizeof(addr));
     166                        rc = sendto(conn_sd, buf, bufsize, 0, saddr, saddrlen);
    155167                }
    156168                if (rc != EOK) {
     
    161173       
    162174        closesocket(conn_sd);
     175        free(saddr);
    163176        return rc;
    164177}
     
    167180{
    168181        fprintf(stderr, "Usage: netspeed <tcp|udp> server [port] <buffer size>\n");
    169         fprintf(stderr, "       netspeed <tcp|udp> client <ip> <port> <count> <buffer size>\n");
     182        fprintf(stderr, "       netspeed <tcp|udp> client <host> <port> <count> <buffer size>\n");
    170183}
    171184
  • uspace/app/nettest1/nettest1.c

    r6297465 r4c14b88  
    3838#include "print_error.h"
    3939
     40#include <assert.h>
    4041#include <malloc.h>
    4142#include <stdio.h>
     
    5960#define NETTEST1_TEXT  "Networking test 1 - sockets"
    6061
    61 static uint16_t family = AF_INET;
     62static uint16_t family = AF_NONE;
    6263static sock_type_t type = SOCK_DGRAM;
    6364static size_t size = 27;
     
    326327        }
    327328       
    328         char *addr_s = argv[argc - 1];
     329        char *host = argv[argc - 1];
    329330       
    330331        /* Interpret as address */
    331         inet_addr_t addr_addr;
    332         rc = inet_addr_parse(addr_s, &addr_addr);
     332        inet_addr_t iaddr;
     333        rc = inet_addr_parse(host, &iaddr);
    333334       
    334335        if (rc != EOK) {
    335336                /* Interpret as a host name */
    336337                dnsr_hostinfo_t *hinfo = NULL;
    337                 rc = dnsr_name2host(addr_s, &hinfo, family);
     338                rc = dnsr_name2host(host, &hinfo, ipver_from_af(family));
    338339               
    339340                if (rc != EOK) {
    340                         printf("Error resolving host '%s'.\n", addr_s);
     341                        printf("Error resolving host '%s'.\n", host);
    341342                        return EINVAL;
    342343                }
    343344               
    344                 addr_addr = hinfo->addr;
    345         }
    346        
    347         struct sockaddr_in addr;
    348         struct sockaddr_in6 addr6;
    349         uint16_t af = inet_addr_sockaddr_in(&addr_addr, &addr, &addr6);
    350        
    351         if (af != family) {
     345                iaddr = hinfo->addr;
     346        }
     347       
     348        rc = inet_addr_sockaddr(&iaddr, port, &address, &addrlen);
     349        if (rc != EOK) {
     350                assert(rc == ENOMEM);
     351                printf("Out of memory.\n");
     352                return ENOMEM;
     353        }
     354       
     355        if (family == AF_NONE)
     356                family = address->sa_family;
     357       
     358        if (address->sa_family != family) {
    352359                printf("Address family does not match explicitly set family.\n");
    353360                return EINVAL;
    354         }
    355        
    356         /* Prepare the address buffer */
    357        
    358         switch (af) {
    359         case AF_INET:
    360                 addr.sin_port = htons(port);
    361                 address = (struct sockaddr *) &addr;
    362                 addrlen = sizeof(addr);
    363                 break;
    364         case AF_INET6:
    365                 addr6.sin6_port = htons(port);
    366                 address = (struct sockaddr *) &addr6;
    367                 addrlen = sizeof(addr6);
    368                 break;
    369         default:
    370                 fprintf(stderr, "Address family is not supported\n");
    371                 return EAFNOSUPPORT;
    372361        }
    373362       
     
    434423            &time_before));
    435424       
     425        free(address);
     426       
    436427        if (verbose)
    437428                printf("Exiting\n");
  • uspace/app/nettest2/nettest2.c

    r6297465 r4c14b88  
    3838#include "print_error.h"
    3939
     40#include <assert.h>
    4041#include <malloc.h>
    4142#include <stdio.h>
     
    6061#define NETTEST2_TEXT  "Networking test 2 - transfer"
    6162
    62 static uint16_t family = PF_INET;
     63static uint16_t family = AF_NONE;
    6364static size_t size = 28;
    6465static bool verbose = false;
     
    271272                /* Interpret as a host name */
    272273                dnsr_hostinfo_t *hinfo = NULL;
    273                 rc = dnsr_name2host(addr_s, &hinfo, family);
     274                rc = dnsr_name2host(addr_s, &hinfo, ipver_from_af(family));
    274275               
    275276                if (rc != EOK) {
     
    281282        }
    282283       
    283         struct sockaddr_in addr;
    284         struct sockaddr_in6 addr6;
    285         uint16_t af = inet_addr_sockaddr_in(&addr_addr, &addr, &addr6);
    286        
    287         if (af != family) {
     284        struct sockaddr *address;
     285        socklen_t addrlen;
     286        rc = inet_addr_sockaddr(&addr_addr, port, &address, &addrlen);
     287        if (rc != EOK) {
     288                assert(rc == ENOMEM);
     289                printf("Out of memory.\n");
     290                return ENOMEM;
     291        }
     292       
     293        if (family == AF_NONE)
     294                family = address->sa_family;
     295       
     296        if (address->sa_family != family) {
    288297                printf("Address family does not match explicitly set family.\n");
    289298                return EINVAL;
    290         }
    291        
    292         /* Prepare the address buffer */
    293        
    294         struct sockaddr *address;
    295         socklen_t addrlen;
    296        
    297         switch (af) {
    298         case AF_INET:
    299                 addr.sin_port = htons(port);
    300                 address = (struct sockaddr *) &addr;
    301                 addrlen = sizeof(addr);
    302                 break;
    303         case AF_INET6:
    304                 addr6.sin6_port = htons(port);
    305                 address = (struct sockaddr *) &addr6;
    306                 addrlen = sizeof(addr6);
    307                 break;
    308         default:
    309                 fprintf(stderr, "Address family is not supported\n");
    310                 return EAFNOSUPPORT;
    311299        }
    312300       
     
    424412                return rc;
    425413       
     414        free(address);
     415       
    426416        if (verbose)
    427417                printf("\nExiting\n");
  • uspace/app/nettest3/nettest3.c

    r6297465 r4c14b88  
    3737#include <async.h>
    3838#include <stdio.h>
     39#include <stdlib.h>
    3940#include <str.h>
    4041
     
    5253static char buf[BUF_SIZE];
    5354
    54 static struct sockaddr_in addr;
     55static struct sockaddr *address;
     56static socklen_t addrlen;
    5557
    5658static uint16_t port;
     
    6264        char *endptr;
    6365        dnsr_hostinfo_t *hinfo;
     66        inet_addr_t addr;
     67        char *addr_s;
    6468
    6569        port = 7;
     
    6973
    7074        /* Connect to local IP address by default */
    71         addr.sin_family = AF_INET;
    72         addr.sin_port = htons(port);
    73         addr.sin_addr.s_addr = htonl(0x7f000001);
     75        inet_addr(&addr, 127, 0, 0, 1);
    7476
    7577        if (argc >= 2) {
    7678                printf("parsing address '%s'\n", argv[1]);
    77                 rc = inet_pton(AF_INET, argv[1], (uint8_t *)&addr.sin_addr.s_addr);
     79                rc = inet_addr_parse(argv[1], &addr);
    7880                if (rc != EOK) {
    7981                        /* Try interpreting as a host name */
    80                         rc = dnsr_name2host(argv[1], &hinfo, AF_INET);
     82                        rc = dnsr_name2host(argv[1], &hinfo, ip_v4);
    8183                        if (rc != EOK) {
    8284                                printf("Error resolving host '%s'.\n", argv[1]);
    8385                                return rc;
    8486                        }
    85                        
    86                         uint16_t af = inet_addr_sockaddr_in(&hinfo->addr, &addr, NULL);
    87                         if (af != AF_INET) {
    88                                 printf("Host '%s' not resolved as IPv4 address.\n", argv[1]);
    89                                 return rc;
    90                         }
     87
     88                        addr = hinfo->addr;
    9189                }
    92                 printf("result: rc=%d, family=%d, addr=%x\n", rc,
    93                     addr.sin_family, addr.sin_addr.s_addr);
     90                rc = inet_addr_format(&addr, &addr_s);
     91                if (rc != EOK) {
     92                        assert(rc == ENOMEM);
     93                        printf("Out of memory.\n");
     94                        return rc;
     95                }
     96                printf("result: rc=%d, ver=%d, addr=%s\n", rc,
     97                    addr.version, addr_s);
     98                free(addr_s);
    9499        }
    95100
    96101        if (argc >= 3) {
    97102                printf("parsing port '%s'\n", argv[2]);
    98                 addr.sin_port = htons(strtoul(argv[2], &endptr, 10));
     103                port = htons(strtoul(argv[2], &endptr, 10));
    99104                if (*endptr != '\0') {
    100105                        fprintf(stderr, "Error parsing port\n");
     
    103108        }
    104109
     110        rc = inet_addr_sockaddr(&hinfo->addr, port, &address, &addrlen);
     111        if (rc != EOK) {
     112                printf("Out of memory.\n");
     113                return rc;
     114        }
     115
    105116        printf("socket()\n");
    106         fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
     117        fd = socket(address->sa_family, SOCK_STREAM, IPPROTO_TCP);
    107118        printf(" -> %d\n", fd);
    108119        if (fd < 0)
     
    110121
    111122        printf("connect()\n");
    112         rc = connect(fd, (struct sockaddr *) &addr, sizeof(addr));
     123        rc = connect(fd, address, addrlen);
    113124        printf(" -> %d\n", rc);
    114125        if (rc != 0)
     
    133144        printf(" -> %d\n", rc);
    134145
     146        free(address);
     147
    135148        return 0;
    136149}
  • uspace/app/nterm/conn.c

    r6297465 r4c14b88  
    3838#include <fibril.h>
    3939#include <inet/dnsr.h>
     40#include <net/inet.h>
    4041#include <net/socket.h>
    4142#include <stdio.h>
     43#include <stdlib.h>
    4244#include <str_error.h>
    4345#include <sys/types.h>
     
    7375}
    7476
    75 int conn_open(const char *addr_s, const char *port_s)
     77int conn_open(const char *host, const char *port_s)
    7678{
    7779        int conn_fd = -1;
     80        struct sockaddr *saddr = NULL;
     81        socklen_t saddrlen;
    7882       
    7983        /* Interpret as address */
    80         inet_addr_t addr_addr;
    81         int rc = inet_addr_parse(addr_s, &addr_addr);
     84        inet_addr_t iaddr;
     85        int rc = inet_addr_parse(host, &iaddr);
    8286       
    8387        if (rc != EOK) {
    8488                /* Interpret as a host name */
    8589                dnsr_hostinfo_t *hinfo = NULL;
    86                 rc = dnsr_name2host(addr_s, &hinfo, 0);
     90                rc = dnsr_name2host(host, &hinfo, ip_any);
    8791               
    8892                if (rc != EOK) {
    89                         printf("Error resolving host '%s'.\n", addr_s);
     93                        printf("Error resolving host '%s'.\n", host);
    9094                        goto error;
    9195                }
    9296               
    93                 addr_addr = hinfo->addr;
     97                iaddr = hinfo->addr;
    9498        }
    95        
    96         struct sockaddr_in addr;
    97         struct sockaddr_in6 addr6;
    98         uint16_t af = inet_addr_sockaddr_in(&addr_addr, &addr, &addr6);
    9999       
    100100        char *endptr;
     
    105105        }
    106106       
    107         printf("Connecting to host %s port %u\n", addr_s, port);
     107        rc = inet_addr_sockaddr(&iaddr, port, &saddr, &saddrlen);
     108        if (rc != EOK) {
     109                assert(rc == ENOMEM);
     110                printf("Out of memory.\n");
     111                return ENOMEM;
     112        }
    108113       
    109         conn_fd = socket(PF_INET, SOCK_STREAM, 0);
     114        printf("Connecting to host %s port %u\n", host, port);
     115       
     116        conn_fd = socket(saddr->sa_family, SOCK_STREAM, 0);
    110117        if (conn_fd < 0)
    111118                goto error;
    112119       
    113         switch (af) {
    114         case AF_INET:
    115                 addr.sin_port = htons(port);
    116                 rc = connect(conn_fd, (struct sockaddr *) &addr, sizeof(addr));
    117                 break;
    118         case AF_INET6:
    119                 addr6.sin6_port = htons(port);
    120                 rc = connect(conn_fd, (struct sockaddr *) &addr6, sizeof(addr6));
    121                 break;
    122         default:
    123                 printf("Unknown address family.\n");
    124                 goto error;
    125         }
    126        
     120        rc = connect(conn_fd, saddr, saddrlen);
    127121        if (rc != EOK)
    128122                goto error;
     
    134128        fibril_add_ready(rcv_fid);
    135129       
     130        free(saddr);
    136131        return EOK;
    137        
    138132error:
    139133        if (conn_fd >= 0) {
     
    141135                conn_fd = -1;
    142136        }
     137        free(saddr);
    143138       
    144139        return EIO;
  • uspace/app/ping/ping.c

    r6297465 r4c14b88  
    3737#include <errno.h>
    3838#include <fibril_synch.h>
    39 #include <net/socket_codes.h>
    4039#include <inet/dnsr.h>
    4140#include <inet/addr.h>
     
    7776};
    7877
    79 static addr32_t src;
    80 static addr32_t dest;
     78static inet_addr_t src_addr;
     79static inet_addr_t dest_addr;
    8180
    8281static bool repeat_forever = false;
    8382static size_t repeat_count = 1;
    8483
    85 static const char *short_options = "rn:";
     84static const char *short_options = "46rn:";
    8685
    8786static void print_syntax(void)
    8887{
    89         printf("Syntax: %s [-n <count>|-r] <host>\n", NAME);
     88        printf("Syntax: %s [<options>] <host>\n", NAME);
     89        printf("\t-n <count> Repeat the specified number of times\n");
     90        printf("\t-r         Repeat forever\n");
     91        printf("\t-4|-6      Use IPv4 or IPv6 destination host address\n");
    9092}
    9193
     
    108110static int ping_ev_recv(inetping_sdu_t *sdu)
    109111{
    110         inet_addr_t src_addr;
    111         inet_addr_set(sdu->src, &src_addr);
    112        
    113         inet_addr_t dest_addr;
    114         inet_addr_set(sdu->dest, &dest_addr);
    115        
    116112        char *asrc;
    117113        int rc = inet_addr_format(&src_addr, &asrc);
     
    140136        inetping_sdu_t sdu;
    141137       
    142         sdu.src = src;
    143         sdu.dest = dest;
     138        sdu.src = src_addr;
     139        sdu.dest = dest_addr;
    144140        sdu.seq_no = seq_no;
    145141        sdu.data = (void *) "foo";
     
    222218        char *adest = NULL;
    223219        char *sdest = NULL;
     220        ip_ver_t ip_ver = ip_any;
    224221       
    225222        int rc = inetping_init(&ev_ops);
     
    244241                        }
    245242                        break;
     243                case '4':
     244                        ip_ver = ip_v4;
     245                        break;
     246                case '6':
     247                        ip_ver = ip_v6;
     248                        break;
    246249                default:
    247250                        printf("Unknown option passed.\n");
     
    258261       
    259262        /* Parse destination address */
    260         inet_addr_t dest_addr;
    261263        rc = inet_addr_parse(argv[optind], &dest_addr);
    262264        if (rc != EOK) {
    263265                /* Try interpreting as a host name */
    264                 rc = dnsr_name2host(argv[optind], &hinfo, AF_INET);
     266                rc = dnsr_name2host(argv[optind], &hinfo, ip_ver);
    265267                if (rc != EOK) {
    266268                        printf("Error resolving host '%s'.\n", argv[optind]);
     
    271273        }
    272274       
    273         uint16_t af = inet_addr_get(&dest_addr, &dest, NULL);
    274         if (af != AF_INET) {
    275                 printf("Destination '%s' is not an IPv4 address.\n",
    276                     argv[optind]);
    277                 goto error;
    278         }
    279        
    280275        /* Determine source address */
    281         rc = inetping_get_srcaddr(dest, &src);
     276        rc = inetping_get_srcaddr(&dest_addr, &src_addr);
    282277        if (rc != EOK) {
    283278                printf("Failed determining source address.\n");
    284279                goto error;
    285280        }
    286        
    287         inet_addr_t src_addr;
    288         inet_addr_set(src, &src_addr);
    289281       
    290282        rc = inet_addr_format(&src_addr, &asrc);
  • uspace/app/tester/Makefile

    r6297465 r4c14b88  
    3737        util.c \
    3838        thread/thread1.c \
     39        thread/setjmp1.c \
    3940        print/print1.c \
    4041        print/print2.c \
  • uspace/app/tester/tester.c

    r6297465 r4c14b88  
    4848test_t tests[] = {
    4949#include "thread/thread1.def"
     50#include "thread/setjmp1.def"
    5051#include "print/print1.def"
    5152#include "print/print2.def"
  • uspace/app/tester/tester.h

    r6297465 r4c14b88  
    3939#include <stdbool.h>
    4040#include <stacktrace.h>
     41#include <stdio.h>
    4142
    4243#define IPC_TEST_SERVICE  10240
     
    8081
    8182extern const char *test_thread1(void);
     83extern const char *test_setjmp1(void);
    8284extern const char *test_print1(void);
    8385extern const char *test_print2(void);
Note: See TracChangeset for help on using the changeset viewer.