[quagga-dev 707] Re: q about prefix_same

Gilad Arnold gilad.arnold at terayon.com
Tue Jan 13 14:52:23 GMT 2004

sowmini.varadhan at Sun.COM wrote:

 > Good question... is there a reason why prefix_same can't just do
 > a single memcmp() instead of painfully first comparing family and
 > len? Is there any padding in that structure?

Of course it can't, because (a) you want to be padding independant, and 
this isn't a sequential type of data structure; (b) in this case, it's 
obvious that the union member (prefix.u...) imposes trailing pad-bytes, 
since sizeof(struct in_addr) < sizeof(struct in6_addr). Assuming some 
non-virgin IPv6 prefix is assigned an IPv4 address/mask, you can't 
guarantee the excess bytes are of any particular value, can you?

(PS: what's wrong with particle comparison anyway?)


More information about the Quagga-dev mailing list