[PATCHES] Ethernet MAC bug. - Mailing list pgsql-bugs

From Daniel Boyd
Subject [PATCHES] Ethernet MAC bug.
Date
Msg-id 199912151926.OAA01699@oberon.vacationclub.com
Whole thread Raw
List pgsql-bugs
Ethernet MAC addresses (macaddr type) are not compared correctly for
equality.  The lobits macro is wrong and extracts the wrong set of
bits out of the structure.

To exhibit the problem:

select '000000:000000'::macaddr = '000000:110000'::macaddr ;
?column?
--------
t
(1 row)

The mac addresses are different, but compare identical.  This is still
broken even in -current.

Here's the (admittedly simple) fix:


*** ./src/backend/utils/adt/mac.c.orig    Wed Dec 15 14:18:08 1999
--- ./src/backend/utils/adt/mac.c    Wed Dec 15 14:18:20 1999
***************
*** 132,138 ****
    ((unsigned long)((addr->a<<16)|(addr->b<<8)|(addr->c)))

  #define lobits(addr) \
!   ((unsigned long)((addr->c<<16)|(addr->e<<8)|(addr->f)))

  /*
   *    MAC address reader.  Accepts several common notations.
--- 132,138 ----
    ((unsigned long)((addr->a<<16)|(addr->b<<8)|(addr->c)))

  #define lobits(addr) \
!   ((unsigned long)((addr->d<<16)|(addr->e<<8)|(addr->f)))

  /*
   *    MAC address reader.  Accepts several common notations.




************



--ELM945307750-8421-0_

--ELM945307750-8421-0_--

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] ECPG memory leak detected
Next
From: Bruce Momjian
Date:
Subject: Re: [BUGS] uniqueness not always correct