All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Leblond <eric@inl.fr>
To: netfilter-devel@vger.kernel.org
Cc: Eric leblond <eric@inl.fr>
Subject: [PATCH 17/34]  Suppress key relative to IPv6 address.
Date: Sat,  2 Feb 2008 22:24:12 +0100	[thread overview]
Message-ID: <1201987471474-git-send-email-eric@inl.fr> (raw)
In-Reply-To: <12019874712066-git-send-email-eric@inl.fr>

From: Eric leblond <eric@inl.fr>

This patch suppress key relative to IPv6 address because IPv4 and IPv6 can 
be stored in the same key.

Signed-off-by: Eric leblond <eric@inl.fr>
---
:100644 100644 4420507... e837c62... M	filter/raw2packet/ulogd_raw2packet_BASE.c
:100644 100644 3db2862... ae56946... M	include/ulogd/printpkt.h
:100644 100644 d43f1fd... 465b224... M	ulogd.conf.in
:100644 100644 7719cae... 6606824... M	util/printpkt.c
 filter/raw2packet/ulogd_raw2packet_BASE.c |   28 ++++------------------------
 include/ulogd/printpkt.h                  |    2 --
 ulogd.conf.in                             |   10 +++++++++-
 util/printpkt.c                           |   26 ++++++++------------------
 4 files changed, 21 insertions(+), 45 deletions(-)

diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c
index 4420507..e837c62 100644
--- a/filter/raw2packet/ulogd_raw2packet_BASE.c
+++ b/filter/raw2packet/ulogd_raw2packet_BASE.c
@@ -54,8 +54,6 @@ enum output_keys {
 	KEY_IP_CSUM,
 	KEY_IP_ID,
 	KEY_IP_FRAGOFF,
-	KEY_IP6_SADDR,
-	KEY_IP6_DADDR,
 	KEY_IP6_PAYLOAD_LEN,
 	KEY_IP6_PRIORITY,
 	KEY_IP6_FLOWLABEL,
@@ -186,24 +184,6 @@ static struct ulogd_key iphdr_rets[] = {
 			.field_id = IPFIX_fragmentOffsetIPv4,
 		},
 	},
-	[KEY_IP6_SADDR] = {
-		.type = ULOGD_RET_RAW,
-		.flags = ULOGD_RETF_NONE,
-		.name = "ip6.saddr",
-		.ipfix = {
-			.vendor = IPFIX_VENDOR_IETF,
-			.field_id = IPFIX_sourceIPv6Address,
-		},
-	},
-	[KEY_IP6_DADDR] = {
-		.type = ULOGD_RET_RAW,
-		.flags = ULOGD_RETF_NONE,
-		.name = "ip6.daddr",
-		.ipfix = {
-			.vendor = IPFIX_VENDOR_IETF,
-			.field_id = IPFIX_destinationIPv6Address,
-		},
-	},
 	[KEY_IP6_PAYLOAD_LEN] = {
 		.type = ULOGD_RET_UINT16,
 		.flags = ULOGD_RETF_NONE,
@@ -730,10 +710,10 @@ static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, u_int32_t len)
 	if (len < sizeof(struct ip6_hdr))
 		return 0;
 
-	ret[KEY_IP6_SADDR].u.value.ptr = &ipv6h->ip6_src;
-	ret[KEY_IP6_SADDR].flags |= ULOGD_RETF_VALID;
-	ret[KEY_IP6_DADDR].u.value.ptr = &ipv6h->ip6_dst;
-	ret[KEY_IP6_DADDR].flags |= ULOGD_RETF_VALID;
+	ret[KEY_IP_SADDR].u.value.ptr = &ipv6h->ip6_src;
+	ret[KEY_IP_SADDR].flags |= ULOGD_RETF_VALID;
+	ret[KEY_IP_DADDR].u.value.ptr = &ipv6h->ip6_dst;
+	ret[KEY_IP_DADDR].flags |= ULOGD_RETF_VALID;
 	ret[KEY_IP6_PAYLOAD_LEN].u.value.ui16 = ntohs(ipv6h->ip6_plen);
 	ret[KEY_IP6_PAYLOAD_LEN].flags |= ULOGD_RETF_VALID;
 	ret[KEY_IP6_PRIORITY].u.value.ui8 = ntohl(ipv6h->ip6_flow & 0x0ff00000) >> 20;
diff --git a/include/ulogd/printpkt.h b/include/ulogd/printpkt.h
index 3db2862..ae56946 100644
--- a/include/ulogd/printpkt.h
+++ b/include/ulogd/printpkt.h
@@ -17,8 +17,6 @@ enum pkt_keys {
 	KEY_IP_ID,
 	KEY_IP_FRAGOFF,
 	KEY_IP_PROTOCOL,
-	KEY_IP6_SADDR,
-	KEY_IP6_DADDR,
 	KEY_IP6_PAYLOAD_LEN,
 	KEY_IP6_PRIORITY,
 	KEY_IP6_HOPLIMIT,
diff --git a/ulogd.conf.in b/ulogd.conf.in
index d43f1fd..465b224 100644
--- a/ulogd.conf.in
+++ b/ulogd.conf.in
@@ -35,6 +35,7 @@ bufsize=150000
 plugin="@libdir@/ulogd/ulogd_inppkt_NFLOG.so"
 plugin="@libdir@/ulogd/ulogd_inpflow_NFCT.so"
 plugin="@libdir@/ulogd/ulogd_filter_IFINDEX.so"
+plugin="@libdir@/ulogd/ulogd_filter_IP2STR.so"
 plugin="@libdir@/ulogd/ulogd_filter_PRINTPKT.so"
 plugin="@libdir@/ulogd/ulogd_filter_PRINTFLOW.so"
 plugin="@libdir@/ulogd/ulogd_output_LOGEMU.so"
@@ -42,7 +43,10 @@ plugin="@libdir@/ulogd/ulogd_output_OPRINT.so"
 plugin="@libdir@/ulogd/ulogd_raw2packet_BASE.so"
 
 # this is a stack for packet-based logging via LOGEMU
-#stack=log1:NFLOG,base1:BASE,ifi1:IFINDEX,print1:PRINTPKT,emu1:LOGEMU
+#stack=log1:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU
+
+# this is a stack for IPv6 packet-based logging via LOGEMU
+#stack=log2:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU
 
 # this is a stack for ULOG packet-based logging via LOGEMU
 #stack=ulog1:ULOG,base1:BASE,print1:PRINTPKT,emu1:LOGEMU
@@ -59,6 +63,10 @@ plugin="@libdir@/ulogd/ulogd_raw2packet_BASE.so"
 # netlink multicast group (the same as the iptables --ulog-nlgroup param)
 group=0
 
+[log2]
+group=1
+addressfamily=10
+
 [ulog1]
 nlgroup=1
 
diff --git a/util/printpkt.c b/util/printpkt.c
index 7719cae..6606824 100644
--- a/util/printpkt.c
+++ b/util/printpkt.c
@@ -45,16 +45,14 @@ struct ulogd_key printpkt_keys[] = {
 	[KEY_OOB_OUT]		= { .name = "oob.out", },
 	[KEY_RAW_MAC]		= { .name = "raw.mac", },
 	[KEY_RAW_MACLEN]	= { .name = "raw.mac_len", },
-	[KEY_IP_SADDR]		= { .name = "ip.saddr", },
-	[KEY_IP_DADDR]		= { .name = "ip.daddr", },
+	[KEY_IP_SADDR]		= { .name = "ip.saddr.str", },
+	[KEY_IP_DADDR]		= { .name = "ip.daddr.str", },
 	[KEY_IP_TOTLEN]		= { .name = "ip.totlen", },
 	[KEY_IP_TOS]		= { .name = "ip.tos", },
 	[KEY_IP_TTL]		= { .name = "ip.ttl", },
 	[KEY_IP_ID]		= { .name = "ip.id", },
 	[KEY_IP_FRAGOFF]	= { .name = "ip.fragoff", },
 	[KEY_IP_PROTOCOL]	= { .name = "ip.protocol", },
-	[KEY_IP6_SADDR]		= { .name = "ip6.saddr", },
-	[KEY_IP6_DADDR]		= { .name = "ip6.daddr", },
 	[KEY_IP6_PAYLOAD_LEN]	= { .name = "ip6.payload_len" },
 	[KEY_IP6_PRIORITY]	= { .name = "ip6.priority" },
 	[KEY_IP6_HOPLIMIT]	= { .name = "ip6.hoplimit" },
@@ -182,15 +180,11 @@ static int printpkt_ipv4(struct ulogd_key *res, char *buf)
 
 	if (pp_is_valid(res, KEY_IP_SADDR))
 		buf_cur += sprintf(buf_cur, "SRC=%s ",
-				   inet_ntop(AF_INET,
-				   	     &GET_VALUE(res, KEY_IP_SADDR).ui32,
-					     tmp, sizeof(tmp)));
+				   GET_VALUE(res, KEY_IP_SADDR).ptr);
 
 	if (pp_is_valid(res, KEY_IP_DADDR))
 		buf_cur += sprintf(buf_cur, "DST=%s ",
-				   inet_ntop(AF_INET,
-				   	     &GET_VALUE(res, KEY_IP_DADDR).ui32,
-					     tmp, sizeof(tmp)));
+				   GET_VALUE(res, KEY_IP_DADDR).ptr);
 
 	/* FIXME: add pp_is_valid calls to remainder of file */
 	buf_cur += sprintf(buf_cur,"LEN=%u TOS=%02X PREC=0x%02X TTL=%u ID=%u ", 
@@ -271,17 +265,13 @@ static int printpkt_ipv6(struct ulogd_key *res, char *buf)
 	char *buf_cur = buf;
 	char tmp[INET6_ADDRSTRLEN];
 
-	if (pp_is_valid(res, KEY_IP6_SADDR))
+	if (pp_is_valid(res, KEY_IP_SADDR))
 		buf_cur += sprintf(buf_cur, "SRC=%s ",
-				   inet_ntop(AF_INET6,
-				   	     GET_VALUE(res, KEY_IP6_SADDR).ptr,
-					     tmp, sizeof(tmp)));
+				   GET_VALUE(res, KEY_IP_SADDR).ptr);
 
-	if (pp_is_valid(res, KEY_IP6_DADDR))
+	if (pp_is_valid(res, KEY_IP_DADDR))
 		buf_cur += sprintf(buf_cur, "DST=%s ",
-				   inet_ntop(AF_INET6,
-				   	     GET_VALUE(res, KEY_IP6_DADDR).ptr,
-					     tmp, sizeof(tmp)));
+				   GET_VALUE(res, KEY_IP_DADDR).ptr);
 
 	if (pp_is_valid(res, KEY_IP6_PAYLOAD_LEN))
 		buf_cur += sprintf(buf_cur, "LEN=%Zu ",
-- 
1.5.2.5


  reply	other threads:[~2008-02-02 22:16 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-02 21:23 [ULOGD RFC PATCH 0/34] Eric Leblond
2008-02-02 21:23 ` [PATCH 01/34] Introduce new SQL schema Eric Leblond
2008-02-02 21:23   ` [PATCH 02/34] [Resend] Do not propagate one conntrack event via 2 messages Eric Leblond
2008-02-02 21:23     ` [PATCH 03/34] Use an enum to clarify code Eric Leblond
2008-02-02 21:23       ` [PATCH 04/34] Adapt printflow for one conntrack entry per line format Eric Leblond
2008-02-02 21:24         ` [PATCH 05/34] Add --info option which displays information about plugin Eric Leblond
2008-02-02 21:24           ` [PATCH 06/34] New version of SQL schema Eric Leblond
2008-02-02 21:24             ` [PATCH 07/34] Changed sighup_handler_print to fallback to continue using old descriptor on new file opening failure Eric Leblond
2008-02-02 21:24               ` [PATCH 08/34] Added explicit null termination of the hostname buffer Eric Leblond
2008-02-02 21:24                 ` [PATCH 09/34] For OPRINT, changed sighup_handler_print to fallback to continue using old descriptor on new file opening failure Eric Leblond
2008-02-02 21:24                   ` [PATCH 10/34] Add some missing line break Eric Leblond
2008-02-02 21:24                     ` [PATCH 11/34] Put O at the real end of the string Eric Leblond
2008-02-02 21:24                       ` [PATCH 12/34] Changed to show pcap file name when open failed Eric Leblond
2008-02-02 21:24                         ` [PATCH 13/34] Display filename in the other error case Eric Leblond
2008-02-02 21:24                           ` [PATCH 14/34] Request at least autoconf 2.50 (needed for large file support macro) Eric Leblond
2008-02-02 21:24                             ` [PATCH 15/34] MySQL client library does not reconnect automatically since 5.0 Eric Leblond
2008-02-02 21:24                               ` [PATCH 16/34] Introduce IP2STR module which convert IP to string Eric Leblond
2008-02-02 21:24                                 ` Eric Leblond [this message]
2008-02-02 21:24                                   ` [PATCH 18/34] Update schema for PostgreSQL Eric Leblond
2008-02-02 21:24                                     ` [PATCH 19/34] Fix options for pgsql module Eric Leblond
2008-02-02 21:24                                       ` [PATCH 20/34] Mark ID as inactive (sequence in pg schema) Eric Leblond
2008-02-02 21:24                                         ` [PATCH 21/34] Add IP2BIN module: convert IP address to binary string Eric Leblond
2008-02-02 21:24                                           ` [PATCH 22/34] Fix description and indenting Eric Leblond
2008-02-02 21:24                                             ` [PATCH 23/34] Print RAW as raw string Eric Leblond
2008-02-02 21:24                                               ` [PATCH 24/34] Fix IPv4 output Eric Leblond
2008-02-02 21:24                                                 ` [PATCH 25/34] Set oob.family as VALID key Eric Leblond
2008-02-02 21:24                                                   ` [PATCH 26/34] Modify IPv6 parser to fill oob_family Eric Leblond
2008-02-02 21:24                                                     ` [PATCH 27/34] Free insertion function result (mysql) Eric Leblond
2008-02-02 21:24                                                       ` [PATCH 28/34] Update SQL schema Eric Leblond
2008-02-02 21:24                                                         ` [PATCH 29/34] Fix some place were oob_family was used instead of _oob_family Eric Leblond
2008-02-02 21:24                                                           ` [PATCH 30/34] Convert SQL procedure to function call Eric Leblond
2008-02-02 21:24                                                             ` [PATCH 31/34] Switch from INNER JOIN to LEFT JOIN in ulog view Eric Leblond
2008-02-02 21:24                                                               ` [PATCH 32/34] Add state extension Eric Leblond
2008-02-02 21:24                                                                 ` [PATCH 33/34] ULOGD_RET_IPADDR is for IPv4 or IPv6 address: fix description Eric Leblond
2008-02-02 21:24                                                                   ` [PATCH 34/34] Modify insert functions to accept standard integers to avoid casts Eric Leblond
2008-02-03 12:28                                                                     ` Pablo Neira Ayuso
2008-02-03 12:29                                                                   ` [PATCH 33/34] ULOGD_RET_IPADDR is for IPv4 or IPv6 address: fix description Pablo Neira Ayuso
2008-02-03 12:27                                                                 ` [PATCH 32/34] Add state extension Pablo Neira Ayuso
2008-02-03 12:26                                                               ` [PATCH 31/34] Switch from INNER JOIN to LEFT JOIN in ulog view Pablo Neira Ayuso
2008-02-03 12:26                                                             ` [PATCH 30/34] Convert SQL procedure to function call Pablo Neira Ayuso
2008-02-03 12:24                                                           ` [PATCH 29/34] Fix some place were oob_family was used instead of _oob_family Pablo Neira Ayuso
2008-02-03 12:23                                                         ` [PATCH 28/34] Update SQL schema Pablo Neira Ayuso
2008-02-03 12:22                                                       ` [PATCH 27/34] Free insertion function result (mysql) Pablo Neira Ayuso
2008-02-03 12:21                                                     ` [PATCH 26/34] Modify IPv6 parser to fill oob_family Pablo Neira Ayuso
2008-02-03 12:17                                                   ` [PATCH 25/34] Set oob.family as VALID key Pablo Neira Ayuso
2008-02-03 12:10                                                 ` [PATCH 24/34] Fix IPv4 output Pablo Neira Ayuso
2008-02-03 17:36                                                   ` Eric Leblond
2008-02-03 12:09                                               ` [PATCH 23/34] Print RAW as raw string Pablo Neira Ayuso
2008-02-03 12:07                                             ` [PATCH 22/34] Fix description and indenting Pablo Neira Ayuso
2008-02-03 12:04                                           ` [PATCH 21/34] Add IP2BIN module: convert IP address to binary string Pablo Neira Ayuso
2008-02-03 12:02                                         ` [PATCH 20/34] Mark ID as inactive (sequence in pg schema) Pablo Neira Ayuso
2008-02-03 12:01                                       ` [PATCH 19/34] Fix options for pgsql module Pablo Neira Ayuso
2008-02-03 11:59                                     ` [PATCH 18/34] Update schema for PostgreSQL Pablo Neira Ayuso
2008-02-03 11:59                                   ` [PATCH 17/34] Suppress key relative to IPv6 address Pablo Neira Ayuso
2008-02-03 11:55                                 ` [PATCH 16/34] Introduce IP2STR module which convert IP to string Pablo Neira Ayuso
2008-02-03 11:45                               ` [PATCH 15/34] MySQL client library does not reconnect automatically since 5.0 Pablo Neira Ayuso
2008-02-03 11:44                             ` [PATCH 14/34] Request at least autoconf 2.50 (needed for large file support macro) Pablo Neira Ayuso
2008-02-03 11:43                           ` [PATCH 13/34] Display filename in the other error case Pablo Neira Ayuso
2008-02-03 11:42                         ` [PATCH 12/34] Changed to show pcap file name when open failed Pablo Neira Ayuso
2008-02-03 11:41                       ` [PATCH 11/34] Put O at the real end of the string Pablo Neira Ayuso
2008-02-03 11:40                     ` [PATCH 10/34] Add some missing line break Pablo Neira Ayuso
2008-02-03 11:38                   ` [PATCH 09/34] For OPRINT, changed sighup_handler_print to fallback to continue using old descriptor on new file opening failure Pablo Neira Ayuso
2008-02-03 11:36                 ` [PATCH 08/34] Added explicit null termination of the hostname buffer Pablo Neira Ayuso
2008-02-03 11:35               ` [PATCH 07/34] Changed sighup_handler_print to fallback to continue using old descriptor on new file opening failure Pablo Neira Ayuso
2008-02-03 11:34             ` [PATCH 06/34] New version of SQL schema Pablo Neira Ayuso
2008-02-03 11:30           ` [PATCH 05/34] Add --info option which displays information about plugin Pablo Neira Ayuso
2008-02-03 11:25         ` [PATCH 04/34] Adapt printflow for one conntrack entry per line format Pablo Neira Ayuso
2008-02-03 11:23       ` [PATCH 03/34] Use an enum to clarify code Pablo Neira Ayuso
2008-02-03  9:27     ` [PATCH 02/34] [Resend] Do not propagate one conntrack event via 2 messages Holger Eitzenberger
2008-02-03 11:53       ` Eric Leblond
2008-02-19 14:05         ` Eric Leblond
2008-02-19 15:31           ` Pablo Neira Ayuso
2008-02-19 15:49             ` [ULOGD2 PATCH] Sends one message for each connection event instead of two Eric Leblond
2008-02-19 16:01               ` Pablo Neira Ayuso
2008-02-03 11:22   ` [PATCH 01/34] Introduce new SQL schema Pablo Neira Ayuso
2008-02-03 11:50     ` Eric Leblond
2008-02-03 11:57       ` Eric Leblond
2008-02-03 12:17         ` Pablo Neira Ayuso
2008-02-06 10:04           ` [PATCH] Use index2name capabilities of libnfnetlink in IFINDEX filter Eric Leblond
2008-02-07  6:45             ` Pablo Neira Ayuso
2008-02-03 12:14       ` [PATCH 01/34] Introduce new SQL schema Pablo Neira Ayuso
2008-02-03 12:37       ` Holger Eitzenberger
2008-02-03 17:34         ` Pierre Chifflier
2008-02-03 23:54           ` Pablo Neira Ayuso
2008-02-03  0:32 ` [ULOGD RFC PATCH 0/34] Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201987471474-git-send-email-eric@inl.fr \
    --to=eric@inl.fr \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.