[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151210191008.GA20440@salvia>
Date: Thu, 10 Dec 2015 20:10:08 +0100
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Jarno Rajahalme <jarno@....org>
Cc: netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
dev@...nvswitch.org
Subject: Re: [PATCH net-next v4 8/8] openvswitch: Interface with NAT.
On Tue, Dec 08, 2015 at 05:01:10PM -0800, Jarno Rajahalme wrote:
> - /* Call the helper right after nf_conntrack_in() for confirmed
> - * connections, but only when commiting for unconfirmed connections.
> - */
> ct = nf_ct_get(skb, &ctinfo);
> - if (ct && (nf_ct_is_confirmed(ct) ? !cached : info->commit)
> - && ovs_ct_helper(skb, info->family) != NF_ACCEPT) {
> - WARN_ONCE(1, "helper rejected packet");
> - return -EINVAL;
> + if (ct) {
> +#ifdef CONFIG_NF_NAT_NEEDED
> + /* Packets starting a new connection must be NATted before the
> + * helper, so that the helper knows about the NAT. We enforce
> + * this by delaying both NAT and helper calls for unconfirmed
> + * connections until the commiting CT action. For later
> + * packets NAT and Helper may be called in either order.
> + *
> + * NAT will be done only if the CT action has NAT, and only
> + * once per packet (per zone), as guarded by the NAT bits in
> + * the key->ct.state.
> + */
> + if (info->nat && !(key->ct.state & OVS_CS_F_NAT_MASK) &&
> + (nf_ct_is_confirmed(ct) || info->commit) &&
> + ovs_ct_nat(net, key, info, skb, ct, ctinfo) != NF_ACCEPT) {
> + WARN_ONCE(1, "NAT rejected packet");
NAT can drop packets, so this warn_on I don't think you need it.
> + return -EINVAL;
> + }
> +#endif
> + /* Call the helper whenever nf_conntrack_in() was called for
> + * confirmed connections, but only when commiting for
> + * unconfirmed connections.
> + */
> + if ((nf_ct_is_confirmed(ct) ? !cached : info->commit)
> + && ovs_ct_helper(skb, info->family) != NF_ACCEPT) {
> + WARN_ONCE(1, "helper rejected packet");
Same thing may happen with helpers.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists