From: Peter Warasin <peter@endian.com>
To: netfilter-devel@vger.kernel.org
Cc: ebtables-devel@lists.sourceforge.net, Peter Warasin <peter@endian.com>
Subject: [PATCH 1/5] Adds input keys enumeration
Date: Mon, 11 Feb 2008 23:07:54 +0100 [thread overview]
Message-ID: <20080211221055.928104246@endian.com> (raw)
In-Reply-To: 20080211220753.796791654@endian.com
[-- Attachment #1: filter-raw2packet-usekeys.patch --]
[-- Type: text/plain, Size: 1948 bytes --]
Adds input key enumeration in order to address the fields
with symbols instead of numbers.
Shortens the lines by the use of GET_VALUE()
Signed-off-by: Peter Warasin <peter@endian.com>
---
filter/raw2packet/ulogd_raw2packet_BASE.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
Index: ulogd2/filter/raw2packet/ulogd_raw2packet_BASE.c
===================================================================
--- ulogd2.orig/filter/raw2packet/ulogd_raw2packet_BASE.c 2008-02-11 22:03:19.000000000 +0100
+++ ulogd2/filter/raw2packet/ulogd_raw2packet_BASE.c 2008-02-11 22:04:15.000000000 +0100
@@ -43,6 +43,12 @@
#include <ulogd/ulogd.h>
#include <ulogd/ipfix_protocol.h>
+enum input_keys {
+ INKEY_RAW_PCKT,
+ INKEY_RAW_PCKTLEN,
+ INKEY_OOB_FAMILY,
+};
+
enum output_keys {
KEY_IP_SADDR,
KEY_IP_DADDR,
@@ -633,7 +639,8 @@
static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
{
struct ulogd_key *ret = pi->output.keys;
- struct iphdr *iph = pi->input.keys[0].u.source->u.value.ptr;
+ struct iphdr *iph =
+ GET_VALUE(pi->input.keys, INKEY_RAW_PCKT).ptr;
void *nexthdr = (u_int32_t *)iph + iph->ihl;
if (len < sizeof(struct iphdr) || len <= iph->ihl * 4)
@@ -702,7 +709,8 @@
static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, u_int32_t len)
{
struct ulogd_key *ret = pi->output.keys;
- struct ip6_hdr *ipv6h = pi->input.keys[0].u.source->u.value.ptr;
+ struct ip6_hdr *ipv6h =
+ GET_VALUE(pi->input.keys, INKEY_RAW_PCKT).ptr;
unsigned int ptr, hdrlen = 0;
u_int8_t curhdr;
int fragment = 0;
@@ -819,8 +827,8 @@
static int _interp_pkt(struct ulogd_pluginstance *pi)
{
- u_int32_t len = pi->input.keys[1].u.source->u.value.ui32;
- u_int8_t family = pi->input.keys[2].u.source->u.value.ui8;
+ u_int32_t len = GET_VALUE(pi->input.keys, INKEY_RAW_PCKTLEN).ui32;
+ u_int8_t family = GET_VALUE(pi->input.keys, INKEY_OOB_FAMILY).ui8;
switch (family) {
case AF_INET:
--
next prev parent reply other threads:[~2008-02-11 22:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 22:07 [PATCH 0/5] adds ebtables nflog support to ulogd Peter Warasin
2008-02-11 22:07 ` Peter Warasin [this message]
2008-02-14 14:46 ` [PATCH 1/5] Adds input keys enumeration Pablo Neira Ayuso
2008-02-11 22:07 ` [PATCH 2/5] Adds AF_BRIDGE and ARP header interpreter to BASE plugin Peter Warasin
2008-02-13 23:05 ` [PATCHv2 " Peter Warasin
2008-02-14 7:39 ` Eric Leblond
2008-02-14 11:34 ` [PATCHv3 " Peter Warasin
2008-02-14 15:23 ` Pablo Neira Ayuso
2008-02-15 17:25 ` [PATCHv4 " Peter Warasin
2008-02-15 17:39 ` Peter Warasin
2008-02-16 0:25 ` [PATCHv5 " Peter Warasin
2008-02-19 0:58 ` Pablo Neira Ayuso
2008-02-19 10:53 ` Peter Warasin
2008-02-11 22:07 ` [PATCH 3/5] adds AF_BRIDGE support to PRINTPKT plugin Peter Warasin
2008-02-19 10:54 ` Pablo Neira Ayuso
2008-02-11 22:07 ` [PATCH 4/5] adds AF_BRIDGE support to IP2STR Peter Warasin
2008-02-12 20:28 ` Eric Leblond
2008-02-13 11:17 ` Peter Warasin
2008-02-12 21:15 ` Eric Leblond
2008-02-13 11:13 ` Peter Warasin
2008-02-13 23:06 ` [PATCHv2 " Peter Warasin
2008-02-14 11:36 ` [PATCHv3 " Peter Warasin
2008-02-16 0:25 ` [PATCHv4 " Peter Warasin
2008-02-19 10:55 ` Pablo Neira Ayuso
2008-02-11 22:07 ` [PATCH 5/5] Adds ebtables nflog stack samples to config file Peter Warasin
2008-02-19 10:56 ` Pablo Neira Ayuso
2008-02-12 20:04 ` [Ebtables-devel] [PATCH 0/5] adds ebtables nflog support to ulogd Bart De Schuymer
2008-02-12 20:30 ` Peter Warasin
2008-02-21 22:23 ` Bart De Schuymer
[not found] ` <1203632611.2902.6.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-02-25 13:55 ` Peter Warasin
[not found] ` <1202846691.2901.16.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-02-19 1:50 ` [PATCH 1/2] Add IPv6 support Tseng, Kuo-Lang
2008-02-19 18:24 ` [Ebtables-devel] " Tseng, Kuo-Lang
[not found] ` <3F25FE8C477E9E4FB3D42C2FF937C08A8D0B66-7XlYjKTK0pNQxe9IK+vIArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-02-21 21:29 ` Bart De Schuymer
2008-02-19 15:12 ` [Ebtables-devel] [PATCH 0/5] adds ebtables nflog support to ulogd Patrick McHardy
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=20080211221055.928104246@endian.com \
--to=peter@endian.com \
--cc=ebtables-devel@lists.sourceforge.net \
--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.