]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
sun: Making routing work with both 64-bit and 32-bit userlands
authorRoy Marples <roy@marples.name>
Mon, 22 Apr 2019 12:37:15 +0000 (12:37 +0000)
committerRoy Marples <roy@marples.name>
Mon, 22 Apr 2019 12:37:15 +0000 (12:37 +0000)
Basically Dilos is 64-bit userland and SmartOS is 32-bit.
We need code to fit both, this seems to work.

src/if-sun.c

index 891a6883c503ad6036969e77a87c8a5417aefd34..bb5b5c0a6b08ab71d34edd3e55f37e9bbdc84eba 100644 (file)
@@ -75,7 +75,8 @@ extern int getallifaddrs(sa_family_t, struct ifaddrs **, int64_t);
 
 #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 @@ get_addrs(int type, const void *data, const struct sockaddr **sa)
                sap = &sa[i];
                if (type & (1 << i)) {
                        *sap = (const struct sockaddr *)cp;
-                       cp += salen(*sap);
+                       RT_ADVANCE(cp, *sap);
                } else
                        *sap = NULL;
        }