From: | Larry Rosenman <ler(at)lerctr(dot)org> |
---|---|
To: | Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> |
Cc: | pgsql-hackers(at)hub(dot)org |
Subject: | Re: mac.c |
Date: | 2000-08-20 22:50:58 |
Message-ID: | 20000820175058.A15912@lerami.lerctr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thanks Thomas!
I just didn't want the ideas to die.
Larry
* Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> [000820 14:28]:
> > Does anyone want to do the coding we've talked about?
>
> OK, here is what I have so far, based on the work of Larry, Alex, and
> others:
>
> o Two new functions, trunc(macaddr) and text(macaddr), where the former
> returns the mac address with the low (non-manufacturer) fields zeroed
> out, and the latter converts to a text string. The text conversion is
> nice because capabilities such as LIKE can be used transparently :) Will
> need to add macaddr(text) for symmetry.
>
> o Two utilities for contrib/mac, createoui and updateoui. The former
> creates a table "macoui" with the fields oui and manufacturer. The
> latter populates it with the contents of the file oui.txt, fetched from
> the IEEE web site and processed by a slightly modified version of
> Larry's awk script.
>
> o An sql definition file, manuf.sql, which defines a function
> manuf(macaddr) along the lines Alex had suggested. It returns a text
> string of the manufacturer's name, or NULL if none is matched. You can
> use COALESCE() to return something other than NULL if you want.
>
> Should we have updateoui use wget to fetch oui.txt from the IEEE web
> site? Or perhaps better we could have that in a separate utility?
>
> Comments?
>
> - Thomas
>
> Some examples are
>
> myst> ./createoui
> myst> ./updateoui
>
> lockhart=# select trunc(macaddr '00:01:a0:aa:bb:cc');
> trunc
> -------------------
> 00:01:a0:00:00:00
> (1 row)
>
> lockhart=# select manuf('01:02:03:00:00:00');
> manuf
> -------
>
> (1 row)
>
> lockhart=# select manuf('00:01:a0:00:00:00');
> manuf
> ------------------------
> Infinilink Corporation
> (1 row)
>
> lockhart=# select manuf('00:01:A0:00:00:00');
> manuf
> ------------------------
> Infinilink Corporation
> (1 row)
>
> lockhart=# select manuf('00:01:A0:00:00:01');
> manuf
> ------------------------
> Infinilink Corporation
> (1 row)
>
> lockhart=# select coalesce(manuf('01:02:03:00:00:00'), 'nada');
> case
> ------
> nada
> (1 row)
>
> lockhart=# select * from macoui where oui like '00:aa%';
> oui | manufacturer
> -------------------+-------------------------------
> 00:aa:00:00:00:00 | INTEL CORPORATION
> 00:aa:01:00:00:00 | INTEL CORPORATION
> 00:aa:02:00:00:00 | INTEL CORPORATION
> 00:aa:3c:00:00:00 | OLIVETTI TELECOM SPA (OLTECO)
> (4 rows)
>
> lockhart=# select * from macoui where oui like '00:AA%';
> oui | manufacturer
> -----+--------------
> (0 rows)
>
> lockhart=# select * from macoui where oui ilike '00:AA%';
> oui | manufacturer
> -------------------+-------------------------------
> 00:aa:00:00:00:00 | INTEL CORPORATION
> 00:aa:01:00:00:00 | INTEL CORPORATION
> 00:aa:02:00:00:00 | INTEL CORPORATION
> 00:aa:3c:00:00:00 | OLIVETTI TELECOM SPA (OLTECO)
> (4 rows)
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2000-08-20 23:27:54 | Re: Optimisation deficiency: currval('seq')-->seqscan, constant-->index scan |
Previous Message | The Hermit Hacker | 2000-08-20 22:48:23 | Re: How Do You Pronounce "PostgreSQL"? |