3a958f6588817510bfb1d776e01008d8873cb84c
[packages.git] / ipv6 / tspc / patches / 001-debian_patches.patch
1 diff -Nur tspc2/conf/Makefile tspc2.owrt/conf/Makefile
2 --- tspc2/conf/Makefile 2004-03-29 17:37:56.000000000 +0200
3 +++ tspc2.owrt/conf/Makefile    2007-02-19 16:07:05.000000000 +0100
4 @@ -42,7 +42,7 @@
5          sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(configdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
6         fi
7  
8 -       chmod 700 $(BIN)/tspc.conf.sample
9 +       chmod 600 $(BIN)/tspc.conf.sample
10         
11  
12  clean:
13 diff -Nur tspc2/conf/tspc.conf.in tspc2.owrt/conf/tspc.conf.in
14 --- tspc2/conf/tspc.conf.in     2004-06-15 17:01:01.000000000 +0200
15 +++ tspc2.owrt/conf/tspc.conf.in        2007-02-19 16:07:05.000000000 +0100
16 @@ -18,13 +18,6 @@
17  # to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
18  # MA 02111-1307 USA
19  #------------------------------------------------------------------------------
20 -#
21 -#
22 -# tsp directory:
23 -#  the only use is for the OS scripts which will be taken 
24 -#  from $tsp_dir/template
25 -#
26 -tsp_dir=@tsp_dir@
27  
28  #
29  # authentication method:
30 @@ -66,28 +59,19 @@
31  
32  #
33  # Name of the script:
34 -# template=checktunnel|freebsd|netbsd|linux|windows|darwin|cisco|
35 -#   solaris|openbsd
36 +# template=checktunnel|setup
37  #
38  # the value is the file name of the script in the tsp_dir/template directory
39  # The script will be executed after the TSP session is completed. The script
40  #  is configuring the tunnel interface and routes.
41  # checktunnel is only printing information and does not configure any tunnel
42 -# freebsd is for FreeBSD 4.X and above
43 -# netbsd is for NetBSD 1.6 and above
44 -# linux is for Linux (most distributions)
45 -# windows is for WindowsXP
46 -# darwin is for MacOS X 10.2 and above
47 -# cisco is for Cisco IOS. This script prints the cisco configuration while
48 -#  not configuring the cisco itself.
49 -# solaris is for Solaris 8 and above.
50 -# openbsd is for OpenBSD 3.X and above
51 +# setup will do the actual work
52  # you could customize your own script, name it and put the filename in 
53  #  the template variable.
54  # on unix, '.sh' is added to the name of the script. 
55  # on windows, '.bat' is added to the name of the script.
56  # 
57 -template=@target@
58 +template=setup
59  
60  #
61  # 'server' is the tunnel broker identifier
62 diff -Nur tspc2/platform/linux/tsp_local.c tspc2.owrt/platform/linux/tsp_local.c
63 --- tspc2/platform/linux/tsp_local.c    2004-07-07 21:25:47.000000000 +0200
64 +++ tspc2.owrt/platform/linux/tsp_local.c       2007-02-19 16:07:18.000000000 +0100
65 @@ -59,13 +59,13 @@
66  
67  /* these globals are defined by US used by alot of things in  */
68  
69 -char *FileName  = "tspc.conf";
70 -char *LogFile   = "tspc.log";
71 +char *FileName  = "/etc/tsp/tspc.conf";
72 +char *LogFile   = "/var/log/tspc.log";
73  char *LogFileName = NULL;
74 -char *ScriptInterpretor = "/bin/sh";
75 +char *ScriptInterpretor = "";
76  char *ScriptExtension = "sh";
77  char *ScriptDir = NULL;
78 -char *TspHomeDir = "/usr/local/etc/tsp";
79 +char *TspHomeDir = "/etc/tsp";
80  char DirSeparator = '/';
81  
82  int Verbose = 0;
83 @@ -143,7 +143,7 @@
84         {
85                   int tunfd;
86  
87 -                 Display(0, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile);
88 +                 Display(1, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile);
89  
90                   if (daemon(0,0) == -1) {
91                           Display(1, ELError, "tspStartLocal", "Unable to fork.");
92 diff -Nur tspc2/src/lib/config.c tspc2.owrt/src/lib/config.c
93 --- tspc2/src/lib/config.c      2004-06-29 17:06:13.000000000 +0200
94 +++ tspc2.owrt/src/lib/config.c 2007-02-19 16:07:11.000000000 +0100
95 @@ -474,14 +474,17 @@
96    if(IsPresent(Conf->dns_server)) {
97       char *Server;
98       char *dns = strdup(Conf->dns_server);
99 +     struct addrinfo *contact;
100       if (eq(Conf->host_type, "host")) {
101         Display(1,ELError, "tspVerifyConfig", "DNS delegation is not supported for host_type=host");
102         status = 1;
103       }
104       for(Server = strtok(dns, ":");Server; Server = strtok(NULL, ":")) {
105 -        if(gethostbyname(Server) == NULL) {
106 +        if(getaddrinfo(Server, "domain", 0, &contact)!=0) {
107             Display(1,ELError, "tspVerifyConfig", "DNS server name %s is not resolving.", Server);
108             status = 1;
109 +        } else {
110 +           freeaddrinfo(contact);
111          }
112       }
113       free(dns);
114 diff -Nur tspc2/src/tsp/tsp_client.c tspc2.owrt/src/tsp/tsp_client.c
115 --- tspc2/src/tsp/tsp_client.c  2004-04-20 17:10:58.000000000 +0200
116 +++ tspc2.owrt/src/tsp/tsp_client.c     2007-02-19 16:07:18.000000000 +0100
117 @@ -275,7 +275,7 @@
118  
119  start_show:
120  
121 -       Display(0, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel");
122 +       Display(1, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel");
123  
124         /* and start the show */
125         ret = tspStartLocal(socket, conf, &t, nt[conf->transport]);
126 @@ -337,8 +337,8 @@
127         LogInit("tspc", LogFile);
128  
129         Display( 1, ELInfo, "tspMain", "----- TSP Client Version %s Initializing -------------------------", TSP_CLIENT_VERSION);
130 -       Display( 0, ELInfo, "tspMain", IDENTIFICATION);
131 -       Display( 0, ELInfo, "tspMain", "Initializing (use -h for help)\n");
132 +       Display( 1, ELInfo, "tspMain", IDENTIFICATION);
133 +       Display( 1, ELInfo, "tspMain", "Initializing (use -h for help)\n");
134  
135         if((status = tspInitialize(argc, argv, &c)) != 0) {     // *** we have no uninitialize
136                 if (status == -1) {
137 @@ -361,12 +361,12 @@
138  
139         /* first try with RUDP */
140         c.transport = NET_TOOLS_T_RUDP;
141 -       Display( 0, ELInfo, "tspMain", "\nConnecting to server with reliable udp");
142 +       Display( 1, ELInfo, "tspMain", "\nConnecting to server with reliable udp");
143  
144  try_server:
145  
146         if (c.transport == NET_TOOLS_T_TCP)
147 -               Display( 0, ELInfo, "tspMain", "\nConnecting to server with tcp");
148 +               Display( 1, ELInfo, "tspMain", "\nConnecting to server with tcp");
149  
150         Display( 1, ELInfo, "tspMain", "Using TSP protocol version %s",
151                 TspProtocolVersionStrings[version_index]); 
152 diff -Nur tspc2/template/linux.sh tspc2.owrt/template/linux.sh
153 --- tspc2/template/linux.sh     2004-06-23 23:29:20.000000000 +0200
154 +++ tspc2.owrt/template/linux.sh        2007-02-19 16:08:39.000000000 +0100
155 @@ -135,9 +135,7 @@
156     # 
157     # Default route  
158     Display 1 "Adding default route"
159 -   ExecNoCheck $route -A inet6 del ::/0 2>/dev/null # delete old default route
160     ExecNoCheck $route -A inet6 del 2000::/3 2>/dev/null  # delete old gw route
161 -   Exec $route -A inet6 add ::/0 dev $TSP_TUNNEL_INTERFACE
162     Exec $route -A inet6 add 2000::/3 dev $TSP_TUNNEL_INTERFACE
163  fi
164  
165 @@ -147,9 +145,10 @@
166     Display 1 "Kernel setup"
167     if [ X"${TSP_PREFIXLEN}" != X"64" ]; then
168        #Better way on linux to avoid loop with the remaining /48?
169 -      $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
170 +      ExecNoCheck $route -A inet6 del $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
171 +      Exec $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE
172     fi
173 -   Exec $sysctl -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled
174 +   Exec $sysctl -q -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled
175     Display 1 "Adding prefix to $TSP_HOME_INTERFACE"
176     OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
177     if [ ! -z $OLDADDR ]; then
178 @@ -157,28 +156,28 @@
179        Exec $ifconfig $TSP_HOME_INTERFACE inet6 del $OLDADDR
180     fi
181     Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64
182 -   # Router advertisement configuration 
183 -   Display 1 "Create new $rtadvdconfigfile"
184 -   echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile"
185 -   echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
186 -   echo "{" >> "$rtadvdconfigfile"
187 -   echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
188 -   echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
189 -   echo " {" >> "$rtadvdconfigfile"
190 -   echo " AdvOnLink on;" >> "$rtadvdconfigfile"
191 -   echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
192 -   echo " };" >> "$rtadvdconfigfile"
193 -   echo "};" >> "$rtadvdconfigfile"
194 -   echo "" >> "$rtadvdconfigfile"
195 -   /etc/init.d/radvd stop
196 -   if [ -f $rtadvdconfigfile ]; then
197 -      KillProcess $rtadvdconfigfile
198 -      Exec $rtadvd -u radvd -C $rtadvdconfigfile
199 -      Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile"
200 -   else
201 -      echo "Error : file $rtadvdconfigfile not found"
202 -      exit 1
203 -   fi
204 +#   # Router advertisement configuration 
205 +#   Display 1 "Create new $rtadvdconfigfile"
206 +#   echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile"
207 +#   echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
208 +#   echo "{" >> "$rtadvdconfigfile"
209 +#   echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
210 +#   echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
211 +#   echo " {" >> "$rtadvdconfigfile"
212 +#   echo " AdvOnLink on;" >> "$rtadvdconfigfile"
213 +#   echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
214 +#   echo " };" >> "$rtadvdconfigfile"
215 +#   echo "};" >> "$rtadvdconfigfile"
216 +#   echo "" >> "$rtadvdconfigfile"
217 +#   /etc/init.d/radvd stop
218 +#   if [ -f $rtadvdconfigfile ]; then
219 +#      KillProcess $rtadvdconfigfile
220 +#      Exec $rtadvd -u radvd -C $rtadvdconfigfile
221 +#      Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile"
222 +#   else
223 +#      echo "Error : file $rtadvdconfigfile not found"
224 +#      exit 1
225 +#   fi
226  fi
227  
228  Display 1 "--- End of configuration script. ---"