From 1c7bd4aed4bda77a690703a2e5f4023a68f850fb Mon Sep 17 00:00:00 2001 From: brooks Date: Tue, 10 Jan 2006 04:53:20 +0000 Subject: Allow users to add aliases to the interface. PR: bin/87465 (different solution used) MFC after: 1 week --- sbin/dhclient/dhclient.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'sbin') diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 2c722fe..40e68af 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -200,13 +200,23 @@ routehandler(struct protocol *p) switch (rtm->rtm_type) { case RTM_NEWADDR: + /* + * XXX: If someone other than us adds our address, + * we should assume they are taking over from us, + * delete the lease record, and exit without modifying + * the interface. + */ + break; + case RTM_DELADDR: ifam = (struct ifa_msghdr *)rtm; + if (ifam->ifam_index != ifi->index) break; if (findproto((char *)(ifam + 1), ifam->ifam_addrs) != AF_INET) break; - if (ifi == NULL) - goto die; + if (scripttime == 0 || t < scripttime + 10) + break; + sa = get_ifa((char *)(ifam + 1), ifam->ifam_addrs); if (sa == NULL) goto die; @@ -221,17 +231,7 @@ routehandler(struct protocol *p) if (addr_eq(a, l->address)) break; - if (l != NULL) /* new addr is the one we set */ - break; - - goto die; - case RTM_DELADDR: - ifam = (struct ifa_msghdr *)rtm; - if (ifam->ifam_index != ifi->index) - break; - if (findproto((char *)(ifam + 1), ifam->ifam_addrs) != AF_INET) - break; - if (scripttime == 0 || t < scripttime + 10) + if (l == NULL) /* deleted addr is not the one we set */ break; goto die; case RTM_IFINFO: -- cgit v1.1