public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mirai at makinata dot eu" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug network/30604] New: Inconsistent getaddrinfo zone-index handling
Date: Sat, 01 Jul 2023 20:57:55 +0000	[thread overview]
Message-ID: <bug-30604-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30604

            Bug ID: 30604
           Summary: Inconsistent getaddrinfo zone-index handling
           Product: glibc
           Version: 2.37
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: network
          Assignee: unassigned at sourceware dot org
          Reporter: mirai at makinata dot eu
  Target Milestone: ---

Created attachment 14951
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14951&action=edit
Reproducer code

While writing a procedure that validates IP addresses by using getaddrinfo I
noticed the following inconsistencies when it comes to addresses with a zone
index:

An existing interface …
… as a numeric value:
2001:db8::1%2: getaddrinfo: OK
fe80::1%2: getaddrinfo: OK

… as an interface name:
2001:db8::1%enp4s0: getaddrinfo: Name or service not known
fe80::1%enp4s0: getaddrinfo: OK

An absent interface…
… as a numeric value:
2001:db8::1%9999: getaddrinfo: OK
fe80::1%9999: getaddrinfo: OK

… as an interface name:
2001:db8::1%foobar: getaddrinfo: Name or service not known
fe80::1%foobar: getaddrinfo: Name or service not known


I've included a small reproducer example below.
(regarding the absent interface cases, I've no opinion on what behavior to
expect here.)

It strikes me as odd that the "2001:db8::1%enp4s0" case is treated differently
on the
basis of its prefix (compared to "fe80:…").
Although at the moment only link-local and multicast scopes have defined
meaning
[RFC4007], within the Introduction of the same RFC it states:
  … the IPv6 working group decided to … and is now investigating other
  forms of local IPv6 addressing.

If I understood correctly this means that zone indexes should not be
preferentially handled on basis of prefix since other scopes might be
introduced later.


In any case, I think that getaddrinfo should handle "2001:db8::1%enp4s0"
in the same way it handles "2001:db8::1%2". Allowing %2 but not %enp4s0
is just massive hair-splitting. (especially when %2 happens to match %enp4s0)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-07-01 20:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01 20:57 mirai at makinata dot eu [this message]
2023-07-03 19:08 ` [Bug network/30604] " fweimer at redhat dot com

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=bug-30604-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).