From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Nikolai Zhubr <n-a-zhubr@yandex.ru>
Cc: libvirt-users@redhat.com, netfilter@vger.kernel.org
Subject: Re: netfilter+libvirt=(smth got broken?)
Date: Thu, 21 Mar 2013 03:30:46 +0100 [thread overview]
Message-ID: <20130321023046.GA4189@localhost> (raw)
In-Reply-To: <5149BC91.4090502@yandex.ru>
Hi Nikolai,
On Wed, Mar 20, 2013 at 05:41:37PM +0400, Nikolai Zhubr wrote:
> Hello,
> 20.03.2013 16:47, I wrote:
> [...]
> >This all looks to me as if "--ctdir" argument somehow magically changed
> >its meaning to the opposite, but this just cannot be! I'm out of ideas
> >and looking for insights. Any hints appreciated quite a lot.
>
> Some more searching over maillists yielded this (quite astonishing):
>
> net/netfilter/xt_conntrack.c
> diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
> index 2c0086a..481a86f 100644
> --- a/net/netfilter/xt_conntrack.c
> +++ b/net/netfilter/xt_conntrack.c
> @@ -195,7 +195,7 @@ conntrack_mt(const struct sk_buff *skb, struct
> xt_action_param *par,
> return info->match_flags & XT_CONNTRACK_STATE;
> if ((info->match_flags & XT_CONNTRACK_DIRECTION) &&
> (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) ^
> - !!(info->invert_flags & XT_CONNTRACK_DIRECTION))
> + !(info->invert_flags & XT_CONNTRACK_DIRECTION))
> return false;
>
> if (info->match_flags & XT_CONNTRACK_ORIGSRC)
>
> So apparently, netfilter's behaviour was indeed reversed at some
> point, therefore libvirt stopped working properly.
--ctdir was broken and it was fixed in patch:
commit 96120d86fe302c006259baee9061eea9e1b9e486
Author: Florian Westphal <fw@strlen.de>
Date: Mon Apr 4 17:06:21 2011 +0200
netfilter: xt_conntrack: fix inverted conntrack direction test
--ctdir ORIGINAL matches REPLY packets, and vv:
userspace sets "invert_flags &= ~XT_CONNTRACK_DIRECTION" in ORIGINAL
case.
By looking at the changes you made:
>--A FI-vnet0 -p tcp -m tcp --sport 110 -m conntrack --ctstate
>ESTABLISHED -m conntrack --ctdir ORIGINAL -j RETURN
>+-A FI-vnet0 -p tcp -m tcp --sport 110 -m conntrack --ctstate
>ESTABLISHED -m conntrack --ctdir REPLY -j RETURN
The first rule looks wrong to me indeed, traffic coming in the
original direction will initiate the connection to destination port
TCP/110. Therefore, your change is correct.
It's unfortunate nobody noticed this rule was incorrect so far (even
if it was working).
> I'd guess libvirt needs to be adapted then? Is it a known issue or
> should I fill in bugreport at Novell/Red Hat?
I think you should file the bug.
next prev parent reply other threads:[~2013-03-21 2:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-20 12:47 netfilter+libvirt=(smth got broken?) Nikolai Zhubr
2013-03-20 13:06 ` Nikolai Zhubr
2013-03-20 13:41 ` Nikolai Zhubr
[not found] ` <514A1F0A.4090402@laine.org>
[not found] ` <514A1F0A.4090402-k/Ak44NBdeXYtjvyW6yDsg@public.gmane.org>
2013-03-20 23:01 ` Nikolai Zhubr
2013-03-21 2:30 ` Pablo Neira Ayuso [this message]
2013-03-21 3:18 ` [libvirt-users] " Eric Blake
2013-03-21 9:55 ` Pablo Neira Ayuso
2013-03-22 10:53 ` Pablo Neira Ayuso
2013-03-22 18:10 ` Laine Stump
2013-03-26 14:18 ` Pablo Neira Ayuso
2013-03-27 18:22 ` Laine Stump
2013-03-21 10:32 ` Nikolai Zhubr
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=20130321023046.GA4189@localhost \
--to=pablo@netfilter.org \
--cc=libvirt-users@redhat.com \
--cc=n-a-zhubr@yandex.ru \
--cc=netfilter@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