summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libct_proto_sctp.c10
-rw-r--r--extensions/libct_proto_tcp.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/extensions/libct_proto_sctp.c b/extensions/libct_proto_sctp.c
index 2b1a337..5e96391 100644
--- a/extensions/libct_proto_sctp.c
+++ b/extensions/libct_proto_sctp.c
@@ -108,6 +108,7 @@ int parse_options(char c, char *argv[],
printf("doh?\n");
return 0;
}
+ *flags |= STATE;
}
break;
}
@@ -118,19 +119,24 @@ int final_check(unsigned int flags,
struct nfct_tuple *orig,
struct nfct_tuple *reply)
{
+ int ret = 0;
+
if ((flags & (ORIG_SPORT|ORIG_DPORT))
&& !(flags & (REPL_SPORT|REPL_DPORT))) {
reply->l4src.sctp.port = orig->l4dst.sctp.port;
reply->l4dst.sctp.port = orig->l4src.sctp.port;
- return 1;
+ ret = 1;
} else if (!(flags & (ORIG_SPORT|ORIG_DPORT))
&& (flags & (REPL_SPORT|REPL_DPORT))) {
orig->l4src.sctp.port = reply->l4dst.sctp.port;
orig->l4dst.sctp.port = reply->l4src.sctp.port;
- return 1;
+ ret = 1;
}
if ((flags & (ORIG_SPORT|ORIG_DPORT))
&& ((flags & (REPL_SPORT|REPL_DPORT))))
+ ret = 1;
+
+ if (ret & (flags & STATE))
return 1;
return 0;
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
index 4aa6587..7c1e605 100644
--- a/extensions/libct_proto_tcp.c
+++ b/extensions/libct_proto_tcp.c
@@ -131,6 +131,7 @@ int parse_options(char c, char *argv[],
printf("doh?\n");
return 0;
}
+ *flags |= STATE;
}
break;
}
@@ -141,19 +142,24 @@ int final_check(unsigned int flags,
struct nfct_tuple *orig,
struct nfct_tuple *reply)
{
+ int ret = 0;
+
if ((flags & (ORIG_SPORT|ORIG_DPORT))
&& !(flags & (REPL_SPORT|REPL_DPORT))) {
reply->l4src.tcp.port = orig->l4dst.tcp.port;
reply->l4dst.tcp.port = orig->l4src.tcp.port;
- return 1;
+ ret = 1;
} else if (!(flags & (ORIG_SPORT|ORIG_DPORT))
&& (flags & (REPL_SPORT|REPL_DPORT))) {
orig->l4src.tcp.port = reply->l4dst.tcp.port;
orig->l4dst.tcp.port = reply->l4src.tcp.port;
- return 1;
+ ret = 1;
}
if ((flags & (ORIG_SPORT|ORIG_DPORT))
&& ((flags & (REPL_SPORT|REPL_DPORT))))
+ ret = 1;
+
+ if (ret && (flags & STATE))
return 1;
return 0;