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 <j...@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-unsubscr...@freebsd.org"
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to