summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@openbsd.org>2000-01-07 03:47:12 +0000
committerbrian <brian@openbsd.org>2000-01-07 03:47:12 +0000
commit65ceef44c493709c4c8cccb70736f94eb2873a93 (patch)
tree7c8b406d1ec0829c2372250ef2101353efdd0b78
parentUpgrade from 2.23 -> 2.26 (diff)
downloadwireguard-openbsd-65ceef44c493709c4c8cccb70736f94eb2873a93.tar.xz
wireguard-openbsd-65ceef44c493709c4c8cccb70736f94eb2873a93.zip
Don't set ifaddr::in_addrs to 1 after an ``iface clear'' on an interface
with no addresses.
-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