Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/route Fix fallout from 1.129 that converted sou::so_foo...
details: https://anonhg.NetBSD.org/src/rev/631f9b653c6e
branches: trunk
changeset: 781857:631f9b653c6e
user: uwe <uwe%NetBSD.org@localhost>
date: Thu Oct 04 00:01:48 2012 +0000
description:
Fix fallout from 1.129 that converted sou::so_foo from unions to
pointers but missed (char *)&soup->so_foo => (char *)soup->so_foo in
mask_addr(). It worked by luck - unless it didn't: due to pointer
numerology on amd64 route add -net ClassC without explicit /24 prefix
length specification would result into /16 destination instead of /24.
diffstat:
sbin/route/route.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r 9517a2deb1a6 -r 631f9b653c6e sbin/route/route.c
--- a/sbin/route/route.c Wed Oct 03 23:55:22 2012 +0000
+++ b/sbin/route/route.c Thu Oct 04 00:01:48 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.138 2012/08/08 14:04:26 christos Exp $ */
+/* $NetBSD: route.c,v 1.139 2012/10/04 00:01:48 uwe Exp $ */
/*
* Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: route.c,v 1.138 2012/08/08 14:04:26 christos Exp $");
+__RCSID("$NetBSD: route.c,v 1.139 2012/10/04 00:01:48 uwe Exp $");
#endif
#endif /* not lint */
@@ -1648,11 +1648,11 @@
mask_addr(struct sou *soup)
{
int olen = soup->so_mask->sa.sa_len;
- char *cp1 = olen + (char *)&soup->so_mask, *cp2;
+ char *cp1 = olen + (char *)soup->so_mask, *cp2;
- for (soup->so_mask->sa.sa_len = 0; cp1 > (char *)&soup->so_mask; )
+ for (soup->so_mask->sa.sa_len = 0; cp1 > (char *)soup->so_mask; )
if (*--cp1 != 0) {
- soup->so_mask->sa.sa_len = 1 + cp1 - (char *)&soup->so_mask;
+ soup->so_mask->sa.sa_len = 1 + cp1 - (char *)soup->so_mask;
break;
}
if ((rtm_addrs & RTA_DST) == 0)
@@ -1674,11 +1674,11 @@
break;
#endif /* SMALL */
}
- cp1 = soup->so_mask->sa.sa_len + 1 + (char *)&soup->so_dst;
- cp2 = soup->so_dst->sa.sa_len + 1 + (char *)&soup->so_dst;
+ cp1 = soup->so_mask->sa.sa_len + 1 + (char *)soup->so_dst;
+ cp2 = soup->so_dst->sa.sa_len + 1 + (char *)soup->so_dst;
while (cp2 > cp1)
*--cp2 = 0;
- cp2 = soup->so_mask->sa.sa_len + 1 + (char *)&soup->so_mask;
+ cp2 = soup->so_mask->sa.sa_len + 1 + (char *)soup->so_mask;
while (cp1 > soup->so_dst->sa.sa_data)
*--cp1 &= *--cp2;
#ifndef SMALL
Home |
Main Index |
Thread Index |
Old Index