Module Name: src
Committed By: matt
Date: Mon Aug 16 18:43:55 UTC 2010
Modified Files:
src/sbin/routed [matt-nb5-mips64]: if.c table.c
Log Message:
Change to new route message sematics
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.20.1 src/sbin/routed/if.c
cvs rdiff -u -r1.22 -r1.22.38.1 src/sbin/routed/table.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/routed/if.c
diff -u src/sbin/routed/if.c:1.26 src/sbin/routed/if.c:1.26.20.1
--- src/sbin/routed/if.c:1.26 Tue Aug 14 03:39:19 2007
+++ src/sbin/routed/if.c Mon Aug 16 18:43:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.26 2007/08/14 03:39:19 dyoung Exp $ */
+/* $NetBSD: if.c,v 1.26.20.1 2010/08/16 18:43:55 matt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -37,7 +37,7 @@
#include "pathnames.h"
#ifdef __NetBSD__
-__RCSID("$NetBSD: if.c,v 1.26 2007/08/14 03:39:19 dyoung Exp $");
+__RCSID("$NetBSD: if.c,v 1.26.20.1 2010/08/16 18:43:55 matt Exp $");
#elif defined(__FreeBSD__)
__RCSID("$FreeBSD$");
#else
@@ -84,6 +84,19 @@
int have_ripv1_out; /* have a RIPv1 interface */
int have_ripv1_in;
+#ifdef sgi
+#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) - 1))) \
+ : sizeof(__uint64_t))
+#define ROUNDUPMSG(a) (a)
+#elif defined(__NetBSD__)
+#define ROUNDUP(a) RT_ROUNDUP(a)
+#define ROUNDUPMSG(a) RT_ROUNDUP(a)
+#else
+#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \
+ : sizeof(long))
+#define ROUNDUPMSG(a) (a)
+#endif
+
static struct interface**
nhash(char *p)
@@ -641,14 +654,6 @@
#ifdef _HAVE_SA_LEN
static struct sockaddr sa_zero;
#endif
-#ifdef sgi
-#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) - 1))) \
- : sizeof(__uint64_t))
-#else
-#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \
- : sizeof(long))
-#endif
-
memset(info, 0, sizeof(*info));
info->rti_addrs = addrs;
@@ -742,7 +747,7 @@
ifam < ifam_lim;
ifam = ifam2) {
- ifam2 = (struct ifa_msghdr*)((char*)ifam + ifam->ifam_msglen);
+ ifam2 = (struct ifa_msghdr*)((uintptr_t)ifam + ROUNDUPMSG(ifam->ifam_msglen));
#ifdef RTM_OIFINFO
if (ifam->ifam_type == RTM_OIFINFO)
@@ -769,7 +774,8 @@
#ifdef sgi
ifs0.int_data.odrops = ifm->ifm_data.ifi_odrops;
#endif
- sdl = (const struct sockaddr_dl *)(ifm + 1);
+ sdl = (const struct sockaddr_dl *)
+ ((uintptr_t)ifm + ROUNDUP(sizeof(*ifm)));
/* NUL-termination by memset, above. */
memcpy(ifs0.int_name, sdl->sdl_data,
MIN(sizeof(ifs0.int_name) - 1, sdl->sdl_nlen));
Index: src/sbin/routed/table.c
diff -u src/sbin/routed/table.c:1.22 src/sbin/routed/table.c:1.22.38.1
--- src/sbin/routed/table.c:1.22 Tue Jul 6 23:36:24 2004
+++ src/sbin/routed/table.c Mon Aug 16 18:43:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: table.c,v 1.22 2004/07/06 23:36:24 mycroft Exp $ */
+/* $NetBSD: table.c,v 1.22.38.1 2010/08/16 18:43:55 matt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -36,7 +36,7 @@
#include "defs.h"
#ifdef __NetBSD__
-__RCSID("$NetBSD: table.c,v 1.22 2004/07/06 23:36:24 mycroft Exp $");
+__RCSID("$NetBSD: table.c,v 1.22.38.1 2010/08/16 18:43:55 matt Exp $");
#elif defined(__FreeBSD__)
__RCSID("$FreeBSD$");
#else
@@ -1092,8 +1092,8 @@
rtm = (struct rt_msghdr *)next;
if (rtm->rtm_msglen == 0) {
msglog("zero length kernel route at "
- " %#lx in buffer %#lx before %#lx",
- (u_long)rtm, (u_long)sysctl_buf, (u_long)lim);
+ " %p in buffer %p before %p",
+ rtm, sysctl_buf, lim);
break;
}