Re: [PATCH net-next v4 8/8] openvswitch: Interface with NAT.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux