9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Presotto <presotto@closedmind.org>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] bug in v4parseip?
Date: Thu, 13 Feb 2003 10:21:09 -0500	[thread overview]
Message-ID: <713e94f597696a29dd5a3ef441a109ca@plan9.bell-labs.com> (raw)
In-Reply-To: <6d3220b4.0302121654.66a0f55e@posting.google.com>

On Thu Feb 13 04:50:37 EST 2003, saroj@optonline.net wrote:
> v4parseip function code in libip/ipparse.c looks suspicious. First of
> all, I don't know why it bothers about class A or B given the trend
> towards classless addresses?

Classless or not, the most standard string form of v4 IP addresss is
a set of dot separated decimal numbers, each number representing
an octet.  The only truncated form was the class{ABC} one and such
truncated addresses (such as 127.1) are still very common.  Ignoring
them would be a disservice.  Hence the class sensitivity.

> Next, if it is trying to handle inputs of
> the form: a.b.c and a.b, then the problem is that c in the first case
> can be a 24-bit integer and b in the second case can be a 16-bit
> integer; the code assigns those parts to a 'uchar' resulting in
> truncation. Or, did I misunderstand the code?

In the (classy?) truncated forms a, b, and c are still required
to be octet representations.  You understood the code, just not
the representation.  If you do indeed use 10.100000, you won't
get what you want.  I've never seen that form defined and am
not totally sure what the correct value would be, though BSD
would convert it to 10.1.134.160 which is the result I would
have guessed at.  What should 192.100000.1 be?  If there
really is a well accepted definition of what non
octet representations yield, I'ld be happy to implement
that.  If its a side effect of the BSD conversion, I'ld
be less thrilled.


  reply	other threads:[~2003-02-13 15:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-13  9:38 Saroj Mahapatra
2003-02-13 15:21 ` David Presotto [this message]
2003-02-13 15:55   ` Lucio De Re
2003-02-13 16:12     ` David Presotto
2003-02-13 16:17       ` Boyd Roberts
2003-02-13 16:29       ` Lucio De Re

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=713e94f597696a29dd5a3ef441a109ca@plan9.bell-labs.com \
    --to=presotto@closedmind.org \
    --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).