summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2005-04-25 10:01:10 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2005-04-25 10:01:10 +0000
commit21ed4ac1f957f1e4d7be195a98fb235de13ede21 (patch)
tree7779d560a7eadae421c7b35c7491463508c5314d /extensions
parent1c33487e481b32ba34259df153b02acc46323c6d (diff)
downloadconntrack-tools-21ed4ac1f957f1e4d7be195a98fb235de13ede21.tar.gz
conntrack-tools-21ed4ac1f957f1e4d7be195a98fb235de13ede21.zip
Major resync
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libct_proto_tcp.c64
-rw-r--r--extensions/libct_proto_udp.c4
2 files changed, 62 insertions, 6 deletions
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
index 521a170..3366da4 100644
--- a/extensions/libct_proto_tcp.c
+++ b/extensions/libct_proto_tcp.c
@@ -11,29 +11,83 @@ static struct option opts[] = {
{"orig-port-dst", 1, 0, '2'},
{"reply-port-src", 1, 0, '3'},
{"reply-port-dst", 1, 0, '4'},
+ {"state", 1, 0, '5'},
{0, 0, 0, 0}
};
+enum tcp_param_flags {
+ ORIG_SPORT_BIT = 0,
+ ORIG_SPORT = (1 << ORIG_SPORT_BIT),
+
+ ORIG_DPORT_BIT = 1,
+ ORIG_DPORT = (1 << ORIG_DPORT_BIT),
+
+ REPL_SPORT_BIT = 2,
+ REPL_SPORT = (1 << REPL_SPORT_BIT),
+
+ REPL_DPORT_BIT = 3,
+ REPL_DPORT = (1 << REPL_DPORT_BIT),
+
+ STATE_BIT = 4,
+ STATE = (1 << STATE_BIT)
+};
+
+static const char *states[] = {
+ "NONE",
+ "SYN_SENT",
+ "SYN_RECV",
+ "ESTABLISHED",
+ "FIN_WAIT",
+ "CLOSE_WAIT",
+ "LAST_ACK",
+ "TIME_WAIT",
+ "CLOSE",
+ "LISTEN"
+};
+
int parse(char c, char *argv[],
struct ip_conntrack_tuple *orig,
- struct ip_conntrack_tuple *reply)
+ struct ip_conntrack_tuple *reply,
+ union ip_conntrack_proto *proto,
+ unsigned int *flags)
{
switch(c) {
case '1':
- if (optarg)
+ if (optarg) {
orig->src.u.tcp.port = htons(atoi(optarg));
+ *flags |= ORIG_SPORT;
+ }
break;
case '2':
- if (optarg)
+ if (optarg) {
orig->dst.u.tcp.port = htons(atoi(optarg));
+ *flags |= ORIG_DPORT;
+ }
break;
case '3':
- if (optarg)
+ if (optarg) {
reply->src.u.tcp.port = htons(atoi(optarg));
+ *flags |= REPL_SPORT;
+ }
break;
case '4':
- if (optarg)
+ if (optarg) {
reply->dst.u.tcp.port = htons(atoi(optarg));
+ *flags |= REPL_DPORT;
+ }
+ break;
+ case '5':
+ if (optarg) {
+ int i;
+ for (i=0; i<10; i++) {
+ if (strcmp(optarg, states[i]) == 0) {
+ proto->tcp.state = i;
+ break;
+ }
+ }
+ if (i == 10)
+ printf("doh?\n");
+ }
break;
}
return 1;
diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c
index 8022913..cf91934 100644
--- a/extensions/libct_proto_udp.c
+++ b/extensions/libct_proto_udp.c
@@ -16,7 +16,9 @@ static struct option opts[] = {
int parse(char c, char *argv[],
struct ip_conntrack_tuple *orig,
- struct ip_conntrack_tuple *reply)
+ struct ip_conntrack_tuple *reply,
+ union ip_conntrack_proto *proto,
+ unsigned int *flags)
{
switch(c) {
case '1':