Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rarpd Fix alignment for socket addresses in routing...
details: https://anonhg.NetBSD.org/src/rev/f54cdd666876
branches: trunk
changeset: 545394:f54cdd666876
user: petrov <petrov%NetBSD.org@localhost>
date: Tue Apr 08 04:04:01 2003 +0000
description:
Fix alignment for socket addresses in routing socket requests for
LP64 machines. Addresses port-alpha/11089. Reviewed by thorpej.
diffstat:
usr.sbin/rarpd/mkarp.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r cebc3048c642 -r f54cdd666876 usr.sbin/rarpd/mkarp.c
--- a/usr.sbin/rarpd/mkarp.c Tue Apr 08 03:49:44 2003 +0000
+++ b/usr.sbin/rarpd/mkarp.c Tue Apr 08 04:04:01 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkarp.c,v 1.4 2002/07/14 00:58:30 wiz Exp $ */
+/* $NetBSD: mkarp.c,v 1.5 2003/04/08 04:04:01 petrov Exp $ */
/*
* Copyright (c) 1984, 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)arp.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: mkarp.c,v 1.4 2002/07/14 00:58:30 wiz Exp $");
+__RCSID("$NetBSD: mkarp.c,v 1.5 2003/04/08 04:04:01 petrov Exp $");
#endif
#endif /* not lint */
@@ -80,6 +80,10 @@
#include "mkarp.h"
+/* Roundup the same way rt_xaddrs does */
+#define ROUNDUP(a) \
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+
int rtmsg(int, int, struct rt_msghdr *, struct sockaddr_inarp *,
struct sockaddr_dl *);
struct {
@@ -213,7 +217,7 @@
#define NEXTADDR(w, s) \
if (rtm->rtm_addrs & (w)) { \
(void)memcpy(cp, s, ((struct sockaddr *)s)->sa_len); \
- cp += ((struct sockaddr *)s)->sa_len;}
+ cp += ROUNDUP(((struct sockaddr *)s)->sa_len);}
NEXTADDR(RTA_DST, sin_m);
NEXTADDR(RTA_GATEWAY, sdl_m);
Home |
Main Index |
Thread Index |
Old Index