From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] src: add tee statement
Date: Fri, 19 Jun 2015 15:37:26 +0200 [thread overview]
Message-ID: <20150619133726.GA11813@salvia> (raw)
In-Reply-To: <20150619125724.GG22946@acer.localdomain>
On Fri, Jun 19, 2015 at 02:57:24PM +0200, Patrick McHardy wrote:
> On 19.06, Pablo Neira Ayuso wrote:
> > This allows you to clone packets to some destination, eg.
> >
> > ... tee gateway 172.20.0.2
> > ... tee oifname tap0 gateway ip saddr map { 192.168.0.2 : 172.20.0.2, ... }
>
> Is tee a name we want to use for userspace syntax? It's not particulary
> descriptive for people who don't know what "tee" is, which I guess are
> quite a few. Alternative suggestion of the top of my head would be "dup"
> or "duplicate".
I can do so, yes. Do you want to me rename the kernel part to
nft_dup.c as well? The core name can be net/netfilter/nf_dup.c instead
of net/netfilter/nf_tee.c
> > +struct tee_stmt {
> > + struct expr *gw;
> > + const char *oifname;
>
> I'd suggest to use an expr as well to allow use of symbolic variables.
> BTW, have you considered using an ifindex? I mean, we do it for matches
> as well, and in case of tee its rather unlikely to be used with a
> dynamic network device.
Note sure about this, we now have tapX in place in VM environments
that can go up and down.
However, when implementing tee (now dup) for the new netdev and bridge
family we'll indicate the physical device to duplicate packets, it
should be good to allow the use ifindef if we want maps in place
there.
I think we can change to ifindex, if someone needs with ifname, we can
add it later on, OK?
> > + reg1 = netlink_parse_register(nle, NFT_EXPR_TEE_SREG_GW);
> > + if (reg1) {
> > + addr = netlink_get_register(ctx, loc, reg1);
> > + if (addr == NULL)
> > + return netlink_error(ctx, loc,
> > + "TEE statement has no address "
> > + "expression");
> > +
> > + if (ctx->table->handle.family == NFPROTO_IPV4)
> > + expr_set_type(addr, &ipaddr_type, BYTEORDER_BIG_ENDIAN);
> > + else
> > + expr_set_type(addr, &ip6addr_type,
> > + BYTEORDER_BIG_ENDIAN);
> > + stmt->tee.gw = addr;
> > + }
> > +
> > + if (nft_rule_expr_is_set(nle, NFT_EXPR_TEE_OIFNAME)) {
> > + stmt->tee.oifname =
> > + strdup(nft_rule_expr_get_str(nle, NFT_EXPR_TEE_OIFNAME));
>
> Please use consistent braces, IOW none for single statements.
I'll do it, but I think it's unclear wrt. kernel netdev coding style,
since the line split can be considered as two lines.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
next prev parent reply other threads:[~2015-06-19 13:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 10:26 [PATCH nft] src: add tee statement Pablo Neira Ayuso
2015-06-19 12:57 ` Patrick McHardy
2015-06-19 13:17 ` Patrick Schaaf
2015-06-19 13:24 ` Jan Engelhardt
2015-06-19 13:37 ` Patrick McHardy
2015-06-19 14:07 ` Jan Engelhardt
2015-06-26 11:47 ` Bjørnar Ness
2015-06-19 13:29 ` Patrick McHardy
2015-06-19 13:37 ` Pablo Neira Ayuso [this message]
2015-06-19 13:41 ` Patrick McHardy
2015-06-19 13:56 ` 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=20150619133726.GA11813@salvia \
--to=pablo@netfilter.org \
--cc=kaber@trash.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 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).