From: Guus Sliepen Date: Wed, 5 Oct 2011 20:05:13 +0000 (+0200) Subject: Test corner cases in the SPTPS protocol. X-Git-Tag: import-tinc-1.1~411 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=67ff81ec16b8ab5f15d16efbedfecfaf0be17c13;p=meshlink Test corner cases in the SPTPS protocol. * Test zero-byte messages. * Test maximum size (65535 byte) messages. * Test different message types. * Test key renegotiation. --- diff --git a/src/sptps_test.c b/src/sptps_test.c index 7b33eef1..866159eb 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) { return 1; while(true) { - char buf[4095]; + char buf[65535] = ""; struct pollfd fds[2]; fds[0].fd = 0; @@ -139,7 +139,12 @@ int main(int argc, char *argv[]) { } if(len == 0) break; - if(!send_record(&s, 0, buf, len)) + if(buf[0] == '^') + send_record(&s, SPTPS_HANDSHAKE, NULL, 0); + else if(buf[0] == '$') + force_kex(&s); + else + if(!send_record(&s, buf[0] == '!' ? 1 : 0, buf, buf[0] == '\n' ? 0 : buf[0] == '*' ? sizeof buf : len)) return 1; }