diff --git a/usr.sbin/pppd/pppd/sys-bsd.c b/usr.sbin/pppd/pppd/sys-bsd.c index e0c0b2818bff..824284cce46b 100644 --- a/usr.sbin/pppd/pppd/sys-bsd.c +++ b/usr.sbin/pppd/pppd/sys-bsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys-bsd.c,v 1.22 1997/09/29 19:05:53 christos Exp $ */ +/* $NetBSD: sys-bsd.c,v 1.23 1997/09/30 16:45:16 christos Exp $ */ /* * sys-bsd.c - System-dependent procedures for setting up @@ -27,7 +27,7 @@ #if 0 static char rcsid[] = "Id: sys-bsd.c,v 1.28 1997/04/30 05:57:46 paulus Exp "; #else -__RCSID("$NetBSD: sys-bsd.c,v 1.22 1997/09/29 19:05:53 christos Exp $"); +__RCSID("$NetBSD: sys-bsd.c,v 1.23 1997/09/30 16:45:16 christos Exp $"); #endif #endif @@ -962,6 +962,7 @@ sifaddr(u, o, h, m) u_int32_t o, h, m; { struct ifaliasreq ifra; + struct ifreq ifr; strncpy(ifra.ifra_name, ifname, sizeof(ifra.ifra_name)); SET_SA_FAMILY(ifra.ifra_addr, AF_INET); @@ -973,6 +974,12 @@ sifaddr(u, o, h, m) ((struct sockaddr_in *) &ifra.ifra_mask)->sin_addr.s_addr = m; } else BZERO(&ifra.ifra_mask, sizeof(ifra.ifra_mask)); + BZERO(&ifr, sizeof(ifr)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifr) < 0) { + if (errno != EADDRNOTAVAIL) + syslog(LOG_WARNING, "Couldn't remove interface address: %m"); + } if (ioctl(sockfd, SIOCAIFADDR, (caddr_t) &ifra) < 0) { if (errno != EEXIST) { syslog(LOG_ERR, "Couldn't set interface address: %m");