summaryrefslogtreecommitdiffstats
path: root/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2011-02-04 14:43:51 +0000
committerRoy Marples <roy@marples.name>2011-02-04 14:43:51 +0000
commitb92c960fe0c7a0b3a1cd7f33699d7e1a4db1b518 (patch)
tree6129d86ad057060f1304f4a227185eb755f90866 /if-bsd.c
parentbffdfbcecee33df3f2f992744f82c15f2125e6c8 (diff)
downloaddhcpcd-b92c960fe0c7a0b3a1cd7f33699d7e1a4db1b518.tar.xz
Use RT_ROUNDUP and friends so that we work with NetBSD 64-bit routing.
Diffstat (limited to 'if-bsd.c')
-rw-r--r--if-bsd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/if-bsd.c b/if-bsd.c
index 462ec2a0..49fc7c27 100644
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -61,9 +61,11 @@
#include "if-options.h"
#include "net.h"
-#define ROUNDUP(a) \
+#ifndef RT_ROUNDUP
+#define RT_ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+#define RT_ADVANCE(x, n) (x += RT_ROUNDUP((n)->sa_len))
+#endif
/* FIXME: Why do we need to check for sa_family 255 */
#define COPYOUT(sin, sa) \
@@ -198,7 +200,7 @@ if_route(const struct interface *iface, const struct in_addr *dest,
int retval = 0;
#define ADDSU(_su) { \
- l = ROUNDUP(_su.sa.sa_len); \
+ l = RT_ROUNDUP(_su.sa.sa_len); \
memcpy(bp, &(_su), l); \
bp += l; \
}
@@ -298,7 +300,7 @@ get_addrs(int type, char *cp, struct sockaddr **sa)
inet_ntoa(((struct sockaddr_in *)sa[i])->
sin_addr));
#endif
- ADVANCE(cp, sa[i]);
+ RT_ADVANCE(cp, sa[i]);
} else
sa[i] = NULL;
}