All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yi-Hung Wei <yihung.wei@gmail.com>
To: Pravin Shelar <pshelar@ovn.org>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 2/2] openvswitch: Add timeout support to ct action
Date: Thu, 21 Mar 2019 16:05:19 -0700	[thread overview]
Message-ID: <CAG1aQh+kdpaSb9Dh8jkMJNP79CuHx2oTMsP4yFAgo=ER0ODQAg@mail.gmail.com> (raw)
In-Reply-To: <CAOrHB_BfojzbHHQgnCh7kqKPHLzLssBDj0KCrv-kAAkM4pzZTA@mail.gmail.com>

> > +static void ovs_ct_add_timeout(struct net *net, struct nf_conn *ct,
> > +                              const char *timeout_name, u16 l3num, u8 l4num)
> > +{
> This code looks very similar to xt_ct_set_timeout(), can you refactor
> it to avoid code duplication?

Thanks Prvain's feedback. I will export the set timeout function and
use that to avoid duplication.

> >  static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
> > @@ -1550,6 +1607,15 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
> >                         info->have_eventmask = true;
> >                         info->eventmask = nla_get_u32(a);
> >                         break;
> > +#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
> > +               case OVS_CT_ATTR_TIMEOUT:
> > +                       memcpy(info->timeout, nla_data(a), nla_len(a));
> Before copying timeout, we need to check sizeof source string.
> 'nla_len(a)' needs to be less than CTNL_TIMEOUT_NAME_MAX.

There are some exiting checking in parse_ct() as below. That should
check the sizeof source string already.
....
        nla_for_each_nested(a, attr, rem) {
                int type = nla_type(a);
                int maxlen;
                int minlen;
......
                maxlen = ovs_ct_attr_lens[type].maxlen;
                minlen = ovs_ct_attr_lens[type].minlen;
                if (nla_len(a) < minlen || nla_len(a) > maxlen) {
                        OVS_NLERR(log,
                                  "Conntrack attr type has unexpected
length (type=%d, length=%d, expected=%d)",
                                  type, nla_len(a), maxlen);
                        return -EINVAL;
                }

I will respin v2 soon.

Thanks,

-Yi-Hung

  reply	other threads:[~2019-03-21 23:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 21:11 [PATCH net-next 1/2] netfilter: Export nf_ct_destroy_timeout() Yi-Hung Wei
2019-03-20 21:11 ` [PATCH net-next 2/2] openvswitch: Add timeout support to ct action Yi-Hung Wei
2019-03-21  4:39   ` Pravin Shelar
2019-03-21 23:05     ` Yi-Hung Wei [this message]
2019-03-23  2:49   ` kbuild test robot
2019-03-23  8:35   ` kbuild test robot
2019-03-23  6:41 ` [PATCH net-next 1/2] netfilter: Export nf_ct_destroy_timeout() kbuild test robot

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='CAG1aQh+kdpaSb9Dh8jkMJNP79CuHx2oTMsP4yFAgo=ER0ODQAg@mail.gmail.com' \
    --to=yihung.wei@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.