Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/ndp make this work again after routing socket align...



details:   https://anonhg.NetBSD.org/src/rev/aa1ac08037ef
branches:  trunk
changeset: 765802:aa1ac08037ef
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Jun 06 16:50:46 2011 +0000

description:
make this work again after routing socket alignment changes

diffstat:

 usr.sbin/ndp/ndp.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r 3d5983f5383a -r aa1ac08037ef usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c        Mon Jun 06 16:48:35 2011 +0000
+++ b/usr.sbin/ndp/ndp.c        Mon Jun 06 16:50:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ndp.c,v 1.38 2009/11/06 20:51:19 dyoung Exp $  */
+/*     $NetBSD: ndp.c,v 1.39 2011/06/06 16:50:46 drochner Exp $        */
 /*     $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $  */
 
 /*
@@ -106,11 +106,6 @@
 #include <unistd.h>
 #include "gmt2local.h"
 
-/* packing rule 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))
-
 static pid_t pid;
 static int nflag;
 static int tflag;
@@ -387,7 +382,7 @@
                /* NOTREACHED */
        }
        mysin = (struct sockaddr_in6 *)(void *)(rtm + 1);
-       sdl = (struct sockaddr_dl *)(void *)(ROUNDUP(mysin->sin6_len) + (char *)(void *)mysin);
+       sdl = (struct sockaddr_dl *)(void *)(RT_ROUNDUP(mysin->sin6_len) + (char *)(void *)mysin);
        if (IN6_ARE_ADDR_EQUAL(&mysin->sin6_addr, &sin_m.sin6_addr)) {
                if (sdl->sdl_family == AF_LINK &&
                    (rtm->rtm_flags & RTF_LLINFO) &&
@@ -482,7 +477,7 @@
        if (rtmsg(RTM_GET) < 0)
                errx(1, "RTM_GET(%s) failed", host);
        mysin = (struct sockaddr_in6 *)(void *)(rtm + 1);
-       sdl = (struct sockaddr_dl *)(void *)(ROUNDUP(mysin->sin6_len) +
+       sdl = (struct sockaddr_dl *)(void *)(RT_ROUNDUP(mysin->sin6_len) +
            (char *)(void *)mysin);
        if (IN6_ARE_ADDR_EQUAL(&mysin->sin6_addr, &sin_m.sin6_addr)) {
                if (sdl->sdl_family == AF_LINK &&
@@ -574,7 +569,7 @@
 
                rtm = (struct rt_msghdr *)(void *)next;
                mysin = (struct sockaddr_in6 *)(void *)(rtm + 1);
-               sdl = (struct sockaddr_dl *)(void *)((char *)(void *)mysin + ROUNDUP(mysin->sin6_len));
+               sdl = (struct sockaddr_dl *)(void *)((char *)(void *)mysin + RT_ROUNDUP(mysin->sin6_len));
 
                /*
                 * Some OSes can produce a route that has the LINK flag but
@@ -850,7 +845,7 @@
 #define NEXTADDR(w, s) \
        if (rtm->rtm_addrs & (w)) { \
                (void)memcpy(cp, &s, sizeof(s)); \
-               ADVANCE(cp, (struct sockaddr *)(void *)&s); \
+               RT_ADVANCE(cp, (struct sockaddr *)(void *)&s); \
        }
 
        NEXTADDR(RTA_DST, sin_m);



Home | Main Index | Thread Index | Old Index