Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig Fix PR bin/9629. The global variable ifr was ...



details:   https://anonhg.NetBSD.org/src/rev/cb2ea362eab4
branches:  trunk
changeset: 483793:cb2ea362eab4
user:      castor <castor%NetBSD.org@localhost>
date:      Sat Mar 18 21:10:50 2000 +0000

description:
Fix PR bin/9629.  The global variable ifr was used to save interface
flags even though the media routines tweak it.

diffstat:

 sbin/ifconfig/ifconfig.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (60 lines):

diff -r ca24215565f6 -r cb2ea362eab4 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Sat Mar 18 20:53:24 2000 +0000
+++ b/sbin/ifconfig/ifconfig.c  Sat Mar 18 21:10:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.73 2000/03/06 09:00:13 enami Exp $      */
+/*     $NetBSD: ifconfig.c,v 1.74 2000/03/18 21:10:50 castor Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
 #if 0
 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
 #else
-__RCSID("$NetBSD: ifconfig.c,v 1.73 2000/03/06 09:00:13 enami Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.74 2000/03/18 21:10:50 castor Exp $");
 #endif
 #endif /* not lint */
 
@@ -121,7 +121,7 @@
 #include <string.h>
 #include <unistd.h>
 
-struct ifreq           ifr, ridreq;
+struct ifreq           ifr, flagreq, ridreq;
 struct ifaliasreq      addreq __attribute__((aligned(4)));
 #ifdef INET6
 struct in6_ifreq       ifr6;
@@ -550,7 +550,7 @@
                if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0)
                        warn("SIOCAIFADDR");
        }
-       if (reset_if_flags && ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0)
+       if (reset_if_flags && ioctl(s, SIOCSIFFLAGS, (caddr_t)&flagreq) < 0)
                err(1, "SIOCSIFFLAGS");
        exit(0);
 }
@@ -830,18 +830,18 @@
        char *vname;
        int value;
 {
-       if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)
+       if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&flagreq) < 0)
                err(1, "SIOCGIFFLAGS");
-       (void) strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
-       flags = ifr.ifr_flags;
+       (void) strncpy(flagreq.ifr_name, name, sizeof (flagreq.ifr_name));
+       flags = flagreq.ifr_flags;
 
        if (value < 0) {
                value = -value;
                flags &= ~value;
        } else
                flags |= value;
-       ifr.ifr_flags = flags;
-       if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0)
+       flagreq.ifr_flags = flags;
+       if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&flagreq) < 0)
                err(1, "SIOCSIFFLAGS");
 
        reset_if_flags = 1;



Home | Main Index | Thread Index | Old Index