From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sat, 14 May 2005 12:18:36 -0400 From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] silly dhcpd question In-Reply-To: <14ec7b18050514014012d4e1fe@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <72cca6a6583b9c78a245f4825fa65229@proxima.alt.za> <14ec7b1805051401384dc36d2@mail.gmail.com> <14ec7b18050514014012d4e1fe@mail.gmail.com> Topicbox-Message-UUID: 4bb800c8-ead0-11e9-9d60-3106f5b1d025 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=3D00d0c9670733 it doesn't match against ether=3D00D0C9670733. =20 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.=20 2. Parseether (which ndb isn't using) correctly handles upper case ethernet addresses already. =20 3. Strtoul correctly handles upper case hex already, as required by the C standard. =20 The program below prints abcdef abcdefabcdef for me. Russ #include #include #include void main(void) { =09uchar ea[6]; =09fmtinstall('H', encodefmt); =09print("%x\n", strtoul("ABCDEF", 0, 16)); =09parseether(ea, "ABCDEFABCDEF"); =09print("%.6lH\n", ea); }