Message ID | 1468306616-125783-21-git-send-email-jpettit@ovn.org |
---|---|
State | Changes Requested |
Headers | show |
On Mon, Jul 11, 2016 at 11:56:50PM -0700, Justin Pettit wrote: > This will have a caller in a future commit. > > Signed-off-by: Justin Pettit <jpettit@ovn.org> I figured out what lla means, but would you mind adding a comment? > +static inline bool > +in6_is_lla(struct in6_addr *addr) > +{ The parentheses after ! aren't needed, do you like them a lot? > + return addr->s6_addr32[0] == htonl(0xfe800000) && !(addr->s6_addr32[1]); > +} Acked-by: Ben Pfaff <blp@ovn.org>
On Mon, Jul 11, 2016 at 11:56:50PM -0700, Justin Pettit wrote: > This will have a caller in a future commit. > > Signed-off-by: Justin Pettit <jpettit@ovn.org> > +static inline bool > +in6_is_lla(struct in6_addr *addr) > +{ > + return addr->s6_addr32[0] == htonl(0xfe800000) && !(addr->s6_addr32[1]); > +} One more thing: not all implementations have s6_addr32, so we probably need a fallback.
diff --git a/lib/packets.h b/lib/packets.h index 617f058..df6ce4b 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -980,6 +980,12 @@ in6_generate_lla(struct eth_addr ea, struct in6_addr *lla) taddr->be16[7] = ea.be16[2]; } +static inline bool +in6_is_lla(struct in6_addr *addr) +{ + return addr->s6_addr32[0] == htonl(0xfe800000) && !(addr->s6_addr32[1]); +} + static inline void ipv6_multicast_to_ethernet(struct eth_addr *eth, const struct in6_addr *ip6) {
This will have a caller in a future commit. Signed-off-by: Justin Pettit <jpettit@ovn.org> --- lib/packets.h | 6 ++++++ 1 file changed, 6 insertions(+)