[PATCH 1/7] Babel: Make sure intervals don't overflow.

Toke Høiland-Jørgensen toke at toke.dk
Wed Jul 20 14:02:24 CEST 2016


Ondrej Zajicek <santiago at crfreenet.org> writes:

> On Tue, Jul 19, 2016 at 06:09:41PM +0200, Toke Høiland-Jørgensen wrote:
>> Ondrej Zajicek <santiago at crfreenet.org> writes:
>> 
>> > On Mon, May 02, 2016 at 07:07:49PM +0200, Toke Høiland-Jørgensen wrote:
>> >> Intervals are carried as 16-bit centisecond values, but kept internally
>> >> in 16-bit second values, which causes a potential for overflow. This
>> >> adds some checks to make sure this doesn't happen.
>> >> 
>> >> +  /* make sure we don't overflow the 16-bit centisec fields */
>> >>    if (!BABEL_IFACE->update_interval)
>> >> -    BABEL_IFACE->update_interval = BABEL_IFACE->hello_interval*BABEL_UPDATE_INTERVAL_FACTOR;
>> >> -  BABEL_IFACE->ihu_interval = BABEL_IFACE->hello_interval*BABEL_IHU_INTERVAL_FACTOR;
>> >> +    BABEL_IFACE->update_interval = MIN_(BABEL_IFACE->hello_interval*BABEL_UPDATE_INTERVAL_FACTOR, BABEL_MAX_INTERVAL);
>> >> +  BABEL_IFACE->ihu_interval = MIN_(BABEL_IFACE->hello_interval*BABEL_IHU_INTERVAL_FACTOR, BABEL_MAX_INTERVAL);
>> >
>> > This is not completely correct, because IHU interval is not independent
>> > of hello_interval in this implementation - IHUs are sent for each
>> > BABEL_IHU_INTERVAL_FACTOR hellos even if ihu_interval is limited by this.
>> 
>> Yeah, you're right. Hmm, guess it doesn't really make sense to have the
>> IHU interval configurable by itself, then?
>
> Probably not. But it makes sense to have configurable IHU factor
> (different for wired and wireless networks). And if hello*factor is too
> large, then just use smaller factor.

Right, makes sense. I'll write that up and submit another patch :)

-Toke



More information about the Bird-users mailing list