aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/stress-testing/badpacket.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/stress-testing/badpacket.c')
-rw-r--r--contrib/stress-testing/badpacket.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/stress-testing/badpacket.c b/contrib/stress-testing/badpacket.c
new file mode 100644
index 0000000..eee61fc
--- /dev/null
+++ b/contrib/stress-testing/badpacket.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <linux/limits.h>
+
+int main(int argc, char *argv[])
+{
+ static const unsigned char handshake1[143] = { 1, 0 };
+ int fd = socket(AF_INET, SOCK_DGRAM, 0);
+ struct sockaddr_in addr = {
+ .sin_family = AF_INET,
+ .sin_port = htons(atoi(argv[2])),
+ .sin_addr = inet_addr(argv[1])
+ };
+ connect(fd, (struct sockaddr *)&addr, sizeof(addr));
+
+ for (;;)
+ send(fd, handshake1, sizeof(handshake1), 0);
+
+ close(fd);
+
+ return 0;
+}