public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarno Rajahalme <jarno@ovn.org>
To: Joe Stringer <joe@ovn.org>
Cc: Thomas Graf <tgraf@suug.ch>,
	netfilter-devel@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	ovs dev <dev@openvswitch.org>
Subject: Re: [PATCH nf-next v9 8/8] openvswitch: Interface with NAT.
Date: Thu, 10 Mar 2016 10:55:53 -0800	[thread overview]
Message-ID: <D23E44DD-FA6D-4095-ABC8-CAE8E032BE7A@ovn.org> (raw)
In-Reply-To: <CAPWQB7GkhrfZaaT-LkTP7Esfj4tzU=Fgto2ZaSq4YkurhOf8bw@mail.gmail.com>

Thanks for the reviews Joe! Comments below.

> On Mar 9, 2016, at 7:47 PM, Joe Stringer <joe@ovn.org> wrote:
> 
> Hi Jarno,
> 
> Thanks for working on this. Mostly just a few style things around #ifdefs below.
> 
> On 9 March 2016 at 15:10, Jarno Rajahalme <jarno@ovn.org> wrote:
>> Extend OVS conntrack interface to cover NAT.  New nested
>> OVS_CT_ATTR_NAT attribute may be used to include NAT with a CT action.
>> A bare OVS_CT_ATTR_NAT only mangles existing and expected connections.
>> If OVS_NAT_ATTR_SRC or OVS_NAT_ATTR_DST is included within the nested
>> attributes, new (non-committed/non-confirmed) connections are mangled
>> according to the rest of the nested attributes.
>> 
>> The corresponding OVS userspace patch series includes test cases (in
>> tests/system-traffic.at) that also serve as example uses.
>> 
>> This work extends on a branch by Thomas Graf at
>> https://github.com/tgraf/ovs/tree/nat.
> 
> Thomas, I guess there was not signoff in these patches so Jarno does
> not have your signoff in this patch.
> 
>> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
>> ---
>> v9: Fixed module dependencies.
>> 
>> include/uapi/linux/openvswitch.h |  49 ++++
>> net/openvswitch/Kconfig          |   3 +-
>> net/openvswitch/conntrack.c      | 523 +++++++++++++++++++++++++++++++++++++--
>> net/openvswitch/conntrack.h      |   3 +-
>> 4 files changed, 551 insertions(+), 27 deletions(-)
> 
> <snip>
> 
>> diff --git a/net/openvswitch/Kconfig b/net/openvswitch/Kconfig
>> index cd5fd9d..23471a4 100644
>> --- a/net/openvswitch/Kconfig
>> +++ b/net/openvswitch/Kconfig
>> @@ -6,7 +6,8 @@ config OPENVSWITCH
>>        tristate "Open vSwitch"
>>        depends on INET
>>        depends on !NF_CONNTRACK || \
>> -                  (NF_CONNTRACK && (!NF_DEFRAG_IPV6 || NF_DEFRAG_IPV6))
>> +                  (NF_CONNTRACK && ((!NF_DEFRAG_IPV6 || NF_DEFRAG_IPV6) && \
>> +                                (!NF_NAT || NF_NAT)))
> 
> Whitespace.
> 

Fixed.

>>        select LIBCRC32C
>>        select MPLS
>>        select NET_MPLS_GSO
>> diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
>> index 5711f80..6455237 100644
>> --- a/net/openvswitch/conntrack.c
>> +++ b/net/openvswitch/conntrack.c
> 
> <snip>
> 
>> struct ovs_ct_len_tbl {
>> -       size_t maxlen;
>> -       size_t minlen;
>> +       int maxlen;
>> +       int minlen;
>> };
> 
> Are these changed for a specific reason, or just to use INT_MAX rather
> than SIZE_MAX in ovs_ct_len_tbl?
> 

‘maxlen’ and ‘minlen’ are compared against the values returned by nla_len(), which returns an int:

net/netlink.h:static inline int nla_len(const struct nlattr *nla)

so I figured it is better to have these as ints, too.

>> /* Metadata mark for masked write to conntrack mark */
>> @@ -42,15 +52,29 @@ struct md_labels {
>>        struct ovs_key_ct_labels mask;
>> };
>> 
>> +#ifdef CONFIG_NF_NAT_NEEDED
>> +enum ovs_ct_nat {
>> +       OVS_CT_NAT = 1 << 0,     /* NAT for committed connections only. */
>> +       OVS_CT_SRC_NAT = 1 << 1, /* Source NAT for NEW connections. */
>> +       OVS_CT_DST_NAT = 1 << 2, /* Destination NAT for NEW connections. */
>> +};
>> +#endif
> 
> Here...
> 
>> /* Conntrack action context for execution. */
>> struct ovs_conntrack_info {
>>        struct nf_conntrack_helper *helper;
>>        struct nf_conntrack_zone zone;
>>        struct nf_conn *ct;
>>        u8 commit : 1;
>> +#ifdef CONFIG_NF_NAT_NEEDED
>> +       u8 nat : 3;                 /* enum ovs_ct_nat */
>> +#endif
> 
> and here.. I wonder if we can trim more of these #ifdefs, for
> readability and more compiler coverage if the feature is disabled.
> 

Trimmed this and other #ifdefs as you suggested, and it still compiles when NAT is disabled.

Just posted the v10, which I hope will be the final version :-)

  Jarno

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2016-03-10 18:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 23:10 [PATCH nf-next v9 1/8] netfilter: Remove IP_CT_NEW_REPLY definition Jarno Rajahalme
2016-03-09 23:10 ` [PATCH nf-next v9 3/8] openvswitch: Add commentary to conntrack.c Jarno Rajahalme
     [not found] ` <1457565024-27300-1-git-send-email-jarno-LZ6Gd1LRuIk@public.gmane.org>
2016-03-09 23:10   ` [PATCH nf-next v9 2/8] netfilter: Allow calling into nat helper without skb_dst Jarno Rajahalme
2016-03-09 23:10   ` [PATCH nf-next v9 4/8] openvswitch: Update the CT state key only after nf_conntrack_in() Jarno Rajahalme
     [not found]     ` <1457565024-27300-4-git-send-email-jarno-LZ6Gd1LRuIk@public.gmane.org>
2016-03-10  2:12       ` Joe Stringer
2016-03-09 23:10 ` [PATCH nf-next v9 5/8] openvswitch: Find existing conntrack entry after upcall Jarno Rajahalme
     [not found]   ` <1457565024-27300-5-git-send-email-jarno-LZ6Gd1LRuIk@public.gmane.org>
2016-03-10  2:29     ` Joe Stringer
2016-03-09 23:10 ` [PATCH nf-next v9 6/8] openvswitch: Handle NF_REPEAT in conntrack action Jarno Rajahalme
2016-03-09 23:10 ` [PATCH nf-next v9 7/8] openvswitch: Delay conntrack helper call for new connections Jarno Rajahalme
     [not found]   ` <1457565024-27300-7-git-send-email-jarno-LZ6Gd1LRuIk@public.gmane.org>
2016-03-10  2:37     ` Joe Stringer
2016-03-09 23:10 ` [PATCH nf-next v9 8/8] openvswitch: Interface with NAT Jarno Rajahalme
     [not found]   ` <1457565024-27300-8-git-send-email-jarno-LZ6Gd1LRuIk@public.gmane.org>
2016-03-10  3:47     ` Joe Stringer
     [not found]       ` <CAPWQB7GkhrfZaaT-LkTP7Esfj4tzU=Fgto2ZaSq4YkurhOf8bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-10 12:00         ` Thomas Graf
     [not found]           ` <20160310120021.GA26693-4EA/1caXOu0mYvmMESoHnA@public.gmane.org>
2016-03-10 18:45             ` Jarno Rajahalme
2016-03-10 18:55       ` Jarno Rajahalme [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=D23E44DD-FA6D-4095-ABC8-CAE8E032BE7A@ovn.org \
    --to=jarno@ovn.org \
    --cc=dev@openvswitch.org \
    --cc=joe@ovn.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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