changeset 4470:974677be560f draft

sun: Making routing work with both 64-bit and 32-bit userlands Basically Dilos is 64-bit userland and SmartOS is 32-bit. We need code to fit both, this seems to work.
author Roy Marples <roy@marples.name>
date Mon, 22 Apr 2019 12:37:15 +0000
parents 246f6cfa2f6b
children 15b9659186e8
files src/if-sun.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-sun.c	Sun Apr 21 23:56:48 2019 +0000
+++ b/src/if-sun.c	Mon Apr 22 12:37:15 2019 +0000
@@ -75,7 +75,8 @@
 
 #ifndef RT_ROUNDUP
 #define RT_ROUNDUP(a)                                                        \
-       ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+       ((a) > 0 ? (1 + (((a) - 1) | (sizeof(int32_t) - 1))) : sizeof(int32_t))
+#define RT_ADVANCE(x, n) ((x) += RT_ROUNDUP(salen((n))))
 #endif
 
 #define COPYOUT(sin, sa) do {						      \
@@ -433,7 +434,7 @@
 		sap = &sa[i];
 		if (type & (1 << i)) {
 			*sap = (const struct sockaddr *)cp;
-			cp += salen(*sap);
+			RT_ADVANCE(cp, *sap);
 		} else
 			*sap = NULL;
 	}