Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210063 > unrolled thread

Re: [PATCHv4 net-next 10/10] openvswitch: Allow attaching helpers to ct action

Started byPravin Shelar <pshelar@nicira.com>
First post2015-08-20 01:00 +0200
Last post2015-08-21 19:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCHv4 net-next 10/10] openvswitch: Allow attaching helpers to  ct action Pravin Shelar <pshelar@nicira.com> - 2015-08-20 01:00 +0200
    Re: [PATCHv4 net-next 10/10] openvswitch: Allow attaching helpers to  ct action Joe Stringer <joestringer@nicira.com> - 2015-08-21 02:50 +0200
      Re: [PATCHv4 net-next 10/10] openvswitch: Allow attaching helpers to  ct action Pravin Shelar <pshelar@nicira.com> - 2015-08-21 19:50 +0200

#1210063 — Re: [PATCHv4 net-next 10/10] openvswitch: Allow attaching helpers to ct action

FromPravin Shelar <pshelar@nicira.com>
Date2015-08-20 01:00 +0200
SubjectRe: [PATCHv4 net-next 10/10] openvswitch: Allow attaching helpers to ct action
Message-ID<pZkuR-33G-7@gated-at.bofh.it>
On Tue, Aug 18, 2015 at 4:39 PM, Joe Stringer <joestringer@nicira.com> wrote:
> Add support for using conntrack helpers to assist protocol detection.
> The new OVS_CT_ATTR_HELPER attribute of the ct action specifies a helper
> to be used for this connection.
>
> Example ODP flows allowing FTP connections from ports 1->2:
> in_port=1,tcp,action=ct(helper=ftp,commit),2
> in_port=2,tcp,ct_state=-trk,action=ct(),recirc(1)
> recirc_id=1,in_port=2,tcp,ct_state=+trk-new+est,action=1
> recirc_id=1,in_port=2,tcp,ct_state=+trk+rel,action=1
>
> Signed-off-by: Joe Stringer <joestringer@nicira.com>
> ---
> v2-v3: No change.
> v4: Change error code for unknown helper ENOENT->EINVAL.

I got following compilation warning :

net/openvswitch/conntrack.c:352:42: error: incompatible types in
comparison expression (different address spaces)

> ---
>  include/uapi/linux/openvswitch.h |   3 ++
>  net/openvswitch/conntrack.c      | 109 ++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 110 insertions(+), 2 deletions(-)
>
...

> +static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
> +                            const struct sw_flow_key *key, bool log)
> +{
> +       struct nf_conntrack_helper *helper;
> +       struct nf_conn_help *help;
> +
> +       helper = nf_conntrack_helper_try_module_get(name, info->family,
> +                                                   key->ip.proto);
> +       if (!helper) {
> +               OVS_NLERR(log, "Unknown helper \"%s\"", name);
> +               return -EINVAL;
> +       }
> +
> +       help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL);
> +       if (!help) {
> +               module_put(helper->me);
> +               return -ENOMEM;
> +       }
> +
> +       help->helper = helper;
helper is rcu pointer so need to use rcu API to set the value. I know
it is not required here, but it is still cleaner to use the API.

> +       info->helper = helper;
> +       return 0;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1210815

FromJoe Stringer <joestringer@nicira.com>
Date2015-08-21 02:50 +0200
Message-ID<pZIGS-4zi-7@gated-at.bofh.it>
In reply to#1210063
On 19 August 2015 at 15:57, Pravin Shelar <pshelar@nicira.com> wrote:
> On Tue, Aug 18, 2015 at 4:39 PM, Joe Stringer <joestringer@nicira.com> wrote:
>> Add support for using conntrack helpers to assist protocol detection.
>> The new OVS_CT_ATTR_HELPER attribute of the ct action specifies a helper
>> to be used for this connection.
>>
>> Example ODP flows allowing FTP connections from ports 1->2:
>> in_port=1,tcp,action=ct(helper=ftp,commit),2
>> in_port=2,tcp,ct_state=-trk,action=ct(),recirc(1)
>> recirc_id=1,in_port=2,tcp,ct_state=+trk-new+est,action=1
>> recirc_id=1,in_port=2,tcp,ct_state=+trk+rel,action=1
>>
>> Signed-off-by: Joe Stringer <joestringer@nicira.com>
>> ---
>> v2-v3: No change.
>> v4: Change error code for unknown helper ENOENT->EINVAL.
>
> I got following compilation warning :
>
> net/openvswitch/conntrack.c:352:42: error: incompatible types in
> comparison expression (different address spaces)

Is this made available via another sparse flag? It looks like it's
related to the __rcu as you've mentioned below, but I'm not seeing
this (latest sparse, gcc-4.9.2)

>> +static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
>> +                            const struct sw_flow_key *key, bool log)
>> +{
>> +       struct nf_conntrack_helper *helper;
>> +       struct nf_conn_help *help;
>> +
>> +       helper = nf_conntrack_helper_try_module_get(name, info->family,
>> +                                                   key->ip.proto);
>> +       if (!helper) {
>> +               OVS_NLERR(log, "Unknown helper \"%s\"", name);
>> +               return -EINVAL;
>> +       }
>> +
>> +       help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL);
>> +       if (!help) {
>> +               module_put(helper->me);
>> +               return -ENOMEM;
>> +       }
>> +
>> +       help->helper = helper;
> helper is rcu pointer so need to use rcu API to set the value. I know
> it is not required here, but it is still cleaner to use the API.

Will update, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1211272

FromPravin Shelar <pshelar@nicira.com>
Date2015-08-21 19:50 +0200
Message-ID<pZYBY-2dA-7@gated-at.bofh.it>
In reply to#1210815
On Thu, Aug 20, 2015 at 5:47 PM, Joe Stringer <joestringer@nicira.com> wrote:
> On 19 August 2015 at 15:57, Pravin Shelar <pshelar@nicira.com> wrote:
>> On Tue, Aug 18, 2015 at 4:39 PM, Joe Stringer <joestringer@nicira.com> wrote:
>>> Add support for using conntrack helpers to assist protocol detection.
>>> The new OVS_CT_ATTR_HELPER attribute of the ct action specifies a helper
>>> to be used for this connection.
>>>
>>> Example ODP flows allowing FTP connections from ports 1->2:
>>> in_port=1,tcp,action=ct(helper=ftp,commit),2
>>> in_port=2,tcp,ct_state=-trk,action=ct(),recirc(1)
>>> recirc_id=1,in_port=2,tcp,ct_state=+trk-new+est,action=1
>>> recirc_id=1,in_port=2,tcp,ct_state=+trk+rel,action=1
>>>
>>> Signed-off-by: Joe Stringer <joestringer@nicira.com>
>>> ---
>>> v2-v3: No change.
>>> v4: Change error code for unknown helper ENOENT->EINVAL.
>>
>> I got following compilation warning :
>>
>> net/openvswitch/conntrack.c:352:42: error: incompatible types in
>> comparison expression (different address spaces)
>
> Is this made available via another sparse flag? It looks like it's
> related to the __rcu as you've mentioned below, but I'm not seeing
> this (latest sparse, gcc-4.9.2)
>
You need to enable RCU space checker in kernel config.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web