> /* > * 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.
As the comment you included states, the code is assuming that the passed-in Ethernet address is at least 2-byte aligned -- which makes some sense since that's going to tbe usual case with an Ethernet header. -- meem _______________________________________________ networking-discuss mailing list [email protected]
