From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Paul Blakey <paulb@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>, Roi Dayan <roid@mellanox.com>,
Yossi Kuperman <yossiku@mellanox.com>,
Oz Shlomo <ozsh@mellanox.com>,
netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
Aaron Conole <aconole@redhat.com>, Zhike Wang <wangzhike@jd.com>,
Rony Efraim <ronye@mellanox.com>,
nst-kernel@redhat.com, John Hurley <john.hurley@netronome.com>,
Simon Horman <simon.horman@netronome.com>,
Justin Pettit <jpettit@ovn.org>
Subject: Re: [PATCH net-next 1/3] net/sched: Introduce action ct
Date: Wed, 19 Jun 2019 15:33:13 -0300 [thread overview]
Message-ID: <20190619183313.GA2746@localhost.localdomain> (raw)
In-Reply-To: <1560259713-25603-2-git-send-email-paulb@mellanox.com>
On Tue, Jun 11, 2019 at 04:28:31PM +0300, Paul Blakey wrote:
...
> +static int tcf_ct_fill_params_nat(struct tcf_ct_params *p,
> + struct tc_ct *parm,
> + struct nlattr **tb,
> + struct netlink_ext_ack *extack)
> +{
> + struct nf_nat_range2 *range;
> +
> + if (!(p->ct_action & TCA_CT_ACT_NAT))
> + return 0;
> +
> + if (!IS_ENABLED(CONFIG_NF_NAT)) {
> + NL_SET_ERR_MSG_MOD(extack, "Netfilter nat isn't enabled in kernel");
> + return -EOPNOTSUPP;
> + }
> +
> + if (!(p->ct_action & (TCA_CT_ACT_NAT_SRC | TCA_CT_ACT_NAT_DST)))
> + return 0;
> +
> + if ((p->ct_action & TCA_CT_ACT_NAT_SRC) &&
> + (p->ct_action & TCA_CT_ACT_NAT_DST)) {
> + NL_SET_ERR_MSG_MOD(extack, "dnat and snat can't be enabled at the same time");
> + return -EOPNOTSUPP;
> + }
> +
> + range = &p->range;
> + if (tb[TCA_CT_NAT_IPV4_MIN]) {
> + range->min_addr.ip =
> + nla_get_in_addr(tb[TCA_CT_NAT_IPV4_MIN]);
> + range->flags |= NF_NAT_RANGE_MAP_IPS;
> + p->ipv4_range = true;
> + }
> + if (tb[TCA_CT_NAT_IPV4_MAX]) {
> + range->max_addr.ip =
> + nla_get_in_addr(tb[TCA_CT_NAT_IPV4_MAX]);
> + range->flags |= NF_NAT_RANGE_MAP_IPS;
> + p->ipv4_range = true;
> + } else if (range->min_addr.ip) {
> + range->max_addr.ip = range->min_addr.ip;
> + }
> +
> + if (tb[TCA_CT_NAT_IPV6_MIN]) {
> + range->min_addr.in6 =
> + nla_get_in6_addr(tb[TCA_CT_NAT_IPV6_MIN]);
> + range->flags |= NF_NAT_RANGE_MAP_IPS;
> + p->ipv4_range = false;
> + }
> + if (tb[TCA_CT_NAT_IPV6_MAX]) {
> + range->max_addr.in6 =
> + nla_get_in6_addr(tb[TCA_CT_NAT_IPV6_MAX]);
> + range->flags |= NF_NAT_RANGE_MAP_IPS;
> + p->ipv4_range = false;
> + } else if (memchr_inv(&range->min_addr.in6, 0,
> + sizeof(range->min_addr.in6))) {
> + range->max_addr.in6 = range->min_addr.in6;
This will overwrite ipv4_max if it was used, as min/max_addr are
unions.
What about having the _MAX handling (for both ipv4/6) inside the
if (.._MIN) { } block ?
> + }
> +
next prev parent reply other threads:[~2019-06-19 18:33 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 13:28 [PATCH net-next 0/3] net/sched: Introduce tc connection tracking Paul Blakey
2019-06-11 13:28 ` [PATCH net-next 1/3] net/sched: Introduce action ct Paul Blakey
2019-06-11 13:59 ` Toke Høiland-Jørgensen
2019-06-11 14:15 ` Paul Blakey
2019-06-11 15:34 ` Toke Høiland-Jørgensen
2019-06-11 15:53 ` Marcelo Ricardo Leitner
2019-06-11 20:23 ` Toke Høiland-Jørgensen
2019-06-13 13:46 ` Paul Blakey
2019-06-13 14:08 ` Toke Høiland-Jørgensen
2019-06-14 18:07 ` Cong Wang
2019-06-14 19:24 ` Marcelo Ricardo Leitner
2019-06-18 16:03 ` Cong Wang
2019-06-20 7:32 ` Paul Blakey
2019-06-24 17:46 ` Cong Wang
2019-06-13 11:00 ` Kevin Darbyshire-Bryant
2019-06-12 18:04 ` Marcelo Ricardo Leitner
2019-06-13 13:44 ` Paul Blakey
2019-06-12 19:55 ` Florian Westphal
2019-06-13 13:39 ` Paul Blakey
2019-06-13 10:16 ` Davide Caratti
2019-06-13 10:49 ` Davide Caratti
2019-06-13 13:40 ` Paul Blakey
2019-06-14 18:02 ` Cong Wang
2019-06-16 7:29 ` Paul Blakey
2019-06-19 18:33 ` Marcelo Ricardo Leitner [this message]
2019-06-20 7:07 ` Paul Blakey
2019-06-11 13:28 ` [PATCH net-next 2/3] net/flow_dissector: add connection tracking dissection Paul Blakey
2019-06-11 13:28 ` [PATCH net-next 3/3] net/sched: cls_flower: Add matching on conntrack info Paul Blakey
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=20190619183313.GA2746@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=aconole@redhat.com \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=john.hurley@netronome.com \
--cc=jpettit@ovn.org \
--cc=netdev@vger.kernel.org \
--cc=nst-kernel@redhat.com \
--cc=ozsh@mellanox.com \
--cc=paulb@mellanox.com \
--cc=roid@mellanox.com \
--cc=ronye@mellanox.com \
--cc=simon.horman@netronome.com \
--cc=wangzhike@jd.com \
--cc=yossiku@mellanox.com \
/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;
as well as URLs for NNTP newsgroup(s).