Thread: Mac address lobits macro error

Mac address lobits macro error

From
Daniel Boyd
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        :    Daniel F. Boyd
Your email address    :    Daniel.Boyd@vacationclub.com


System Configuration
- ---------------------
  Architecture (example: Intel Pentium)      :Intel Pentium

  Operating System (example: Linux 2.0.26 ELF)     :FreeBSD 3.2

  PostgreSQL version (example: PostgreSQL-6.5)  :   PostgreSQL-6.5

  Compiler used (example:  gcc 2.8.0)        :gcc version 2.7.2.1


Please enter a FULL description of your problem:
- ------------------------------------------------
Ethernet MAC addresses (macaddr type) are not compared correctly for
equality.

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
- ----------------------------------------------------------------------
select '0000c0:d178d1'::macaddr = '0000c0:0b78d1'::macaddr;

Should return false, as these two mac addresses are different -- but
it returns true.


If you know how this problem might be fixed, list the solution below:
- ---------------------------------------------------------------------


Apply this patch to postgresql-6.5/src/backend/utils/adt/mac.c

*** mac.c_orig  Thu Oct  7 17:12:38 1999
--- mac.c       Thu Oct  7 17:12:52 1999
***************
*** 136,142 ****
    ((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.
--- 136,142 ----
    ((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.
------- end -------