summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-05-26 17:43:49 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-05-26 17:44:51 +0200
commit0e1ce4f491e2134d6207f55c4a5f52e157a54707 (patch)
tree8acfb557824eeb93f645622edd1d5be06501a533 /qa
parent1975dc432a57a78880e28aadceb3d7bcf923fe8b (diff)
downloadconntrack-tools-0e1ce4f491e2134d6207f55c4a5f52e157a54707.tar.gz
conntrack-tools-0e1ce4f491e2134d6207f55c4a5f52e157a54707.zip
move qa directory to tests/conntrack/
All automated testing for the conntrack-tools will now reside under the test directory. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'qa')
-rw-r--r--qa/test-conntrack.c94
-rw-r--r--qa/testsuite/00create20
-rw-r--r--qa/testsuite/01delete6
-rw-r--r--qa/testsuite/02filter23
-rw-r--r--qa/testsuite/03nat40
-rw-r--r--qa/testsuite/04zone8
-rw-r--r--qa/testsuite/05mark27
-rw-r--r--qa/testsuite/06update8
8 files changed, 0 insertions, 226 deletions
diff --git a/qa/test-conntrack.c b/qa/test-conntrack.c
deleted file mode 100644
index c9097b6..0000000
--- a/qa/test-conntrack.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Very simple test-tool for the command line tool `conntrack'.
- * This code is released under GPLv2 or any later at your option.
- *
- * gcc test-conntrack.c -o test
- *
- * Do not forget that you need *root* or CAP_NET_ADMIN capabilities ;-)
- *
- * (c) 2008 Pablo Neira Ayuso <pablo@netfilter.org>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <dirent.h>
-
-#define CT_PROG "/usr/sbin/conntrack"
-
-int main()
-{
- int ret, ok = 0, bad = 0, line;
- FILE *fp;
- DIR *d;
- char buf[1024];
- struct dirent *dent;
- char file[1024];
-
- d = opendir("testsuite");
-
- while ((dent = readdir(d)) != NULL) {
-
- sprintf(file, "testsuite/%s", dent->d_name);
-
- line = 0;
-
- fp = fopen(file, "r");
- if (fp == NULL) {
- perror("cannot find testsuite file");
- exit(EXIT_FAILURE);
- }
-
- while (fgets(buf, sizeof(buf), fp)) {
- char tmp[1024] = CT_PROG, *res;
- tmp[strlen(CT_PROG)] = ' ';
-
- line++;
-
- if (buf[0] == '#' || buf[0] == ' ')
- continue;
-
- res = strchr(buf, ';');
- if (!res) {
- printf("malformed file %s at line %d\n",
- dent->d_name, line);
- exit(EXIT_FAILURE);
- }
- *res = '\0';
- res+=2;
-
- strcpy(tmp + strlen(CT_PROG) + 1, buf);
- printf("(%d) Executing: %s\n", line, tmp);
-
- ret = system(tmp);
-
- if (WIFEXITED(ret) &&
- WEXITSTATUS(ret) == EXIT_SUCCESS) {
- if (res[0] == 'O' &&
- res[1] == 'K')
- ok++;
- else {
- bad++;
- printf("^----- BAD\n");
- }
- } else {
- if (res[0] == 'B' &&
- res[1] == 'A' &&
- res[2] == 'D')
- ok++;
- else {
- bad++;
- printf("^----- BAD\n");
- }
- }
- printf("=====\n");
- }
- fclose(fp);
- }
- closedir(d);
-
- fprintf(stdout, "OK: %d BAD: %d\n", ok, bad);
-}
diff --git a/qa/testsuite/00create b/qa/testsuite/00create
deleted file mode 100644
index 40e2c19..0000000
--- a/qa/testsuite/00create
+++ /dev/null
@@ -1,20 +0,0 @@
-#missing destination
--I -s 1.1.1.1 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; BAD
-#missing source
--I -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; BAD
-#missing protocol
--I -s 1.1.1.1 -d 2.2.2.2 --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; BAD
-#missing source port
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; BAD
-#missing timeout
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY ; BAD
-# create a conntrack
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# create again
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; BAD
-# delete
--D -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 ; OK
-# create from reply
--I -r 2.2.2.2 -q 1.1.1.1 -p tcp --reply-port-src 11 --reply-port-dst 21 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# delete reverse
--D -r 2.2.2.2 -q 1.1.1.1 -p tcp --reply-port-src 11 --reply-port-dst 21 ; OK
diff --git a/qa/testsuite/01delete b/qa/testsuite/01delete
deleted file mode 100644
index 3c38ac5..0000000
--- a/qa/testsuite/01delete
+++ /dev/null
@@ -1,6 +0,0 @@
-# create dummy
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# delete bad source
--D -s 2.2.2.2 -p tcp --sport 10 --dport 20 ; BAD
-# delete by source
--D -s 1.1.1.1 ; OK
diff --git a/qa/testsuite/02filter b/qa/testsuite/02filter
deleted file mode 100644
index 204c4e8..0000000
--- a/qa/testsuite/02filter
+++ /dev/null
@@ -1,23 +0,0 @@
-# create dummy
-conntrack -I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# filter by source
-conntrack -L -s 1.1.1.1 ; OK
-# filter by destination
-conntrack -L -d 2.2.2.2 ; OK
-# filter by protocol
-conntrack -L -p tcp ; OK
-# filter by status
-conntrack -L -u SEEN_REPLY ; OK
-# filter by TCP protocol state
-conntrack -L -p tcp --state LISTEN ; OK
-# update mark of dummy conntrack
-conntrack -U -s 1.1.1.1 -m 1 ; OK
-# filter by mark
-conntrack -L -m 1 ; OK
-# filter by layer 3 protocol
-conntrack -L -f ipv4 ; OK
-# filter by mark
-conntrack -L --mark 0 ; OK
-conntrack -L --mark 0/0xffffffff; OK
-# delete dummy
-conntrack -D -d 2.2.2.2 ; OK
diff --git a/qa/testsuite/03nat b/qa/testsuite/03nat
deleted file mode 100644
index f94e8ff..0000000
--- a/qa/testsuite/03nat
+++ /dev/null
@@ -1,40 +0,0 @@
-# create dummy
--I -s 1.1.1.1 -d 2.2.2.2 --dst-nat 3.3.3.3 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# show
--L --dst-nat ; OK
-# show
--L --dst-nat 3.3.3.3 ; OK
-# show
--L --src-nat ; OK
-# delete
--D -s 1.1.1.1 ; OK
-# create dummy again
--I -s 1.1.1.1 -d 2.2.2.2 --src-nat 3.3.3.3 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# show
--L --src-nat ; OK
-# show
--L --src-nat 3.3.3.3 ; OK
-# show
--L --dst-nat ; OK
-# show any-nat
--L --any-nat ; OK
-# delete
--D -s 1.1.1.1 ; OK
-# bad combination
--L --dst-nat --any-nat ; BAD
-# bad combination
--L --src-nat --any-nat ; BAD
-# bad combination
--L --src-nat --dst-nat --any-nat ; BAD
-# create
--I -s 1.1.1.1 -d 2.2.2.2 --dst-nat 3.3.3.3:80 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 ; OK
-# show
--L --dst-nat 3.3.3.3:80 ; OK
-# show
--L --any-nat 3.3.3.3:80 ; OK
-# show
--L --dst-nat 3.3.3.3:81 ; OK
-# show
--L --dst-nat 1.1.1.1:80 ; OK
-# delete
--D -s 1.1.1.1 ; OK
diff --git a/qa/testsuite/04zone b/qa/testsuite/04zone
deleted file mode 100644
index 4ff3d34..0000000
--- a/qa/testsuite/04zone
+++ /dev/null
@@ -1,8 +0,0 @@
-# create dummy
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 --zone 1; OK
-# display dummy
--L --zone 1; OK
-# display dummy
--L --zone 0; OK
-# delete dummy
--D --zone 1; OK
diff --git a/qa/testsuite/05mark b/qa/testsuite/05mark
deleted file mode 100644
index 4d99dea..0000000
--- a/qa/testsuite/05mark
+++ /dev/null
@@ -1,27 +0,0 @@
-# create with a mark
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 --mark 42 ; OK
-# find it again using mark
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42 ; OK
--L --mark 42; OK
-# ct already exists
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 --mark 42/0xffffffff ; BAD
-# delete by mark
--D -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42/0xffffffff ; OK
-# try again after del
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 --mark 417889/0xffffffff ; OK
-# delete by mark
--D --mark 417889 ; OK
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state LISTEN -u SEEN_REPLY -t 50 --mark 0xffffffff ; OK
-# zap top 16.
--U -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 0/0xffff0000 ; OK
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 0x0000ffff ; OK
--U -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42/0xffff ; OK
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42/0x0000ffff ; OK
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42/42 ; OK
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 2/2 ; OK
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 2/3 ; OK
-# OK, but no flow entries should be shown here:
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 2/0xf ; OK
-# BAD, because no updates done (mark is already 42).
--U -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42 ; BAD
--D -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --mark 42 ; OK
diff --git a/qa/testsuite/06update b/qa/testsuite/06update
deleted file mode 100644
index 0408303..0000000
--- a/qa/testsuite/06update
+++ /dev/null
@@ -1,8 +0,0 @@
-# create dummy flow
--I -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 --state SYN_RECV -u SEEN_REPLY,ASSURED -t 50 ; OK
-# find it again using mark
--L -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 ; OK
-# set fixed timeout
--U -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20 -u FIXED_TIMEOUT; OK
-# delete it
--D -s 1.1.1.1 -d 2.2.2.2 -p tcp --sport 10 --dport 20; OK