Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sbin/route Pull up following revision(s) (requested by uw...



details:   https://anonhg.NetBSD.org/src/rev/7951a7d76192
branches:  netbsd-6
changeset: 775359:7951a7d76192
user:      riz <riz%NetBSD.org@localhost>
date:      Wed Oct 17 21:57:07 2012 +0000

description:
Pull up following revision(s) (requested by uwe in ticket #592):
        sbin/route/route.c: revision 1.139
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 3ed311588bdb -r 7951a7d76192 sbin/route/route.c
--- a/sbin/route/route.c        Wed Oct 17 21:53:58 2012 +0000
+++ b/sbin/route/route.c        Wed Oct 17 21:57:07 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.136 2011/12/26 00:20:43 christos Exp $     */
+/*     $NetBSD: route.c,v 1.136.2.1 2012/10/17 21:57:07 riz 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.136 2011/12/26 00:20:43 christos Exp $");
+__RCSID("$NetBSD: route.c,v 1.136.2.1 2012/10/17 21:57:07 riz 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