summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DEDICATION2
-rw-r--r--Mk/release.mk2
-rw-r--r--src/ot_config.c4
-rw-r--r--src/ot_socket.c8
-rw-r--r--tests/integration/test_config.py26
5 files changed, 30 insertions, 12 deletions
diff --git a/DEDICATION b/DEDICATION
new file mode 100644
index 0000000..eca7d99
--- /dev/null
+++ b/DEDICATION
@@ -0,0 +1,2 @@
1This release is dedicated to Felix von Leitner, whose libowfat carried
2opentracker for its first eighteen years.
diff --git a/Mk/release.mk b/Mk/release.mk
index 5c4afe9..e5336e0 100644
--- a/Mk/release.mk
+++ b/Mk/release.mk
@@ -2,7 +2,7 @@
2# In a checkout it is absent and git answers instead. A release is always 2# In a checkout it is absent and git answers instead. A release is always
3# tagged, so in a tarball both of these are that tag, and the gitweb link 3# tagged, so in a tarball both of these are that tag, and the gitweb link
4# is to it. Between releases there is no tag and the version is the commit. 4# is to it. Between releases there is no tag and the version is the commit.
5VERSION=1.0.0 5VERSION=2.0.0
6 6
7TARBALL_VERSION=test -r .tarball-version && read v < .tarball-version && echo "$$v" 7TARBALL_VERSION=test -r .tarball-version && read v < .tarball-version && echo "$$v"
8HAVE_GIT=command -v git >/dev/null && test -d .git 8HAVE_GIT=command -v git >/dev/null && test -d .git
diff --git a/src/ot_config.c b/src/ot_config.c
index 36f50a6..6b51c61 100644
--- a/src/ot_config.c
+++ b/src/ot_config.c
@@ -320,7 +320,7 @@ static int parse_configfile(char *config_filename) {
320 int off = scan_ip6_port(p, tmpip, &tmpport); 320 int off = scan_ip6_port(p, tmpip, &tmpport);
321 321
322 if (!off || !listen_scan_options(p + off, &shared, &workers)) 322 if (!off || !listen_scan_options(p + off, &shared, &workers))
323 goto parse_error; 323 exerr("listen.tcp, listen.udp and listen.tcp_udp want an address, optionally a port and options.");
324 if (kind != CONFIG_LISTEN_UDP) 324 if (kind != CONFIG_LISTEN_UDP)
325 listen_append(tmpip, tmpport, FLAG_TCP, shared, workers), ++bound; 325 listen_append(tmpip, tmpport, FLAG_TCP, shared, workers), ++bound;
326 if (kind != CONFIG_LISTEN_TCP) 326 if (kind != CONFIG_LISTEN_TCP)
@@ -446,7 +446,7 @@ static void help(char *name) {
446 fprintf(stderr, "\nExample: ./opentracker -i 127.0.0.1 -p 6969 -P 6969 -f ./opentracker.conf -i 10.1.1.23 -p 2710 -p 80\n"); 446 fprintf(stderr, "\nExample: ./opentracker -i 127.0.0.1 -p 6969 -P 6969 -f ./opentracker.conf -i 10.1.1.23 -p 2710 -p 80\n");
447 fprintf(stderr, " Here -i 127.0.0.1 selects the ip address for the next -p 6969 and -P 6969.\n"); 447 fprintf(stderr, " Here -i 127.0.0.1 selects the ip address for the next -p 6969 and -P 6969.\n");
448 fprintf(stderr, " If no port is bound from config file or command line, the last address given\n"); 448 fprintf(stderr, " If no port is bound from config file or command line, the last address given\n");
449 fprintf(stderr, " (or ::1 if none is set) will be used on port 6969.\n"); 449 fprintf(stderr, " is used on port 6969, and every interface if none was given.\n");
450} 450}
451#undef HELPLINE 451#undef HELPLINE
452 452
diff --git a/src/ot_socket.c b/src/ot_socket.c
index 79bb01a..b6a1803 100644
--- a/src/ot_socket.c
+++ b/src/ot_socket.c
@@ -263,15 +263,9 @@ static int socket_v4_bind(const ot_ip6 ip, uint16_t port) {
263 263
264int socket_mcast_join(const ot_ip6 group, const ot_ip6 interface, uint16_t port) { 264int socket_mcast_join(const ot_ip6 group, const ot_ip6 interface, uint16_t port) {
265 struct ip_mreq mreq; 265 struct ip_mreq mreq;
266 ot_ip6 any;
267 int s; 266 int s;
268 267
269 /* The group is what is listened to, so the socket takes the wildcard and 268 if ((s = socket_v4_bind(group, port)) == -1)
270 the join names the interface to receive it on */
271 memcpy(any, ip_v4mapped_prefix, sizeof(ip_v4mapped_prefix));
272 memset(any + sizeof(ip_v4mapped_prefix), 0, 4);
273
274 if ((s = socket_v4_bind(any, port)) == -1)
275 return -1; 269 return -1;
276 270
277 memset(&mreq, 0, sizeof(mreq)); 271 memset(&mreq, 0, sizeof(mreq));
diff --git a/tests/integration/test_config.py b/tests/integration/test_config.py
index 1a84fa7..2f6bdc4 100644
--- a/tests/integration/test_config.py
+++ b/tests/integration/test_config.py
@@ -1,7 +1,9 @@
1"""Settings the tracker has to accept, and still work with. 1"""Settings the tracker has to accept, and still work with.
2 2
3An unrecognised key makes opentracker refuse to start, so a test that it 3An unrecognised key only warns, so coming up proves nothing on its own and a
4comes up at all is a test that the key was understood. 4test that cares has to look at what the tracker said. A key that is
5recognised but cannot be parsed is another matter, and for the listen
6statements it stops the tracker.
5""" 7"""
6 8
7import unittest 9import unittest
@@ -14,6 +16,7 @@ class TcpWorkers(TrackerTestCase):
14 16
15 def test_the_tracker_serves_with_tcp_workers_asked_for(self): 17 def test_the_tracker_serves_with_tcp_workers_asked_for(self):
16 self.assertEqual(self.tracker.announce(self.hash_for("tcpworkers"))[b"complete"], 1) 18 self.assertEqual(self.tracker.announce(self.hash_for("tcpworkers"))[b"complete"], 1)
19 self.assertNotIn("Unhandled line", self.tracker.output())
17 20
18 21
19class WorkersOnAListenStatement(unittest.TestCase): 22class WorkersOnAListenStatement(unittest.TestCase):
@@ -27,3 +30,22 @@ class WorkersOnAListenStatement(unittest.TestCase):
27 self.assertEqual(complaints, [], "the tracker reported:\n" + "\n".join(complaints)) 30 self.assertEqual(complaints, [], "the tracker reported:\n" + "\n".join(complaints))
28 finally: 31 finally:
29 tracker._cleanup() 32 tracker._cleanup()
33
34
35class AListenLineThatDoesNotParse(unittest.TestCase):
36 """Warning and carrying on left a tracker that had been told where to
37 listen coming up on its default instead, which is every interface."""
38
39 def refuses(self, line):
40 with self.assertRaises(AssertionError) as caught:
41 Tracker(line)
42 return str(caught.exception)
43
44 def test_an_address_that_is_not_one_stops_the_tracker(self):
45 self.assertIn("want an address", self.refuses("listen.tcp 10.0.0.300:7999\n"))
46
47 def test_so_does_a_port_out_of_range(self):
48 self.assertIn("want an address", self.refuses("listen.udp 127.0.0.1:99999\n"))
49
50 def test_so_does_an_option_it_does_not_know(self):
51 self.assertIn("want an address", self.refuses("listen.tcp 127.0.0.1:7999 wokers=2\n"))