Re: [v3] net/ceph/messenger: support IPv6 Link-Local with scope identifier

Alex Markuze <[email protected]>
Newsgroups org.kernel.vger.ceph-devel
Message-ID <[email protected]>
Hi Max,

NACK for now. Thanks for the patch, but I have some concerns
that need a v2:

  1. [critical] messenger.c:1259: scope_id leaks into wire identity, breaking handshake
     `inet_pton_with_scope()` stores the local interface index in
     `sin6_scope_id`. The full `sockaddr_storage` — including
     `sin6_scope_id` — is copied into `ceph_entity_addr.in_addr`, which
     is then wire-encoded and `memcmp`'d during both v1 and v2
     handshakes. The server will have `scope_id=0` in its advertised
     address, so the comparison will always fail for link-local
     addresses with a scope. The interface index is also
     namespace-local, so it won't match across hosts even if both sides
     set one.
     Suggested fix: Zero out `sin6_scope_id` in the canonical
     `ceph_entity_addr` after the `memcpy`. Keep the scope only in the
     `sockaddr` passed to `kernel_connect()`, or store it in a side
     field.
  2. [minor] messenger.c:1334: Allocation failure masked by DNS fallback
     `ceph_pton()` can return `-ENOMEM` from `kstrndup()`, but
     `ceph_parse_server_name()` treats any non-zero return as "not an IP
     literal" and falls through to `ceph_dns_resolve_name()`. This
     silently turns OOM into a spurious DNS lookup.
     Suggested fix: Fall back to DNS only on `-EINVAL`; propagate
     `-ENOMEM` directly.
  3. [nit] messenger.c:1247: GFP_NOFS in non-filesystem context
     `kstrndup(str, len, GFP_NOFS)` is used during mount option parsing
     — process context, no filesystem locks held. `GFP_KERNEL` would be
     more appropriate.

scope_id from inet_pton_with_scope() is copied into the canonical ceph_entity_addr, breaking v1 and v2 handshake identity comparisons for link-local addresses


-- 
Alex Markuze
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.