summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2000-01-07 03:47:13 +0000
committerbrian <brian@cvs.openbsd.org>2000-01-07 03:47:13 +0000
commit257abd21623f284d659c85127a6dc3125919e543 (patch)
tree6551a99a50a209639eb5c133f76938162f016f11 /usr.sbin
parent27f54ded34080678fc4c377bf2442d27828f491a (diff)
Don't set ifaddr::in_addrs to 1 after an ``iface clear'' on an interface
with no addresses.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ppp/iface.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/ppp/ppp/iface.c b/usr.sbin/ppp/ppp/iface.c
index c55360303a8..ace87979b07 100644
--- a/usr.sbin/ppp/ppp/iface.c
+++ b/usr.sbin/ppp/ppp/iface.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: iface.c,v 1.7 2000/01/07 03:26:54 brian Exp $
+ * $Id: iface.c,v 1.8 2000/01/07 03:47:12 brian Exp $
*/
#include <sys/param.h>
@@ -251,12 +251,14 @@ iface_inClear(struct iface *iface, int how)
{
int n, addrs;
- addrs = n = how == IFACE_CLEAR_ALL ? 0 : 1;
- for (; n < iface->in_addrs; n++)
- iface_addr_Zap(iface->name, iface->in_addr + n);
+ if (iface->in_addrs) {
+ addrs = n = how == IFACE_CLEAR_ALL ? 0 : 1;
+ for (; n < iface->in_addrs; n++)
+ iface_addr_Zap(iface->name, iface->in_addr + n);
- iface->in_addrs = addrs;
- /* Don't bother realloc()ing - we have little to gain */
+ iface->in_addrs = addrs;
+ /* Don't bother realloc()ing - we have little to gain */
+ }
}
int