summaryrefslogtreecommitdiff
path: root/sbin/route/show.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-09-22 05:10:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-09-22 05:10:05 +0000
commitcf644adbbdf952cbefaa4db9c57d480b33677e6e (patch)
treed3c29dd82dc6a8d4c93788056e549473b7c39a54 /sbin/route/show.c
parente94fcd12aabf6dc0d04ab06d4b144275cda837a7 (diff)
routing interface sends aligned to long word boundaries; itojun
Diffstat (limited to 'sbin/route/show.c')
-rw-r--r--sbin/route/show.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c
index 40fa2419db2..237a10ecd36 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.8 1999/02/24 22:56:02 angelos Exp $ */
+/* $OpenBSD: show.c,v 1.9 1999/09/22 05:10:04 deraadt Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static char *rcsid = "$OpenBSD: show.c,v 1.8 1999/02/24 22:56:02 angelos Exp $";
+static char *rcsid = "$OpenBSD: show.c,v 1.9 1999/09/22 05:10:04 deraadt Exp $";
#endif
#endif /* not lint */
@@ -70,6 +70,10 @@ extern char *netname __P((struct sockaddr *));
extern char *ns_print __P((struct sockaddr_ns *));
extern int nflag;
+#define ROUNDUP(a) \
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+
/*
* Definitions for showing gateway flags.
*/
@@ -209,9 +213,7 @@ p_rtentry(rtm)
p_sockaddr(sa, 0, 36);
else {
p_sockaddr(sa, rtm->rtm_flags, 16);
- if (sa->sa_len == 0)
- sa->sa_len = sizeof(in_addr_t);
- sa = (struct sockaddr *)(sa->sa_len + (char *)sa);
+ sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);
p_sockaddr(sa, 0, 18);
}
p_flags(rtm->rtm_flags & interesting, "%-6.6s ");