Archie Cobbs writes:
> > that is exactly what I am seeing, the clients are behind this stupid
> > little GVC IP0008 machine, and I am using your mpd software for the pptp
> > server. I know about the "BUG" in libalias.
> > 
> > Is this part of the PPTP spec, that only one TCP control connection can be
> > open to an IP, or is it a purely libalias thing.
> 
> Yes it is part of the PPTP spec.. however, I've seen servers
> that ignore the spec and accept multiple connections from a
> single remote source. Mpd should probably do the same thing
> when configured for 'server only' mode.. hmm, maybe I'll look
> into that (will send you a patch if/when).

Please try the patch below and see if it works.
I haven't tested it at all myself..

Thanks,
-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com

Index: pptp.c
===================================================================
RCS file: /home/cvs/archie/mpd/src/pptp.c,v
retrieving revision 1.4
diff -u -r1.4 pptp.c
--- pptp.c      2002/03/01 02:42:24     1.4
+++ pptp.c      2002/04/12 22:12:25
@@ -680,22 +680,32 @@
 static void
 PptpListenUpdate(void)
 {
+  int  allow_incoming = 0;
+  int  allow_multiple = 1;
   int  k;
 
+  /* Examine all PPTP links */
   for (k = 0; k < gNumLinks; k++) {
     if (gLinks[k] && gLinks[k]->phys->type == &gPptpPhysType) {
       PptpInfo const p = (PptpInfo)gLinks[k]->phys->info;
 
       if (Enabled(&p->options, PPTP_CONF_INCOMING))
-       break;
+       allow_incoming = 1;
+      if (Enabled(&p->options, PPTP_CONF_ORIGINATE)
+         && p->peer_addr_req.ipaddr.s_addr != 0)
+       allow_multiple = 0;
     }
   }
+
+  /* Initialize first time */
   if (!gInitialized) {
-    if (k == gNumLinks)
+    if (!allow_incoming)
       return;          /* wait till later; we may not have an IP address yet */
     PptpInitCtrl();
   }
-  PptpCtrlListen(k < gNumLinks, gLocalPort);
+
+  /* Set up listening for incoming connections */
+  PptpCtrlListen(allow_incoming, gLocalPort, allow_multiple);
 }
 
 /*
@@ -727,6 +737,7 @@
        pptp->peer_addr_req = rng;
        pptp->peer_port_req = port;
       }
+      PptpListenUpdate();
       break;
     case SET_PHONENUM:
       if (ac != 1)
Index: pptp_ctrl.c
===================================================================
RCS file: /home/cvs/archie/mpd/src/pptp_ctrl.c,v
retrieving revision 1.4
diff -u -r1.4 pptp_ctrl.c
--- pptp_ctrl.c 2002/03/16 18:29:37     1.4
+++ pptp_ctrl.c 2002/04/12 22:12:27
@@ -228,6 +228,7 @@
   static u_char                        gInitialized;
   static u_long                        gStartTime;
   static u_int16_t             gLastCallId;
+  static int                   gAllowMultiple;
   static int                   gListenSock = -1;
   static struct in_addr                gListenIp;
   static EventRef              gListenRetry;
@@ -518,11 +519,12 @@
  */
 
 int
-PptpCtrlListen(int enable, int port)
+PptpCtrlListen(int enable, int port, int allow_multiple)
 {
   assert(gInitialized);
   port = port ? port : PPTP_PORT;
   if (enable) {
+    gAllowMultiple = allow_multiple;
     if (gListenSock >= 0 || EventIsRegistered(gListenRetry))
       return(0);
     if ((gListenSock = TcpGetListenPort(gListenIp, &port)) < 0) {
@@ -536,6 +538,7 @@
     EventRegister(&gListenEvent, EVENT_READ,
       gListenSock, DEV_PRIO, PptpCtrlListenEvent, NULL);
   } else {
+    gAllowMultiple = 0;
     if (gListenSock < 0)
       return(0);
     close(gListenSock);
@@ -557,7 +560,7 @@
 {
   const u_short        port = (u_short) (int) cookie;
 
-  PptpCtrlListen(TRUE, port);
+  PptpCtrlListen(TRUE, port, gAllowMultiple);
 }
 
 /*
@@ -1826,6 +1829,10 @@
   struct pptpStartCtrlConnReply        reply;
   int                          k;
 
+  /* Are we allowing multiple connections from the same IP address? */
+  if (gAllowMultiple)
+    goto reply;
+
   /* Check for a collision */
   for (k = 0; k < gNumPptpCtrl; k++) {
     PptpCtrl   const c2 = gPptpCtrl[k];
@@ -1845,6 +1852,7 @@
       PptpCtrlKillCtrl(c2);    /* Kill the connection that I initiated */
   }
 
+reply:
   /* Initialize reply */
   memset(&reply, 0, sizeof(reply));
   reply.vers = PPTP_PROTO_VERS;
Index: pptp_ctrl.h
===================================================================
RCS file: /home/cvs/archie/mpd/src/pptp_ctrl.h,v
retrieving revision 1.3
diff -u -r1.3 pptp_ctrl.h
--- pptp_ctrl.h 2001/12/15 20:59:51     1.3
+++ pptp_ctrl.h 2002/04/12 22:12:27
@@ -406,7 +406,8 @@
                                  PptpGetOutLink_t getOutLink,
                                  struct in_addr myip);
 
-  extern int                   PptpCtrlListen(int enable, int port);
+  extern int                   PptpCtrlListen(int enable, int port,
+                                 int allow_multiple);
 
   extern struct pptpctrlinfo   PptpCtrlInCall(struct pptplinkinfo linfo,
                                  struct in_addr ip, int port, int bearType,

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to