> On Jul 13, 2016, at 12:57 PM, Ben Pfaff <[email protected]> wrote:
>
> 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 <[email protected]>
>
>> +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.
Good point. I've addressed that as well as your previous comments.
--Justin
-=-=-=-=-=-=-=-=-=-
diff --git a/lib/packets.h b/lib/packets.h
index 02028c9..8f11e2c 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -980,10 +980,16 @@ in6_generate_lla(struct eth_addr ea, struct in6_addr *lla)
taddr->be16[7] = ea.be16[2];
}
+/* Returns true if 'addr' is a link local address. Otherwise, false. */
static inline bool
in6_is_lla(struct in6_addr *addr)
{
+#ifdef s6_addr32
return addr->s6_addr32[0] == htonl(0xfe800000) && !(addr->s6_addr32[1]);
+#else
+ return addr->s6_addr[0] == htons(0xfe80) &&
+ !(addr->s6_addr[1] | addr->s6_addr[2] | addr->s6_addr[3]);
+#endif
}
static inline void
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev