<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: Re: long standing problem with cipe finally resolved...
From: Olaf Titz <olaf,AT,bigred,DOT,inka,DOT,de>
Date: Sun, 18 Nov 2001 19:57:10 +0100
In-reply-to: <3BED7873.3053D423@umr.edu>

> > So basically, I'm not sure if a bind() is supposed to last through a
> > connect(AF_UNSPEC). But, basically, it doesn't, at least on this
> > box/kernel. The server is running 2.2.19 btw. Clients running 2.4.10.

Good question what it is supposed to. The local and remote addresses
are different things and bind() and connect() _should_ not interact,
but that's IMHO. Also note that the code for connect() has changed
dramatically over the kernel versions.

> > Anyway, by commenting out the "dis"connect() code in opendev(), and
> > just
> > letting cipe continue to do another connect() on the socket (i.e.
> > instead of conn/disconn/conn, just let it do conn/conn), it has
> > started
> > working fine for me.

When I coded the stuff I had a rather unusual system, where both
incoming pkcipe and outgoing cipe would go via different proxies and
most automatic address-picking would fail. This was the reason for the
-r argument and socket passing. (So much for the background and why
this all is so weird. :-)

I think the reason for the disconnection is that the kernel would not
allow connect() on an already connected socket. If it does, fine, then
the code can just be removed, I think.

Just looking over the kernel code:
2.0.38 seems to allow re-connect
2.2.19 seems to allow re-connect, also has code for explicit
       disconnection which does _not_ touch the local port but _does_
       touch the local address
2.4.9 seems to allow re-connect, its disconnect code does _not_ touch
      the local address.

Looking at this, it seems that the disconnection code can be removed.
Unfortunately, I'm not in my original weird-config-stress-test network
any more to see if something would break. PKCIPE users, please test.

Olaf

--- cipe/ciped.c        2001/04/15 21:25:12     1.52
+++ cipe/ciped.c        2001/11/18 18:13:14
@@ -300,6 +300,8 @@
     if (inetd) {
         f=0;
     } else if (usesock>=0) {
+#if 0
+        /* this seems to be unnecessary */
        struct sockaddr_in sa;
        memset(&sa, 0, sizeof(sa));
        sa.sin_family=AF_UNSPEC;
@@ -307,6 +309,7 @@
        if (connect(f, (struct sockaddr *)&sa, sizeof(sa))<0) {
            err("opendev: disconnect: %m");
        }
+#endif
     } else {
         if ((f=socket(AF_INET, SOCK_DGRAM, 0))<0) {
             Log(LOG_ERR, "opendev: socket: %m");

=== end of patch ===





<< | Thread Index | >> ]    [ << | Date Index | >> ]