9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@coraid.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Re: ip(2) man page: return code of parseip() and parsemaskip()
Date: Fri, 20 Oct 2006 11:20:40 -0400	[thread overview]
Message-ID: <8c36be2026de3e0cadd8f554d4f6088c@coraid.com> (raw)
In-Reply-To: <ee9e417a0610200738p6647462bqb8b808d5c9c954@mail.gmail.com>

On Fri Oct 20 11:09:54 EDT 2006, rsc@swtch.com wrote:
> > but i think it's silly to differentiate between 192.168.0.1 and
> > ::ffff:192.168.0.1 an ip6 address. that's like a c compiler declaring
> > 0x3 != 3.
> 
> No, it's not.  It's like if atoi, in addition to returning
> the actual value, also returned the base the number
> was written in.  Most callers wouldn't care, but some
> might.

but it's instructive that atoi does not.

i think point of libip is to hide this stuff.
do you have an example of code where it would
be beneficial to distinguish ::ffff:192.168.0.1 from
192.168.0.1?

> Most people calling parseip shouldn't care what
> format the address was in, and should use *to
> as the address.  The only interesting question
> that should ever be asked of the return value is whether
> or not it is equal to 6.  In particular, code that uses
> 
>    ip = parseip(to, from);
> 
> and then goes on to use ip as an IP address
> is wrong and needs to be rewritten, not catered to.

however, if you decide that you don't have an ip4
address based on the fact that parseip returns 6,
you are also wrong.  

i think it would be more useful to know if it is
an ip4 address rather than what format it was
entered in.

just my opinion.

- erik


      reply	other threads:[~2006-10-20 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20  9:04 [9fans] " Gabriel Diaz
2006-10-20  9:48 ` [9fans] " Gabriel Diaz
2006-10-20 12:56   ` erik quanstrom
2006-10-20 13:44     ` Russ Cox
2006-10-20 13:56       ` erik quanstrom
2006-10-20 14:38         ` Russ Cox
2006-10-20 15:20           ` erik quanstrom [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=8c36be2026de3e0cadd8f554d4f6088c@coraid.com \
    --to=quanstro@coraid.com \
    --cc=9fans@cse.psu.edu \
    /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 NNTP newsgroup(s).