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

Subject: Re: long standing problem with cipe finally resolved...
From: Nathan Neulinger <nneul,AT,umr,DOT,edu>
Date: Sun, 18 Nov 2001 21:10:42 +0100
In-reply-to: <B94EA0108C0A894A94F55273B9594E0D4FC26A@exch101.on.ws>

I had made a local change to cipe very similar, but slightly different
to solve my problem with pkcipe initiated cipe tunnels, and it has
worked great ever since.

diff -ur cipe-1.5.2-orig/cipe/ciped.c cipe-1.5.2/cipe/ciped.c
--- cipe-1.5.2-orig/cipe/ciped.c        Sun Feb 11 15:42:39 2001
+++ cipe-1.5.2/cipe/ciped.c     Sat Nov 10 12:51:21 2001
@@ -290,9 +290,11 @@
        memset(&sa, 0, sizeof(sa));
        sa.sin_family=AF_UNSPEC;
        f=usesock;
+#if 0
        if (connect(f, (struct sockaddr *)&sa, sizeof(sa))<0) {
            err("opendev: disconnect");
        }
+#endif
     } else {
         if ((f=socket(AF_INET, SOCK_DGRAM, 0))<0) {
             Log(LOG_ERR, "opendev: socket: %m");

I think I figured it was important to set f since it is used later on
for the setsockopt. 

Haven't tested with the below patch.

-- Nathan

Jan De landtsheer wrote:
> 
> But what about PKCIPE then ?
> I _really_ would like to use this tool ;o)
> 
> Thx
> Jan
> 
> > -----Original Message-----
> > From: Olaf Titz [mailto:olaf,AT,bigred,DOT,inka,DOT,de
> > Sent: Sunday, November 18, 2001 7:23 PM
> > To: cipe-l,AT,inka,DOT,de
> > Subject: Re: long standing problem with cipe finally resolved...
> >
> >
> > > > 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 ===
> >
> >
> > --
> > Message sent by the cipe-l,AT,inka,DOT,de mailing list.
> > Unsubscribe: mail majordomo,AT,inka,DOT,de, "unsubscribe cipe-l" in
> > body Other commands available with "help" in body to the same
> > address. CIPE info and list archive:
> > <URL:http://sites.inka.de/~bigred/devel/cipe.html>
> >
> 
> --
> Message sent by the cipe-l,AT,inka,DOT,de mailing list.
> Unsubscribe: mail majordomo,AT,inka,DOT,de, "unsubscribe cipe-l" in body
> Other commands available with "help" in body to the same address.
> CIPE info and list archive: 
><URL:http://sites.inka.de/~bigred/devel/cipe.html>

-- 

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul,AT,umr,DOT,edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216





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