On Sat, Jan 07, 2017 at 08:49:18PM +0800, Liping Zhang wrote:
> From: Liping Zhang <[email protected]>
> 
> 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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to