From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Felix Fietkau <nbd@openwrt.org>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
Yury Stankevich <urykhy@gmail.com>,
Hasan Chowdhury <shemonc@gmail.com>,
Stephen Hemminger <shemminger@vyatta.com>,
Jan Engelhardt <jengelh@inai.de>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] pkt_sched: act_xt support new Xtables interface
Date: Mon, 24 Dec 2012 14:12:33 +0100 [thread overview]
Message-ID: <20121224131233.GA29307@1984> (raw)
In-Reply-To: <50D8413C.8050508@openwrt.org>
Hi Felix,
On Mon, Dec 24, 2012 at 12:49:16PM +0100, Felix Fietkau wrote:
> On 2012-12-24 12:34 PM, Jamal Hadi Salim wrote:
> >
> > Some good news Yury.
> > I am told Felix Fietkau <nbd@openwrt.org> (on CC) actually
> > already solved this issue and it is a feature in openwrt. I
> > cant find the code.
> >
> > Felix - Yury is trying to retrieve skb->mark fields from
> > netfilter connmark. My understanding is you have written
> > such an action. Can you please point us to it - and any
> > reason you havent submitted this for inclusion in kernel
> > proper?
> After I added it as an experiment, I got distracted with other projects
> again and forgot about submitting it. Take a look at the code - if the
> approach is reasonable, I'll submit this thing for inclusion soon.
>
> - Felix
>
> --- /dev/null
> +++ b/net/sched/act_connmark.c
> @@ -0,0 +1,137 @@
> +/*
> + * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
> + * Place - Suite 330, Boston, MA 02111-1307 USA.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/skbuff.h>
> +#include <linux/rtnetlink.h>
> +#include <linux/pkt_cls.h>
> +#include <linux/ip.h>
> +#include <linux/ipv6.h>
> +#include <net/netlink.h>
> +#include <net/pkt_sched.h>
> +#include <net/act_api.h>
> +
> +#include <net/netfilter/nf_conntrack.h>
> +#include <net/netfilter/nf_conntrack_core.h>
> +
> +#define TCA_ACT_CONNMARK 20
> +
> +#define CONNMARK_TAB_MASK 3
> +static struct tcf_common *tcf_connmark_ht[CONNMARK_TAB_MASK + 1];
> +static u32 connmark_idx_gen;
> +static DEFINE_RWLOCK(connmark_lock);
> +
> +static struct tcf_hashinfo connmark_hash_info = {
> + .htab = tcf_connmark_ht,
> + .hmask = CONNMARK_TAB_MASK,
> + .lock = &connmark_lock,
> +};
> +
> +static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a,
> + struct tcf_result *res)
> +{
> + struct nf_conn *c;
> + enum ip_conntrack_info ctinfo;
> + int proto;
> + int r;
> +
> + if (skb->protocol == htons(ETH_P_IP)) {
> + if (skb->len < sizeof(struct iphdr))
> + goto out;
> + proto = PF_INET;
> + } else if (skb->protocol == htons(ETH_P_IPV6)) {
> + if (skb->len < sizeof(struct ipv6hdr))
> + goto out;
> + proto = PF_INET6;
> + } else
> + goto out;
> +
> + r = nf_conntrack_in(dev_net(skb->dev), proto, NF_INET_PRE_ROUTING, skb);
conntrack needs to see defragmented packets, you have to call
nf_defrag_ipv4 / _ipv6 respectively before that.
This also changes the semantics of the raw table in iptables since it
will now see packet with conntrack already attached. So this would
also break -j CT --notrack.
This needs more thinking. I can appreciate the value of calling
conntrack from different points of the packet traversal, but there are
a couple of thing we have to resolve before allowing that.
next prev parent reply other threads:[~2012-12-24 13:12 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-09 12:20 tc ipt action Yury Stankevich
2012-12-13 10:58 ` Jamal Hadi Salim
2012-12-15 21:19 ` Jamal Hadi Salim
2012-12-15 23:06 ` Jan Engelhardt
2012-12-16 0:26 ` Jan Engelhardt
2012-12-16 0:32 ` [PATCH] build: unbreak linkage of m_xt.so Jan Engelhardt
2012-12-16 10:30 ` Jamal Hadi Salim
2012-12-16 17:03 ` Jamal Hadi Salim
2012-12-16 17:43 ` Jan Engelhardt
2012-12-16 18:05 ` Jamal Hadi Salim
2012-12-16 22:02 ` Mike Frysinger
2012-12-18 17:21 ` Stephen Hemminger
2012-12-18 18:47 ` Mike Frysinger
2012-12-20 0:03 ` Stephen Hemminger
2012-12-16 10:22 ` tc ipt action Jamal Hadi Salim
[not found] ` <CAASe=fQT2pVOK0uctdaKL+aOrF8nYeTMfoF15kmd-rC02+7Vnw@mail.gmail.com>
2012-12-16 16:48 ` Jamal Hadi Salim
2012-12-16 18:59 ` Jamal Hadi Salim
2012-12-16 19:13 ` Jan Engelhardt
2012-12-16 20:36 ` Jamal Hadi Salim
2012-12-16 20:41 ` [PATCH] iproute2: act_ipt fix xtables breakage Jamal Hadi Salim
2012-12-17 12:30 ` RFC [PATCH] iproute2: temporary solution to fix xt breakage Jamal Hadi Salim
2012-12-17 16:12 ` Stephen Hemminger
2012-12-19 11:36 ` Jamal Hadi Salim
[not found] ` <CAASe=fRuJdtisEvp7uo=PHwN3nKHqsYDW4Om1gk2MK-vyNvBrA@mail.gmail.com>
2012-12-18 12:28 ` Jamal Hadi Salim
[not found] ` <CAASe=fR6Hm2dxp=1wDchtrzqnaH6qacHpg2wrsqLfmGpPbQ9Fg@mail.gmail.com>
2012-12-19 11:44 ` Jamal Hadi Salim
2012-12-19 11:56 ` [PATCH] pkt_sched: act_xt support new Xtables interface Jamal Hadi Salim
2012-12-19 15:52 ` Jan Engelhardt
2012-12-19 23:05 ` Jamal Hadi Salim
[not found] ` <CAASe=fQZGwjM_2PStRE0tje33Doi6TuwJJ3p7x-SRcwq3mQvRg@mail.gmail.com>
2012-12-19 23:00 ` Jamal Hadi Salim
2012-12-20 8:54 ` Yury Stankevich
2012-12-20 12:35 ` Jamal Hadi Salim
2012-12-20 14:59 ` Yury Stankevich
2012-12-21 13:03 ` Jamal Hadi Salim
2012-12-21 13:13 ` Yury Stankevich
2012-12-21 13:50 ` Jamal Hadi Salim
2012-12-21 14:14 ` Yury Stankevich
2012-12-22 13:19 ` Jamal Hadi Salim
2012-12-22 13:43 ` Jan Engelhardt
2012-12-22 13:56 ` Jamal Hadi Salim
2012-12-22 13:58 ` Yury Stankevich
2012-12-22 14:04 ` Florian Westphal
2012-12-22 14:09 ` Jamal Hadi Salim
2012-12-24 11:34 ` Jamal Hadi Salim
2012-12-24 11:49 ` Felix Fietkau
2012-12-24 12:19 ` Jamal Hadi Salim
2012-12-24 13:12 ` Pablo Neira Ayuso [this message]
2012-12-24 14:05 ` Jamal Hadi Salim
2012-12-24 18:19 ` Pablo Neira Ayuso
2012-12-26 23:10 ` Pablo Neira Ayuso
2012-12-21 14:35 ` Jan Engelhardt
2012-12-21 15:45 ` Eric Dumazet
2012-12-22 13:42 ` Jamal Hadi Salim
2013-01-07 19:28 ` [PATCH net-next] net: introduce skb_transport_header_was_set() Eric Dumazet
2013-01-08 14:05 ` Jamal Hadi Salim
2013-01-09 1:52 ` David Miller
2012-12-16 0:27 ` tc ipt action Pablo Neira Ayuso
2012-12-16 0:59 ` Jan Engelhardt
2012-12-16 10:43 ` Jamal Hadi Salim
2012-12-16 17:21 ` Jan Engelhardt
2012-12-16 17:47 ` Jamal Hadi Salim
2012-12-16 18:59 ` Jan Engelhardt
2012-12-16 20:35 ` Jamal Hadi Salim
2012-12-16 21:21 ` Jan Engelhardt
2012-12-17 12:58 ` Jamal Hadi Salim
2012-12-17 13:28 ` Jan Engelhardt
2012-12-18 13:23 ` Jamal Hadi Salim
2012-12-18 13:58 ` Jan Engelhardt
2012-12-19 11:43 ` Jamal Hadi Salim
2012-12-16 10:26 ` Jamal Hadi Salim
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=20121224131233.GA29307@1984 \
--to=pablo@netfilter.org \
--cc=jengelh@inai.de \
--cc=jhs@mojatatu.com \
--cc=nbd@openwrt.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=shemonc@gmail.com \
--cc=urykhy@gmail.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).