packages/ipv6/tspc/patches/001-debian_patches.patch
florian 37ed46d819 tspc: do not attempt patching the configuration file
This uses SED syntax which is unsupported most of the time, and we copy the
sample configuration so we do not really care

Signed-off-by: Florian Fainelli <florian@openwrt.org>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@39825 3c298f89-4303-0410-b956-a3cf2f4a3e73
2014-03-08 00:57:39 +00:00

234 lines
9.4 KiB
Diff

--- a/conf/Makefile
+++ b/conf/Makefile
@@ -34,15 +34,15 @@ tspc.conf.sample:
fi
@if [ -z "$(configdir)" ]; then \
if [ -z "$(installdir)" ]; then \
- sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+`cd ..;pwd`+" tspc.conf.in>$(BIN)/tspc.conf.sample; \
+ $(SED) -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+`cd ..;pwd`+" tspc.conf.in>$(BIN)/tspc.conf.sample; \
else \
- sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(installdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
+ $(SED) -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(installdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
fi \
else \
- 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; \
+ $(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; \
fi
- chmod 700 $(BIN)/tspc.conf.sample
+ chmod 600 $(BIN)/tspc.conf.sample
clean:
--- a/conf/tspc.conf.in
+++ b/conf/tspc.conf.in
@@ -18,13 +18,6 @@
# to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#------------------------------------------------------------------------------
-#
-#
-# tsp directory:
-# the only use is for the OS scripts which will be taken
-# from $tsp_dir/template
-#
-tsp_dir=@tsp_dir@
#
# authentication method:
@@ -66,28 +59,19 @@ passwd=
#
# Name of the script:
-# template=checktunnel|freebsd|netbsd|linux|windows|darwin|cisco|
-# solaris|openbsd
+# template=checktunnel|setup
#
# the value is the file name of the script in the tsp_dir/template directory
# The script will be executed after the TSP session is completed. The script
# is configuring the tunnel interface and routes.
# checktunnel is only printing information and does not configure any tunnel
-# freebsd is for FreeBSD 4.X and above
-# netbsd is for NetBSD 1.6 and above
-# linux is for Linux (most distributions)
-# windows is for WindowsXP
-# darwin is for MacOS X 10.2 and above
-# cisco is for Cisco IOS. This script prints the cisco configuration while
-# not configuring the cisco itself.
-# solaris is for Solaris 8 and above.
-# openbsd is for OpenBSD 3.X and above
+# setup will do the actual work
# you could customize your own script, name it and put the filename in
# the template variable.
# on unix, '.sh' is added to the name of the script.
# on windows, '.bat' is added to the name of the script.
#
-template=@target@
+template=setup
#
# 'server' is the tunnel broker identifier
--- a/platform/linux/tsp_local.c
+++ b/platform/linux/tsp_local.c
@@ -59,13 +59,13 @@
/* these globals are defined by US used by alot of things in */
-char *FileName = "tspc.conf";
-char *LogFile = "tspc.log";
+char *FileName = "/etc/tsp/tspc.conf";
+char *LogFile = "/var/log/tspc.log";
char *LogFileName = NULL;
-char *ScriptInterpretor = "/bin/sh";
+char *ScriptInterpretor = "";
char *ScriptExtension = "sh";
char *ScriptDir = NULL;
-char *TspHomeDir = "/usr/local/etc/tsp";
+char *TspHomeDir = "/etc/tsp";
char DirSeparator = '/';
int Verbose = 0;
@@ -143,7 +143,7 @@ int tspStartLocal(SOCKET socket, tConf *
{
int tunfd;
- Display(0, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile);
+ Display(1, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile);
if (daemon(0,0) == -1) {
Display(1, ELError, "tspStartLocal", "Unable to fork.");
--- a/src/lib/config.c
+++ b/src/lib/config.c
@@ -474,14 +474,17 @@ int tspVerifyConfig(tConf *Conf)
if(IsPresent(Conf->dns_server)) {
char *Server;
char *dns = strdup(Conf->dns_server);
+ struct addrinfo *contact;
if (eq(Conf->host_type, "host")) {
Display(1,ELError, "tspVerifyConfig", "DNS delegation is not supported for host_type=host");
status = 1;
}
for(Server = strtok(dns, ":");Server; Server = strtok(NULL, ":")) {
- if(gethostbyname(Server) == NULL) {
+ if(getaddrinfo(Server, "domain", 0, &contact)!=0) {
Display(1,ELError, "tspVerifyConfig", "DNS server name %s is not resolving.", Server);
status = 1;
+ } else {
+ freeaddrinfo(contact);
}
}
free(dns);
--- a/src/tsp/tsp_client.c
+++ b/src/tsp/tsp_client.c
@@ -275,7 +275,7 @@ int tspSetupTunnel(tConf *conf, net_tool
start_show:
- Display(0, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel");
+ Display(1, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel");
/* and start the show */
ret = tspStartLocal(socket, conf, &t, nt[conf->transport]);
@@ -337,8 +337,8 @@ int tspMain(int argc, char *argv[])
LogInit("tspc", LogFile);
Display( 1, ELInfo, "tspMain", "----- TSP Client Version %s Initializing -------------------------", TSP_CLIENT_VERSION);
- Display( 0, ELInfo, "tspMain", IDENTIFICATION);
- Display( 0, ELInfo, "tspMain", "Initializing (use -h for help)\n");
+ Display( 1, ELInfo, "tspMain", IDENTIFICATION);
+ Display( 1, ELInfo, "tspMain", "Initializing (use -h for help)\n");
if((status = tspInitialize(argc, argv, &c)) != 0) { // *** we have no uninitialize
if (status == -1) {
@@ -361,12 +361,12 @@ int tspMain(int argc, char *argv[])
/* first try with RUDP */
c.transport = NET_TOOLS_T_RUDP;
- Display( 0, ELInfo, "tspMain", "\nConnecting to server with reliable udp");
+ Display( 1, ELInfo, "tspMain", "\nConnecting to server with reliable udp");
try_server:
if (c.transport == NET_TOOLS_T_TCP)
- Display( 0, ELInfo, "tspMain", "\nConnecting to server with tcp");
+ Display( 1, ELInfo, "tspMain", "\nConnecting to server with tcp");
Display( 1, ELInfo, "tspMain", "Using TSP protocol version %s",
TspProtocolVersionStrings[version_index]);
--- a/template/linux.sh
+++ b/template/linux.sh
@@ -135,9 +135,7 @@ if [ X"${TSP_HOST_TYPE}" = X"host" ] ||
#
# Default route
Display 1 "Adding default route"
- ExecNoCheck $route -A inet6 del ::/0 2>/dev/null # delete old default route
ExecNoCheck $route -A inet6 del 2000::/3 2>/dev/null # delete old gw route
- Exec $route -A inet6 add ::/0 dev $TSP_TUNNEL_INTERFACE
Exec $route -A inet6 add 2000::/3 dev $TSP_TUNNEL_INTERFACE
fi
@@ -147,9 +145,10 @@ if [ X"${TSP_HOST_TYPE}" = X"router" ];
Display 1 "Kernel setup"
if [ X"${TSP_PREFIXLEN}" != X"64" ]; then
#Better way on linux to avoid loop with the remaining /48?
- $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
+ ExecNoCheck $route -A inet6 del $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
+ Exec $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE
fi
- Exec $sysctl -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled
+ Exec $sysctl -q -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled
Display 1 "Adding prefix to $TSP_HOME_INTERFACE"
OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
if [ ! -z $OLDADDR ]; then
@@ -157,28 +156,28 @@ if [ X"${TSP_HOST_TYPE}" = X"router" ];
Exec $ifconfig $TSP_HOME_INTERFACE inet6 del $OLDADDR
fi
Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64
- # Router advertisement configuration
- Display 1 "Create new $rtadvdconfigfile"
- echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile"
- echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
- echo "{" >> "$rtadvdconfigfile"
- echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
- echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
- echo " {" >> "$rtadvdconfigfile"
- echo " AdvOnLink on;" >> "$rtadvdconfigfile"
- echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
- echo " };" >> "$rtadvdconfigfile"
- echo "};" >> "$rtadvdconfigfile"
- echo "" >> "$rtadvdconfigfile"
- /etc/init.d/radvd stop
- if [ -f $rtadvdconfigfile ]; then
- KillProcess $rtadvdconfigfile
- Exec $rtadvd -u radvd -C $rtadvdconfigfile
- Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile"
- else
- echo "Error : file $rtadvdconfigfile not found"
- exit 1
- fi
+# # Router advertisement configuration
+# Display 1 "Create new $rtadvdconfigfile"
+# echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile"
+# echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
+# echo "{" >> "$rtadvdconfigfile"
+# echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
+# echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
+# echo " {" >> "$rtadvdconfigfile"
+# echo " AdvOnLink on;" >> "$rtadvdconfigfile"
+# echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
+# echo " };" >> "$rtadvdconfigfile"
+# echo "};" >> "$rtadvdconfigfile"
+# echo "" >> "$rtadvdconfigfile"
+# /etc/init.d/radvd stop
+# if [ -f $rtadvdconfigfile ]; then
+# KillProcess $rtadvdconfigfile
+# Exec $rtadvd -u radvd -C $rtadvdconfigfile
+# Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile"
+# else
+# echo "Error : file $rtadvdconfigfile not found"
+# exit 1
+# fi
fi
Display 1 "--- End of configuration script. ---"