Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 17:52:40 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        YongHyeon PYUN <pyunyh@gmail.com>, Vitalij Satanivskij <satan@ukr.net>, freebsd-current@freebsd.org, Peter Jeremy <peter@rulingia.com>, current@freebsd.org
Subject:   Re: dhclient cause up/down cycle after 239356 ?
Message-ID:  <CAJ-Vmo=RFGu%2BunoAvBFA_e-vME3tdxM-43b9kGN57-6RqiKaXw@mail.gmail.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@freebsd.org> 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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=RFGu%2BunoAvBFA_e-vME3tdxM-43b9kGN57-6RqiKaXw>