Initial revision
[openwrt.git] / obsolete-buildroot / sources / vtun.patch
1 diff -urN vtun/Makefile.in vtun-2.6/Makefile.in
2 --- vtun/Makefile.in    2002-12-20 09:55:47.000000000 -0700
3 +++ vtun-2.6/Makefile.in        2003-06-05 12:38:31.000000000 -0600
4 @@ -28,7 +28,7 @@
5  LEXFLAGS = -t 
6  
7  INSTALL = @INSTALL@
8 -INSTALL_OWNER = -o root -g 0
9 +INSTALL_OWNER =
10  
11  prefix = @prefix@
12  exec_prefix = @exec_prefix@
13 @@ -86,15 +86,15 @@
14  
15  install_config: 
16         $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(ETC_DIR)
17 -       if [ ! -f $(ETC_DIR)/vtund.conf ]; then \
18 -         $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR); \
19 -       fi
20 +       $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR);
21 +       $(INSTALL) -m 600 $(INSTALL_OWNER) scripts/vtund-start.conf $(DESTDIR)$(ETC_DIR);
22  
23  install: vtund install_config install_man
24 -       $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(VAR_DIR)/run
25         $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(STAT_DIR)
26         $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(LOCK_DIR)
27         $(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(SBIN_DIR)
28         $(INSTALL) -m 755 $(INSTALL_OWNER) vtund $(DESTDIR)$(SBIN_DIR)
29 +       $(INSTALL) -m 755 $(INSTALL_OWNER) scripts/vtund.rc.debian \
30 +               $(DESTDIR)$(ETC_DIR)/init.d/S90vtun
31  
32  # DO NOT DELETE THIS LINE -- make depend depends on it.
33 diff -urN vtun/scripts/vtund.rc.debian vtun-2.6/scripts/vtund.rc.debian
34 --- vtun/scripts/vtund.rc.debian        2000-03-26 10:06:37.000000000 -0700
35 +++ vtun-2.6/scripts/vtund.rc.debian    2003-06-05 12:38:46.000000000 -0600
36 @@ -1,92 +1,48 @@
37 -#! /usr/bin/perl -w
38 +#! /bin/sh
39 +#
40  
41 -### vtund-start
42 -###
43 -### script to start vtund as either a server or a client, according to
44 -### the config file /etc/vtund-start.conf
45 -###
46 -### Copyright 1999 Craig Sanders <cas@taz.net.au>
47 -###
48 -### Written for the Debian GNU/Linux distribution.  This script is free
49 -### software licensed under the terms of the GNU General Public License.
50 -
51 -$DAEMON="/usr/sbin/vtund" ;
52 -
53 -$do_what = shift ;
54 -$args="start|stop|reload|force-reload|restart" ;
55 -if ( $do_what !~ /^($args)$/i ) {
56 -    print "Usage: /etc/init.d/vtun {$args}\n" ;
57 -        exit 0 ;
58 -}
59 -
60 -$SSD="/sbin/start-stop-daemon" ;
61 -$SSDARGS="--verbose --exec $DAEMON" ;
62 -
63 -$sconf="/etc/vtund-start.conf" ;
64 -open(SCONF,"<$sconf") || die "couldn't open $sconf: $!\n" ;
65 -while (<SCONF>) {
66 -        chomp ;
67 -        s/#.*//;
68 -        s/^ +| +$//;
69 -        next if (/^$/) ;
70 -
71 -        @line = split ;
72 -        $host = shift(@line) ;
73 -        $server = shift(@line) ;
74 -        $args = "" ;
75 -        foreach (@line) { $args .= " $_" } ;
76 -
77 -        $host='' if ($host =~ /--server--/i ) ;
78 -
79 -        if ( $do_what eq 'start' ) {
80 -                &start($host,$server,$args) ;
81 -        } elsif ( $do_what eq 'stop' ) {
82 -                &stop($host,$server,$args) ;
83 -        } elsif ( $do_what eq 'restart' ) {
84 -                &stop($pidfile) ;
85 -                &start($host,$server,$args) ;
86 -        } elsif ( $do_what =~ /^(reload|force-reload)$/ ) {
87 -                &reload($host,$server) ;
88 -        }
89 -}
90 -close (SCONF);
91 -
92 -
93 -sub start {
94 -        my($host,$server,$args) = @_ ;
95 -    print "  Starting vtun " ;
96 -        if ($host eq '') {
97 -                print "server\n" ;
98 -        system "$SSD --start $SSDARGS -- $args -s -P $server" ;
99 -        } else {
100 -                print "client $host to $server\n" ;
101 -                $pidfile="/var/run/vtun.$host.$server" ;
102 -        system "$SSD --start $SSDARGS --pidfile $pidfile -- $args $host $server" ;
103 -        }
104 -} ;
105 -
106 -sub stop {
107 -        my($host,$server,$args) = @_ ;
108 -    print "  Stopping vtun " ;
109 -        if ($host eq '') {
110 -                print "server\n" ;
111 -        system "$SSD --stop $SSDARGS" ;
112 -        } else {
113 -                print "client $host to $server\n" ;
114 -                $pidfile="/var/run/vtun.$host.$server" ;
115 -        system "$SSD --stop $SSDARGS --pidfile $pidfile" ;
116 -        }
117 -} ;
118 -
119 -sub reload {
120 -        my($host,$server) = @_ ;
121 -    print "  Reloading vtun " ;
122 -        if ($host eq '') {
123 -                print "server\n" ;
124 -        system "$SSD --stop $SSDARGS --signal 1" ;
125 -        } else {
126 -                print "client $host to $server\n" ;
127 -                $pidfile="/var/run/vtun.$host.$server" ;
128 -        system "$SSD --stop $SSDARGS --signal 1 --pidfile $pidfile" ;
129 -        }
130 -}
131 +PATH=/bin:/usr/bin:/sbin:/usr/sbin
132 +DAEMON=/usr/sbin/vtund
133 +CONFFILE=/etc/vtund-start.conf
134 +PIDPREFIX=/var/run/vtund
135 +  
136 +test -f $DAEMON || exit 0
137 +  
138 +case "$1" in 
139 +       start)
140 +      # find all the defined tunnels
141 +      egrep -v '^[:space:]*(#.*)?$' $CONFFILE | while true;
142 +      do
143 +          read i
144 +          # no more lines available? done, then.
145 +          if [ $? != 0 ] ; then break; fi
146 +              SARGS=`echo $i|sed -ne 's/--server--\s*/-s -P /p'`;
147 +              if [ -n "$SARGS" ];
148 +              then
149 +                 echo "Starting vtund server."
150 +                  start-stop-daemon -S -x $DAEMON -- $SARGS;
151 +              else
152 +                  # split args into host and rest
153 +                  HOST=`echo $i|cut -f 1 -d " "`;
154 +                  TARGET=`echo $i|cut -f 2 -d " "`;
155 +                  echo  "Starting vtund client $HOST to $TARGET.";
156 +                  start-stop-daemon -S -x $DAEMON -- $i;
157 +              fi
158 +          done
159 +              ;;
160 +       stop) 
161 +          echo "Stopping vtund.";
162 +          start-stop-daemon -K -x vtund;
163 +          ;;
164 +
165 +       restart|reload|force-reload) 
166 +          $0 stop
167 +          sleep 1;
168 +          $0 start
169 +          ;;
170 +   *)
171 +      echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
172 +       exit 1
173 +               ;;
174 +esac
175 +exit 0
176 --- vtun-2.6/configure.dist     2004-03-11 10:39:10.000000000 -0600
177 +++ vtun-2.6/configure  2004-03-11 10:45:52.000000000 -0600
178 @@ -2112,7 +2112,7 @@
179      echo $ac_n "checking "for blowfish.h"""... $ac_c" 1>&6
180  echo "configure:2114: checking "for blowfish.h"" >&5 
181      ac_hdr_found=no
182 -    for p in $BLOWFISH_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include  /usr/include/crypto; do
183 +    for p in $BLOWFISH_HDR_DIR $SSL_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include  /usr/include/crypto; do
184         if test -n "$p"; then
185           dir="$p"
186         else