* [PATCH] net/ceph/messenger: support IPv6 Link-Local with scope identifier
@ 2026-06-29 19:55 Max Kellermann
2026-07-02 11:40 ` Alex Markuze
0 siblings, 1 reply; 3+ messages in thread
From: Max Kellermann @ 2026-06-29 19:55 UTC (permalink / raw)
To: idryomov, amarkuze, ceph-devel, linux-kernel; +Cc: Max Kellermann
Implement ceph_pton() using inet_pton_with_scope(). This minimal
patch preserves the ceph_pton() API and thus requires copying the
parameter to a null-terminated string.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
net/ceph/messenger.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 34b3097b4c7b..4848ae5f61bb 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1221,19 +1221,37 @@ void ceph_addr_set_port(struct ceph_entity_addr *addr, int p)
static int ceph_pton(const char *str, size_t len, struct ceph_entity_addr *addr,
char delim, const char **ipend)
{
- memset(&addr->in_addr, 0, sizeof(addr->in_addr));
+ const char *delim_p;
+ char *copy;
+ struct sockaddr_storage stor = { 0 };
+ int ret;
- if (in4_pton(str, len, (u8 *)&((struct sockaddr_in *)&addr->in_addr)->sin_addr.s_addr, delim, ipend)) {
- put_unaligned(AF_INET, &addr->in_addr.ss_family);
- return 0;
- }
+ delim_p = memchr(str, delim, len);
+ if (delim_p)
+ /* delimiter was found - stop parsing there */
+ len = delim_p - str;
- if (in6_pton(str, len, (u8 *)&((struct sockaddr_in6 *)&addr->in_addr)->sin6_addr.s6_addr, delim, ipend)) {
- put_unaligned(AF_INET6, &addr->in_addr.ss_family);
- return 0;
+ /* the input string might not be null terminated, so copy it
+ * to a null-terminated string
+ */
+ copy = kstrndup(str, len, GFP_NOFS);
+ if (!copy)
+ return -ENOMEM;
+
+ ret = inet_pton_with_scope(&init_net, AF_UNSPEC, copy, NULL, &stor);
+ kfree(copy);
+
+ if (!ret) {
+ /* ceph_entity_addr might be misaligned, so we have to
+ * parse to a stack variable first
+ */
+ memcpy(&addr->in_addr, &stor, sizeof(stor));
+
+ /* return the end of the parsed portion to the caller on success */
+ *ipend = str + len;
}
- return -EINVAL;
+ return ret;
}
/*
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: net/ceph/messenger: support IPv6 Link-Local with scope identifier
2026-06-29 19:55 [PATCH] net/ceph/messenger: support IPv6 Link-Local with scope identifier Max Kellermann
@ 2026-07-02 11:40 ` Alex Markuze
2026-07-03 7:19 ` Max Kellermann
0 siblings, 1 reply; 3+ messages in thread
From: Alex Markuze @ 2026-07-02 11:40 UTC (permalink / raw)
To: Max Kellermann; +Cc: Alex Markuze, ceph-devel
Hi Max,
NACK for now. Thanks for the patch, but I have some concerns
that need a v2:
1. [critical] net/ceph/messenger.c:1251: NULL pointer dereference via ceph_dns_resolve_name
2. [major] net/ceph/messenger.c:1251: IPv4 port parsing regression
3. [major] net/ceph/messenger.c:1243: Scope resolution uses init_net instead of caller's namespace
--
Alex Markuze
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: net/ceph/messenger: support IPv6 Link-Local with scope identifier
2026-07-02 11:40 ` Alex Markuze
@ 2026-07-03 7:19 ` Max Kellermann
0 siblings, 0 replies; 3+ messages in thread
From: Max Kellermann @ 2026-07-03 7:19 UTC (permalink / raw)
To: Alex Markuze; +Cc: ceph-devel
On Thu, Jul 2, 2026 at 1:40 PM Alex Markuze <amarkuze@redhat.com> wrote:
>
> Hi Max,
>
> NACK for now. Thanks for the patch, but I have some concerns
> that need a v2:
>
> 1. [critical] net/ceph/messenger.c:1251: NULL pointer dereference via ceph_dns_resolve_name
> 2. [major] net/ceph/messenger.c:1251: IPv4 port parsing regression
Need more information on these.
--
Max Kellermann
Principal Architect
Hosting Technology
cm4all | Im Mediapark 6a | 50670 Köln | Germany
General information about the company can be found here:
https://www.cm4all.com/impressum
A member of the IONOS Group
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-03 7:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 19:55 [PATCH] net/ceph/messenger: support IPv6 Link-Local with scope identifier Max Kellermann
2026-07-02 11:40 ` Alex Markuze
2026-07-03 7:19 ` Max Kellermann
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.