Thread

  1. [PATCHES] Ethernet MAC bug.

    Daniel Boyd <daniel.boyd@vacationclub.com> — 1999-12-15T19:26:54Z

    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_--