summaryrefslogtreecommitdiffstats
path: root/extensions/libct_proto_udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/libct_proto_udp.c')
-rw-r--r--extensions/libct_proto_udp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c
index 5675a05..8e20bd5 100644
--- a/extensions/libct_proto_udp.c
+++ b/extensions/libct_proto_udp.c
@@ -37,6 +37,14 @@ enum udp_param_flags {
REPL_DPORT = (1 << REPL_DPORT_BIT),
};
+void help()
+{
+ fprintf(stdout, "--orig-port-src original source port\n");
+ fprintf(stdout, "--orig-port-dst original destination port\n");
+ fprintf(stdout, "--reply-port-src reply source port\n");
+ fprintf(stdout, "--reply-port-dst reply destination port\n");
+}
+
int parse(char c, char *argv[],
struct ip_conntrack_tuple *orig,
struct ip_conntrack_tuple *reply,
@@ -72,6 +80,20 @@ int parse(char c, char *argv[],
return 1;
}
+int final_check(unsigned int flags)
+{
+ if (!(flags & ORIG_SPORT))
+ return 0;
+ else if (!(flags & ORIG_DPORT))
+ return 0;
+ else if (!(flags & REPL_SPORT))
+ return 0;
+ else if (!(flags & REPL_DPORT))
+ return 0;
+
+ return 1;
+}
+
void print_tuple(struct ip_conntrack_tuple *t)
{
fprintf(stdout, "sport=%d dport=%d ", ntohs(t->src.u.udp.port),
@@ -83,6 +105,8 @@ static struct ctproto_handler udp = {
.protonum = 17,
.parse = parse,
.print_tuple = print_tuple,
+ .final_check = final_check,
+ .help = help,
.opts = opts
};