NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/44835: ndp -a shows nothing
>Number: 44835
>Category: bin
>Synopsis: ndp -a shows nothing
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 06 10:10:00 +0000 2011
>Originator: Takahiro HAYASHI
>Release: NetBSD 5.99.48
>Organization:
>Environment:
System: NetBSD halt 5.99.48 NetBSD 5.99.48 (UNION) #0: Wed Apr 6 15:53:12 JST
2011 root@halt:/usr/build2/obj.i386/sys/arch/i386/compile/UNION i386
Architecture: i386
Machine: i386
>Description:
ndp(8) -a does not show valid informations after change of
64-bit clean routing socket on Feb 1 2011.
This program should use RT_ROUNDUP() macro defined in <sys/route.h>.
>How-To-Repeat:
type "ndp -na"
>Fix:
Please apply this patch unless you have better idea.
Index: src/usr.sbin/ndp/ndp.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/ndp/ndp.c,v
retrieving revision 1.38
diff -u -r1.38 ndp.c
--- src/usr.sbin/ndp/ndp.c 6 Nov 2009 20:51:19 -0000 1.38
+++ src/usr.sbin/ndp/ndp.c 28 Feb 2011 16:52:06 -0000
@@ -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);
--
Takahiro HAYASHI
Home |
Main Index |
Thread Index |
Old Index