Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat sync with recent KAME.
details: https://anonhg.NetBSD.org/src/rev/b89230e4df24
branches: trunk
changeset: 476005:b89230e4df24
user: itojun <itojun%NetBSD.org@localhost>
date: Fri Sep 03 04:26:31 1999 +0000
description:
sync with recent KAME.
- fix routing socket align issue on 64bit arch.
- avoid s6_addr{8,16,32}, which are nonstandard.
diffstat:
usr.bin/netstat/route.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diffs (57 lines):
diff -r 48bbbb35c576 -r b89230e4df24 usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c Fri Sep 03 04:17:19 1999 +0000
+++ b/usr.bin/netstat/route.c Fri Sep 03 04:26:31 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.38 1999/07/01 18:40:36 itojun Exp $ */
+/* $NetBSD: route.c,v 1.39 1999/09/03 04:26:31 itojun Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-__RCSID("$NetBSD: route.c,v 1.38 1999/07/01 18:40:36 itojun Exp $");
+__RCSID("$NetBSD: route.c,v 1.39 1999/09/03 04:26:31 itojun Exp $");
#endif
#endif /* not lint */
@@ -75,6 +75,11 @@
#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
+/* alignment constraint for routing socket */
+#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.
*/
@@ -390,9 +395,7 @@
p_sockaddr(sa, NULL, 0, 36);
else {
p_sockaddr(sa, NULL, rtm->rtm_flags, 16);
- if (sa->sa_len == 0)
- sa->sa_len = sizeof(long);
- sa = (struct sockaddr *)(sa->sa_len + (char *)sa);
+ sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);
p_sockaddr(sa, NULL, 0, 18);
}
p_flags(rtm->rtm_flags & interesting, "%-6.6s ");
@@ -776,12 +779,11 @@
u_char *p;
u_char *lim;
int masklen, final = 0, illegal = 0;
+ int i;
net6 = *in6;
- net6.s6_addr32[0] &= mask->s6_addr32[0];
- net6.s6_addr32[1] &= mask->s6_addr32[1];
- net6.s6_addr32[2] &= mask->s6_addr32[2];
- net6.s6_addr32[3] &= mask->s6_addr32[3];
+ for (i = 0; i < sizeof(net6); i++)
+ net6.s6_addr[i] &= mask->s6_addr[i];
masklen = 0;
lim = (u_char *)mask + 16;
Home |
Main Index |
Thread Index |
Old Index