On 01/06/2012 07:01 PM, Pravin B Shelar wrote: > --- a/lib/packets.h > +++ b/lib/packets.h > @@ -464,4 +464,14 @@ void *snap_compose(struct ofpbuf *, const uint8_t > eth_dst[ETH_ADDR_LEN], > const uint8_t eth_src[ETH_ADDR_LEN], > unsigned int oui, uint16_t snap_type, size_t size); > > +static inline int ipv6_addr_is_zero(const struct in6_addr *addr) > +{ > + const uint32_t *a = (const uint32_t *)&addr->s6_addr[0]; > + int i, ret = 0; > + > + for (i = 0; i < 4; i++) { > + ret += a[i]; > + } > + return !ret; > +}
There's already an IN6_IS_ADDR_UNSPECIFIED macro defined in in.h, which every platform should have for RFC compliance. Alternately, there's ipv6_addr_any() in ipv6.h that defines an optimized Linux version: static inline int ipv6_addr_any(const struct in6_addr *a) { return (a->s6_addr32[0] | a->s6_addr32[1] | a->s6_addr32[2] | a->s6_addr32[3]) == 0; } -Brian _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev