From: Jakub Kicinski <kuba@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] geneve: Allow users to specify source port range
Date: Tue, 25 Feb 2025 18:26:47 -0800 [thread overview]
Message-ID: <20250225182647.486772df@kernel.org> (raw)
In-Reply-To: <20250224153927.50684-1-daniel@iogearbox.net>
On Mon, 24 Feb 2025 16:39:26 +0100 Daniel Borkmann wrote:
> @@ -1083,8 +1087,8 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
>
> use_cache = ip_tunnel_dst_cache_usable(skb, info);
> tos = geneve_get_dsfield(skb, dev, info, &use_cache);
> - sport = udp_flow_src_port(geneve->net, skb,
> - 1, USHRT_MAX, true);
> + sport = udp_flow_src_port(geneve->net, skb, geneve->cfg.port_min,
nit: we do still prefer breaking at 80 columns if it doesn't make code
less readable.
> + geneve->cfg.port_max, true);
>
> rt = udp_tunnel_dst_lookup(skb, dev, geneve->net, 0, &saddr,
> &info->key,
> @@ -1279,6 +1284,17 @@ static int geneve_validate(struct nlattr *tb[], struct nlattr *data[],
> }
> }
>
> + if (data[IFLA_GENEVE_PORT_RANGE]) {
> + const struct ifla_geneve_port_range *p =
> + nla_data(data[IFLA_GENEVE_PORT_RANGE]);
nit: would be more readable as fully separate assignment
> + if (p->high < p->low) {
> + NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_PORT_RANGE],
> + "Invalid source port range");
> + return -EINVAL;
> + }
> + }
> +
> return 0;
> }
> @@ -1450,6 +1451,11 @@ enum ifla_geneve_df {
> GENEVE_DF_MAX = __GENEVE_DF_END - 1,
> };
>
> +struct ifla_geneve_port_range {
> + __u16 low;
> + __u16 high;
I agree with the choice in abstract, but since VXLAN uses byte swapped
fields I think we may be setting an annoying trap for user space
implementations. I'd err on the side of consistency. No?
> +};
> +
> /* Bareudp section */
> enum {
> IFLA_BAREUDP_UNSPEC,
--
pw-bot: cr
next prev parent reply other threads:[~2025-02-26 2:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 15:39 [PATCH net-next 1/2] geneve: Allow users to specify source port range Daniel Borkmann
2025-02-24 15:39 ` [PATCH net-next 2/2] geneve, specs: Add port range to rt_link specification Daniel Borkmann
2025-02-26 2:26 ` Jakub Kicinski [this message]
2025-02-26 7:03 ` [PATCH net-next 1/2] geneve: Allow users to specify source port range Daniel Borkmann
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=20250225182647.486772df@kernel.org \
--to=kuba@kernel.org \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).