Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/rarpd Copy struct ifreq returned by SIOGIFCONF to e...



details:   https://anonhg.NetBSD.org/src/rev/664fda51f878
branches:  trunk
changeset: 481815:664fda51f878
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Mon Feb 07 01:15:52 2000 +0000

description:
Copy struct ifreq returned by SIOGIFCONF to ensure correct alignment.

diffstat:

 usr.sbin/rarpd/rarpd.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r a2334dce458e -r 664fda51f878 usr.sbin/rarpd/rarpd.c
--- a/usr.sbin/rarpd/rarpd.c    Sun Feb 06 23:23:37 2000 +0000
+++ b/usr.sbin/rarpd/rarpd.c    Mon Feb 07 01:15:52 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rarpd.c,v 1.34 1999/09/26 10:40:32 kleink Exp $        */
+/*     $NetBSD: rarpd.c,v 1.35 2000/02/07 01:15:52 nathanw Exp $       */
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -28,7 +28,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: rarpd.c,v 1.34 1999/09/26 10:40:32 kleink Exp $");
+__RCSID("$NetBSD: rarpd.c,v 1.35 2000/02/07 01:15:52 nathanw Exp $");
 #endif
 
 
@@ -243,7 +243,7 @@
 {
        char inbuf[8192*2];
        struct ifconf ifc;
-       struct ifreq ifreq, *ifr;
+       struct ifreq ifreq, ifrd, *ifr, *ifrp;
        int fd;
        int i, len;
 
@@ -259,11 +259,13 @@
                rarperr(FATAL, "init_all: SIOCGIFCONF: %s", strerror(errno));
                /* NOTREACHED */
        }
-       ifr = ifc.ifc_req;
+       ifr = &ifrd;
+       ifrp = ifc.ifc_req;
        ifreq.ifr_name[0] = '\0';
        for (i = 0; i < ifc.ifc_len;
-            i += len, ifr = (struct ifreq *)((caddr_t)ifr + len)) {
+            i += len, ifrp = (struct ifreq *)((caddr_t)ifrp + len)) {
 #define SIN(s) ((struct sockaddr_in *) (s))
+               memcpy(&ifrd, ifrp, sizeof (ifrd));
                len = sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len;
                if (ifr->ifr_addr.sa_family != AF_INET)
                        continue;



Home | Main Index | Thread Index | Old Index