Обсуждение: [PATCHES] Ethernet MAC bug.

Поиск
Список
Период
Сортировка

[PATCHES] Ethernet MAC bug.

От
Daniel Boyd
Дата:
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_--