From: Roy Marples Date: Mon, 25 Apr 2016 19:00:55 +0000 (+0000) Subject: Linux does not change netmask/broadcast addresses when re-adding an address. X-Git-Tag: v6.11.0~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab8e5278073fa2ba22507ea15997d101ad375851;p=thirdparty%2Fdhcpcd.git Linux does not change netmask/broadcast addresses when re-adding an address. --- diff --git a/ipv4.c b/ipv4.c index 1ccdaa97..dcfedb0d 100644 --- a/ipv4.c +++ b/ipv4.c @@ -1172,6 +1172,13 @@ ipv4_applyaddr(void *arg) ifp->name, inet_ntoa(lease->addr), inet_ntocidr(lease->net)); else { +#if __linux__ + /* Linux does not change netmask/broadcast address + * for re-added addresses, so we need to delete the old one + * first. */ + if (ap != NULL) + ipv4_deladdr(ifp, &ap->addr, &ap->net, 0); +#endif r = ipv4_daddaddr(ifp, lease); if (r == -1 && errno != EEXIST) return;