From ba2a63e1b8e18e0d1f383af50d3d40c2eb785d3e Mon Sep 17 00:00:00 2001
From: "/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>
Date: Thu, 3 Nov 2005 19:57:50 +0000
Subject: See ChangeLog

---
 extensions/libct_proto_sctp.c | 10 ++++++++--
 extensions/libct_proto_tcp.c  | 10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

(limited to 'extensions')

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;
-- 
cgit v1.2.3