Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Oct 2001 20:51:26 +0200 (CEST)
From:      Martin Blapp <mb@imp.ch>
To:        <freebsd-emulation@freebsd.org>
Cc:        <des@freebsd.org>, <marcel@freebsd.org>
Subject:   linux_connect() broken for linux_base-7
Message-ID:  <20011022204208.Q29117-200000@levais.imp.ch>

index | next in thread | raw e-mail

[-- Attachment #1 --]

Hi,

As you may have seen linux_base-7 is not able to resolve any
DNS-Query's. For every connect(), we get EINVAL back.

The resposible part is: sys/netinet/udp_usrreq.c

853	inp = sotoinpcb(so);
854	if (inp == 0)
855	return EINVAL;

The socket seems to be in a state where the initialisation
fails.

Here is a kdump of a simple gethostbyname program:

 15097 gethost  CALL  linux_socketcall(0x1,0xbfbfe408)
 15097 gethost  RET   linux_socketcall 3
 15097 gethost  CALL  linux_socketcall(0x3,0xbfbfe408)
 15097 gethost  RET   linux_socketcall -1 errno 22 Invalid argument

As you see the first linux_socketcall got passed, and the second,
which is linux_connect(), fails.

Anybody have some clues ?

I've no linux box around to compile a statically linked test binary.
If anyone has one with glibc2.2.2 and resolver.2.2.2 please compile
one and send it to me.

The code of the test programm is attached. It works with linux_base-6,
but not with linux_base-7.

As I still have problems reading kernel source without help, I'm not sure
where to look. I've no clue what sotoinpcb() does. I'm sorry.

Martin

Martin Blapp, mb@imp.ch
------------------------------------------------------------------
Improware AG, UNIX solution and service provider
Zurlindenstrasse 29, 4133 Pratteln, Switzerland
Phone: +41 061 826 93 00: +41 61 826 93 01
PGP Fingerprint: 57E 7CCD 2769 E7AC C5FA  DF2C 19C6 DCD1 1B3A EC9C
------------------------------------------------------------------

[-- Attachment #2 --]
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

void
usage(void)
{
        printf("usage: a.out hostaddress\n");
        exit(1);
}

int
main(int argc, char *argv[])
{
        struct in_addr addr;
        int     ret, *intp;
        char    **p;
        struct hostent *hp;

        if (argc != 2)
                usage();

        hp = gethostbyname(argv[1]);
        if (hp == NULL) {
                printf("ERROR: gethostbyname(\"%s\")\n", argv[1]);
                exit(1);
        }
        printf("%s: ", hp->h_name);
        p = hp->h_aliases;
        while (*p)
                printf("%s\n", *p++);

        p = hp->h_addr_list;
        while (*p) {
                intp = (int *) *p++;
                ret = *intp;
                addr.s_addr = ret;
                printf("%s\n", inet_ntoa(addr));
        }

        return 0;
}
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011022204208.Q29117-200000>