diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-06-18 17:50:51 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-06-21 17:03:22 +0200 |
commit | 4b3fea3d54f884cc9e72bef630ffa9eb00f84b07 (patch) | |
tree | 3b2fce44677105ab5624ce30f424c555312e528b | |
parent | aa33d2e6eb2f7508d0650132e481758d6372825e (diff) | |
download | strongswan-4b3fea3d54f884cc9e72bef630ffa9eb00f84b07.tar.bz2 strongswan-4b3fea3d54f884cc9e72bef630ffa9eb00f84b07.tar.xz |
kernel-pfroute: Alignment of sockaddrs is not always the same
-rw-r--r-- | src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c | 9 |
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; } } |