]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix "sockunion: add hash function" for BSD (9196caf)
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 20 May 2015 20:34:56 +0000 (22:34 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 8 Sep 2015 20:19:30 +0000 (13:19 -0700)
The sockunion_hash() function uses s6_addr32, which is not defined on
BSD systems.  (It only works on glibc because we set _GNU_SOURCE)

ripngd/ripng_nexthop.h already contains a workaround for this.  Bump
workaround to prefix.h so it's available everywhere.

Reported-by: NetDEF CI System <mwinter@netdef.org>
Fixes: 9196caf ("sockunion: add hash function")
Cc: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/prefix.h
ripngd/ripng_nexthop.h

index 30fdaed3cf0d7047e881a10622041aed6c2092f4..cc4bbe280dac40068d8c03fd1893c2694332cab6 100644 (file)
@@ -156,6 +156,16 @@ union prefix46constptr
 /* Prefix's family member. */
 #define PREFIX_FAMILY(p)  ((p)->family)
 
+/* glibc defines s6_addr32 to __in6_u.__u6_addr32 if __USE_{MISC || GNU} */
+#ifndef s6_addr32
+#if defined(SUNOS_5)
+/* Some SunOS define s6_addr32 only to kernel */
+#define s6_addr32 _S6_un._S6_u32
+#else
+#define s6_addr32 __u6_addr.__u6_addr32
+#endif /* SUNOS_5 */
+#endif /*s6_addr32*/
+
 /* Prototypes. */
 extern int afi2family (afi_t);
 extern afi_t family2afi (int);
index 7c041059245c62bb65b1d2d14e9090814d5cf678..19bd32b5032d9a258d3386148d2bce40c950223a 100644 (file)
@@ -41,17 +41,8 @@ extern void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp,
  * -1 if A < B
  **/
 static inline int
-addr6_cmp(struct in6_addr *A, struct in6_addr *B) {
-
-#ifndef s6_addr32
-#if defined(SUNOS_5)
-/* Some SunOS define s6_addr32 only to kernel */
-#define s6_addr32 _S6_un._S6_u32
-#else
-#define s6_addr32 __u6_addr.__u6_addr32
-#endif /* SUNOS_5 */
-#endif /*s6_addr32*/
-
+addr6_cmp(struct in6_addr *A, struct in6_addr *B)
+{
 #define a(i) A->s6_addr32[i]
 #define b(i) B->s6_addr32[i]