linuxulator problems in linux_socket.c (and friends)

Andrew Atrens atrens at nortelnetworks.com
Wed Jan 7 14:10:17 PST 2004


Hi All,

I've had clearcase 5.0 running on FreeBSD-stable for quite some time 
(probably 3+ years) and I thought I'd give it a try on DragonFly ...

Well, the short version is that it doesn't work... and I've not found a 
workaround -

in linux_socket.c -

kern_getsockopt() (quoted below) is failing with error 42...

#define ENOPROTOOPT     42              /* Protocol not available */

If I kludge around the error by forcing both error and sopt to zero, I 
can get simple commands to work, but this is clearly not the right thing
to do.

linux_socket.c is very different in df from what's in 4.9. Looks like 
the df version has been substantially refactored.

In 4.9 IP_HDRINCL sockets are treated very specially (with their own 
special identification test func. and special sendto func as well). 
Don't know if this is required in df, but what's there now doesn't work 
for me :(

I'd certainly like to get this working ... let me know how you'd like me 
  to proceed.

Cheers,

Andrew.



static int
linux_sendto(struct linux_sendto_args *args, int *res)
{
    struct linux_sendto_args linux_args;
    struct thread *td = curthread;
    struct uio auio;
    struct iovec aiov;
    struct sockopt sopt;
    struct sockaddr *sa = NULL;
    caddr_t msg = NULL;
    int error, optval;
    error = copyin(args, &linux_args, sizeof(linux_args));
    if (error)
        return (error);
    if (linux_args.to) {
        error = linux_getsockaddr(&sa, linux_args.to,
            linux_args.tolen);
        if (error)
            return (error);
    }
    /*
     * Check to see if the IP_HDRINCL option is set.
     */
    sopt.sopt_dir = SOPT_GET;
    sopt.sopt_level = IPPROTO_IP;
    sopt.sopt_name = IP_HDRINCL;
    sopt.sopt_val = &optval;
    sopt.sopt_valsize = sizeof(optval);
    sopt.sopt_td = NULL;
    error = kern_getsockopt(linux_args.s, &sopt);    <--- returns 42

    error = sopt = 0 ; /* BROKEN: assume the option is not set */

    if (error)
        return (error);





More information about the Bugs mailing list