[pptp-server] Fw: OpenBSD

David Luyer luyer at ucs.uwa.edu.au
Mon Jul 26 01:43:58 CDT 1999


(copied to Theo de Raadt - I don't have "sendbug" since I don't have OpenBSD 
myself)

> After Paolo Supino posted a mail about the OpenBSD error and didnt get
> any solve for this i will post it again:

I asked for further details such as system call and library traces for a few 
specific calls, but no details were forthcoming.  So I didn't follow it up.

> this is the log of the messages ... i am using OpenBSD 2.5 and pppd 2.3.5

Is this the latest OpenBSD kernel?  If not, you might want to upgrade and see 
if the problem is fixed by a later kernel.  It appears to be the latest to
me and I don't see anything on their errata page.

> Jul 23 21:37:50 mustang pptpd[4036]: GRE: bind() failed: Can't assign requested address

This is the error.  Probably an OpenBSD kernel bug - but you'd have to check 
with an OpenBSD person.

As a temporary workaround only, delete line 68 in pptpgre.c ("return -1;").

Send this code and comment to an OpenBSD kernel person and ask them if they 
think it's a kernel bug, mention that it works on other OS's;

inet_addrs[0] = returned from earlier getsockname() on a connected TCP socket
inet_addrs[1] = returned from earlier getpeername() on a connected TCP socket
PPTP_PROTO = 47

        struct sockaddr_in addr;
        int gre_fd;

        /* Open IP protocol socket */
        gre_fd = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
        if (gre_fd < 0) {
                syslog(LOG_ERR, "GRE: socket() failed");
                return -1;
        }

        addr.sin_family = AF_INET;
        addr.sin_addr = inetaddrs[0];
        addr.sin_port = 0;

        if (bind(gre_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
                syslog(LOG_ERR, "GRE: bind() failed: %s", strerror(errno));
                return -1;
        }

        addr.sin_family = AF_INET;
        addr.sin_addr = inetaddrs[1];
        addr.sin_port = 0;

        if (connect(gre_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
                syslog(LOG_ERR, "GRE: connect() failed: %s", strerror(errno));
                return -1;
        }

The bind() is returning can't assign requested address.  We need to bind() so 
that the outgoing packets go out the interface the TCP socket is established 
to.

> Jul 23 21:37:50 mustang pptpd[4036]: GRE: xmit failed from decaps_hdlc: Bad file descriptor
> Jul 23 21:37:50 mustang pptpd[4036]: CTRL: PTY read or GRE write failed (pty,gre)=(4,-1)

This last bit is a pptpd bug - not properly handling the failed pptp_gre_init 
call.

David.





More information about the pptp-server mailing list