summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-09-18 11:50:07 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2017-09-19 11:22:55 +0100
commit0ab63f3dea522591218c0d65c78a686b7fa64db6 (patch)
tree0e95c7b2d8125f7dec65f148750e2703714312db /test
parentc4d5e329acddb83df43254990f98c53cd5b1fbf7 (diff)
TFO: early-data for client outbound via socks5 proxy
Diffstat (limited to 'test')
-rw-r--r--test/confs/402011
l---------test/confs/40271
-rw-r--r--test/log/40276
-rw-r--r--test/scripts/4020-socks/40203
-rw-r--r--test/scripts/4027-TFO-socks/402783
-rw-r--r--test/scripts/4027-TFO-socks/REQUIRES2
-rw-r--r--test/src/server.c21
-rw-r--r--test/stdout/402766
8 files changed, 185 insertions, 8 deletions
diff --git a/test/confs/4020 b/test/confs/4020
index 8dfd46888..05c95a571 100644
--- a/test/confs/4020
+++ b/test/confs/4020
@@ -32,11 +32,12 @@ my_main_router:
begin transports
my_smtp:
- driver = smtp
- interface = HOSTIPV4
- port = PORT_S
- hide socks_proxy = 127.0.0.1 port=PORT_D OPT
- debug_print = transport_name <$transport_name>
+ driver = smtp
+ interface = HOSTIPV4
+ port = PORT_S
+ hide socks_proxy = 127.0.0.1 port=PORT_D OPT
+ hosts_try_fastopen = ${if eq {$local_part}{user_tfo} {*}}
+ debug_print = transport_name <$transport_name>
# End
diff --git a/test/confs/4027 b/test/confs/4027
new file mode 120000
index 000000000..4af051ca9
--- /dev/null
+++ b/test/confs/4027
@@ -0,0 +1 @@
+4020 \ No newline at end of file
diff --git a/test/log/4027 b/test/log/4027
new file mode 100644
index 000000000..ed6b92611
--- /dev/null
+++ b/test/log/4027
@@ -0,0 +1,6 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 => user_tfo@test.ex R=my_main_router T=my_smtp H=127.0.0.1 [127.0.0.1]:1224 PRX=[127.0.0.1]:1225 C="250 accepted OK"
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss
+1999-03-02 09:44:33 10HmaY-0005vi-00 => user_tfo@test.ex R=my_main_router T=my_smtp H=127.0.0.1 [127.0.0.1]:1224 PRX=[127.0.0.1]:1225 C="250 accepted OK"
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
diff --git a/test/scripts/4020-socks/4020 b/test/scripts/4020-socks/4020
index 44c885b8d..4a0ac0893 100644
--- a/test/scripts/4020-socks/4020
+++ b/test/scripts/4020-socks/4020
@@ -81,5 +81,4 @@ quit
****
#
#
-#
-
+# Ends
diff --git a/test/scripts/4027-TFO-socks/4027 b/test/scripts/4027-TFO-socks/4027
new file mode 100644
index 000000000..533021cbf
--- /dev/null
+++ b/test/scripts/4027-TFO-socks/4027
@@ -0,0 +1,83 @@
+# socks5 proxy on smtp transport, TCP Fast Open
+#
+munge loopback
+#
+#
+# TFO client, not server
+server PORT_D
+<<\x05\x01\x00
+>>\x05\x00
+<<\x05\x01\x00\x01\x7f\x00\x00\x01\x04\xc8
+>>\x05\x00\x00\x01\x7f\x00\x00\x01\xbe\xef
+220 Connected OK
+EHLO
+250-server id
+250
+MAIL FROM
+250
+RCPT TO
+250
+DATA
+354 do me
+.
+250 accepted OK
+QUIT
+250 bye
+****
+#
+#
+exim -odi -bs -DOPT=
+ehlo test.ex
+mail from:<>
+rcpt to:<user_tfo@test.ex>
+data
+Date: Fri, 17 Dec 2004 14:35:01 +0100
+Subject: message should be sent
+
+connection trying TFO
+via null-auth proxy
+.
+quit
+****
+#
+#
+#
+# TFO client and server
+server -tfo PORT_D
+<<\x05\x01\x00
+>>\x05\x00
+<<\x05\x01\x00\x01\x7f\x00\x00\x01\x04\xc8
+>>\x05\x00\x00\x01\x7f\x00\x00\x01\xbe\xef
+220 Connected OK
+EHLO
+250-server id
+250
+MAIL FROM
+250
+RCPT TO
+250
+DATA
+354 do me mate
+.
+250 accepted OK
+QUIT
+250 bye
+****
+#
+#
+exim -odi -bs -DOPT=
+ehlo test.ex
+mail from:<>
+rcpt to:<user_tfo@test.ex>
+data
+Date: Fri, 17 Dec 2004 14:35:01 +0100
+Subject: message should be sent
+
+connection using TFO
+via null-auth proxy
+.
+quit
+****
+#
+#
+# Ends
diff --git a/test/scripts/4027-TFO-socks/REQUIRES b/test/scripts/4027-TFO-socks/REQUIRES
new file mode 100644
index 000000000..f7e42e611
--- /dev/null
+++ b/test/scripts/4027-TFO-socks/REQUIRES
@@ -0,0 +1,2 @@
+support SOCKS
+support TCP_Fast_Open
diff --git a/test/src/server.c b/test/src/server.c
index ce55c5c37..4656b02af 100644
--- a/test/src/server.c
+++ b/test/src/server.c
@@ -26,6 +26,7 @@ on all interfaces, unless the option -noipv6 is given. */
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/tcp.h>
#ifdef HAVE_NETINET_IP_VAR_H
# include <netinet/ip_var.h>
@@ -169,7 +170,7 @@ int connection_count = 1;
int count;
int on = 1;
int timeout = 5;
-int initial_pause = 0;
+int initial_pause = 0, tfo = 0;
int use_ipv4 = 1;
int use_ipv6 = 1;
int debug = 0;
@@ -214,6 +215,7 @@ if (argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))
"\n\t-noipv6 disable ipv6"
"\n\t-oP file write PID to file"
"\n\t-t n n seconds timeout"
+ "\n\t-tfo enable TCP Fast Open"
);
exit(0);
}
@@ -221,6 +223,7 @@ if (argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))
while (na < argc && argv[na][0] == '-')
{
if (strcmp(argv[na], "-d") == 0) debug = 1;
+ else if (strcmp(argv[na], "-tfo") == 0) tfo = 1;
else if (strcmp(argv[na], "-t") == 0)
{
if (tmo_noerror = ((timeout = atoi(argv[++na])) < 0)) timeout = -timeout;
@@ -296,6 +299,14 @@ else
exit(1);
}
+ if (tfo)
+ {
+ int backlog = 5;
+ if (setsockopt(listen_socket[v6n], IPPROTO_TCP, TCP_FASTOPEN,
+ &backlog, sizeof(backlog)))
+ if (debug) printf("setsockopt TCP_FASTOPEN: %s\n", strerror(errno));
+ }
+
/* If this is an IPv6 wildcard socket, set IPV6_V6ONLY if that option is
available. */
@@ -319,6 +330,14 @@ else
printf("IPv4 socket creation failed: %s\n", strerror(errno));
exit(1);
}
+ if (tfo)
+ {
+ int backlog = 5;
+ if (setsockopt(listen_socket[v4n], IPPROTO_TCP, TCP_FASTOPEN,
+ &backlog, sizeof(backlog)))
+ if (debug) printf("setsockopt TCP_FASTOPEN: %s\n", strerror(errno));
+ }
+
}
}
diff --git a/test/stdout/4027 b/test/stdout/4027
new file mode 100644
index 000000000..74837c4ac
--- /dev/null
+++ b/test/stdout/4027
@@ -0,0 +1,66 @@
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250-myhost.test.ex Hello CALLER at test.ex
+250-SIZE 52428800
+250-8BITMIME
+250-PIPELINING
+250 HELP
+250 OK
+250 Accepted
+354 Enter message, ending with "." on a line by itself
+250 OK id=10HmaX-0005vi-00
+221 myhost.test.ex closing connection
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250-myhost.test.ex Hello CALLER at test.ex
+250-SIZE 52428800
+250-8BITMIME
+250-PIPELINING
+250 HELP
+250 OK
+250 Accepted
+354 Enter message, ending with "." on a line by itself
+250 OK id=10HmaY-0005vi-00
+221 myhost.test.ex closing connection
+
+******** SERVER ********
+Listening on port 1225 ...
+Connection request from [ip4.ip4.ip4.ip4]
+<<\x05\x01\x00
+>>\x05\x00
+<<\x05\x01\x00\x01\x7f\x00\x00\x01\x04\xc8
+>>\x05\x00\x00\x01\x7f\x00\x00\x01\xbe\xef
+220 Connected OK
+EHLO
+250-server id
+250
+MAIL FROM
+250
+RCPT TO
+250
+DATA
+354 do me
+R
+250 accepted OK
+QUIT
+250 bye
+End of script
+Listening on port 1225 ...
+Connection request from [ip4.ip4.ip4.ip4]
+<<\x05\x01\x00
+>>\x05\x00
+<<\x05\x01\x00\x01\x7f\x00\x00\x01\x04\xc8
+>>\x05\x00\x00\x01\x7f\x00\x00\x01\xbe\xef
+220 Connected OK
+EHLO
+250-server id
+250
+MAIL FROM
+250
+RCPT TO
+250
+DATA
+354 do me mate
+R
+250 accepted OK
+QUIT
+250 bye
+End of script