From 70707ec9bca89a2996b2cba43719e1ea57383810 Mon Sep 17 00:00:00 2001 From: mrg Date: Mon, 8 Sep 1997 05:26:08 +0000 Subject: [PATCH] note that we have set ifflags so that we can reset them again after setting the interface address. this is necessary as we may want to configure an interface `down' by default, but, SIOCAIFADDR turns the interface back on for us. --- sbin/ifconfig/ifconfig.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 3ab18661b5db..18ab4cb11b55 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $NetBSD: ifconfig.c,v 1.37 1997/07/14 12:54:27 is Exp $ */ +/* $NetBSD: ifconfig.c,v 1.38 1997/09/08 05:26:08 mrg Exp $ */ /* * Copyright (c) 1997 Jason R. Thorpe. @@ -75,7 +75,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #else -static char rcsid[] = "$NetBSD: ifconfig.c,v 1.37 1997/07/14 12:54:27 is Exp $"; +static char rcsid[] = "$NetBSD: ifconfig.c,v 1.38 1997/09/08 05:26:08 mrg Exp $"; #endif #endif /* not lint */ @@ -122,6 +122,7 @@ int newaddr = -1; int nsellength = 1; int af; int dflag, mflag, lflag, uflag; +int reset_if_flags; void notealias __P((char *, int)); void notrailers __P((char *, int)); @@ -400,6 +401,8 @@ main(argc, argv) if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0) warn("SIOCAIFADDR"); } + if (reset_if_flags && ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) + err(1, "SIOCSIFFLAGS"); exit(0); } @@ -623,6 +626,8 @@ setifflags(vname, value) ifr.ifr_flags = flags; if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) err(1, "SIOCSIFFLAGS"); + + reset_if_flags = 1; } void