9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <russcox@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] silly dhcpd question
Date: Sat, 14 May 2005 12:18:36 -0400	[thread overview]
Message-ID: <ee9e417a050514091821ab55d5@mail.gmail.com> (raw)
In-Reply-To: <14ec7b18050514014012d4e1fe@mail.gmail.com>

You guys don't appear to be running the Plan 9 that I am.

1. As Boyd pointed out, the correct fix is to use lower case
in ndb.  Ndb is treating its entries as plain old case-sensitive
strings.  For the most part, the lookup routines have no
idea what an IP address or an ethernet address is, so when
dhcpd asks for an entry with ether=00d0c9670733 it doesn't
match against ether=00D0C9670733.  

The correct fix, if there is one, is to change the ndb reading
routines to recognize certain attributes and canonicalize
them: ip, ether, dom, maybe sysname.  But then it will be
weird that dom is case-insensitive but bootf is not.  Should
fs be case-sensitive?  Etc.  I'm much happier requiring that
the ndb entries be stored in canonical form than doing magical
rewriting under the hood. 

2. Parseether (which ndb isn't using) correctly handles upper
case ethernet addresses already.  

3. Strtoul correctly handles upper case hex already, as required
by the C standard.  

The program below prints

    abcdef
    abcdefabcdef

for me.

Russ

#include <u.h>
#include <libc.h>
#include <ip.h>

void
main(void)
{
	uchar ea[6];

	fmtinstall('H', encodefmt);
	print("%x\n", strtoul("ABCDEF", 0, 16));
	parseether(ea, "ABCDEFABCDEF");
	print("%.6lH\n", ea);
}


  reply	other threads:[~2005-05-14 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 21:59 Ronald G. Minnich
2005-05-13 22:04 ` "Nils O. Selåsdal"
2005-05-13 22:28   ` Ronald G. Minnich
2005-05-14  2:36     ` boyd, rounin
2005-05-14  5:44 ` lucio
2005-05-14  8:05   ` lucio
2005-05-14  8:38     ` andrey mirtchovski
2005-05-14  8:40       ` andrey mirtchovski
2005-05-14 16:18         ` Russ Cox [this message]
2005-05-14 16:31           ` boyd, rounin
2005-05-14 18:59             ` Axel Belinfante
2005-05-14 19:11               ` Russ Cox
2005-05-16  4:04               ` Ronald G. Minnich

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=ee9e417a050514091821ab55d5@mail.gmail.com \
    --to=russcox@gmail.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).