diff options
author | Ben Pfaff <blp@ovn.org> | 2018-07-10 09:27:18 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-07-11 08:28:33 -0700 |
commit | 0b9cf44914cbe959427124c7e24de575bac782e6 (patch) | |
tree | 5161afc0eb37731f8d394faa987bdf42b3345e1f /include/sparse | |
parent | bfd2c0eccedf024e2c2baaf8f43ad4d97480ea0d (diff) | |
download | openvswitch-0b9cf44914cbe959427124c7e24de575bac782e6.tar.gz |
sparse: Make IN6_IS_ADDR_MC_LINKLOCAL and IN6_ARE_ADDR_EQUAL pickier.
On GNU systems these macros work with arbitrary pointers, but the relevant
standards only require IN6_IS_ADDR_MC_LINKLOCAL to work with in6_addr (and
don't specify IN6_ARE_ADDR_EQUAL at all). Make the "sparse"
implementations correspondingly pickier so that we catch any introduced
problems more quickly.
CC: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Diffstat (limited to 'include/sparse')
-rw-r--r-- | include/sparse/netinet/in.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/sparse/netinet/in.h b/include/sparse/netinet/in.h index eea41bd7f..21deceb28 100644 --- a/include/sparse/netinet/in.h +++ b/include/sparse/netinet/in.h @@ -124,14 +124,25 @@ struct sockaddr_in6 { (X)->s6_addr[11] == 0xff) #define IN6_IS_ADDR_MC_LINKLOCAL(a) \ - (((const uint8_t *) (a))[0] == 0xff && \ - (((const uint8_t *) (a))[1] & 0xf) == 0x2) - -# define IN6_ARE_ADDR_EQUAL(a,b) \ - ((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) && \ - (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) && \ - (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) && \ - (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3])) + ((a)->s6_addr[0] == 0xff && ((a)->s6_addr[1] & 0xf) == 0x2) + +# define IN6_ARE_ADDR_EQUAL(a, b) \ + ((a)->s6_addr[0] == (b)->s6_addr[0] && \ + (a)->s6_addr[1] == (b)->s6_addr[1] && \ + (a)->s6_addr[2] == (b)->s6_addr[2] && \ + (a)->s6_addr[3] == (b)->s6_addr[3] && \ + (a)->s6_addr[4] == (b)->s6_addr[4] && \ + (a)->s6_addr[5] == (b)->s6_addr[5] && \ + (a)->s6_addr[6] == (b)->s6_addr[6] && \ + (a)->s6_addr[7] == (b)->s6_addr[7] && \ + (a)->s6_addr[8] == (b)->s6_addr[8] && \ + (a)->s6_addr[9] == (b)->s6_addr[9] && \ + (a)->s6_addr[10] == (b)->s6_addr[10] && \ + (a)->s6_addr[11] == (b)->s6_addr[11] && \ + (a)->s6_addr[12] == (b)->s6_addr[12] && \ + (a)->s6_addr[13] == (b)->s6_addr[13] && \ + (a)->s6_addr[14] == (b)->s6_addr[14] && \ + (a)->s6_addr[15] == (b)->s6_addr[15]) #define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 |