I don't get the inclusion of __sparc in the ether_cmp() definition below 
(from <sys/ethernet.h>):

/*
  * Compare two Ethernet addresses - assumes that the two given
  * pointers can be referenced as shorts.  On architectures
  * where this is not the case, use bcmp instead.  Note that like
  * bcmp, we return zero if they are the SAME.
  */

#if defined(__sparc) || defined(__i386) || defined(__amd64)
#define ether_cmp(a, b) (((short *)b)[2] != ((short *)a)[2] || \
         ((short *)b)[1] != ((short *)a)[1] || \
         ((short *)b)[0] != ((short *)a)[0])
#else
#define ether_cmp(a, b) (bcmp((caddr_t)a, (caddr_t)b, 6))
#endif


For SPARC-based architectures, alignment is required on a 2-byte boundary 
to access these pointers as shorts.  I'm fixing a panic on sun4u where 
ether_cmp() is being called and the system is panicing here due to a 
caller passing in a misaligned Ethernet address, but my initial thought 
is that ether_cmp() itself looks like it's a bit confused about its own 
alignment requirements.

Am I missing something?

(ether_copy() does the same thing)

-Seb
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to