svn commit: r247335 - stable/9/sbin/dhclient
John Baldwin
jhb at FreeBSD.org
Tue Feb 26 19:14:06 UTC 2013
Author: jhb
Date: Tue Feb 26 19:14:05 2013
New Revision: 247335
URL: http://svnweb.freebsd.org/changeset/base/247335
Log:
MFC 239356,239564:
Teach dhclient to track changes in link state and to enter the reboot
state when the link on an interface goes up causing dhclient to attempt
to renew its existing lease.
PR: bin/166656
Modified:
stable/9/sbin/dhclient/dhclient.c
stable/9/sbin/dhclient/dhcpd.h
Directory Properties:
stable/9/sbin/dhclient/ (props changed)
Modified: stable/9/sbin/dhclient/dhclient.c
==============================================================================
--- stable/9/sbin/dhclient/dhclient.c Tue Feb 26 18:33:23 2013 (r247334)
+++ stable/9/sbin/dhclient/dhclient.c Tue Feb 26 19:14:05 2013 (r247335)
@@ -218,6 +218,7 @@ routehandler(struct protocol *p)
struct sockaddr *sa;
struct iaddr a;
ssize_t n;
+ int linkstat;
n = read(routefd, &msg, sizeof(msg));
rtm = (struct rt_msghdr *)msg;
@@ -278,6 +279,15 @@ routehandler(struct protocol *p)
ifi->name);
goto die;
}
+ linkstat = interface_link_status(ifi->name);
+ if (linkstat != ifi->linkstat) {
+ debug("%s link state %s -> %s", ifi->name,
+ ifi->linkstat ? "up" : "down",
+ linkstat ? "up" : "down");
+ ifi->linkstat = linkstat;
+ if (linkstat)
+ state_reboot(ifi);
+ }
break;
case RTM_IFANNOUNCE:
ifan = (struct if_announcemsghdr *)rtm;
@@ -430,6 +440,7 @@ main(int argc, char *argv[])
}
fprintf(stderr, " got link\n");
}
+ ifi->linkstat = 1;
if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
error("cannot open %s: %m", _PATH_DEVNULL);
Modified: stable/9/sbin/dhclient/dhcpd.h
==============================================================================
--- stable/9/sbin/dhclient/dhcpd.h Tue Feb 26 18:33:23 2013 (r247334)
+++ stable/9/sbin/dhclient/dhcpd.h Tue Feb 26 19:14:05 2013 (r247335)
@@ -208,6 +208,7 @@ struct interface_info {
int errors;
int dead;
u_int16_t index;
+ int linkstat;
};
struct timeout {
More information about the svn-src-stable-9
mailing list