From: Patrick McHardy <kaber@trash.net>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jan Engelhardt <jengelh@medozas.de>,
Randy Dunlap <randy.dunlap@oracle.com>,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, kvm@vger.kernel.org,
herbert@gondor.hengli.com.au
Subject: Re: [PATCHv3] extensions: libxt_CHECKSUM extension
Date: Thu, 15 Jul 2010 11:39:48 +0200 [thread overview]
Message-ID: <4C3ED764.3060301@trash.net> (raw)
In-Reply-To: <20100711151453.GA7563@redhat.com>
Am 11.07.2010 17:14, schrieb Michael S. Tsirkin:
> diff --git a/extensions/libxt_CHECKSUM.c b/extensions/libxt_CHECKSUM.c
> new file mode 100644
> index 0000000..00fbd8f
> --- /dev/null
> +++ b/extensions/libxt_CHECKSUM.c
> @@ -0,0 +1,99 @@
> +/* Shared library add-on to xtables for CHECKSUM
> + *
> + * (C) 2002 by Harald Welte <laforge@gnumonks.org>
> + * (C) 2010 by Red Hat, Inc
> + * Author: Michael S. Tsirkin <mst@redhat.com>
> + *
> + * This program is distributed under the terms of GNU GPL v2, 1991
> + *
> + * libxt_CHECKSUM.c borrowed some bits from libipt_ECN.c
> + *
> + * $Id$
Please no CVS IDs.
> + */
> +#include <stdio.h>
> +#include <string.h>
> +#include <stdlib.h>
> +#include <getopt.h>
> +
> +#include <xtables.h>
> +#include <linux/netfilter/xt_CHECKSUM.h>
> +
> +static void CHECKSUM_help(void)
> +{
> + printf(
> +"CHECKSUM target options\n"
> +" --checksum-fill Fill in packet checksum.\n");
> +}
> +
> +static const struct option CHECKSUM_opts[] = {
> + { "checksum-fill", 0, NULL, 'F' },
> + { .name = NULL }
> +};
> +
> +static int CHECKSUM_parse(int c, char **argv, int invert, unsigned int *flags,
> + const void *entry, struct xt_entry_target **target)
> +{
> + struct xt_CHECKSUM_info *einfo
> + = (struct xt_CHECKSUM_info *)(*target)->data;
> +
> + switch (c) {
> + case 'F':
> + if (*flags)
> + xtables_error(PARAMETER_PROBLEM,
> + "CHECKSUM target: Only use --checksum-fill ONCE!");
There is a helper function called xtables_param_act for checking double
arguments and printing a standarized error message.
> + einfo->operation = XT_CHECKSUM_OP_FILL;
> + *flags |= XT_CHECKSUM_OP_FILL;
> + break;
> + default:
> + return 0;
> + }
> +
> + return 1;
> +}
> +
next prev parent reply other threads:[~2010-07-15 9:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100711150623.GA7420@redhat.com>
2010-07-11 15:08 ` [PATCHv2] extensions: libxt_CHECKSUM extension Michael S. Tsirkin
2010-07-11 15:14 ` [PATCHv3] " Michael S. Tsirkin
2010-07-15 9:36 ` [PATCHv2] netfilter: add CHECKSUM target Patrick McHardy
[not found] ` <20100711151453.GA7563@redhat.com>
2010-07-11 15:57 ` [PATCHv2] extensions: libxt_CHECKSUM extension Jan Engelhardt
2010-07-11 19:00 ` Michael S. Tsirkin
2010-07-11 19:54 ` Jan Engelhardt
2010-07-11 19:52 ` Michael S. Tsirkin
2010-07-11 20:03 ` Jan Engelhardt
2010-07-11 20:00 ` Michael S. Tsirkin
2010-07-12 17:12 ` Jan Engelhardt
2010-07-12 17:50 ` Michael S. Tsirkin
2010-07-11 19:06 ` Michael S. Tsirkin
2010-07-11 19:57 ` Jan Engelhardt
2010-07-11 19:59 ` Michael S. Tsirkin
2010-07-15 9:39 ` Patrick McHardy [this message]
2010-07-15 10:17 ` several messages Jan Engelhardt
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=4C3ED764.3060301@trash.net \
--to=kaber@trash.net \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.hengli.com.au \
--cc=jengelh@medozas.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=netfilter@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).