aboutsummaryrefslogtreecommitdiff
blob: 4a7e89027a80820e21479690de4ecb5ff557f95b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--- libdnet-stripped/src/route-bsd.c.dist	2016-10-01 00:25:36.000000000 +0100
+++ libdnet-stripped/src/route-bsd.c	2016-10-01 00:27:50.000000000 +0100
@@ -47,6 +47,18 @@
 
 #include "dnet.h"
 
+/* Unix Network Programming, 3rd edition says that sockaddr structures in
+   rt_msghdr should be padded so their addresses start on a multiple of
+   sizeof(u_long). But on 64-bit Mac OS X 10.6 at least, this is false. Apple's
+   netstat code uses 4-byte padding, not 8-byte. This is relevant for IPv6
+   addresses, for which sa_len == 28.
+   http://www.opensource.apple.com/source/network_cmds/network_cmds-329.2.2/netstat.tproj/route.c */
+#ifdef __APPLE__
+#define RT_MSGHDR_ALIGNMENT sizeof(uint32_t)
+#else
+#define RT_MSGHDR_ALIGNMENT sizeof(unsigned long)
+#endif
+
 #if defined(RT_ROUNDUP) && defined(__NetBSD__)
 /* NetBSD defines this macro rounding to 64-bit boundaries.
    http://fxr.watson.org/fxr/ident?v=NETBSD;i=RT_ROUNDUP */