aboutsummaryrefslogtreecommitdiffstats
path: root/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-06-18 17:50:51 +0200
committerTobias Brunner <tobias@strongswan.org>2013-06-21 17:03:22 +0200
commit4b3fea3d54f884cc9e72bef630ffa9eb00f84b07 (patch)
tree3b2fce44677105ab5624ce30f424c555312e528b /src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
parentaa33d2e6eb2f7508d0650132e481758d6372825e (diff)
downloadstrongswan-4b3fea3d54f884cc9e72bef630ffa9eb00f84b07.tar.bz2
strongswan-4b3fea3d54f884cc9e72bef630ffa9eb00f84b07.tar.xz
kernel-pfroute: Alignment of sockaddrs is not always the same
Diffstat (limited to 'src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c')
-rw-r--r--src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
index 0dfb2957a..f8eed5775 100644
--- a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
+++ b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
@@ -41,7 +41,13 @@
#endif
/** properly align sockaddrs */
+#ifdef __APPLE__
+/* Apple always uses 4 bytes */
#define SA_ALIGN 4
+#else
+/* while on other platforms like FreeBSD it depends on the architecture */
+#define SA_ALIGN sizeof(long)
+#endif
#define SA_LEN(len) ((len) > 0 ? (((len)+SA_ALIGN-1) & ~(SA_ALIGN-1)) : SA_ALIGN)
/** delay before firing roam events (ms) */
@@ -349,7 +355,8 @@ METHOD(enumerator_t, rt_enumerate, bool,
*addr = this->addr;
*xtype = i;
this->remaining -= SA_LEN(this->addr->sa_len);
- this->addr = (char*)this->addr + SA_LEN(this->addr->sa_len);
+ this->addr = (struct sockaddr*)((char*)this->addr +
+ SA_LEN(this->addr->sa_len));
return TRUE;
}
}