[ovs-dev] packets: Fix in6_is_lla() on systems without s6_addr32 defined.
diff mbox

Message ID 1468994660-4501-1-git-send-email-jpettit@ovn.org
State Accepted
Headers show

Commit Message

Justin Pettit July 20, 2016, 6:04 a.m. UTC
Reported-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 lib/packets.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ben Pfaff July 20, 2016, 6:39 a.m. UTC | #1
On Tue, Jul 19, 2016 at 11:04:20PM -0700, Justin Pettit wrote:
> Reported-by: Ben Pfaff <blp@ovn.org>
> Signed-off-by: Justin Pettit <jpettit@ovn.org>

Might add a Fixes: header.

Acked-by: Ben Pfaff <blp@ovn.org>
Justin Pettit July 20, 2016, 6:51 a.m. UTC | #2
> On Jul 19, 2016, at 11:39 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> On Tue, Jul 19, 2016 at 11:04:20PM -0700, Justin Pettit wrote:
>> Reported-by: Ben Pfaff <blp@ovn.org>
>> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> 
> Might add a Fixes: header.

Done.

> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks for spotting the problem and the quick review.  Pushed to master.

--Justin

Patch
diff mbox

diff --git a/lib/packets.h b/lib/packets.h
index 8f11e2c..5fd1e51 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -987,8 +987,9 @@  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]);
+    return addr->s6_addr[0] == 0xfe && addr->s6_addr[1] == 0x80 &&
+         !(addr->s6_addr[2] | addr->s6_addr[3] | addr->s6_addr[4] |
+           addr->s6_addr[5] | addr->s6_addr[6] | addr->s6_addr[7]);
 #endif
 }