All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Liping Zhang <zlpnobody@163.com>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de,
	Liping Zhang <zlpnobody@gmail.com>
Subject: Re: [PATCH nf] netfilter: rpfilter: fix incorrect loopback packet judgment
Date: Mon, 16 Jan 2017 14:26:18 +0100	[thread overview]
Message-ID: <20170116132618.GA20958@salvia> (raw)
In-Reply-To: <1483793358-30619-1-git-send-email-zlpnobody@163.com>

On Sat, Jan 07, 2017 at 08:49:18PM +0800, Liping Zhang wrote:
> From: Liping Zhang <zlpnobody@gmail.com>
> 
> Currently, we check the existing rtable in PREROUTING hook, if RTCF_LOCAL
> is set, we assume that the packet is loopback.
> 
> But this assumption is incorrect, for example, a packet encapsulated
> in ipsec transport mode was received and routed to local, after
> decapsulation, it would be delivered to local again, and the rtable
> was not dropped, so RTCF_LOCAL check would trigger. But actually, the
> packet was not loopback.
> 
> So for these normal loopback packets, we can check whether the in device
> is IFF_LOOPBACK or not. For these locally generated broadcast/multicast,
> we can check whether the skb->pkt_type is PACKET_LOOPBACK or not.
> 
> Finally, there's a subtle difference between nft fib expr and xtables
> rpfilter extension, user can add the following nft rule to do strict
> rpfilter check:
>   # nft add rule x y meta iif eth0 fib saddr . iif oif != eth0 drop
> 
> So when the packet is loopback, it's better to store the in device
> instead of the LOOPBACK_IFINDEX, otherwise, after adding the above
> nft rule, locally generated broad/multicast packets will be dropped
> incorrectly.

Applied, thanks.

      reply	other threads:[~2017-01-16 13:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07 12:49 [PATCH nf] netfilter: rpfilter: fix incorrect loopback packet judgment Liping Zhang
2017-01-16 13:26 ` Pablo Neira Ayuso [this message]

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=20170116132618.GA20958@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=zlpnobody@163.com \
    --cc=zlpnobody@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 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.