Update of /cvsroot/leaf/src/bering-uclibc/contrib/xl2tpd
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19311

Modified Files:
        buildtool.cfg buildtool.mk xl2tpd.init 
Added Files:
        pppol2tp-fix.patch safe_xl2tpd xl2tpd-1.1.06.tar.gz 
Removed Files:
        pppol2tp.patch.gz xl2tpd-1.1.05.tar.gz 
Log Message:
* Updated upstream to 1.1.06
* Removed pppol2tp.patch.gz, merged upstream
* Added (temporary) pppol2tp-fix.patch for breakage in upstream merge
* Added safe_xl2tpd for automatic restart of daemon when crashing


--- NEW FILE: pppol2tp-fix.patch ---
--- xl2tpd-1.1.06.orig/xl2tpd.c 2006-12-04 22:28:30.000000000 +0100
+++ xl2tpd-1.1.06/xl2tpd.c      2006-12-04 22:28:30.000000000 +0100
@@ -45,9 +45,6 @@
 #include <fcntl.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#ifdef USE_KERNEL
-#include <sys/ioctl.h>
-#endif
 #include "l2tp.h"
 
 struct tunnel_list tunnels;
@@ -238,6 +235,9 @@
                      * OK...pppd died, we can go ahead and close the pty for
                      * it
                      */
+#ifdef USE_KERNEL
+                   if (!kernel_support)
+#endif
                     close (c->fd);
                     c->fd = -1;
                     /*
@@ -297,7 +297,8 @@
     char *stropt[80];
     struct ppp_opts *p;
 #ifdef USE_KERNEL
-    struct l2tp_call_opts co;
+    struct sockaddr_pppol2tp sax;
+    int flags;
 #endif
     int pos = 1;
     int fd2;
@@ -333,12 +334,39 @@
 #ifdef USE_KERNEL
     if (kernel_support)
     {
-        co.ourtid = c->container->ourtid;
-        co.ourcid = c->ourcid;
-        ioctl (server_socket, L2TPIOCGETCALLOPTS, &co);
-        stropt[pos++] = strdup ("channel");
+       fd2 = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
+       if (fd2 < 0) {
+           l2tp_log (LOG_WARNING, "%s: Unable to allocate PPPoL2TP socket.\n",
+                __FUNCTION__);
+           return -EINVAL;
+       }
+       flags = fcntl(fd2, F_GETFL);
+       if (flags == -1 || fcntl(fd2, F_SETFL, flags | O_NONBLOCK) == -1) {
+           l2tp_log (LOG_WARNING, "%s: Unable to set PPPoL2TP socket 
nonblock.\n",
+                __FUNCTION__);
+           return -EINVAL;
+       }
+       sax.sa_family = AF_PPPOX;
+       sax.sa_protocol = PX_PROTO_OL2TP;
+       sax.pppol2tp.pid = 0;
+       sax.pppol2tp.fd = server_socket;
+       sax.pppol2tp.addr.sin_addr.s_addr = c->container->peer.sin_addr.s_addr;
+       sax.pppol2tp.addr.sin_port = c->container->peer.sin_port;
+       sax.pppol2tp.addr.sin_family = AF_INET;
+       sax.pppol2tp.s_tunnel  = c->container->ourtid;
+       sax.pppol2tp.s_session = c->ourcid;
+       sax.pppol2tp.d_tunnel  = c->container->tid;
+       sax.pppol2tp.d_session = c->cid;
+       if (connect(fd2, (struct sockaddr *)&sax, sizeof(sax)) < 0) {
+           l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket.\n",
+                __FUNCTION__);
+           return -EINVAL;
+       }
+       stropt[pos++] = strdup ("plugin");
+       stropt[pos++] = strdup ("pppol2tp.so");
+       stropt[pos++] = strdup ("pppol2tp");
         stropt[pos] = (char *) malloc (10);
-        snprintf (stropt[pos], 10, "%d", co.id);
+       snprintf (stropt[pos], 10, "%d", fd2);
         pos++;
         stropt[pos] = NULL;
     }
@@ -400,6 +428,10 @@
         close (1); /* ditto */
         /* close (2); No, we want to keep the connection to /dev/null. */ 
 
+#ifdef USE_KERNEL
+       if (!kernel_support)
+#endif
+       {
         /* connect the pty to stdin and stdout */
         dup2 (fd2, 0);
         dup2 (fd2, 1);
@@ -416,6 +448,7 @@
             }
             st = st->next;
         }
+       }
 
         /* close the UDP socket fd */
         close (server_socket);
@@ -748,11 +781,6 @@
     tmp->hello = NULL;
 #ifndef TESTING
 /*      while(get_call((tmp->ourtid = rand() & 0xFFFF),0,0,0)); */
-#ifdef USE_KERNEL
-    if (kernel_support)
-        tmp->ourtid = ioctl (server_socket, L2TPIOCADDTUNNEL, 0);
-    else
-#endif
 /*        tmp->ourtid = rand () & 0xFFFF; */
         /* get_entropy((char *)&tmp->ourtid, 2); */
         get_entropy(entropy_buf, 2);

--- NEW FILE: xl2tpd-1.1.06.tar.gz ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: safe_xl2tpd ---
#!/bin/sh

NAME=xl2tpd
DAEMON=/usr/sbin/xl2tpd
PID=/var/run/xl2tpd/xl2tpd.pid
CONF=/etc/xl2tpd/xl2tpd.conf
ARGS="-D -c $CONF -p $PID"

if test -e $PID
then
  echo "$NAME already running."
  exit 1
fi

touch $PID
while test -e $PID
do
  rm -f $PID
  $DAEMON $ARGS 2>&1 | logger -p daemon.info
done

Index: xl2tpd.init
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/contrib/xl2tpd/xl2tpd.init,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** xl2tpd.init 3 Jun 2006 13:21:10 -0000       1.1
--- xl2tpd.init 5 Dec 2006 10:57:00 -0000       1.2
***************
*** 1,45 ****
  #!/bin/sh
! #/etc/init.d/l2tpd: start L2TP daemon.
  
  RCDLINKS="0,K41 1,K41 2,S43 3,S43 4,S43 5,S43 6,K41"
  
! test -x /usr/sbin/l2tpd || exit 0
  
! # Set run_l2tpd to 1 to start l2tpd or 0 to disable it.
! run_l2tpd=1
  
  case "$1" in
    start)
!     if [ $run_l2tpd = 1 ]
      then
!         echo -n "Starting L2TP daemon... "
!         if start-stop-daemon --start --quiet --exec /usr/sbin/l2tpd
!         then
!             echo done.
!         else
!             echo failed.
!         fi
      fi
!     ;;                     
!                            
!   stop)                    
!     if [ $run_l2tpd = 1 ]  
!     then                   
!         echo -n "Stopping L2TP daemon..."
!         if start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/l2tpd
!         then               
!             echo done.     
!         else               
!             echo failed.   
!         fi                 
!     fi                     
!     ;;                     
!                            
!   *)                       
!     echo "Usage: /etc/init.d/l2tpd {start|stop}"
!     exit 1                 
!                            
! esac                       
!                            
! exit 0                     
  
--- 1,47 ----
  #!/bin/sh
! #/etc/init.d/xl2tpd: start L2TP daemon.
  
  RCDLINKS="0,K41 1,K41 2,S43 3,S43 4,S43 5,S43 6,K41"
  
! NAME=xl2tpd
! DAEMON=/usr/sbin/xl2tpd
! SAFEDAEMON=/usr/sbin/safe_xl2tpd
! PIDFILE=/var/run/xl2tpd/xl2tpd.pid
  
! # Uncomment to enable core dumps
! #dumpdir=/mnt/l2tpd
! 
! test -x $DAEMON || exit 0
! test -x $SAFEDAEMON || exit 0
  
  case "$1" in
    start)
!     echo -n "Starting L2TP daemon... "
!     test -n "$dumpdir" && test -d $dumpdir && cd $dumpdir && ulimit -c 
unlimited
!     if start-stop-daemon --start --background --quiet --pid $PIDFILE --exec 
$SAFEDAEMON
      then
!       echo done.
!     else
!       echo failed.
      fi
!     ;;
! 
!   stop)
!     echo -n "Stopping L2TP daemon..."
!     if start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
!     then
!       echo done.
!     else
!       echo failed.
!     fi
!     ;;
! 
!   *)
!     echo "Usage: /etc/init.d/$NAME {start|stop}"
!     exit 1
!     ;;
! 
! esac
! 
! exit 0
  

--- pppol2tp.patch.gz DELETED ---

--- xl2tpd-1.1.05.tar.gz DELETED ---

Index: buildtool.mk
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/contrib/xl2tpd/buildtool.mk,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** buildtool.mk        3 Nov 2006 18:56:51 -0000       1.3
--- buildtool.mk        5 Dec 2006 10:57:00 -0000       1.4
***************
*** 1,9 ****
  include $(MASTERMAKEFILE)
! XL2TPD_DIR:=xl2tpd-1.1.05
  
  $(XL2TPD_DIR)/.source:
        zcat $(XL2TPD_SOURCE) |  tar -xvf -
        zcat $(XL2TPD_PATCH1) | patch -d $(XL2TPD_DIR) -p1
!       zcat $(XL2TPD_PATCH2) | patch -d $(XL2TPD_DIR) -p1
        touch $(XL2TPD_DIR)/.source
  
--- 1,9 ----
  include $(MASTERMAKEFILE)
! XL2TPD_DIR:=xl2tpd-1.1.06
  
  $(XL2TPD_DIR)/.source:
        zcat $(XL2TPD_SOURCE) |  tar -xvf -
        zcat $(XL2TPD_PATCH1) | patch -d $(XL2TPD_DIR) -p1
!       cat $(XL2TPD_PATCH2) | patch -d $(XL2TPD_DIR) -p1
        touch $(XL2TPD_DIR)/.source
  
***************
*** 12,25 ****
  $(XL2TPD_DIR)/.build:
        $(MAKE) -C $(XL2TPD_DIR) CC=$(TARGET_CC) LD=$(TARGET_LD) 
DFLAGS="$(BT_COPT_FLAGS) -DUSE_KERNEL"
!       mkdir -p $(BT_STAGING_DIR)/etc/l2tpd
        mkdir -p $(BT_STAGING_DIR)/usr/sbin
        mkdir -p $(BT_STAGING_DIR)/etc/init.d
        mkdir -p $(BT_STAGING_DIR)/etc/ppp
!       cp $(XL2TPD_DIR)/l2tpd $(BT_STAGING_DIR)/usr/sbin/
!       cp $(XL2TPD_INITD) $(BT_STAGING_DIR)/etc/init.d/l2tpd
!       cp $(XL2TPD_DIR)/examples/ppp-options.l2tpd 
$(BT_STAGING_DIR)/etc/ppp/options.l2tpd
!       cp $(XL2TPD_DIR)/examples/l2tpd.conf 
$(BT_STAGING_DIR)/etc/l2tpd/l2tpd.conf
!       cp $(XL2TPD_DIR)/doc/l2tp-secrets.sample 
$(BT_STAGING_DIR)/etc/l2tpd/l2tp-secrets
!       $(BT_STRIP) $(BT_STRIP_BINOPTS) $(BT_STAGING_DIR)/usr/sbin/l2tpd
        touch $(XL2TPD_DIR)/.build
  
--- 12,26 ----
  $(XL2TPD_DIR)/.build:
        $(MAKE) -C $(XL2TPD_DIR) CC=$(TARGET_CC) LD=$(TARGET_LD) 
DFLAGS="$(BT_COPT_FLAGS) -DUSE_KERNEL"
!       mkdir -p $(BT_STAGING_DIR)/etc/xl2tpd
        mkdir -p $(BT_STAGING_DIR)/usr/sbin
        mkdir -p $(BT_STAGING_DIR)/etc/init.d
        mkdir -p $(BT_STAGING_DIR)/etc/ppp
!       cp $(XL2TPD_DIR)/xl2tpd $(BT_STAGING_DIR)/usr/sbin/
!       cp $(XL2TPD_SAFE) $(BT_STAGING_DIR)/usr/sbin/
!       cp $(XL2TPD_INITD) $(BT_STAGING_DIR)/etc/init.d/xl2tpd
!       cp $(XL2TPD_DIR)/examples/ppp-options.xl2tpd 
$(BT_STAGING_DIR)/etc/ppp/options.l2tpd
!       cp $(XL2TPD_DIR)/examples/xl2tpd.conf 
$(BT_STAGING_DIR)/etc/xl2tpd/xl2tpd.conf
!       cp $(XL2TPD_DIR)/doc/l2tp-secrets.sample 
$(BT_STAGING_DIR)/etc/xl2tpd/l2tp-secrets
!       $(BT_STRIP) $(BT_STRIP_BINOPTS) $(BT_STAGING_DIR)/usr/sbin/xl2tpd
        touch $(XL2TPD_DIR)/.build
  
***************
*** 28,38 ****
  clean: 
        $(MAKE) -C $(XL2TPD_DIR) clean
!       rm -f $(BT_STAGING_DIR)/usr/sbin/l2tpd
!       rm -f $(BT_STAGING_DIR)/etc/l2tpd/l2tpd.conf
!       rm -f $(BT_STAGING_DIR)/etc/l2tpd/l2tp-secrets
!       rm -f $(BT_STAGING_DIR)/etc/init.d/l2tpd
!       rm -f $(BT_STAGING_DIR)/etc/ppp/options.l2tpd
        -rmdir $(BT_STAGING_DIR)/etc/init.d
!       -rmdir $(BT_STAGING_DIR)/etc/l2tpd
        -rmdir $(BT_STAGING_DIR)/etc/ppp
        rm -f $(XL2TPD_DIR)/.build
--- 29,40 ----
  clean: 
        $(MAKE) -C $(XL2TPD_DIR) clean
!       rm -f $(BT_STAGING_DIR)/usr/sbin/xl2tpd
!       rm -f $(BT_STAGING_DIR)/usr/sbin/safe_xl2tpd
!       rm -f $(BT_STAGING_DIR)/etc/xl2tpd/xl2tpd.conf
!       rm -f $(BT_STAGING_DIR)/etc/xl2tpd/l2tp-secrets
!       rm -f $(BT_STAGING_DIR)/etc/init.d/xl2tpd
!       rm -f $(BT_STAGING_DIR)/etc/ppp/options.xl2tpd
        -rmdir $(BT_STAGING_DIR)/etc/init.d
!       -rmdir $(BT_STAGING_DIR)/etc/xl2tpd
        -rmdir $(BT_STAGING_DIR)/etc/ppp
        rm -f $(XL2TPD_DIR)/.build

Index: buildtool.cfg
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/contrib/xl2tpd/buildtool.cfg,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** buildtool.cfg       8 Nov 2006 10:21:01 -0000       1.9
--- buildtool.cfg       5 Dec 2006 10:57:00 -0000       1.10
***************
*** 5,9 ****
  </File>
  
! <File xl2tpd-1.1.05.tar.gz>
    Server = cvs-contrib-sourceforge
    Directory = xl2tpd
--- 5,9 ----
  </File>
  
! <File xl2tpd-1.1.06.tar.gz>
    Server = cvs-contrib-sourceforge
    Directory = xl2tpd
***************
*** 19,23 ****
  </File>
  
! <File pppol2tp.patch.gz>
    Server = cvs-contrib-sourceforge
    Directory = xl2tpd
--- 19,24 ----
  </File>
  
! # Temporary fix for partial merge upstream
! <File pppol2tp-fix.patch>
    Server = cvs-contrib-sourceforge
    Directory = xl2tpd
***************
*** 33,43 ****
  </File>
  
  <Package>
    <xl2tpd>
!     Version = 1.1.05
!     Revision = 2
  
      Help <<EOF
!     L2TP daemon
      Homepage: http://www.xelerance.com/software/xl2tpd/
      Requires: ppp pppol2tp
--- 34,51 ----
  </File>
  
+ <File safe_xl2tpd>
+   Server = cvs-contrib-sourceforge
+   Directory = xl2tpd
+   Revision = HEAD
+   envname = XL2TPD_SAFE
+ </File>
+ 
  <Package>
    <xl2tpd>
!     Version = 1.1.06
!     Revision = 1
  
      Help <<EOF
!     Xelerance L2TP daemon
      Homepage: http://www.xelerance.com/software/xl2tpd/
      Requires: ppp pppol2tp
***************
*** 57,68 ****
      <Contents>
        <File>
!         Filename = usr/sbin/l2tpd
!       Source = usr/sbin/l2tpd
        Type = binary
        Permissions = 755
        </File>
        <File>
!         Filename = etc/l2tpd/l2tpd.conf
!       Source = etc/l2tpd/l2tpd.conf
        Description = xl2tpd configuration
        Type = conf
--- 65,82 ----
      <Contents>
        <File>
!         Filename = usr/sbin/xl2tpd
!       Source = usr/sbin/xl2tpd
        Type = binary
        Permissions = 755
        </File>
        <File>
!         Filename = usr/sbin/safe_xl2tpd
!       Source = usr/sbin/safe_xl2tpd
!       Type = binary
!       Permissions = 755
!       </File>
!       <File>
!         Filename = etc/xl2tpd/xl2tpd.conf
!       Source = etc/xl2tpd/xl2tpd.conf
        Description = xl2tpd configuration
        Type = conf
***************
*** 71,76 ****
        </File>
        <File>
!         Filename = etc/l2tpd/l2tp-secrets
!       Source = etc/l2tpd/l2tp-secrets
        Description = secrets for L2TP tunnels
        Type = conf
--- 85,90 ----
        </File>
        <File>
!         Filename = etc/xl2tpd/l2tp-secrets
!       Source = etc/xl2tpd/l2tp-secrets
        Description = secrets for L2TP tunnels
        Type = conf
***************
*** 88,93 ****
        </File>
        <File>
!         Filename = etc/init.d/l2tpd
!       Source = etc/init.d/l2tpd
        Description = xl2tpd init file
        Type = conf
--- 102,107 ----
        </File>
        <File>
!         Filename = etc/init.d/xl2tpd
!       Source = etc/init.d/xl2tpd
        Description = xl2tpd init file
        Type = conf
***************
*** 96,99 ****
--- 110,117 ----
        Permissions = 755
        </File>
+       <File>
+         Filename = var/run/xl2tpd
+       Type = directory
+       </File>
      </Contents>
    </xl2tpd>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
leaf-cvs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to