Skip to contentSkip to conversation

CT: add "none" as parameter for --ctevents

PATCH In review Pablo Neira Ayuso 2 participants 3 messages Jan 31, 2011 – Feb 1, 2011 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 CT: add "none" as parameter for --ctevents

This allows not to deliver any event. This can be useful if you want no events for some protocols, for example:

iptables -I PREROUTING -t raw -p udp -j CT --ctevents none

Thus, no events for UDP traffic are delivered to user-space.

---
 extensions/libxt_CT.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
extensions/libxt_CT.c +5 -1
index 682dd83..e233902 100644
@@ -68,7 +68,7 @@ static uint32_t ct_parse_events(const struct event_tbl *tbl, unsigned int size,
 	strcpy(str, events);
 	while ((t = strsep(&e, ","))) {
 		for (i = 0; i < size; i++) {
-			if (strcmp(t, tbl[i].name))
+			if (!strcmp(t, "none") || strcmp(t, tbl[i].name))
 				continue;
 			mask |= 1 << tbl[i].event;
 			break;
@@ -87,6 +87,10 @@ static void ct_print_events(const char *pfx, const struct event_tbl *tbl,
 	const char *sep = "";
 	unsigned int i;
 
+	if (mask == 0) {
+		printf("none ");
+		return;
+	}
 	printf("%s ", pfx);
 	for (i = 0; i < size; i++) {
 		if (mask & (1 << tbl[i].event)) {
author maintainer
#1 lore raw
Quoted 6 lines · Pablo Neira Ayuso

This allows not to deliver any event. This can be useful if you want no events for some protocols, for example:

iptables -I PREROUTING -t raw -p udp -j CT --ctevents none

Thus, no events for UDP traffic are delivered to user-space.

This patch is broken, I'll fix it and resend, sorry.

#2 lore raw
In reply to Pablo Neira Ayuso

Am 31.01.2011 23:48, schrieb Pablo Neira Ayuso:

Quoted 6 lines

This allows not to deliver any event. This can be useful if you want no events for some protocols, for example:

iptables -I PREROUTING -t raw -p udp -j CT --ctevents none

Thus, no events for UDP traffic are delivered to user-space.

Looks fine to me.