summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Eitzenberger <heitzenberger@astaro.com>2009-10-13 13:56:07 +0200
committerHarald Welte <laforge@gnumonks.org>2010-10-21 19:15:38 +0200
commit33fcd86779645820e98598123aa187358dd6ec77 (patch)
tree2fe4a01bfc16857c00492986e2f3f71ae13374e5
parente9deb08f46327b62cee507b7801df42480c15883 (diff)
BASE: log ICMPv6 type/code values
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
-rw-r--r--filter/raw2packet/ulogd_raw2packet_BASE.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c
index 37c02d4..13a1a45 100644
--- a/filter/raw2packet/ulogd_raw2packet_BASE.c
+++ b/filter/raw2packet/ulogd_raw2packet_BASE.c
@@ -35,6 +35,7 @@
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/ip_icmp.h>
@@ -43,7 +44,7 @@
#define NEXTHDR_TCP IPPROTO_TCP
#define NEXTHDR_UDP IPPROTO_UDP
#define NEXTHDR_ICMP IPPROTO_ICMP
-#define NEXTHDR_ICMP6 58
+#define NEXTHDR_ICMP6 IPPROTO_ICMPV6
#define NEXTHDR_NONE 59
enum {
@@ -100,6 +101,8 @@ enum {
O_IcmpFragMtu,
O_IcmpCsum,
O_AhEspSpi,
+ O_Icmp6Type,
+ O_Icmp6Code,
};
static struct ulogd_key out_keys[] = {
@@ -147,6 +150,8 @@ static struct ulogd_key out_keys[] = {
[O_IcmpFragMtu] = KEY(UINT16, "icmp.fragmtu"),
[O_IcmpCsum] = KEY(UINT16, "icmp.csum"),
[O_AhEspSpi] = KEY(UINT32, "ahesp.spi"),
+ [O_Icmp6Type] = KEY(UINT8, "icmp6.type"),
+ [O_Icmp6Code] = KEY(UINT8, "icmp6.code"),
};
@@ -229,6 +234,18 @@ icmp_interp(const struct ulogd_pluginstance *pi, const void *data)
}
static int
+icmp6_interp(const struct ulogd_pluginstance *pi, const void *data)
+{
+ struct ulogd_key *out = pi->output.keys;
+ const struct icmp6_hdr *icmp6h = data;
+
+ key_set_u8(&out[O_Icmp6Type], icmp6h->icmp6_type);
+ key_set_u8(&out[O_Icmp6Code], icmp6h->icmp6_code);
+
+ return 0;
+}
+
+static int
ahesp_interp(const struct ulogd_pluginstance *pi, const void *data)
{
#if 0
@@ -263,10 +280,17 @@ l4_interp(struct ulogd_pluginstance *pi, int proto, const void *data)
ret = icmp_interp(pi, data);
break;
+ case IPPROTO_ICMPV6:
+ ret = icmp6_interp(pi, data);
+ break;
+
case IPPROTO_AH:
case IPPROTO_ESP:
ret = ahesp_interp(pi, data);
break;
+
+ default:
+ break;
}
return ret;