From owner-freebsd-current@FreeBSD.ORG Thu Aug 23 00:52:42 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C8711065670; Thu, 23 Aug 2012 00:52:42 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 203618FC08; Thu, 23 Aug 2012 00:52:40 +0000 (UTC) Received: by dadr6 with SMTP id r6so115814dad.13 for ; Wed, 22 Aug 2012 17:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=38wIrxOr+ub8y4nI2X+yrAErydekRCU34ZCMGxXkqYk=; b=EPbZA+n+YKygT/m2BMg06MdoYgvyOJ6WqfKUaCFhFuGaJP87056EoEKmoH5B+JRI9S rMoyNCead0a3uP1fQMbbwqsbuFpGrATGO1FMHcjgRb+ZzqojpP3M9E4kFaNbjJdBfBmW HhQ3P+gyEQOR6kxWy4g1BCu1jZWtsCQ5TzbHx+Y2rXZANuYvcGm80kkOlbvDNQ7l9NZo tcf2n23zlSsAI+iSz/DitbEqANIISCgMDQfpaSl6ARLxxsXoalK3nDwDcI1hRfyLOQOw YKI/F1WyoSBmqIvR9Vgu7umNzbGkzMJJHtVh2zZaXp0Qm35hi8uYSBh8sMVR5muoV/ZW b/VQ== MIME-Version: 1.0 Received: by 10.66.85.4 with SMTP id d4mr40588684paz.11.1345683160639; Wed, 22 Aug 2012 17:52:40 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.36.106 with HTTP; Wed, 22 Aug 2012 17:52:40 -0700 (PDT) In-Reply-To: <201208221535.01598.jhb@freebsd.org> References: <20120821095527.GA33206@hell.ukr.net> <20120822171253.GB3300@michelle.cdnetworks.com> <20120822172822.GA52909@hell.ukr.net> <201208221535.01598.jhb@freebsd.org> Date: Wed, 22 Aug 2012 17:52:40 -0700 X-Google-Sender-Auth: L77m4Ls4s1pB856ThFmP5453COQ Message-ID: From: Adrian Chadd To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: YongHyeon PYUN , Vitalij Satanivskij , freebsd-current@freebsd.org, Peter Jeremy , current@freebsd.org Subject: Re: dhclient cause up/down cycle after 239356 ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 00:52:42 -0000 Ew. Be careful. Your admin may decide to change the VLAN you're on (for example.) You definitely want to renegotiate your link state then. Adrian On 22 August 2012 12:35, John Baldwin wrote: > 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 > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"