Date: Wed, 22 Aug 2012 15:35:01 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-current@freebsd.org Cc: YongHyeon PYUN <pyunyh@gmail.com>, Vitalij Satanivskij <satan@ukr.net>, Peter Jeremy <peter@rulingia.com>, current@freebsd.org Subject: Re: dhclient cause up/down cycle after 239356 ? Message-ID: <201208221535.01598.jhb@freebsd.org> In-Reply-To: <20120822172822.GA52909@hell.ukr.net> References: <20120821095527.GA33206@hell.ukr.net> <20120822171253.GB3300@michelle.cdnetworks.com> <20120822172822.GA52909@hell.ukr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, August 22, 2012 1:28:22 pm Vitalij Satanivskij wrote: > ok next round :) > > dhclient updated to Revision 239564 > > with fxp : > > Aug 22 20:06:48 home kernel: fxp0: link state changed to DOWN > Aug 22 20:06:48 home dhclient: New Subnet Mask (fxp0): 255.255.255.0 > Aug 22 20:06:48 home dhclient: New Broadcast Address (fxp0): xx.xx.xx.255 > Aug 22 20:06:48 home dhclient: New Routers (fxp0): xx.xx.xx.1 > Aug 22 20:06:50 home kernel: fxp0: link state changed to UP > Aug 22 20:06:53 home dhclient: New IP Address (fxp0): xx.xx.xx.xx > Aug 22 20:06:53 home kernel: fxp0: link state changed to DOWN > Aug 22 20:06:53 home dhclient: New Subnet Mask (fxp0): 255.255.255.0 > Aug 22 20:06:53 home dhclient: New Broadcast Address (fxp0): xx.xx.xx.255 > Aug 22 20:06:53 home dhclient: New Routers (fxp0): xx.xx.xx.xx > Aug 22 20:06:55 home kernel: fxp0: link state changed to UP > Aug 22 20:07:01 home dhclient: New IP Address (fxp0): xx.xx.xx.xx > Aug 22 20:07:01 home kernel: fxp0: link state changed to DOWN > Aug 22 20:07:01 home dhclient: New Subnet Mask (fxp0): 255.255.255.0 > Aug 22 20:07:01 home dhclient: New Broadcast Address (fxp0): xx.xx.xx.255 > Aug 22 20:07:01 home dhclient: New Routers (fxp0): xx.xx.xx.xx > Aug 22 20:07:03 home kernel: fxp0: link state changed to UP > Aug 22 20:07:07 home dhclient: New IP Address (fxp0): xx.xx.xx.xx > Aug 22 20:07:07 home kernel: fxp0: link state changed to DOWN > Aug 22 20:07:07 home dhclient: New Subnet Mask (fxp0): 255.255.255.0 > Aug 22 20:07:07 home dhclient: New Broadcast Address (fxp0): xx.xx.xx.255 > Aug 22 20:07:07 home dhclient: New Routers (fxp0): xx.xx.xx.xx > Aug 22 20:07:09 home kernel: fxp0: link state changed to UP > Aug 22 20:07:13 home dhclient: New IP Address (fxp0): xx.xx.xx.xx > Aug 22 20:07:13 home kernel: fxp0: link state changed to DOWN > Aug 22 20:07:13 home dhclient: New Subnet Mask (fxp0): 255.255.255.0 > Aug 22 20:07:13 home dhclient: New Broadcast Address (fxp0): xx.xx.xx.255 > Aug 22 20:07:13 home dhclient: New Routers (fxp0): xx.xx.xx.xx > Aug 22 20:07:15 home kernel: fxp0: link state changed to UP Hmm. Perhaps we could use a debouncer to ignore "short" link flaps? Kind of gross (and OpenBSD doesn't do this). For now this change basically ignores link up events if they occur with 5 seconds of the link down event. The 5 is hardcoded which is kind of yuck. Index: dhcpd.h =================================================================== --- dhcpd.h (revision 239564) +++ dhcpd.h (working copy) @@ -209,6 +209,7 @@ int dead; u_int16_t index; int linkstat; + time_t linktime; }; struct timeout { Index: dhclient.c =================================================================== --- dhclient.c (revision 239564) +++ dhclient.c (working copy) @@ -285,8 +285,14 @@ ifi->linkstat ? "up" : "down", linkstat ? "up" : "down"); ifi->linkstat = linkstat; - if (linkstat) + + /* + * XXX: Hardcoded 5 second grace window on + * link flaps. + */ + if (linkstat && (cur_time - ifi->linktime) >= 5) state_reboot(ifi); + ifi->linktime = cur_time; } break; case RTM_IFANNOUNCE: @@ -441,6 +447,7 @@ fprintf(stderr, " got link\n"); } ifi->linkstat = 1; + ifi->linktime = cur_time; if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) error("cannot open %s: %m", _PATH_DEVNULL); -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208221535.01598.jhb>