From: Florian Weimer <fweimer@redhat.com>
To: Ian Pilcher <arequipeno@gmail.com>
Cc: Ian Pilcher via Libc-help <libc-help@sourceware.org>
Subject: Re: inet_net_pton() alternative for IPv6
Date: Mon, 04 Jul 2022 21:57:11 +0200 [thread overview]
Message-ID: <87h73w6488.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <4e18e0fd-44dd-4236-8275-22dffdbf5892@gmail.com> (Ian Pilcher's message of "Mon, 4 Jul 2022 14:34:32 -0500")
* Ian Pilcher:
> On 7/4/22 13:34, Florian Weimer wrote:
>> There's inet_pton, or getaddrinfo AI_NUMERICHOST if you want to produce
>> a full socket address (with a port number as well).
>
> I just need to parse an IP address and prefix length or network address,
> in CIDR format. Unfortunately, inet_pton() won't parse the address
> portion of a CIDR address, so it looks like I'm going to have to make a
> zero-terminated copy of that part of the address, just so I can pass it
> to inet_pton().
I guess that's just living with C strings. 8-/
We have the same issue with separating IPv6 addresses from their scope
IDs, and have an internal __inet_pton_length function, which is used to
avoid that copy. But pretty much anything that operates on C strings
could also work with an explicit length, so there's really no good
reason to start exporting __inet_pton_length, I'm afraid.
Thanks,
Florian
prev parent reply other threads:[~2022-07-04 19:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 18:07 Ian Pilcher
2022-07-04 18:23 ` tomas
2022-07-05 23:58 ` Ian Pilcher
2022-07-06 5:04 ` tomas
2022-07-04 18:34 ` Florian Weimer
2022-07-04 19:34 ` Ian Pilcher
2022-07-04 19:57 ` Florian Weimer [this message]
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=87h73w6488.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=arequipeno@gmail.com \
--cc=libc-help@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).