From: Florian Westphal <fw at strlen.de>
To: mptcp at lists.01.org
Subject: Re: [MPTCP] [RFC PATCH] mptcp:pm: sysctl to announce an addr
Date: Fri, 23 Aug 2019 15:55:43 +0200 [thread overview]
Message-ID: <20190823135543.GL20113@breakpoint.cc> (raw)
In-Reply-To: 0906c889458e3d33596b978188c8cb3e8b028aa2.camel@linux.intel.com
[-- Attachment #1: Type: text/plain, Size: 2091 bytes --]
Peter Krystad <peter.krystad(a)linux.intel.com> wrote:
>
> Hi Matthieu -
>
> Thanks for this patch, I tested it in my setup and it works fine except for
> the endianess issue noted below.
[..]
> > + if (in4_pton(addr, -1, (u8 *)&pernet->announce_v4_addr.s_addr, '\0',
> > + NULL) > 0) {
>
> pm_announce_addr() [and code for OPTION_MPTCP_ADD_ADDR in
> mptcp_write_options()] is expecting this address to be in host byte order. We
> used host byte order for everything in mptcp_pm_data and subflow_context.
> In my tests the address is reversed in the ADD_ADDR option over the wire..
That looks like a bug in pm and options however -- when I see a struct
inaddr I expect it to store network byte order.
So, either those should use u32, or pm/option handling should assume
network byte order, i.e.:
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 4a9aac4710be..9f892478d336 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -603,7 +603,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) {
*ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, TCPOLEN_MPTCP_ADD_ADDR,
MPTCP_ADDR_IPVERSION_4, opts->addr_id);
- *ptr++ = htonl(opts->addr.s_addr);
+ *ptr++ = opts->addr.s_addr;
}
#if IS_ENABLED(CONFIG_IPV6)
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index 501ff67284a4..32be34a5f951 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -93,7 +93,7 @@ int pm_create_subflow(u32 token, u8 remote_id)
remote.sin_family = msk->pm.remote_family;
remote.sin_port = htons(msk->dport);
- remote.sin_addr.s_addr = htonl(msk->pm.remote_addr.s_addr);
+ remote.sin_addr = msk->pm.remote_addr;
err = subflow_connect((struct sock *)msk, &local, &remote, remote_id);
The ipv6 ADD_ADDR handling uses memcpy, so assumes network
byte order, so I think the above makes more sense than to tweak
Mathieus patch (thanks!).
next reply other threads:[~2019-08-23 13:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 13:55 Florian Westphal [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-08-23 14:36 [MPTCP] [RFC PATCH] mptcp:pm: sysctl to announce an addr Peter Krystad
2019-08-22 22:49 Peter Krystad
2019-08-20 15:16 Matthieu Baerts
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=20190823135543.GL20113@breakpoint.cc \
--to=unknown@example.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 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.