Author: jhb Date: Tue Feb 26 19:14:29 2013 New Revision: 247336 URL: http://svnweb.freebsd.org/changeset/base/247336
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/8/sbin/dhclient/dhclient.c stable/8/sbin/dhclient/dhcpd.h Directory Properties: stable/8/sbin/dhclient/ (props changed) Modified: stable/8/sbin/dhclient/dhclient.c ============================================================================== --- stable/8/sbin/dhclient/dhclient.c Tue Feb 26 19:14:05 2013 (r247335) +++ stable/8/sbin/dhclient/dhclient.c Tue Feb 26 19:14:29 2013 (r247336) @@ -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/8/sbin/dhclient/dhcpd.h ============================================================================== --- stable/8/sbin/dhclient/dhcpd.h Tue Feb 26 19:14:05 2013 (r247335) +++ stable/8/sbin/dhclient/dhcpd.h Tue Feb 26 19:14:29 2013 (r247336) @@ -208,6 +208,7 @@ struct interface_info { int errors; int dead; u_int16_t index; + int linkstat; }; struct timeout { _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"