summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libct_proto_icmp.c19
-rw-r--r--extensions/libct_proto_sctp.c9
-rw-r--r--extensions/libct_proto_tcp.c9
-rw-r--r--extensions/libct_proto_udp.c8
4 files changed, 32 insertions, 13 deletions
diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c
index 24d3d3f..e0de27e 100644
--- a/extensions/libct_proto_icmp.c
+++ b/extensions/libct_proto_icmp.c
@@ -1,5 +1,6 @@
/*
* (C) 2005 by Pablo Neira Ayuso <pablo@eurodev.net>
+ * Harald Welte <laforge@netfilter.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,6 +69,21 @@ int parse(char c, char *argv[],
return 1;
}
+void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple)
+{
+ if (cda[CTA_PROTO_ICMP_TYPE-1])
+ tuple->l4dst.icmp.type =
+ *(u_int8_t *)NFA_DATA(cda[CTA_PROTO_ICMP_TYPE-1]);
+
+ if (cda[CTA_PROTO_ICMP_CODE-1])
+ tuple->l4dst.icmp.code =
+ *(u_int8_t *)NFA_DATA(cda[CTA_PROTO_ICMP_CODE-1]);
+
+ if (cda[CTA_PROTO_ICMP_ID-1])
+ tuple->l4src.icmp.id =
+ *(u_int8_t *)NFA_DATA(cda[CTA_PROTO_ICMP_ID-1]);
+}
+
int final_check(unsigned int flags,
struct ctnl_tuple *orig,
struct ctnl_tuple *reply)
@@ -82,7 +98,7 @@ int final_check(unsigned int flags,
void print_proto(struct ctnl_tuple *t)
{
- fprintf(stdout, "type=%d code=%d id=%d", t->l4dst.icmp.type,
+ fprintf(stdout, "type=%d code=%d id=%d ", t->l4dst.icmp.type,
t->l4dst.icmp.code,
t->l4src.icmp.id);
}
@@ -91,6 +107,7 @@ static struct ctproto_handler icmp = {
.name = "icmp",
.protonum = 1,
.parse_opts = parse,
+ .parse_proto = parse_proto,
.print_proto = print_proto,
.final_check = final_check,
.help = help,
diff --git a/extensions/libct_proto_sctp.c b/extensions/libct_proto_sctp.c
index 5b50fbc..d5ff298 100644
--- a/extensions/libct_proto_sctp.c
+++ b/extensions/libct_proto_sctp.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <netinet/in.h> /* For htons */
#include <linux/netfilter_ipv4/ip_conntrack_netlink.h>
#include "libct_proto.h"
@@ -138,12 +139,12 @@ int final_check(unsigned int flags,
void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple)
{
- if (cda[CTA_PROTO_SCTP_SRC-1])
+ if (cda[CTA_PROTO_SRC_PORT-1])
tuple->l4src.sctp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SCTP_SRC-1]);
- if (cda[CTA_PROTO_SCTP_DST-1])
+ *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SRC_PORT-1]);
+ if (cda[CTA_PROTO_DST_PORT-1])
tuple->l4dst.sctp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SCTP_DST-1]);
+ *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]);
}
void parse_protoinfo(struct nfattr *cda[], struct ctnl_conntrack *ct)
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
index 5fa3652..973c5ab 100644
--- a/extensions/libct_proto_tcp.c
+++ b/extensions/libct_proto_tcp.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <netinet/in.h> /* For htons */
#include <linux/netfilter_ipv4/ip_conntrack_netlink.h>
#include "libct_proto.h"
@@ -160,12 +161,12 @@ int final_check(unsigned int flags,
void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple)
{
- if (cda[CTA_PROTO_TCP_SRC-1])
+ if (cda[CTA_PROTO_SRC_PORT-1])
tuple->l4src.tcp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_TCP_SRC-1]);
- if (cda[CTA_PROTO_TCP_DST-1])
+ *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SRC_PORT-1]);
+ if (cda[CTA_PROTO_DST_PORT-1])
tuple->l4dst.tcp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_TCP_DST-1]);
+ *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]);
}
void parse_protoinfo(struct nfattr *cda[], struct ctnl_conntrack *ct)
diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c
index aa733f0..7821d5b 100644
--- a/extensions/libct_proto_udp.c
+++ b/extensions/libct_proto_udp.c
@@ -127,12 +127,12 @@ int final_check(unsigned int flags,
void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple)
{
- if (cda[CTA_PROTO_UDP_SRC-1])
+ if (cda[CTA_PROTO_SRC_PORT-1])
tuple->l4src.udp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_UDP_SRC-1]);
- if (cda[CTA_PROTO_UDP_DST-1])
+ *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SRC_PORT-1]);
+ if (cda[CTA_PROTO_DST_PORT-1])
tuple->l4dst.udp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_UDP_DST-1]);
+ *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]);
}
void print_proto(struct ctnl_tuple *tuple)